orxonox::Language Class Reference

The Language class manges the language files and entries and stores the LanguageEntry objects in a map. More...

#include <src/core/Language.h>

List of all members.

Public Member Functions

void addEntry (const LanguageEntryLabel &label, const std::string &entry)
 Adds a new LanguageEntry, if it's not already existing.
const std::stringgetLocalisation (const LanguageEntryLabel &label) const
 Returns the localisation of a given entry.
 Language ()
 Constructor: Reads the default language file and sets some values.
 ~Language ()
 Destructor: Deletes all language entries.

Static Public Member Functions

static LanguagegetLanguage ()

Private Member Functions

LanguageEntrycreateEntry (const LanguageEntryLabel &label, const std::string &entry)
 Creates a new LanguageEntry with a given label and a given default entry.
 Language (const Language &)
void readDefaultLanguageFile ()
 Reads the default language file and creates a LanguageEntry objects for every entry.
void readTranslatedLanguageFile ()
 Reads the language file of the configured language and assigns the localisation to the corresponding LanguageEntry object.
void writeDefaultLanguageFile () const
 Writes all default entries to the default language file.

Static Private Member Functions

static std::string getFilename (const std::string &language)
 Creates the name of the language file out of the languages name.

Private Attributes

std::string defaultLanguage_
 The default language.
std::string defaultLocalisation_
 The returned string, if an entry unavailable entry is requested.
std::map< std::string,
LanguageEntry * > 
languageEntries_
 A map to store all LanguageEntry objects and their labels.

Static Private Attributes

static LanguagesingletonRef_s = 0

Friends

class CoreConfiguration


Detailed Description

The Language class manges the language files and entries and stores the LanguageEntry objects in a map.

Constructor & Destructor Documentation

orxonox::Language::Language (  ) 

Constructor: Reads the default language file and sets some values.

References defaultLanguage_, defaultLocalisation_, readDefaultLanguageFile(), and singletonRef_s.

orxonox::Language::~Language (  ) 

Destructor: Deletes all language entries.

References languageEntries_, and singletonRef_s.

orxonox::Language::Language ( const Language  )  [private]


Member Function Documentation

void orxonox::Language::addEntry ( const LanguageEntryLabel label,
const std::string entry 
)

Adds a new LanguageEntry, if it's not already existing.

Parameters:
label The label of the entry
entry The default entry

References COUT, createEntry(), languageEntries_, and writeDefaultLanguageFile().

LanguageEntry * orxonox::Language::createEntry ( const LanguageEntryLabel label,
const std::string entry 
) [private]

Creates a new LanguageEntry with a given label and a given default entry.

Parameters:
label The label of the entry
entry The default entry
Returns:
The created LanguageEntry object

References COUT, defaultLanguage_, getFilename(), languageEntries_, and orxonox::LanguageEntry::setLabel().

Referenced by addEntry(), readDefaultLanguageFile(), and readTranslatedLanguageFile().

std::string orxonox::Language::getFilename ( const std::string language  )  [static, private]

Creates the name of the language file out of the languages name.

Parameters:
language The name of the language
Returns:
The filename

Referenced by createEntry(), readDefaultLanguageFile(), readTranslatedLanguageFile(), and writeDefaultLanguageFile().

static Language& orxonox::Language::getLanguage (  )  [inline, static]

const std::string & orxonox::Language::getLocalisation ( const LanguageEntryLabel label  )  const

Returns the localisation of a given entry.

Parameters:
label The label of the entry
Returns:
The localisation

References COUT, defaultLocalisation_, and languageEntries_.

void orxonox::Language::readDefaultLanguageFile (  )  [private]

Reads the default language file and creates a LanguageEntry objects for every entry.

References COUT, createEntry(), defaultLanguage_, orxonox::Core::getConfigPath(), and getFilename().

Referenced by Language().

void orxonox::Language::readTranslatedLanguageFile (  )  [private]

Reads the language file of the configured language and assigns the localisation to the corresponding LanguageEntry object.

References COUT, createEntry(), defaultLanguage_, defaultLocalisation_, orxonox::Core::getConfigPath(), getFilename(), orxonox::Core::getLanguage(), languageEntries_, and orxonox::Core::resetLanguage().

Referenced by orxonox::CoreConfiguration::languageChanged().

void orxonox::Language::writeDefaultLanguageFile (  )  const [private]

Writes all default entries to the default language file.

References COUT, defaultLanguage_, orxonox::Core::getConfigPath(), getFilename(), and languageEntries_.

Referenced by addEntry().


Friends And Related Function Documentation

friend class CoreConfiguration [friend]


Member Data Documentation

The returned string, if an entry unavailable entry is requested.

Referenced by getLocalisation(), Language(), and readTranslatedLanguageFile().

Referenced by Language(), and ~Language().


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

Generated on Tue Jul 28 16:22:41 2009 for Orxonox by  doxygen 1.5.6