![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2001 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: strIntMapper.h,v $ $Revision: 1.10 $ $State: Exp $ 00007 *******************************************************************************/ 00013 00016 00017 00018 #ifndef DtStringIntMapper_H_ 00019 #define DtStringIntMapper_H_ 00020 00021 #include <vlutil/vlHashlist.h> 00022 #include <vlutil/vlString.h> 00023 00072 00073 #include "vrfutil/vrfutilDefines.h" 00074 class DT_DLL_vrfutil DtStringIntMapper 00075 { 00076 public: 00078 DtStringIntMapper(unsigned mapSize = 0, int offset = 0, 00079 bool useStringHashlist = true); 00080 00081 protected: 00083 DtStringIntMapper(const DtStringIntMapper &orig) {} 00084 DtStringIntMapper & operator=(const DtStringIntMapper &orig) { return *this; } 00085 00086 public: 00087 00089 virtual ~DtStringIntMapper(); 00090 00091 protected: 00095 virtual bool createIntToStringMap(); 00096 00100 virtual bool createStringToIntMap(); 00101 00102 public: 00103 00111 virtual bool addMapping(const DtString& stringVal, 00112 int intVal); 00113 00116 virtual bool removeMapping(const DtString& stringVal, 00117 int intVal); 00118 00122 virtual bool getStringFromInt(int intVal, DtString& stringVal) const; 00123 00127 virtual bool getIntFromString(const DtString& stringVal, int& intVal) const; 00128 00129 protected: 00130 00134 void emptyIntToStringArray(); 00135 void emptyStringToIntHashlist(); 00136 void emptyIntToStringHashlist(); 00138 00144 virtual bool checkString(const DtString& stringVal, int intVal) const; 00148 virtual bool checkInteger(int intVal, const DtString& stringVal) const; 00149 00151 bool checkMapArrayInit(const DtString& caller) const; 00152 bool checkStringToIntHashlistInit(const DtString& caller) const; 00153 bool checkIntToStringHashlistInit(const DtString& caller) const; 00154 bool checkMapArrayIndexRange(int index, int intVal, 00155 const DtString& caller) const; 00156 00157 protected: 00158 00162 unsigned myMapSize; 00163 00167 bool myUseStringHashlist; 00168 00171 int myOffset; 00172 00178 DtString** myIntToStringArray; 00179 00183 DtHashlist* myStringToIntHashlist; 00184 00187 DtHashList* myIntToStringHashlist; 00188 00189 }; 00190 00191 00192 00193 #endif 00194