File:
[Public] /
libwww /
Library /
src /
HTAtom.html
Revision
2.26:
download - view:
text,
annotated -
select for diffs
Thu May 14 02:10:15 1998 UTC (26 years ago) by
frystyk
Branches:
MAIN
CVS tags:
Release-5-2-8,
Release-5-2-6,
Release-5-2,
Release-5-1m,
HEAD,
Before-New-Trace-Messages,
Amaya_2_4,
Amaya-6-3,
Amaya-6-1,
Amaya-5-2,
Amaya-4-3-2,
Amaya-4-3-1,
Amaya-4-3,
Amaya-4-1-2,
Amaya-4-1-0,
Amaya-4-0-0,
Amaya-3-2-1,
Amaya-3-2
Changing old pub/WWW links
<HTML>
<HEAD>
<!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
<TITLE>W3C Sample Code Library libwww Atom Class</TITLE>
</HEAD>
<BODY>
<H1>
The Atom Class
</H1>
<PRE>
/*
** (c) COPYRIGHT MIT 1995.
** Please first read the full copyright statement in the file COPYRIGH.
*/
</PRE>
<P>
The <CODE>Atom Class defines s</CODE>trings which are given representative
pointer values so that they can be stored more efficiently, and comparisons
for equality done more efficiently. The list of <CODE>atoms</CODE> are stored
in a has table, so when asking for a new atom you might infact get back an
existing one.
<P>
<B>Note</B>: There are a whole bunch of
<A HREF="HTFormat.html#FormatTypes">MIME-types</A> defined as
<CODE>atoms</CODE>, so please use them!
<P>
This module is implemented by <A HREF="HTAtom.c">HTAtom.c</A>, and it is
a part of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code
Library</A>.
<PRE>
#ifndef HTATOM_H
#define HTATOM_H
#include "HTList.h"
typedef struct _HTAtom HTAtom;
struct _HTAtom {
HTAtom * next;
char * name;
}; /* struct _HTAtom */
</PRE>
<H3>
Get an Atom
</H3>
<P>
This function returns a representative value (an <CODE>atom</CODE>) such
that it will always (within one run of the program) return the same value
for the same given string. The former is case sensitive, the latter is case
insensitive.
<PRE>
extern HTAtom * HTAtom_for (const char * string);
extern HTAtom * HTAtom_caseFor (const char * string);
</PRE>
<H3>
Get Content of an Atom
</H3>
<PRE>
#define HTAtom_name(a) ((a) ? (a)->name : NULL)
</PRE>
<P>
This macro returns the string pointed to by the <CODE>atom</CODE>.
<H3>
Search For Atoms
</H3>
<P>
Returns a list of <CODE>atoms</CODE> which matches the template given. It
is especially made for MIME-types so that for example a template like
<CODE>text<slash><star></CODE> returns a list of all MIME-types
of type <CODE>text</CODE>.
<PRE>
extern HTList * HTAtom_templateMatches (const char * templ);
</PRE>
<H3>
Cleanup Memory
</H3>
<P>
In order to cleanup memory, call this function. This is done automaticly
from the <A HREF="HTReq.html#Library">HTLibTerminate</A> function.
<PRE>
extern void HTAtom_deleteAll (void);
#endif
</PRE>
<P>
<HR>
<ADDRESS>
@(#) $Id: HTAtom.html,v 2.26 1998/05/14 02:10:15 frystyk Exp $
</ADDRESS>
</BODY></HTML>
Webmaster