#include <string_mapper.h>
Nevrax France
Definition at line 54 of file string_mapper.h.
Public Member Functions | |
void | localClear () |
TStringId | localEmptyId () |
Return the local id for the empty string (helper function). | |
TStringId | localMap (const std::string &str) |
Localy map a string into a unique Id. | |
const std::string & | localUnmap (const TStringId &stringId) |
Localy unmap a string. | |
~CStringMapper () | |
Static Public Member Functions | |
void | clear () |
CStringMapper * | createLocalMapper () |
Create a local mapper. You can dispose of it by deleting it. | |
TStringId | emptyId () |
Return the global id for the empty string (helper function). | |
TStringId | map (const std::string &str) |
Globaly map a string into a unique Id. | |
const std::string & | unmap (const TStringId &stringId) |
Globaly unmap a string. | |
Private Member Functions | |
CStringMapper () | |
Private Attributes | |
std::string * | _EmptyId |
std::set< std::string *, CCharComp > | _StringTable |
Static Private Attributes | |
CStringMapper | _GlobalMapper |
|
Definition at line 45 of file string_mapper.cpp. References _EmptyId.
|
|
Definition at line 75 of file string_mapper.h. References localClear().
00076 { 00077 localClear(); 00078 } |
|
Definition at line 87 of file string_mapper.h. References _GlobalMapper, and localClear().
00087 { _GlobalMapper.localClear(); } |
|
Create a local mapper. You can dispose of it by deleting it.
Definition at line 52 of file string_mapper.cpp.
00053 { 00054 return new CStringMapper; 00055 } |
|
Return the global id for the empty string (helper function).
Definition at line 85 of file string_mapper.h. Referenced by NL3D::CPSSound::CPSSound().
00085 { return 0; }
|
|
Definition at line 81 of file string_mapper.cpp. References _EmptyId, and _StringTable. Referenced by clear(), and ~CStringMapper().
00082 { 00083 std::set<string*,CCharComp>::iterator it = _StringTable.begin(); 00084 while (it != _StringTable.end()) 00085 { 00086 string *ptrTmp = (*it); 00087 delete ptrTmp; 00088 it++; 00089 } 00090 _StringTable.clear(); 00091 delete _EmptyId; 00092 } |
|
Return the local id for the empty string (helper function).
Definition at line 96 of file string_mapper.h.
00096 { return 0; }
|
|
Localy map a string into a unique Id.
Definition at line 58 of file string_mapper.cpp. References _StringTable. Referenced by map().
00059 { 00060 if (str.size() == 0) 00061 return 0; 00062 00063 string *pStr = new string; 00064 *pStr = str; 00065 00066 std::set<string*,CCharComp>::iterator it = _StringTable.find(pStr); 00067 00068 if (it == _StringTable.end()) 00069 { 00070 _StringTable.insert(pStr); 00071 } 00072 else 00073 { 00074 delete pStr; 00075 pStr = (*it); 00076 } 00077 return (TStringId)pStr; 00078 } |
|
Localy unmap a string.
Definition at line 94 of file string_mapper.h. References _EmptyId. Referenced by unmap().
00094 { return (stringId==0)?*_EmptyId:*((std::string*)stringId); } |
|
Globaly map a string into a unique Id.
Definition at line 81 of file string_mapper.h. References _GlobalMapper, and localMap(). Referenced by NLSOUND::CAudioMixerUser::map(), NL3D::CPSSound::serial(), NLSOUND::CBackgroundSoundManager::TFxZone::serial(), NLSOUND::CBackgroundSoundManager::TSoundData::serial(), and NLSOUND::CBackgroundSound::TSoundInfo::serial().
00081 { return _GlobalMapper.localMap(str); } |
|
Globaly unmap a string.
Definition at line 83 of file string_mapper.h. References _GlobalMapper, and localUnmap(). Referenced by NLSOUND::CSampleBank::getLoadedSampleBankInfo(), NLSOUND::CSound::operator<(), NL3D::CPSSound::serial(), NLSOUND::CBackgroundSound::TSoundInfo::serial(), and NLSOUND::CAudioMixerUser::unmap().
00083 { return _GlobalMapper.localUnmap(stringId); } |
|
Definition at line 68 of file string_mapper.h. Referenced by CStringMapper(), localClear(), and localUnmap(). |
|
Definition at line 41 of file string_mapper.cpp. |
|
Definition at line 65 of file string_mapper.h. Referenced by localClear(), and localMap(). |