ADTF
stringtable.h
Go to the documentation of this file.
1 
7 #ifndef _STRING_TABLE_CLASS_HEADER_
8 #define _STRING_TABLE_CLASS_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
18 class DOEXPORT cStringTable
19 {
21 
22  public:
36 
37  protected:
40 
41  public:
42 
47 
51  virtual ~cStringTable();
52 
60  tResult Load(const tChar* strFilename);
61 
75  tResult LoadFromString(const tChar* strTable);
76 
77  #ifdef WIN32
85  tResult Load(tInt nResourceId, tHandle hModule=nullptr);
86  #endif // WIN32
87 
93 
99  cString& Get(const tChar* strId);
105  cString Format(const tChar* strId, ...);
106 
115 
126  cString& operator[](const cString& strKey);
127 
138 
139 
147  tBool IsEmpty() const;
148 };
149 
157 cString& __strget(const tChar* strId);
158 
167 cString __strfmt(const tChar* strId, ...);
168 
169 } // namespace A_UTILS_NS
170 
171 //*************************************************************************************************
172 #endif // _STRING_TABLE_CLASS_HEADER_
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
int32_t tInt32
type definition for signed integer values (32bit) (platform and compiler independent type).
tVoid * tHandle
type definition for a handle value (platform and compiler dependent type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
String map class.
Definition: stringmap.h:20
static cStringTable * m_pGlobalInstance
Pointer to global string table.
Definition: stringtable.h:38
cString & Get(const tChar *strId)
Returns the value assigned to a string.
cString Format(const tChar *strId,...)
Printf-style formating.
tResult Free()
Frees all allocated resources.
cStringTable()
Default constructor.
cString & operator[](tInt32 nIdx)
Use this function to access single elements of the table.
cString & operator[](const cString &strKey)
This function retrieves a string value from the list.
virtual ~cStringTable()
Destructor.
tResult LoadFromString(const tChar *strTable)
Initializes the string table from a string.
static cStringTable * GetGlobal()
Returns the global table if available.
cStringMap m_mapStrings
Internally used string map.
Definition: stringtable.h:39
tBool IsEmpty() const
This function checks if the string table object is empty.
tResult Load(const tChar *strFilename)
Loads a string table from a file.
tInt32 GetItemCount() const
This function returns the number of items the table contains.
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition: d_ptr.h:270
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11
cString __strfmt(const tChar *strId,...)
Use this function to access single elements of the global string table.
cString & __strget(const tChar *strId)
Use this function to access single elements of the global string table.