Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 705


Ignore:
Timestamp:
Dec 28, 2007, 2:41:13 AM (16 years ago)
Author:
landauf
Message:

added function to add descriptions to config values

Location:
code/branches/FICN/src/orxonox/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc

    r704 r705  
    4545    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue)
    4646    {
     47        this->bAddedDescription_ = false;
    4748        this->classname_ = classname;
    4849        this->varname_ = varname;
     
    6667    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned int defvalue)
    6768    {
     69        this->bAddedDescription_ = false;
    6870        this->classname_ = classname;
    6971        this->varname_ = varname;
     
    8789    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, char defvalue)
    8890    {
     91        this->bAddedDescription_ = false;
    8992        this->classname_ = classname;
    9093        this->varname_ = varname;
     
    108111    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned char defvalue)
    109112    {
     113        this->bAddedDescription_ = false;
    110114        this->classname_ = classname;
    111115        this->varname_ = varname;
     
    129133    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, float defvalue)
    130134    {
     135        this->bAddedDescription_ = false;
    131136        this->classname_ = classname;
    132137        this->varname_ = varname;
     
    150155    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue)
    151156    {
     157        this->bAddedDescription_ = false;
    152158        this->classname_ = classname;
    153159        this->varname_ = varname;
     
    171177    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, long double defvalue)
    172178    {
     179        this->bAddedDescription_ = false;
    173180        this->classname_ = classname;
    174181        this->varname_ = varname;
     
    192199    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue)
    193200    {
     201        this->bAddedDescription_ = false;
    194202        this->classname_ = classname;
    195203        this->varname_ = varname;
     
    217225    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, const std::string& defvalue)
    218226    {
     227        this->bAddedDescription_ = false;
    219228        this->classname_ = classname;
    220229        this->varname_ = varname;
     
    237246    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, const char* defvalue)
    238247    {
     248        this->bAddedDescription_ = false;
    239249        this->classname_ = classname;
    240250        this->varname_ = varname;
     
    257267    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector2 defvalue)
    258268    {
     269        this->bAddedDescription_ = false;
    259270        this->classname_ = classname;
    260271        this->varname_ = varname;
     
    283294    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector3 defvalue)
    284295    {
     296        this->bAddedDescription_ = false;
    285297        this->classname_ = classname;
    286298        this->varname_ = varname;
     
    309321    ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::ColourValue defvalue)
    310322    {
     323        this->bAddedDescription_ = false;
    311324        this->classname_ = classname;
    312325        this->varname_ = varname;
     
    897910
    898911    /**
    899      *  @param Writes the content of the list, containing all lines of the config-file, into the config-file.
    900      *  @param filename The name of the config-file
    901      */
     912        @brief Writes the content of the list, containing all lines of the config-file, into the config-file.
     913        @param filename The name of the config-file
     914    */
    902915    void ConfigValueContainer::writeConfigFile(const std::string& filename)
    903916    {
     
    925938        file.close();
    926939    }
     940
     941    /**
     942        @brief Adds a description to the config-value.
     943        @param description The description
     944    */
     945    void ConfigValueContainer::description(const std::string& description)
     946    {
     947        if (!this->bAddedDescription_)
     948        {
     949            this->description_ = std::string("ConfigValueDescription::" + this->classname_ + "::" + this->varname_);
     950            Language::getLanguage().addEntry(description_, description);
     951            this->bAddedDescription_ = true;
     952        }
     953    }
    927954}
  • code/branches/FICN/src/orxonox/core/ConfigValueContainer.h

    r704 r705  
    5151#include "OgreVector3.h"
    5252#include "OgreColourValue.h"
     53#include "Language.h"
    5354
    5455namespace orxonox
     
    105106
    106107            /** @returns the value. @param value This is only needed to determine the right type. */
    107             inline int getValue(int value)                                      { return this->value_.value_int_; }
     108            inline ConfigValueContainer& getValue(int& value)                           { value = this->value_.value_int_; return *this; }
    108109            /** @returns the value. @param value This is only needed to determine the right type. */
    109             inline unsigned int getValue(unsigned int value)                    { return this->value_.value_uint_; }
     110            inline ConfigValueContainer& getValue(unsigned int& value)                  { value = this->value_.value_uint_; return *this; }
    110111            /** @returns the value. @param value This is only needed to determine the right type. */
    111             inline char getValue(char value)                                    { return this->value_.value_char_; }
     112            inline ConfigValueContainer& getValue(char& value)                          { value = this->value_.value_char_; return *this; }
    112113            /** @returns the value. @param value This is only needed to determine the right type. */
    113             inline unsigned char getValue(unsigned char value)                  { return this->value_.value_uchar_; }
     114            inline ConfigValueContainer& getValue(unsigned char& value)                 { value = this->value_.value_uchar_; return *this; }
    114115            /** @returns the value. @param value This is only needed to determine the right type. */
    115             inline float getValue(float value)                                  { return this->value_.value_float_; }
     116            inline ConfigValueContainer& getValue(float& value)                         { value = this->value_.value_float_; return *this; }
    116117            /** @returns the value. @param value This is only needed to determine the right type. */
    117             inline double getValue(double value)                                { return this->value_.value_double_; }
     118            inline ConfigValueContainer& getValue(double& value)                        { value = this->value_.value_double_; return *this; }
    118119            /** @returns the value. @param value This is only needed to determine the right type. */
    119             inline double getValue(long double value)                           { return this->value_.value_long_double_; }
     120            inline ConfigValueContainer& getValue(long double& value)                   { value = this->value_.value_long_double_; return *this; }
    120121            /** @returns the value. @param value This is only needed to determine the right type. */
    121             inline bool getValue(bool value)                                    { return this->value_.value_bool_; }
     122            inline ConfigValueContainer& getValue(bool& value)                          { value = this->value_.value_bool_; return *this; }
    122123            /** @returns the value. @param value This is only needed to determine the right type. */
    123             inline const std::string& getValue(const std::string& value)        { return this->value_string_; }
     124            inline ConfigValueContainer& getValue(std::string& value)                   { value = this->value_string_; return *this; }
    124125            /** @returns the value. @param value This is only needed to determine the right type. */
    125             inline const char* getValue(const char* value)                      { return this->value_string_.c_str(); }
     126            inline ConfigValueContainer& getValue(const char* value)                    { value = this->value_string_.c_str(); return *this; }
    126127            /** @returns the value. @param value This is only needed to determine the right type. */
    127             inline Ogre::Vector2 getValue(const Ogre::Vector2& value)           { return this->value_vector2_; }
     128            inline ConfigValueContainer& getValue(Ogre::Vector2& value)                 { value = this->value_vector2_; return *this; }
    128129            /** @returns the value. @param value This is only needed to determine the right type. */
    129             inline Ogre::Vector3 getValue(const Ogre::Vector3& value)           { return this->value_vector3_; }
     130            inline ConfigValueContainer& getValue(Ogre::Vector3& value)                 { value = this->value_vector3_; return *this; }
    130131            /** @returns the value. @param value This is only needed to determine the right type. */
    131             inline Ogre::ColourValue getValue(const Ogre::ColourValue& value)   { return this->value_colourvalue_; }
     132            inline ConfigValueContainer& getValue(Ogre::ColourValue& value)             { value = this->value_colourvalue_; return *this; }
     133
     134            void description(const std::string& description);
    132135
    133136            bool parseSting(const std::string& input);
     
    186189
    187190            VariableType type_;                                 //!< The type of the variable
     191            bool bAddedDescription_;                            //!< True if a description was added
     192            LanguageEntryName description_;                     //!< The description
    188193    };
    189194}
  • code/branches/FICN/src/orxonox/core/CoreIncludes.h

    r704 r705  
    141141        this->getIdentifier()->setConfigValueContainer(#varname, container##varname); \
    142142    } \
    143     varname = container##varname->getValue(varname)
     143    container##varname->getValue(varname)
    144144
    145145/**
     
    152152    { \
    153153        container##varname##reset->resetConfigValue(); \
    154         varname = container##varname##reset->getValue(varname); \
     154        container##varname##reset->getValue(varname); \
    155155    } \
    156156    else \
  • code/branches/FICN/src/orxonox/core/CorePrereqs.h

    r684 r705  
    7979  template <class T>
    8080  class Iterator;
     81  class Language;
     82  class LanguageEntry;
    8183  class MetaObjectList;
    8284  template <class T>
Note: See TracChangeset for help on using the changeset viewer.