Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 27, 2007, 9:38:55 PM (16 years ago)
Author:
landauf
Message:

intern changes in the ConfigValueContainer

File:
1 edited

Legend:

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

    r698 r703  
    7373    {
    7474        public:
     75            enum VariableType
     76            {
     77                Int,
     78                uInt,
     79                Char,
     80                uChar,
     81                Float,
     82                Double,
     83                LongDouble,
     84                Bool,
     85                ConstChar,
     86                String,
     87                Vector2,
     88                Vector3,
     89                ColourValue
     90            };
     91
    7592            ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue);
    7693            ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned int defvalue);
     
    7996            ConfigValueContainer(const std::string& classname, const std::string& varname, float defvalue);
    8097            ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue);
     98            ConfigValueContainer(const std::string& classname, const std::string& varname, long double defvalue);
    8199            ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue);
    82100            ConfigValueContainer(const std::string& classname, const std::string& varname, const std::string& defvalue);
     
    85103            ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector3 defvalue);
    86104            ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::ColourValue defvalue);
    87 
    88             static std::list<std::string>& getConfigFileLines();
    89             static bool finishedReadingConfigFile(bool finished = false);
    90             void setConfigFileEntyToDefault();
    91             void searchConfigFileLine();
    92             std::string parseValueString(bool bStripped = true);
    93 
    94             static std::string getStrippedLine(const std::string& line);
    95             static bool isEmpty(const std::string& line);
    96             static bool isComment(const std::string& line);
    97             static void readConfigFile(const std::string& filename);
    98             static void writeConfigFile(const std::string& filename);
    99105
    100106            /** @returns the value. @param value This is only needed to determine the right type. */
     
    111117            inline double getValue(double value)                                { return this->value_.value_double_; }
    112118            /** @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            /** @returns the value. @param value This is only needed to determine the right type. */
    113121            inline bool getValue(bool value)                                    { return this->value_.value_bool_; }
    114122            /** @returns the value. @param value This is only needed to determine the right type. */
     
    123131            inline Ogre::ColourValue getValue(const Ogre::ColourValue& value)   { return this->value_colourvalue_; }
    124132
     133            bool parseSting(const std::string& input);
     134            void resetConfigFileEntry();
     135            void resetConfigValue();
     136
    125137        private:
     138            bool parseSting(const std::string& input, int defvalue);
     139            bool parseSting(const std::string& input, unsigned int defvalue);
     140            bool parseSting(const std::string& input, char defvalue);
     141            bool parseSting(const std::string& input, unsigned char defvalue);
     142            bool parseSting(const std::string& input, float defvalue);
     143            bool parseSting(const std::string& input, double defvalue);
     144            bool parseSting(const std::string& input, long double defvalue);
     145            bool parseSting(const std::string& input, bool defvalue);
     146            bool parseSting(const std::string& input, const std::string& defvalue);
     147            bool parseSting(const std::string& input, const char* defvalue);
     148            bool parseSting(const std::string& input, const Ogre::Vector2& defvalue);
     149            bool parseSting(const std::string& input, const Ogre::Vector3& defvalue);
     150            bool parseSting(const std::string& input, const Ogre::ColourValue& defvalue);
     151
     152            static std::list<std::string>& getConfigFileLines();
     153            static bool finishedReadingConfigFile(bool finished = false);
     154            void searchConfigFileLine();
     155            std::string parseValueString(bool bStripped = true);
     156
     157            static std::string getStrippedLine(const std::string& line);
     158            static bool isEmpty(const std::string& line);
     159            static bool isComment(const std::string& line);
     160            static void readConfigFile(const std::string& filename);
     161            static void writeConfigFile(const std::string& filename);
     162
    126163            std::string         classname_;                     //!< The name of the class the variable belongs to
    127164            std::string         varname_;                       //!< The name of the variable
     
    136173                float               value_float_;               //!< The value, if the variable is of the type float
    137174                double              value_double_;              //!< The value, if the variable is of the type double
     175                long double         value_long_double_;         //!< The value, if the variable is of the type long double
    138176                bool                value_bool_;                //!< The value, if the variable is of the type bool
    139177            } value_;                                           //!< The value of the variable
     
    146184            std::list<std::string>::iterator configFileLine_;   //!< An iterator, pointing to the entry of the variable in the config-file
    147185
    148             enum VariableType
    149             {
    150                 Int,
    151                 uInt,
    152                 Char,
    153                 uChar,
    154                 Float,
    155                 Double,
    156                 Bool,
    157                 ConstChar,
    158                 String,
    159                 Vector2,
    160                 Vector3,
    161                 ColourValue
    162             } type_;                                            //!< The type of the variable
     186            VariableType type_;                                 //!< The type of the variable
    163187    };
    164188}
Note: See TracChangeset for help on using the changeset viewer.