/xmlbench/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/xmlbench/trunk

« back to all changes in this revision

Viewing changes to parse/parabix.20090211/src/symtab.h

  • Committer: Suren A. Chilingaryan
  • Date: 2009-09-23 17:13:04 UTC
  • Revision ID: csa@dside.dyndns.org-20090923171304-osvtr4zqb29h11kd
Intel, Tango, Phobos, and RapidXML parsers; Memory benchmark scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
#include "stringpool.h"
13
 
 
14
 
struct eqstr
15
 
{
16
 
  bool operator()(const char* s1, const char* s2) const
17
 
  {
18
 
    return strcmp(s1, s2) == 0;
19
 
  }
20
 
};
21
 
 
22
 
struct Name_Data
23
 
{
24
 
        char * name_string;
25
 
        int        lgth;
26
 
};
27
 
        
28
 
char * predefined[] = {"lt", "gt", "amp", "quot", "apos"};
29
 
 
30
 
 
31
 
class Symbol_Table {
32
 
public:
33
 
        Symbol_Table();
34
 
 
35
 
 
36
 
        int Insert_Name(char * name, int lgth);
37
 
        int ASCII_Lookup_or_Insert_Name(char * name, int lgth); 
38
 
        int UTF8_Lookup_or_Insert_Name(char * name, int lgth);
39
 
        int ASCII_Lookup_or_Insert_Nmtoken(char * name, int lgth);      
40
 
        int UTF8_Lookup_or_Insert_Nmtoken(char * name, int lgth);
41
 
 
42
 
        char * Get_UTF8_name(int nameID);
43
 
        int Get_UTF8_lgth(int nameID);
44
 
 
45
 
        char * Get_UTF8_nmtoken(int nmtokenID);
46
 
        int Get_UTF8_nmtoken_lgth(int nmtokenID);
47
 
        
48
 
        char * ReserveSymbolSpace(int u8_lgth);
49
 
        int LookupOrInsertReserved();
50
 
        int LookupOrInsertReserved_nmtoken();
51
 
        
52
 
        XML_version version;
53
 
        vector<Name_Data> UTF8NameTable;
54
 
        vector<Name_Data> UTF8NmtokenTable;
55
 
private:
56
 
        hash_map<const char *, int, hash<const char *>, eqstr > UTF8NameMap;
57
 
        hash_map<const char *, int, hash<const char *>, eqstr > UTF8NmtokenMap;
58
 
        int globalNameCount;
59
 
        int globalNmtokenCount;
60
 
//      vector<char *> UTF8NameTable;
61
 
 
62
 
        char * reserved;
63
 
        int reserved_lgth;
64
 
        StringPool<4096,100> pool;
65
 
};
66
 
 
67
 
 
68
 
 
69
 
#endif