# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CStringIdArray Class Reference

The goal of this class is to associate number and string. More...

#include <string_id_array.h>

List of all members.

Public Types

typedef sint16 TStringId

Public Methods

 CStringIdArray ()
void addString (const std::string &str, TStringId id)
 Adds a string in the string in the array. More...

void addString (const std::string &str)
 Adds a string in the string at the end of the array. More...

TStringId getId (const std::string &str, bool IgnoreIfUnknown=false)
 Returns the id associated to string str. More...

std::string getString (TStringId id) const
 Returns the string associated to this id. More...

void resize (TStringId size)
 Set the size of the _StringArray. More...

TStringId size () const
 Returns the size of the _StringArray. More...

const std::set< std::string > & getNeedToAskedStringArray () const
 Returns all string in the _NeedToAskStringArray. More...

const std::set< std::string > & getAskedStringArray () const
 Returns all string in the _AskedStringArray. More...

void moveNeedToAskToAskedStringArray ()
 Moves string from _NeedToAskStringArray to _AskedStringArray. More...

void ignoreAllUnknownId (bool b)
 If set to true, when we ask a string with no id, we don't put it in the _NeedToAskStringArray array. More...

void clear ()
 Clears the string id array. More...

void display ()
 Displays all association of the array in a C style (useful to copy/paste in your C code). More...


Private Attributes

bool _IgnoreAllUnknownId
std::vector< std::string > _StringArray
std::set< std::string > _NeedToAskStringArray
std::set< std::string > _AskedStringArray


Detailed Description

The goal of this class is to associate number and string.

It is used in the CCallbackNetBase for message id<->string associations.

Author:
Vianney Lecroart , Nevrax France
Date:
2001

Definition at line 50 of file string_id_array.h.


Member Typedef Documentation

typedef sint16 NLMISC::CStringIdArray::TStringId
 

Definition at line 54 of file string_id_array.h.

Referenced by NLNET::CNetManager::addCallbackArray, addString, NLNET::CMessage::CMessage, getId, NLNET::CMessage::getId, getString, NLNET::CCallbackNetBase::processOneMessage, NLNET::CMessage::readType, resize, NLNET::CCallbackNetBase::setOtherSideAssociations, NLNET::CMessage::setType, and size.


Constructor & Destructor Documentation

NLMISC::CStringIdArray::CStringIdArray   [inline]
 

Definition at line 56 of file string_id_array.h.

References _IgnoreAllUnknownId.


Member Function Documentation

void NLMISC::CStringIdArray::addString const std::string &    str [inline]
 

Adds a string in the string at the end of the array.

Definition at line 77 of file string_id_array.h.

References _StringArray, addString, nlassert, and TStringId.

void NLMISC::CStringIdArray::addString const std::string &    str,
TStringId    id
[inline]
 

Adds a string in the string in the array.

Definition at line 59 of file string_id_array.h.

References _AskedStringArray, _IgnoreAllUnknownId, _NeedToAskStringArray, _StringArray, id, nlassert, and TStringId.

Referenced by NLNET::CCallbackNetBase::addCallbackArray, addString, and NLNET::CCallbackNetBase::setOtherSideAssociations.

void NLMISC::CStringIdArray::clear   [inline]
 

Clears the string id array.

Definition at line 179 of file string_id_array.h.

References _AskedStringArray, _NeedToAskStringArray, and _StringArray.

void NLMISC::CStringIdArray::display   [inline]
 

Displays all association of the array in a C style (useful to copy/paste in your C code).

Definition at line 187 of file string_id_array.h.

References _StringArray, and nlinfo.

Referenced by NLNET::CCallbackNetBase::displayAllMyAssociations.

const std::set<std::string>& NLMISC::CStringIdArray::getAskedStringArray   const [inline]
 

Returns all string in the _AskedStringArray.

Definition at line 160 of file string_id_array.h.

References _AskedStringArray.

Referenced by NLNET::CCallbackNetBase::baseUpdate.

TStringId NLMISC::CStringIdArray::getId const std::string &    str,
bool    IgnoreIfUnknown = false
[inline]
 

Returns the id associated to string str.

If the id is not found, the string will be added in _NeedToAskStringArray if ignoreAllUnknownId is false and IgnoreIfUnknown is false too.

Definition at line 89 of file string_id_array.h.

References _AskedStringArray, _IgnoreAllUnknownId, _NeedToAskStringArray, _StringArray, nlassert, and TStringId.

Referenced by NLNET::CMessage::toString.

const std::set<std::string>& NLMISC::CStringIdArray::getNeedToAskedStringArray   const [inline]
 

Returns all string in the _NeedToAskStringArray.

Definition at line 154 of file string_id_array.h.

References _NeedToAskStringArray.

Referenced by NLNET::CCallbackNetBase::baseUpdate.

std::string NLMISC::CStringIdArray::getString TStringId    id const [inline]
 

Returns the string associated to this id.

Definition at line 131 of file string_id_array.h.

References _StringArray, id, nlassert, and TStringId.

Referenced by NLNET::CCallbackServer::sendAllMyAssociations, NLNET::CMessage::setType, and NLNET::CMessage::toString.

void NLMISC::CStringIdArray::ignoreAllUnknownId bool    b [inline]
 

If set to true, when we ask a string with no id, we don't put it in the _NeedToAskStringArray array.

Definition at line 176 of file string_id_array.h.

References _IgnoreAllUnknownId.

Referenced by NLNET::CCallbackClient::CCallbackClient, and NLNET::CCallbackNetBase::ignoreAllUnknownId.

void NLMISC::CStringIdArray::moveNeedToAskToAskedStringArray   [inline]
 

Moves string from _NeedToAskStringArray to _AskedStringArray.

Definition at line 166 of file string_id_array.h.

References _AskedStringArray, _IgnoreAllUnknownId, and _NeedToAskStringArray.

Referenced by NLNET::CCallbackNetBase::baseUpdate.

void NLMISC::CStringIdArray::resize TStringId    size [inline]
 

Set the size of the _StringArray.

Definition at line 142 of file string_id_array.h.

References _StringArray, size, and TStringId.

Referenced by NLNET::CCallbackNetBase::addCallbackArray.

TStringId NLMISC::CStringIdArray::size   const [inline]
 

Returns the size of the _StringArray.

Definition at line 148 of file string_id_array.h.

References _StringArray, and TStringId.

Referenced by NLNET::CCallbackNetBase::addCallbackArray, resize, and NLNET::CCallbackServer::sendAllMyAssociations.


Member Data Documentation

std::set<std::string> NLMISC::CStringIdArray::_AskedStringArray [private]
 

Definition at line 205 of file string_id_array.h.

Referenced by addString, clear, getAskedStringArray, getId, and moveNeedToAskToAskedStringArray.

bool NLMISC::CStringIdArray::_IgnoreAllUnknownId [private]
 

Definition at line 199 of file string_id_array.h.

Referenced by addString, CStringIdArray, getId, ignoreAllUnknownId, and moveNeedToAskToAskedStringArray.

std::set<std::string> NLMISC::CStringIdArray::_NeedToAskStringArray [private]
 

Definition at line 203 of file string_id_array.h.

Referenced by addString, clear, getId, getNeedToAskedStringArray, and moveNeedToAskToAskedStringArray.

std::vector<std::string> NLMISC::CStringIdArray::_StringArray [private]
 

Definition at line 201 of file string_id_array.h.

Referenced by addString, clear, display, getId, getString, resize, and size.


The documentation for this class was generated from the following file: