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

2.7       frystyk     1: <HTML>
                      2: <HEAD>
                      3: <TITLE>Atoms - an easy way of organizing strings</TITLE>
                      4: </HEAD>
                      5: <BODY>
                      6: 
                      7: <H1>Atoms</H1>
2.9       frystyk     8: 
                      9: <PRE>
                     10: /*
                     11: **     (c) COPYRIGHT CERN 1994.
                     12: **     Please first read the full copyright statement in the file COPYRIGH.
                     13: */
                     14: </PRE>
2.7       frystyk    15: 
                     16: <CODE>Atoms</CODE> are strings which are given representative pointer
                     17: values so that they can be stored more efficiently, and compaisons for
                     18: equality done more efficiently. The list of <CODE>atoms</CODE> are
                     19: stored in a has table, so when asking for a new atom you might infact
                     20: get back an existing one.<P>
                     21: 
                     22: There are a whole bunch of <A
                     23: HREF="HTFormat.html#FormatTypes">MIME-types</A> defined as
                     24: <CODE>atoms</CODE>, so please use them! <P>
                     25: 
                     26: This module is implemented by <A HREF="HTAtom.c">HTAtom.c</A>, and it
                     27: is a part of the <A NAME="z10"
                     28: HREF="http://info.cern.ch/hypertext/WWW/Library/User/Guide/Guide.html">Library
                     29: of Common Code</A>. <P>
                     30: 
1.1       timbl      31: <PRE>
                     32: #ifndef HTATOM_H
                     33: #define HTATOM_H
                     34: 
2.11    ! roeber     35: #include "sysdep.h"
2.6       luotonen   36: #include "HTUtils.h"
                     37: #include "HTList.h"
                     38: 
                     39: #ifdef SHORT_NAMES
                     40: #define HTAt_for       HTAtom_for
                     41: #define HTAt_tMa       HTAtom_templateMatches
2.7       frystyk    42: #endif
2.6       luotonen   43: 
1.1       timbl      44: typedef struct _HTAtom HTAtom;
                     45: struct _HTAtom {
                     46:        HTAtom *        next;
                     47:        char *          name;
                     48: }; /* struct _HTAtom */
2.7       frystyk    49: </PRE>
                     50: 
                     51: <H2>Public Functions</H2>
                     52: 
                     53: The following methods are available for this class:
                     54: 
                     55: <H3>Get an Atom</H3>
1.1       timbl      56: 
2.7       frystyk    57: This function returns a representative value (an <CODE>atom</CODE>)
                     58: such that it will always (within one run of the program) return the
                     59: same value for the same given string.
1.1       timbl      60: 
2.7       frystyk    61: <PRE>
2.8       frystyk    62: extern HTAtom * HTAtom_for PARAMS((CONST char * string));
2.7       frystyk    63: </PRE>
                     64: 
                     65: <H3>Get Content of an Atom</H3>
1.1       timbl      66: 
2.7       frystyk    67: <PRE>
1.2       timbl      68: #define HTAtom_name(a) ((a)->name)
2.7       frystyk    69: </PRE>
                     70: 
                     71: This macro returns the string pointed to by the <CODE>atom</CODE>.
                     72: 
                     73: <H3>Search For Atoms</H3>
                     74: 
                     75: Returns a list of <CODE>atoms</CODE> which matches the template
                     76: given. It is especially made for MIME-types so that for example a
                     77: template like <CODE>text&lt;slash&gt;&lt;star&gt;</CODE> returns a
                     78: list of all MIME-types of type <CODE>text</CODE>.
                     79: 
                     80: <PRE>
2.8       frystyk    81: extern HTList * HTAtom_templateMatches PARAMS((CONST char * templ));
2.10      frystyk    82: </PRE>
                     83: 
                     84: <H3>Cleanup Memory</H3>
                     85: 
                     86: In order to cleanup memory, call this function. This is done
                     87: automaticly from the <A
                     88: HREF="HTAccess.html#Library">HTLibTerminate</A> function.
                     89: 
                     90: <PRE>
                     91: extern void HTAtom_deleteAll NOPARAMS;
1.1       timbl      92: 
2.7       frystyk    93: #endif
1.1       timbl      94: </PRE>
2.7       frystyk    95: 
                     96: End of HTAtom definition.
                     97: 
                     98: </BODY>
                     99: </HTML>
                    100: 

Webmaster