source: trunk/symtab/symtab.h @ 4035

Last change on this file since 4035 was 1428, checked in by vla24, 7 years ago

SymbolTable?: commit some missing files

File size: 978 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
12#include "library_conversion.h"
13
14#include "stringpool.h"
15#include <string.h>
16#include <vector>
17#include <ext/hash_map>
18using namespace std;
19using namespace __gnu_cxx;
20
21struct eqstr
22{
23  bool operator()(const char* s1, const char* s2) const
24  {
25    return strcmp(s1, s2) == 0;
26  }
27};
28
29struct Name_Data
30{
31        char * name_string;
32        int        lgth;
33};
34
35class SymbolTable {
36public:
37        SymbolTable();
38
39        int Insert_Name(char * name, int lgth);
40        int Lookup_or_Insert_Name(char * name, int lgth);       
41
42        char * Get_Name(int nameID);
43        int Get_Lgth(int nameID);
44       
45        vector<Name_Data> NameTable;
46private:
47        hash_map<const char *, int, hash<const char *>, eqstr > NameMap;
48        int globalNameCount;
49        StringPool<4096,100> pool;
50};
51
52#endif
Note: See TracBrowser for help on using the repository browser.