source: trunk/src/symtab.h @ 155

Last change on this file since 155 was 141, checked in by cameron, 11 years ago

Eliminate excess name copying.

File size: 987 bytes
Line 
1/*  symtab.h - XML Symbol Table Module
2    Copyright (c) 2008 Robert D. Cameron
3    Licensed to the public under the Open Software License 3.0.
4    Licensed to International Characters, Inc., under the Academic
5    Free License 3.0.
6*/
7
8#ifndef SYMTAB_H
9#define SYMTAB_H
10
11#include "namechars.h"
12
13struct eqstr
14{
15  bool operator()(const char* s1, const char* s2) const
16  {
17    return strcmp(s1, s2) == 0;
18  }
19};
20
21struct Name_Data
22{
23        char * name_string;
24        int        lgth;
25};
26       
27char * predefined[] = {"lt", "gt", "amp", "quot", "apos"};
28
29class Symbol_Table{
30public:
31        Symbol_Table();
32        int Insert_Name(char * name, int lgth);
33        int UTF8_Lookup_or_Insert_XML10_Name(char * name, int lgth);
34        int UTF8_Lookup_or_Insert_XML11_Name(char * name, int lgth);
35        char * Get_UTF8_name(int nameID);
36        int Get_UTF8_lgth(int nameID);
37private:
38        hash_map<const char *, int, hash<const char *>, eqstr > UTF8NameMap;
39        int globalNameCount;
40//      vector<char *> UTF8NameTable;
41        vector<Name_Data> UTF8NameTable;
42};
43
44
45#endif
Note: See TracBrowser for help on using the repository browser.