VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
stringIntMapper.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2001 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: strIntMapper.h,v $ $Revision: 1.10 $ $State: Exp $
7 *******************************************************************************/
13 
16 
17 
18 #ifndef DtStringIntMapper_H_
19 #define DtStringIntMapper_H_
20 
21 #include <vlutil/vlHashlist.h>
22 #include <vlutil/vlString.h>
23 
72 
73 #include "vrfutil/vrfutilDefines.h"
75 {
76 public:
78  DtStringIntMapper(unsigned mapSize = 0, int offset = 0,
79  bool useStringHashlist = true);
80 
81 protected:
84  DtStringIntMapper & operator=(const DtStringIntMapper &orig) { return *this; }
85 
86 public:
87 
89  virtual ~DtStringIntMapper();
90 
91 protected:
95  virtual bool createIntToStringMap();
96 
100  virtual bool createStringToIntMap();
101 
102 public:
103 
111  virtual bool addMapping(const DtString& stringVal,
112  int intVal);
113 
116  virtual bool removeMapping(const DtString& stringVal,
117  int intVal);
118 
122  virtual bool getStringFromInt(int intVal, DtString& stringVal) const;
123 
127  virtual bool getIntFromString(const DtString& stringVal, int& intVal) const;
128 
129 protected:
130 
134  void emptyIntToStringArray();
135  void emptyStringToIntHashlist();
136  void emptyIntToStringHashlist();
138 
144  virtual bool checkString(const DtString& stringVal, int intVal) const;
148  virtual bool checkInteger(int intVal, const DtString& stringVal) const;
149 
151  bool checkMapArrayInit(const DtString& caller) const;
152  bool checkStringToIntHashlistInit(const DtString& caller) const;
153  bool checkIntToStringHashlistInit(const DtString& caller) const;
154  bool checkMapArrayIndexRange(int index, int intVal,
155  const DtString& caller) const;
156 
157 protected:
158 
162  unsigned myMapSize;
163 
168 
171  int myOffset;
172 
179 
184 
188 
189 };
190 
191 
192 
193 #endif
194 
DtString ** myIntToStringArray
This will be an array allocated to have mapSize entries. When a string constant is sought...
Definition: stringIntMapper.h:178
unsigned myMapSize
This argument is the total size of the myIntToStringArray array. Since the integer constants being ma...
Definition: stringIntMapper.h:162
DtStringIntMapper(const DtStringIntMapper &orig)
Copy and Assignment operators undefined.
Definition: stringIntMapper.h:83
DtHashList * myIntToStringHashlist
This is only used if myMapSize == 0. Then createIntToStringMap() will allocate this hash list...
Definition: stringIntMapper.h:187
int myOffset
This argument to the constructor is subtracted from integers on the way in and added on the way out w...
Definition: stringIntMapper.h:171
Description: Maps string constants to integer constants and vice versa. String / integer pairs are re...
Definition: stringIntMapper.h:74
bool myUseStringHashlist
This argument to the constructor indicates whether to use a hash list for string lookup. It is ignored if mapSize == 0, since in this case a hash list is required.
Definition: stringIntMapper.h:167
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
DtHashlist * myStringToIntHashlist
This is only used if useStringHashlist == true. In this case, a hashlist of strings will be maintaine...
Definition: stringIntMapper.h:183
voidpf uLong offset
Definition: ioapi.h:42
DtStringIntMapper & operator=(const DtStringIntMapper &orig)
Definition: stringIntMapper.h:84

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)