- Timestamp:
- Dec 28, 2007, 11:33:10 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/core/ConfigValueContainer.h
r708 r715 44 44 45 45 #include <list> 46 #include <string> 46 47 47 48 #include "CorePrereqs.h" … … 51 52 #include "misc/Matrix3.h" 52 53 #include "misc/Quaternion.h" 53 #include "misc/String.h"54 54 #include "misc/ColourValue.h" 55 55 #include "Language.h" … … 93 93 }; 94 94 95 ConfigValueContainer(const String& classname, const String& varname, int defvalue);96 ConfigValueContainer(const String& classname, const String& varname, unsigned int defvalue);97 ConfigValueContainer(const String& classname, const String& varname, char defvalue);98 ConfigValueContainer(const String& classname, const String& varname, unsigned char defvalue);99 ConfigValueContainer(const String& classname, const String& varname, float defvalue);100 ConfigValueContainer(const String& classname, const String& varname, double defvalue);101 ConfigValueContainer(const String& classname, const String& varname, long double defvalue);102 ConfigValueContainer(const String& classname, const String& varname, bool defvalue);103 ConfigValueContainer(const String& classname, const String& varname, const String& defvalue);104 ConfigValueContainer(const String& classname, const String& varname, const char* defvalue);105 ConfigValueContainer(const String& classname, const String& varname, Vector2 defvalue);106 ConfigValueContainer(const String& classname, const String& varname, Vector3 defvalue);107 ConfigValueContainer(const String& classname, const String& varname, ColourValue defvalue);95 ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue); 96 ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned int defvalue); 97 ConfigValueContainer(const std::string& classname, const std::string& varname, char defvalue); 98 ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned char defvalue); 99 ConfigValueContainer(const std::string& classname, const std::string& varname, float defvalue); 100 ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue); 101 ConfigValueContainer(const std::string& classname, const std::string& varname, long double defvalue); 102 ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue); 103 ConfigValueContainer(const std::string& classname, const std::string& varname, const std::string& defvalue); 104 ConfigValueContainer(const std::string& classname, const std::string& varname, const char* defvalue); 105 ConfigValueContainer(const std::string& classname, const std::string& varname, Vector2 defvalue); 106 ConfigValueContainer(const std::string& classname, const std::string& varname, Vector3 defvalue); 107 ConfigValueContainer(const std::string& classname, const std::string& varname, ColourValue defvalue); 108 108 109 109 /** @returns the value. @param value This is only needed to determine the right type. */ … … 124 124 inline ConfigValueContainer& getValue(bool& value) { value = this->value_.value_bool_; return *this; } 125 125 /** @returns the value. @param value This is only needed to determine the right type. */ 126 inline ConfigValueContainer& getValue( String& value) { value = this->value_string_; return *this; }126 inline ConfigValueContainer& getValue(std::string& value) { value = this->value_string_; return *this; } 127 127 /** @returns the value. @param value This is only needed to determine the right type. */ 128 128 inline ConfigValueContainer& getValue(const char* value) { value = this->value_string_.c_str(); return *this; } … … 134 134 inline ConfigValueContainer& getValue(ColourValue& value) { value = this->value_colourvalue_; return *this; } 135 135 136 void description(const String& description);136 void description(const std::string& description); 137 137 138 bool parseSting(const String& input);138 bool parseSting(const std::string& input); 139 139 void resetConfigFileEntry(); 140 140 void resetConfigValue(); 141 141 142 static String getStrippedLine(const String& line);143 static bool isEmpty(const String& line);144 static bool isComment(const String& line);142 static std::string getStrippedLine(const std::string& line); 143 static bool isEmpty(const std::string& line); 144 static bool isComment(const std::string& line); 145 145 146 146 private: 147 bool parseSting(const String& input, int defvalue);148 bool parseSting(const String& input, unsigned int defvalue);149 bool parseSting(const String& input, char defvalue);150 bool parseSting(const String& input, unsigned char defvalue);151 bool parseSting(const String& input, float defvalue);152 bool parseSting(const String& input, double defvalue);153 bool parseSting(const String& input, long double defvalue);154 bool parseSting(const String& input, bool defvalue);155 bool parseSting(const String& input, const String& defvalue);156 bool parseSting(const String& input, const char* defvalue);157 bool parseSting(const String& input, const Vector2& defvalue);158 bool parseSting(const String& input, const Vector3& defvalue);159 bool parseSting(const String& input, const ColourValue& defvalue);147 bool parseSting(const std::string& input, int defvalue); 148 bool parseSting(const std::string& input, unsigned int defvalue); 149 bool parseSting(const std::string& input, char defvalue); 150 bool parseSting(const std::string& input, unsigned char defvalue); 151 bool parseSting(const std::string& input, float defvalue); 152 bool parseSting(const std::string& input, double defvalue); 153 bool parseSting(const std::string& input, long double defvalue); 154 bool parseSting(const std::string& input, bool defvalue); 155 bool parseSting(const std::string& input, const std::string& defvalue); 156 bool parseSting(const std::string& input, const char* defvalue); 157 bool parseSting(const std::string& input, const Vector2& defvalue); 158 bool parseSting(const std::string& input, const Vector3& defvalue); 159 bool parseSting(const std::string& input, const ColourValue& defvalue); 160 160 161 static std::list< String>& getConfigFileLines();161 static std::list<std::string>& getConfigFileLines(); 162 162 static bool finishedReadingConfigFile(bool finished = false); 163 163 void searchConfigFileLine(); 164 String parseValueString(bool bStripped = true);164 std::string parseValueString(bool bStripped = true); 165 165 166 static void readConfigFile(const String& filename);167 static void writeConfigFile(const String& filename);166 static void readConfigFile(const std::string& filename); 167 static void writeConfigFile(const std::string& filename); 168 168 169 String classname_; //!< The name of the class the variable belongs to170 String varname_; //!< The name of the variable171 String defvalueString_; //!< The string of the default-variable169 std::string classname_; //!< The name of the class the variable belongs to 170 std::string varname_; //!< The name of the variable 171 std::string defvalueString_; //!< The string of the default-variable 172 172 173 173 union MultiType … … 183 183 } value_; //!< The value of the variable 184 184 185 String value_string_; //!< The value, if the variable is of the type string185 std::string value_string_; //!< The value, if the variable is of the type string 186 186 Vector2 value_vector2_; //!< The value, if the variable is of the type Vector2 187 187 Vector3 value_vector3_; //!< The value, if the variable is of the type Vector3 188 188 ColourValue value_colourvalue_; //!< The value, if the variable is of the type ColourValue 189 189 190 std::list< String>::iterator configFileLine_; //!< An iterator, pointing to the entry of the variable in the config-file190 std::list<std::string>::iterator configFileLine_; //!< An iterator, pointing to the entry of the variable in the config-file 191 191 192 192 VariableType type_; //!< The type of the variable
Note: See TracChangeset
for help on using the changeset viewer.