LangManager Class Reference

The class to manage set of available language processing objects. More...

Inheritance diagram for LangManager:

AbstractLangIdResolver

List of all members.

Public Member Functions

const LanggetLangById (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.


Detailed Description

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.

See also:
Lang EngLang RusLang

Member Function Documentation

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.

Parameters:
[in] langId The language identifier to get object by
Returns:
The pointer to language object or NULL if language ID is unknown

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.

Parameters:
[in] name The language name to get ID of
Returns:
The valid language identifier if language name is supported or LANG_ID_NONE value otherwise

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.

Parameters:
[in] langId The ID of the language to get name of
Returns:
Name of the language or an empty string if provided language ID is not valid

void LangManager::getSupportedLanguageNames ( StringList &  stringList  )  const

This method lets you know which languages are currently supported by the server.

Parameters:
[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.

Parameters:
[in] name Name of a language to check
Returns:
Non-zero if specified language is supported

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.

Parameters:
[in] dataDir The directory with data files


Generated on Thu May 6 16:10:58 2010 for VoiceMan by  doxygen 1.5.9