From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03450.html | 597 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 597 insertions(+) create mode 100644 docs/doxygen/nel/a03450.html (limited to 'docs/doxygen/nel/a03450.html') diff --git a/docs/doxygen/nel/a03450.html b/docs/doxygen/nel/a03450.html new file mode 100644 index 00000000..43b089d0 --- /dev/null +++ b/docs/doxygen/nel/a03450.html @@ -0,0 +1,597 @@ + + +NeL: NLMISC::CStringMapper class Reference + + + +
+

NLMISC::CStringMapper Class Reference

#include <string_mapper.h> +

+


Detailed Description

+A static class that map string to integer and vice-versa Each different string is tranformed into an unique integer identifier. If the same string is submited twice, the same id is returned. The class can also return the string associated with an id.

+

Author:
Boris Boucher

+Nevrax France

+
Date:
2003
+ +

+ +

+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 ()
CStringMappercreateLocalMapper ()
 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
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLMISC::CStringMapper::CStringMapper  )  [private]
+
+ + + + + +
+   + + +

+ +

+Definition at line 45 of file string_mapper.cpp. +

+References _EmptyId. +

+

00046 {
+00047         _EmptyId = new string;
+00048         *_EmptyId = "";
+00049 }
+
+

+ + + + +
+ + + + + + + + + +
NLMISC::CStringMapper::~CStringMapper  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 75 of file string_mapper.h. +

+References localClear(). +

+

00076         {
+00077                 localClear();
+00078         }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CStringMapper::clear void   )  [inline, static]
+
+ + + + + +
+   + + +

+ +

+Definition at line 87 of file string_mapper.h. +

+References _GlobalMapper, and localClear(). +

+

00087 { _GlobalMapper.localClear(); }
+
+

+ + + + +
+ + + + + + + + + +
CStringMapper * NLMISC::CStringMapper::createLocalMapper  )  [static]
+
+ + + + + +
+   + + +

+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 }
+
+

+ + + + +
+ + + + + + + + + +
TStringId NLMISC::CStringMapper::emptyId  )  [inline, static]
+
+ + + + + +
+   + + +

+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; }
+
+

+ + + + +
+ + + + + + + + + +
void NLMISC::CStringMapper::localClear  ) 
+
+ + + + + +
+   + + +

+ +

+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 }
+
+

+ + + + +
+ + + + + + + + + +
TStringId NLMISC::CStringMapper::localEmptyId  )  [inline]
+
+ + + + + +
+   + + +

+Return the local id for the empty string (helper function). +

+ +

+Definition at line 96 of file string_mapper.h. +

+

00096 { return 0; }
+
+

+ + + + +
+ + + + + + + + + + +
TStringId NLMISC::CStringMapper::localMap const std::string &  str  ) 
+
+ + + + + +
+   + + +

+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 }
+
+

+ + + + +
+ + + + + + + + + + +
const std::string& NLMISC::CStringMapper::localUnmap const TStringId stringId  )  [inline]
+
+ + + + + +
+   + + +

+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); }
+
+

+ + + + +
+ + + + + + + + + + +
TStringId NLMISC::CStringMapper::map const std::string &  str  )  [inline, static]
+
+ + + + + +
+   + + +

+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); }
+
+

+ + + + +
+ + + + + + + + + + +
const std::string& NLMISC::CStringMapper::unmap const TStringId stringId  )  [inline, static]
+
+ + + + + +
+   + + +

+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); }
+
+


Field Documentation

+

+ + + + +
+ + +
std::string* NLMISC::CStringMapper::_EmptyId [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 68 of file string_mapper.h. +

+Referenced by CStringMapper(), localClear(), and localUnmap().

+

+ + + + +
+ + +
CStringMapper NLMISC::CStringMapper::_GlobalMapper [static, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 41 of file string_mapper.cpp. +

+Referenced by clear(), map(), and unmap().

+

+ + + + +
+ + +
std::set<std::string*,CCharComp> NLMISC::CStringMapper::_StringTable [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 65 of file string_mapper.h. +

+Referenced by localClear(), and localMap().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 13:35:53 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1