Annotation of libwww/Library/src/HTAssoc.html, revision 2.14

2.3       frystyk     1: <HTML>
2.1       luotonen    2: <HEAD>
2.13      frystyk     3: <TITLE>W3C Reference Library libwww Association Pairs</TITLE>
2.14    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
2.1       luotonen    5: </HEAD>
                      6: <BODY>
2.3       frystyk     7: 
2.1       luotonen    8: <H1>Association List For Storing Name-Value Pairs</H1>
2.3       frystyk     9: 
                     10: <PRE>
                     11: /*
2.7       frystyk    12: **     (c) COPYRIGHT MIT 1995.
2.3       frystyk    13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
                     16: 
2.10      frystyk    17: Lookups from association list are not case-sensitive. <P>
2.3       frystyk    18: 
2.10      frystyk    19: This module is implemented by <A HREF="HTAssoc.c">HTAssoc.c</A>, and
                     20: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     21: Reference Library</A>.
2.3       frystyk    22: 
2.1       luotonen   23: <PRE>
                     24: #ifndef HTASSOC_H
                     25: #define HTASSOC_H
                     26: 
                     27: #include "HTList.h"
                     28: 
                     29: typedef HTList HTAssocList;
                     30: 
                     31: typedef struct {
                     32:     char * name;
                     33:     char * value;
                     34: } HTAssoc;
                     35: 
2.10      frystyk    36: extern HTAssocList *HTAssocList_new (void);
                     37: extern BOOL HTAssocList_delete (HTAssocList * alist);
2.1       luotonen   38: 
2.10      frystyk    39: extern BOOL HTAssocList_add    (HTAssocList * alist,
2.12      frystyk    40:                                 const char * name, const char * value);
2.1       luotonen   41: 
2.12      frystyk    42: extern char *HTAssocList_lookup        (HTAssocList * alist, const char * name);
2.11      frystyk    43: </PRE>
                     44: 
                     45: <H3>Get Name and Values</H3>
                     46: 
                     47: Use this to get the name and value of a assoc object
                     48: 
                     49: <PRE>
                     50: #define HTAssoc_name(me)       ((me) ? (me)->name : NULL)
                     51: #define HTAssoc_value(me)      ((me) ? (me)->value : NULL)
                     52: </PRE>
2.1       luotonen   53: 
2.11      frystyk    54: <H3>Traverse list</H3>
                     55: 
                     56: Fast macro to traverse the list. Call it first with copy of list
                     57: header: it returns the first object and increments the passed list
                     58: pointer.  Call it with the same variable until it returns NULL.
                     59: 
                     60: <PRE>
                     61: #define        HTAssocList_nextObject(me) \
                     62:        ((me) &amp;&amp; ((me) = (me)->next) ? (me)->object : NULL)
                     63: </PRE>
                     64: 
                     65: <PRE>
2.1       luotonen   66: #endif /* not HTASSOC_H */
                     67: </PRE>
2.14    ! frystyk    68: 
        !            69: <HR>
        !            70: <ADDRESS>
        !            71: @(#) $Id: Date Author State $
        !            72: </ADDRESS>
2.1       luotonen   73: </BODY>
2.14    ! frystyk    74: </HTML>

Webmaster