- Timestamp:
- Apr 12, 2008, 3:34:55 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/ConfigValueContainer.h
r1020 r1030 43 43 #define _ConfigValueContainer_H__ 44 44 45 #include <list>46 45 #include <string> 46 #include <vector> 47 47 48 48 #include "CorePrereqs.h" … … 73 73 { 74 74 public: 75 ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, MultiTypeMath defvalue); 75 ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const MultiTypeMath& defvalue); 76 ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, const std::vector<MultiTypeMath>& defvalue); 76 77 77 78 /** @brief Returns the configured value. @param value This is only needed to determine the right type. @return The value */ … … 79 80 inline ConfigValueContainer& getValue(T* value) 80 81 { this->value_.getValue(value); return *this; } 82 template <typename T> 83 inline ConfigValueContainer& getValue(std::vector<T>* value) 84 { 85 value->clear(); 86 for (unsigned int i = 0; i < this->valueVector_.size(); i++) 87 value->push_back(this->valueVector_[i]); 88 return *this; 89 } 81 90 82 inline const std::string& getName() 91 inline const std::string& getName() const 83 92 { return this->varname_; } 93 inline bool isVector() const 94 { return this->bIsVector_; } 95 inline unsigned int getVectorSize() const 96 { return this->valueVector_.size(); } 84 97 85 98 void description(const std::string& description); 86 99 const std::string& getDescription() const; 87 100 101 bool add(const std::string& input); 102 bool remove(unsigned int index); 88 103 bool set(const std::string& input); 89 104 bool tset(const std::string& input); … … 102 117 bool parse(const std::string& input, const MultiTypeMath& defvalue); 103 118 104 void setLineInConfigFile(const std::string& input); 105 void resetLineInConfigFile(); 119 bool set(unsigned int index, const std::string& input); 120 bool tset(unsigned int index, const std::string& input); 121 bool parse(unsigned int index, const std::string& input); 122 bool parse(unsigned int index, const std::string& input, const MultiTypeMath& defvalue); 106 123 107 ConfigFileType type_; //!< The type of the corresponding config-file 108 Identifier* identifier_; //!< The identifier of the class 109 std::string sectionname_; //!< The name of the class the variable belongs to 110 std::string varname_; //!< The name of the variable 111 std::string defvalueString_; //!< The string of the default-variable 124 bool bIsVector_; //!< True if the container contains a std::vector 112 125 113 MultiTypeMath value_; //!< The value 126 ConfigFileType type_; //!< The type of the corresponding config-file 127 Identifier* identifier_; //!< The identifier of the class 128 std::string sectionname_; //!< The name of the class the variable belongs to 129 std::string varname_; //!< The name of the variable 130 std::string defvalueString_; //!< The string of the default-value 131 std::vector<std::string> defvalueStringVector_; //!< A vector, containg the strings of the default-values in case we're storing a vector 114 132 115 std::list<std::string>::iterator configFileLine_; //!< An iterator, pointing to the entry of the variable in the config-file 133 MultiTypeMath value_; //!< The value 134 std::vector<MultiTypeMath> valueVector_; //!< A vector, containg the values in case we're storing a vector 116 135 117 bool bAddedDescription_;//!< True if a description was added118 LanguageEntryLabel description_;//!< The description136 bool bAddedDescription_; //!< True if a description was added 137 LanguageEntryLabel description_; //!< The description 119 138 }; 120 139 }
Note: See TracChangeset
for help on using the changeset viewer.