- Timestamp:
- Dec 27, 2007, 9:38:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/core/ConfigValueContainer.h
r698 r703 73 73 { 74 74 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 75 92 ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue); 76 93 ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned int defvalue); … … 79 96 ConfigValueContainer(const std::string& classname, const std::string& varname, float defvalue); 80 97 ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue); 98 ConfigValueContainer(const std::string& classname, const std::string& varname, long double defvalue); 81 99 ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue); 82 100 ConfigValueContainer(const std::string& classname, const std::string& varname, const std::string& defvalue); … … 85 103 ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector3 defvalue); 86 104 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);99 105 100 106 /** @returns the value. @param value This is only needed to determine the right type. */ … … 111 117 inline double getValue(double value) { return this->value_.value_double_; } 112 118 /** @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. */ 113 121 inline bool getValue(bool value) { return this->value_.value_bool_; } 114 122 /** @returns the value. @param value This is only needed to determine the right type. */ … … 123 131 inline Ogre::ColourValue getValue(const Ogre::ColourValue& value) { return this->value_colourvalue_; } 124 132 133 bool parseSting(const std::string& input); 134 void resetConfigFileEntry(); 135 void resetConfigValue(); 136 125 137 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 126 163 std::string classname_; //!< The name of the class the variable belongs to 127 164 std::string varname_; //!< The name of the variable … … 136 173 float value_float_; //!< The value, if the variable is of the type float 137 174 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 138 176 bool value_bool_; //!< The value, if the variable is of the type bool 139 177 } value_; //!< The value of the variable … … 146 184 std::list<std::string>::iterator configFileLine_; //!< An iterator, pointing to the entry of the variable in the config-file 147 185 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 163 187 }; 164 188 }
Note: See TracChangeset
for help on using the changeset viewer.