Annotation of libwww/Library/src/HTAtom.html, revision 2.27

2.7       frystyk     1: <HTML>
                      2: <HEAD>
2.24      frystyk     3:   <!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
2.25      frystyk     4:   <TITLE>W3C Sample Code Library libwww Atom Class</TITLE>
2.7       frystyk     5: </HEAD>
                      6: <BODY>
2.24      frystyk     7: <H1>
                      8:   The Atom Class
                      9: </H1>
2.9       frystyk    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.24      frystyk    16: <P>
                     17: The <CODE>Atom Class defines s</CODE>trings which are given representative
                     18: pointer values so that they can be stored more efficiently, and comparisons
2.27    ! kahan      19: for equality done more efficiently. The list of <CODE>atoms</CODE> is stored
        !            20: in a hash table, so when asking for a new atom you might in fact get back an
2.24      frystyk    21: existing one.
                     22: <P>
                     23: <B>Note</B>: There are a whole bunch of
                     24: <A HREF="HTFormat.html#FormatTypes">MIME-types</A> defined as
                     25: <CODE>atoms</CODE>, so please use them!
                     26: <P>
                     27: This module is implemented by <A HREF="HTAtom.c">HTAtom.c</A>, and it is
2.26      frystyk    28: a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
2.24      frystyk    29: Library</A>.
1.1       timbl      30: <PRE>
                     31: #ifndef HTATOM_H
                     32: #define HTATOM_H
                     33: 
2.6       luotonen   34: #include "HTList.h"
                     35: 
1.1       timbl      36: typedef struct _HTAtom HTAtom;
                     37: struct _HTAtom {
                     38:        HTAtom *        next;
                     39:        char *          name;
                     40: }; /* struct _HTAtom */
2.7       frystyk    41: </PRE>
2.24      frystyk    42: <H3>
                     43:   Get an Atom
                     44: </H3>
                     45: <P>
                     46: This function returns a representative value (an <CODE>atom</CODE>) such
                     47: that it will always (within one run of the program) return the same value
                     48: for the same given string. The former is case sensitive, the latter is case
                     49: insensitive.
2.7       frystyk    50: <PRE>
2.21      frystyk    51: extern HTAtom * HTAtom_for     (const char * string);
                     52: extern HTAtom * HTAtom_caseFor (const char * string);
2.7       frystyk    53: </PRE>
2.24      frystyk    54: <H3>
                     55:   Get Content of an Atom
                     56: </H3>
2.7       frystyk    57: <PRE>
2.24      frystyk    58: #define HTAtom_name(a) ((a) ? (a)-&gt;name : NULL)
2.7       frystyk    59: </PRE>
2.24      frystyk    60: <P>
2.7       frystyk    61: This macro returns the string pointed to by the <CODE>atom</CODE>.
2.24      frystyk    62: <H3>
                     63:   Search For Atoms
                     64: </H3>
                     65: <P>
                     66: Returns a list of <CODE>atoms</CODE> which matches the template given. It
                     67: is especially made for MIME-types so that for example a template like
                     68: <CODE>text&lt;slash&gt;&lt;star&gt;</CODE> returns a list of all MIME-types
                     69: of type <CODE>text</CODE>.
2.7       frystyk    70: <PRE>
2.21      frystyk    71: extern HTList * HTAtom_templateMatches (const char * templ);
2.10      frystyk    72: </PRE>
2.24      frystyk    73: <H3>
                     74:   Cleanup Memory
                     75: </H3>
                     76: <P>
                     77: In order to cleanup memory, call this function. This is done automaticly
                     78: from the <A HREF="HTReq.html#Library">HTLibTerminate</A> function.
2.10      frystyk    79: <PRE>
2.20      frystyk    80: extern void HTAtom_deleteAll (void);
1.1       timbl      81: 
2.7       frystyk    82: #endif
1.1       timbl      83: </PRE>
2.24      frystyk    84: <P>
                     85:   <HR>
2.23      frystyk    86: <ADDRESS>
2.27    ! kahan      87:   @(#) $Id: HTAtom.html,v 2.26 1998/05/14 02:10:15 frystyk Exp $
2.23      frystyk    88: </ADDRESS>
2.24      frystyk    89: </BODY></HTML>

Webmaster