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

2.7     ! frystyk     1: <HTML>
        !             2: <HEAD>
        !             3: <TITLE>Atoms - an easy way of organizing strings</TITLE>
        !             4: </HEAD>
        !             5: 
        !             6: <BODY>
        !             7: 
        !             8: <H1>Atoms</H1>
        !             9: 
        !            10: <CODE>Atoms</CODE> are strings which are given representative pointer
        !            11: values so that they can be stored more efficiently, and compaisons for
        !            12: equality done more efficiently. The list of <CODE>atoms</CODE> are
        !            13: stored in a has table, so when asking for a new atom you might infact
        !            14: get back an existing one.<P>
        !            15: 
        !            16: There are a whole bunch of <A
        !            17: HREF="HTFormat.html#FormatTypes">MIME-types</A> defined as
        !            18: <CODE>atoms</CODE>, so please use them! <P>
        !            19: 
        !            20: This module is implemented by <A HREF="HTAtom.c">HTAtom.c</A>, and it
        !            21: is a part of the <A NAME="z10"
        !            22: HREF="http://info.cern.ch/hypertext/WWW/Library/User/Guide/Guide.html">Library
        !            23: of Common Code</A>. <P>
        !            24: 
1.1       timbl      25: <PRE>
                     26: #ifndef HTATOM_H
                     27: #define HTATOM_H
                     28: 
2.6       luotonen   29: #include "HTUtils.h"
                     30: #include "HTList.h"
                     31: 
                     32: #ifdef SHORT_NAMES
                     33: #define HTAt_for       HTAtom_for
                     34: #define HTAt_tMa       HTAtom_templateMatches
2.7     ! frystyk    35: #endif
2.6       luotonen   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
        !            52: same value for the same given string.
1.1       timbl      53: 
2.7     ! frystyk    54: <PRE>
2.6       luotonen   55: PUBLIC HTAtom * HTAtom_for PARAMS((CONST char * string));
2.7     ! frystyk    56: </PRE>
        !            57: 
        !            58: <H3>Get Content of an Atom</H3>
1.1       timbl      59: 
2.7     ! frystyk    60: <PRE>
1.2       timbl      61: #define HTAtom_name(a) ((a)->name)
2.7     ! frystyk    62: </PRE>
        !            63: 
        !            64: This macro returns the string pointed to by the <CODE>atom</CODE>.
        !            65: 
        !            66: <H3>Search For Atoms</H3>
        !            67: 
        !            68: Returns a list of <CODE>atoms</CODE> which matches the template
        !            69: given. It is especially made for MIME-types so that for example a
        !            70: template like <CODE>text&lt;slash&gt;&lt;star&gt;</CODE> returns a
        !            71: list of all MIME-types of type <CODE>text</CODE>.
        !            72: 
        !            73: <PRE>
        !            74: PUBLIC HTList * HTAtom_templateMatches PARAMS((CONST char * templ));
1.1       timbl      75: 
2.7     ! frystyk    76: #endif
1.1       timbl      77: </PRE>
2.7     ! frystyk    78: 
        !            79: End of HTAtom definition.
        !            80: 
        !            81: </BODY>
        !            82: </HTML>
        !            83: 

Webmaster