Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 29, 2007, 2:37:45 AM (16 years ago)
Author:
landauf
Message:

documented and commented the Language.h and .cc file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/Language.h

    r715 r720  
    2626 */
    2727
     28/*!
     29    @file Language.h
     30    @brief Definition of the Language and the LanguageEntry class.
     31
     32    The Language class is used, to get a translation of a string in the configured language.
     33    The string is identified by another string, the name of the entry.
     34    If the translation in the configured language isn't available, the default entry, defined in the code, is used.
     35
     36    Usage:
     37     - Set the entry with the default string:
     38       Language::getLanguage()->addEntry("name of the entry", "the string to translate");
     39
     40     - Get the translation of the entry in the configured language:
     41       std::cout << Language::getLanguage()->getTranslation("name of the entry") << std::endl;
     42*/
     43
    2844#ifndef _Language_H__
    2945#define _Language_H__
     
    3349
    3450#include "CorePrereqs.h"
    35 
    3651#include "OrxonoxClass.h"
    3752
     
    4055    typedef std::string LanguageEntryName;
    4156
     57    //! The LanguageEntry class stores the default- and the translated string of a given entry in the language file.
    4258    class _CoreExport LanguageEntry : public OrxonoxClass
    4359    {
     
    4763            void setDefault(const std::string& fallbackEntry);
    4864
     65            /** @brief Returns the translated entry in the configured language. @return The translated entry */
    4966            inline const std::string& getTranslation()
    5067                { return this->translatedEntry_; }
    5168
     69            /** @brief Returns the default entry. @return The default entry */
    5270            inline const std::string& getDefault()
    5371                { return this->fallbackEntry_; }
    5472
    5573        private:
    56             std::string fallbackEntry_;
    57             std::string translatedEntry_;
     74            std::string fallbackEntry_;                             //!< The default entry: Used, if no translation is available or no language configured
     75            std::string translatedEntry_;                           //!< The translated entry in the configured language
    5876    };
    5977
     78    //! The Language class manges the language files and entries and stores the LanguageEntry objects in a map.
    6079    class _CoreExport Language : public OrxonoxClass
    6180    {
     
    7796            void createEntry(const LanguageEntryName& name, const std::string& entry);
    7897
    79             std::string language_;
    80             std::string defaultLanguage_;
    81             std::string defaultTranslation_;
    82             std::map<std::string, LanguageEntry*> languageEntries_;
     98            std::string language_;                                  //!< The configured language
     99            std::string defaultLanguage_;                           //!< The default language
     100            std::string defaultTranslation_;                        //!< The returned string, if an entry unavailable entry is requested
     101            std::map<std::string, LanguageEntry*> languageEntries_; //!< A map to store all LanguageEntry objects and their name
    83102    };
    84103}
Note: See TracChangeset for help on using the changeset viewer.