dsrc isn't necessary for this repo
[client-tools.git] / src / external / 3rd / library / perforce / include / strtable.h
blob5cd1c311b9ebdc9ceb006e0294a283cb0829261e
1 /*
2 * Copyright 1995, 1996 Perforce Software. All rights reserved.
4 * This file is part of Perforce - the FAST SCM System.
5 */
7 /*
8 * strtable.h - a string table, using StrDict interface
10 * Classes defined:
12 * StrPtrDict - a dictionary whose values we don't own
13 * StrBufDict - a dictionary whose values we do own
15 * Public methods:
17 * Clear() - reset table, making all variables unset
18 * GetVar() - look up variable, return value (or 0 if not set)
19 * SetVar() - set variable/value pair
21 * XXX Total dumb duplication of StrPtrDict into StrBufDict.
24 struct StrPtrEntry;
25 struct StrBufEntry;
26 class VarArray;
28 class StrPtrDict : public StrDict {
30 public:
31 StrPtrDict();
32 ~StrPtrDict();
34 void Clear()
36 tabLength = 0;
39 // virtuals of StrDict
41 StrPtr * VGetVar( const StrPtr &var );
42 void VSetVar( const StrPtr &var, const StrPtr &val );
43 void VRemoveVar( const StrPtr &var );
44 int VGetVarX( int x, StrRef &var, StrRef &val );
46 private:
48 VarArray *elems;
49 int tabSize;
50 int tabLength;
52 } ;
54 class StrBufDict : public StrDict {
56 public:
57 StrBufDict();
58 StrBufDict( StrDict & dict );
59 StrBufDict & operator =( StrDict & dict );
60 ~StrBufDict();
62 void Clear()
64 tabLength = 0;
67 int GetCount()
69 return tabLength;
72 // virtuals of StrDict
74 StrPtr * VGetVar( const StrPtr &var );
75 void VSetVar( const StrPtr &var, const StrPtr &val );
76 void VRemoveVar( const StrPtr &var );
77 int VGetVarX( int x, StrRef &var, StrRef &val );
79 private:
81 void Set( StrDict & dict );
83 VarArray *elems;
84 int tabSize;
85 int tabLength;
87 } ;