xoreos
0.0.5
|
A map to quickly match strings from a list. More...
#include <stringmap.h>
Public Member Functions | |
StringListMap (const char *const *strings, size_t count, bool onlyFirstWord=false) | |
Build a string map to match a list of strings against. More... | |
size_t | find (const char *str, const char **match) const |
Match a string against the map. More... | |
size_t | find (const UString &str, const char **match) const |
Match a string against the map. More... | |
Static Public Attributes | |
static const size_t | kInvalidIndex = SIZE_MAX |
Private Types | |
typedef boost::unordered_map< UString, size_t, hashUStringCaseInsensitive > | StrMap |
Private Attributes | |
bool | _onlyFirstWord |
StrMap | _map |
A map to quickly match strings from a list.
Definition at line 43 of file stringmap.h.
|
private |
Definition at line 69 of file stringmap.h.
Common::StringListMap::StringListMap | ( | const char *const * | strings, |
size_t | count, | ||
bool | onlyFirstWord = false |
||
) |
Build a string map to match a list of strings against.
Definition at line 32 of file stringmap.cpp.
References _map.
size_t Common::StringListMap::find | ( | const char * | str, |
const char ** | match | ||
) | const |
Match a string against the map.
str | The string to match against. |
match | If != 0, the position after the match will be stored here. |
Definition at line 37 of file stringmap.cpp.
References _map, _onlyFirstWord, Common::UString::end(), Common::UString::findFirst(), kInvalidIndex, and Common::UString::truncate().
Referenced by Graphics::parseTXICommand().
size_t Common::StringListMap::find | ( | const UString & | str, |
const char ** | match | ||
) | const |
Match a string against the map.
str | The string to match against. |
match | If != 0, the position after the match will be stored here. |
Definition at line 55 of file stringmap.cpp.
References _map, _onlyFirstWord, Common::UString::c_str(), Common::UString::end(), Common::UString::findFirst(), kInvalidIndex, and Common::UString::truncate().
|
private |
Definition at line 71 of file stringmap.h.
Referenced by find(), and StringListMap().
|
private |
Definition at line 67 of file stringmap.h.
Referenced by find().
|
static |
Definition at line 45 of file stringmap.h.
Referenced by find().