VoiceMan
|
The class to manage set of available language processing objects. More...
Public Member Functions | |
const Lang * | getLangById (LangId langId) const |
Returns language object by language ID. | |
LangId | getLangId (const std::string &name) const |
Returns language identifier by language name. | |
std::string | getLangName (LangId langId) const |
Returns string with language name by language ID. | |
void | getSupportedLanguageNames (StringList &stringList) const |
Fills provided string list with names of supported languages. | |
bool | hasLanguage (const std::string &name) const |
Checks if language is supported. | |
LangManager () | |
The default constructor. | |
void | load (const std::string &dataDir) |
Fills language objects with initial data. | |
virtual | ~LangManager () |
The destructor. |
This class contains a set of available language objects, fills it with required initial data and provides interface to get language identifier by language name or to get prepared language object by language identifier. Languages must have references by names only in configuration file processing and by identifiers in all other cases. General daemon code may not distinguish languages by itself because in general case their set does not have exact definition. Future version of VoiceMan daemon may have plug-in implementation of supported languages and set of them will be defined in run-time during configuration files processing.
const Lang * LangManager::getLangById | ( | LangId | langId | ) | const [virtual] |
This method checks if provided language identifier is valid and returns a pointer to corresponding language object or NULL otherwise.
[in] | langId | The language identifier to get object by |
Implements AbstractLangIdResolver.
LangId LangManager::getLangId | ( | const std::string & | name | ) | const |
This method can be used to retrieve valid language identifier to distinguish languages in daemon code except configuration files processing.
[in] | name | The language name to get ID of |
std::string LangManager::getLangName | ( | LangId | langId | ) | const |
This method returns short string with language name. These names usually used in configuration files processing. The string returned by this method can be empty if provided language ID is not valid.
[in] | langId | The ID of the language to get name of |
void LangManager::getSupportedLanguageNames | ( | StringList & | stringList | ) | const |
This method lets you know which languages are currently supported by the server.
[out] | stringList | The string list to receive the result |
bool LangManager::hasLanguage | ( | const std::string & | name | ) | const |
This method must be used during configuration file processing to be sure if some language name is valid and corresponding language object is available.
[in] | name | Name of a language to check |
void LangManager::load | ( | const std::string & | dataDir | ) |
Language objects contain various data such as string constants and uses it in different language operations. In most cases this data cannot be included in source code directly because it contains UNICODE characters. This method loads all required structures for all available languages from files stored in the specified directory.
[in] | dataDir | The directory with data files |