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

2.7       frystyk     1: <HTML>
                      2: <HEAD>
                      3: <TITLE>Atoms - an easy way of organizing strings</TITLE>
2.17      frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 23-Aug-1995 -->
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
                     28: is a part of the <A NAME="z10"
2.18    ! frystyk    29: HREF="http://www.w3.org/pub/WWW/Library/">
2.16      frystyk    30: W3C Reference Library</A>. <P>
2.7       frystyk    31: 
1.1       timbl      32: <PRE>
                     33: #ifndef HTATOM_H
                     34: #define HTATOM_H
                     35: 
2.6       luotonen   36: #include "HTList.h"
                     37: 
1.1       timbl      38: typedef struct _HTAtom HTAtom;
                     39: struct _HTAtom {
                     40:        HTAtom *        next;
                     41:        char *          name;
                     42: }; /* struct _HTAtom */
2.7       frystyk    43: </PRE>
                     44: 
                     45: <H2>Public Functions</H2>
                     46: 
                     47: The following methods are available for this class:
                     48: 
                     49: <H3>Get an Atom</H3>
1.1       timbl      50: 
2.7       frystyk    51: This function returns a representative value (an <CODE>atom</CODE>)
                     52: such that it will always (within one run of the program) return the
2.14      frystyk    53: same value for the same given string. The former is case sensitive,
                     54: the latter is case insensitive.
1.1       timbl      55: 
2.7       frystyk    56: <PRE>
2.14      frystyk    57: extern HTAtom * HTAtom_for     PARAMS((CONST char * string));
                     58: extern HTAtom * HTAtom_caseFor PARAMS((CONST char * string));
2.7       frystyk    59: </PRE>
                     60: 
                     61: <H3>Get Content of an Atom</H3>
1.1       timbl      62: 
2.7       frystyk    63: <PRE>
2.17      frystyk    64: #define HTAtom_name(a) ((a) ? (a)->name : NULL)
2.7       frystyk    65: </PRE>
                     66: 
                     67: This macro returns the string pointed to by the <CODE>atom</CODE>.
                     68: 
                     69: <H3>Search For Atoms</H3>
                     70: 
                     71: Returns a list of <CODE>atoms</CODE> which matches the template
                     72: given. It is especially made for MIME-types so that for example a
                     73: template like <CODE>text&lt;slash&gt;&lt;star&gt;</CODE> returns a
                     74: list of all MIME-types of type <CODE>text</CODE>.
                     75: 
                     76: <PRE>
2.8       frystyk    77: extern HTList * HTAtom_templateMatches PARAMS((CONST char * templ));
2.10      frystyk    78: </PRE>
                     79: 
                     80: <H3>Cleanup Memory</H3>
                     81: 
                     82: In order to cleanup memory, call this function. This is done
                     83: automaticly from the <A
                     84: HREF="HTAccess.html#Library">HTLibTerminate</A> function.
                     85: 
                     86: <PRE>
                     87: extern void HTAtom_deleteAll NOPARAMS;
1.1       timbl      88: 
2.7       frystyk    89: #endif
1.1       timbl      90: </PRE>
2.7       frystyk    91: 
                     92: End of HTAtom definition.
                     93: 
                     94: </BODY>
                     95: </HTML>
                     96: 

Webmaster