HTAtom.h
上传用户:zlh9724
上传日期:2007-01-04
资源大小:1991k
文件大小:2k
源码类别:

浏览器

开发平台:

Unix_Linux

  1. /*                                                  Atoms - an easy way of organizing strings
  2.                                           ATOMS
  3.                                              
  4.  */
  5. /*
  6. **      (c) COPYRIGHT MIT 1995.
  7. **      Please first read the full copyright statement in the file COPYRIGH.
  8. */
  9. /*
  10.    Atoms are strings which are given representative pointer values so that they can be
  11.    stored more efficiently, and compaisons for equality done more efficiently. The list of
  12.    atoms are stored in a has table, so when asking for a new atom you might infact get
  13.    back an existing one.
  14.    
  15.    There are a whole bunch of MIME-types defined as atoms, so please use them!
  16.    
  17.    This module is implemented by HTAtom.c, and it is a part of the  W3C Reference Library.
  18.    
  19.  */
  20. #ifndef HTATOM_H
  21. #define HTATOM_H
  22. #include "HTList.h"
  23. typedef struct _HTAtom HTAtom;
  24. struct _HTAtom {
  25.         HTAtom *        next;
  26.         char *          name;
  27. }; /* struct _HTAtom */
  28. /*
  29. Public Functions
  30.    The following methods are available for this class:
  31.    
  32.   GET AN ATOM
  33.   
  34.    This function returns a representative value (an atom) such that it will always (within
  35.    one run of the program) return the same value for the same given string. The former is
  36.    case sensitive, the latter is case insensitive.
  37.    
  38.  */
  39. extern HTAtom * HTAtom_for      (CONST char * string);
  40. extern HTAtom * HTAtom_caseFor  (CONST char * string);
  41. /*
  42.   GET CONTENT OF AN ATOM
  43.   
  44.  */
  45. #define HTAtom_name(a) ((a) ? (a)->name : NULL)
  46. /*
  47.    This macro returns the string pointed to by the atom.
  48.    
  49.   SEARCH FOR ATOMS
  50.   
  51.    Returns a list of atoms which matches the template given. It is especially made for
  52.    MIME-types so that for example a template like text<slash><star> returns a list of all
  53.    MIME-types of type text.
  54.    
  55.  */
  56. extern HTList * HTAtom_templateMatches (CONST char * templ);
  57. /*
  58.   CLEANUP MEMORY
  59.   
  60.    In order to cleanup memory, call this function. This is done automaticly from the
  61.    HTLibTerminate function.
  62.    
  63.  */
  64. extern void HTAtom_deleteAll (void);
  65. #endif
  66. /*
  67.    End of HTAtom definition.  */