Annotation of libwww/Library/src/HTHash.html, revision 1.1

1.1     ! frystyk     1: <HTML>
        !             2: <HEAD>
        !             3:   <TITLE>W3C Sample Code Library libwww Hash Table Class</TITLE>
        !             4: </HEAD>
        !             5: <BODY>
        !             6: <H1>
        !             7:   Hash Table Class
        !             8: </H1>
        !             9: <P>
        !            10: <STRONG>Written and integrated into libwww by John Punin - thanks!</STRONG>
        !            11: <P>
        !            12: This module is implemented by <A HREF="HTHash.c">HTHash.c</A>, and is a part
        !            13: of the <A HREF="http://www.w3.org/Library/"> W3C Sample Code Library</A>.
        !            14: <P>
        !            15: This HashTable class implements a simple hash table to keep objects associated
        !            16: with key words.
        !            17: <PRE>
        !            18: #ifndef HTHASH_H
        !            19: #define HTHASH_H
        !            20: 
        !            21: #include "HTList.h"
        !            22: 
        !            23: typedef struct _HTHashtable HTHashtable;
        !            24: 
        !            25: struct _HTHashtable {
        !            26:     void **table;
        !            27:     int count;
        !            28:     int size;
        !            29: };
        !            30:     
        !            31: typedef struct _keynode keynode;
        !            32: 
        !            33: struct _keynode {
        !            34:     char *key;
        !            35:     void *object;
        !            36: };
        !            37: </PRE>
        !            38: <H2>
        !            39:   Creation and Deletion Methods
        !            40: </H2>
        !            41: <P>
        !            42: These methods create and deletes a Hash Table
        !            43: <PRE>
        !            44: extern HTHashtable *   HTHashtable_new (int size);
        !            45: 
        !            46: extern BOOL    HTHashtable_delete (HTHashtable *me);
        !            47: </PRE>
        !            48: <H2>
        !            49:   Add an Element to a HashTable
        !            50: </H2>
        !            51: <PRE>
        !            52: extern BOOL HTHashtable_addObject (HTHashtable *me, const char *key , void *newObject);
        !            53: </PRE>
        !            54: <H2>
        !            55:   Search for an Element in a Hash Table
        !            56: </H2>
        !            57: <PRE>
        !            58: extern void *  HTHashtable_object (HTHashtable * me, const char *key);
        !            59: </PRE>
        !            60: <H2>
        !            61:   Size of a Hash Table
        !            62: </H2>
        !            63: <PRE>
        !            64: extern int     HTHashtable_count  (HTHashtable *me);
        !            65: </PRE>
        !            66: <H2>
        !            67:   Extract in a dynamic array all keys of the Hash Table
        !            68: </H2>
        !            69: <PRE>
        !            70: extern HTArray * HTHashtable_keys  (HTHashtable *me);
        !            71: </PRE>
        !            72: <H2>
        !            73:   Print the keys of the Hash Table
        !            74: </H2>
        !            75: <PRE>
        !            76: extern void HTHashtable_print (HTHashtable *me);
        !            77: </PRE>
        !            78: <PRE>
        !            79: #endif
        !            80: </PRE>
        !            81: <P>
        !            82:   <HR>
        !            83: <ADDRESS>
        !            84:   @(#) $Id: HTXML.html,v 2.2 1999/02/22 01:04:24 frystyk Exp $
        !            85: </ADDRESS>
        !            86: </BODY></HTML>

Webmaster