File:  [Public] / libwww / Library / src / HTAssoc.html
Revision 2.12: download - view: text, annotated - select for diffs
Mon Mar 4 03:12:01 1996 UTC (28 years, 3 months ago) by frystyk
Branches: MAIN
CVS tags: HEAD
Autoconf

<HTML>
<HEAD>
<TITLE>Association Pairs</TITLE>
<!-- Changed by: Henrik Frystyk Nielsen, 18-Feb-1996 -->
</HEAD>
<BODY>

<H1>Association List For Storing Name-Value Pairs</H1>

<PRE>
/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>

Lookups from association list are not case-sensitive. <P>

This module is implemented by <A HREF="HTAssoc.c">HTAssoc.c</A>, and
it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
Reference Library</A>.

<PRE>
#ifndef HTASSOC_H
#define HTASSOC_H

#include "HTList.h"

typedef HTList HTAssocList;

typedef struct {
    char * name;
    char * value;
} HTAssoc;

extern HTAssocList *HTAssocList_new (void);
extern BOOL HTAssocList_delete	(HTAssocList * alist);

extern BOOL HTAssocList_add	(HTAssocList * alist,
				 const char * name, const char * value);

extern char *HTAssocList_lookup	(HTAssocList * alist, const char * name);
</PRE>

<H3>Get Name and Values</H3>

Use this to get the name and value of a assoc object

<PRE>
#define HTAssoc_name(me)	((me) ? (me)->name : NULL)
#define HTAssoc_value(me)	((me) ? (me)->value : NULL)
</PRE>

<H3>Traverse list</H3>

Fast macro to traverse the list. Call it first with copy of list
header: it returns the first object and increments the passed list
pointer.  Call it with the same variable until it returns NULL.

<PRE>
#define	HTAssocList_nextObject(me) \
	((me) &amp;&amp; ((me) = (me)->next) ? (me)->object : NULL)
</PRE>

<PRE>
#endif /* not HTASSOC_H */
</PRE>
End of file HTAssoc.h.
</BODY>

Webmaster