Annotation of libwww/Library/src/HTAtom.html, revision 2.23
2.7 frystyk 1: <HTML>
2: <HEAD>
2.22 frystyk 3: <TITLE>W3C Reference Library libwww Atoms</TITLE>
2.23 ! frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
2.7 frystyk 5: </HEAD>
6: <BODY>
7:
8: <H1>Atoms</H1>
2.9 frystyk 9:
10: <PRE>
11: /*
2.15 frystyk 12: ** (c) COPYRIGHT MIT 1995.
2.9 frystyk 13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
2.7 frystyk 16:
17: <CODE>Atoms</CODE> are strings which are given representative pointer
18: values so that they can be stored more efficiently, and compaisons for
19: equality done more efficiently. The list of <CODE>atoms</CODE> are
20: stored in a has table, so when asking for a new atom you might infact
21: get back an existing one.<P>
22:
23: There are a whole bunch of <A
24: HREF="HTFormat.html#FormatTypes">MIME-types</A> defined as
25: <CODE>atoms</CODE>, so please use them! <P>
26:
27: This module is implemented by <A HREF="HTAtom.c">HTAtom.c</A>, and it
2.20 frystyk 28: is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
29: Reference Library</A>. <P>
2.7 frystyk 30:
1.1 timbl 31: <PRE>
32: #ifndef HTATOM_H
33: #define HTATOM_H
34:
2.6 luotonen 35: #include "HTList.h"
36:
1.1 timbl 37: typedef struct _HTAtom HTAtom;
38: struct _HTAtom {
39: HTAtom * next;
40: char * name;
41: }; /* struct _HTAtom */
2.7 frystyk 42: </PRE>
43:
44: <H2>Public Functions</H2>
45:
46: The following methods are available for this class:
47:
48: <H3>Get an Atom</H3>
1.1 timbl 49:
2.7 frystyk 50: This function returns a representative value (an <CODE>atom</CODE>)
51: such that it will always (within one run of the program) return the
2.14 frystyk 52: same value for the same given string. The former is case sensitive,
53: the latter is case insensitive.
1.1 timbl 54:
2.7 frystyk 55: <PRE>
2.21 frystyk 56: extern HTAtom * HTAtom_for (const char * string);
57: extern HTAtom * HTAtom_caseFor (const char * string);
2.7 frystyk 58: </PRE>
59:
60: <H3>Get Content of an Atom</H3>
1.1 timbl 61:
2.7 frystyk 62: <PRE>
2.17 frystyk 63: #define HTAtom_name(a) ((a) ? (a)->name : NULL)
2.7 frystyk 64: </PRE>
65:
66: This macro returns the string pointed to by the <CODE>atom</CODE>.
67:
68: <H3>Search For Atoms</H3>
69:
70: Returns a list of <CODE>atoms</CODE> which matches the template
71: given. It is especially made for MIME-types so that for example a
72: template like <CODE>text<slash><star></CODE> returns a
73: list of all MIME-types of type <CODE>text</CODE>.
74:
75: <PRE>
2.21 frystyk 76: extern HTList * HTAtom_templateMatches (const char * templ);
2.10 frystyk 77: </PRE>
78:
79: <H3>Cleanup Memory</H3>
80:
81: In order to cleanup memory, call this function. This is done
82: automaticly from the <A
2.19 frystyk 83: HREF="HTReq.html#Library">HTLibTerminate</A> function.
2.10 frystyk 84:
85: <PRE>
2.20 frystyk 86: extern void HTAtom_deleteAll (void);
1.1 timbl 87:
2.7 frystyk 88: #endif
1.1 timbl 89: </PRE>
2.7 frystyk 90:
2.23 ! frystyk 91: <HR>
! 92: <ADDRESS>
! 93: @(#) $Id: Date Author State $
! 94: </ADDRESS>
2.7 frystyk 95: </BODY>
96: </HTML>
Webmaster