Changeset 3152
- Timestamp:
- Jun 12, 2009, 6:47:14 PM (16 years ago)
- Location:
- code/branches/pch/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pch/src/OrxonoxConfig.h.in
r2946 r3152 181 181 */ 182 182 183 /* Forward declare the everywhere used std::string */ 184 namespace std 185 { 186 template<class _Elem> struct char_traits; 187 template<class _Ty> class allocator; 188 template<class _Elem, class _Traits, class _Ax> class basic_string; 189 typedef basic_string<char, char_traits<char>, allocator<char> > string; 190 } 191 183 192 /* Visual Leak Detector looks for memory leaks */ 184 193 #cmakedefine VISUAL_LEAK_DETECTOR_ENABLE -
code/branches/pch/src/core/ConfigFileManager.cc
r2896 r3152 312 312 // There might be an array index 313 313 unsigned int index = 0; 314 if ( ConvertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1)))314 if (convertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1))) 315 315 { 316 316 // New array -
code/branches/pch/src/core/ConfigValueContainer.cc
r2662 r3152 303 303 304 304 if (token.size() > 0) 305 success = ConvertValue(&index, token[0]);305 success = convertValue(&index, token[0]); 306 306 307 307 if (!success || index < 0 || index > (signed int)MAX_VECTOR_INDEX) -
code/branches/pch/src/util/Convert.h
r3146 r3152 340 340 } 341 341 342 // for compatibility reason. (capital 'c' in ConvertValue)343 template<class FromType, class ToType>344 FORCEINLINE bool ConvertValue(ToType* output, const FromType& input, const ToType& fallback)345 {346 return convertValue(output, input, fallback);347 }348 349 342 // Directly returns the converted value, even if the conversion was not successful. 350 343 template<class FromType, class ToType> -
code/branches/pch/src/util/Math.cc
r3146 r3152 238 238 if (tokens.size() >= 2) 239 239 { 240 if (! ConvertValue(&(output->x), tokens[0]))241 return false; 242 if (! ConvertValue(&(output->y), tokens[1]))240 if (!convertValue(&(output->x), tokens[0])) 241 return false; 242 if (!convertValue(&(output->y), tokens[1])) 243 243 return false; 244 244 … … 261 261 if (tokens.size() >= 3) 262 262 { 263 if (! ConvertValue(&(output->x), tokens[0]))264 return false; 265 if (! ConvertValue(&(output->y), tokens[1]))266 return false; 267 if (! ConvertValue(&(output->z), tokens[2]))263 if (!convertValue(&(output->x), tokens[0])) 264 return false; 265 if (!convertValue(&(output->y), tokens[1])) 266 return false; 267 if (!convertValue(&(output->z), tokens[2])) 268 268 return false; 269 269 … … 286 286 if (tokens.size() >= 4) 287 287 { 288 if (! ConvertValue(&(output->x), tokens[0]))289 return false; 290 if (! ConvertValue(&(output->y), tokens[1]))291 return false; 292 if (! ConvertValue(&(output->z), tokens[2]))293 return false; 294 if (! ConvertValue(&(output->w), tokens[3]))288 if (!convertValue(&(output->x), tokens[0])) 289 return false; 290 if (!convertValue(&(output->y), tokens[1])) 291 return false; 292 if (!convertValue(&(output->z), tokens[2])) 293 return false; 294 if (!convertValue(&(output->w), tokens[3])) 295 295 return false; 296 296 … … 309 309 if (tokens.size() >= 4) 310 310 { 311 if (! ConvertValue(&(output->w), tokens[0]))312 return false; 313 if (! ConvertValue(&(output->x), tokens[1]))314 return false; 315 if (! ConvertValue(&(output->y), tokens[2]))316 return false; 317 if (! ConvertValue(&(output->z), tokens[3]))311 if (!convertValue(&(output->w), tokens[0])) 312 return false; 313 if (!convertValue(&(output->x), tokens[1])) 314 return false; 315 if (!convertValue(&(output->y), tokens[2])) 316 return false; 317 if (!convertValue(&(output->z), tokens[3])) 318 318 return false; 319 319 … … 332 332 if (tokens.size() >= 3) 333 333 { 334 if (! ConvertValue(&(output->r), tokens[0]))335 return false; 336 if (! ConvertValue(&(output->g), tokens[1]))337 return false; 338 if (! ConvertValue(&(output->b), tokens[2]))334 if (!convertValue(&(output->r), tokens[0])) 335 return false; 336 if (!convertValue(&(output->g), tokens[1])) 337 return false; 338 if (!convertValue(&(output->b), tokens[2])) 339 339 return false; 340 340 if (tokens.size() >= 4) 341 341 { 342 if (! ConvertValue(&(output->a), tokens[3]))342 if (!convertValue(&(output->a), tokens[3])) 343 343 return false; 344 344 } -
code/branches/pch/src/util/MultiTypeValue.h
r3146 r3152 76 76 } 77 77 78 inline bool getValue(char* value) const { return ConvertValue<T, char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */79 inline bool getValue(unsigned char* value) const { return ConvertValue<T, unsigned char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */80 inline bool getValue(short* value) const { return ConvertValue<T, short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */81 inline bool getValue(unsigned short* value) const { return ConvertValue<T, unsigned short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */82 inline bool getValue(int* value) const { return ConvertValue<T, int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */83 inline bool getValue(unsigned int* value) const { return ConvertValue<T, unsigned int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */84 inline bool getValue(long* value) const { return ConvertValue<T, long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */85 inline bool getValue(unsigned long* value) const { return ConvertValue<T, unsigned long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */86 inline bool getValue(long long* value) const { return ConvertValue<T, long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */87 inline bool getValue(unsigned long long* value) const { return ConvertValue<T, unsigned long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */88 inline bool getValue(float* value) const { return ConvertValue<T, float >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */89 inline bool getValue(double* value) const { return ConvertValue<T, double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */90 inline bool getValue(long double* value) const { return ConvertValue<T, long double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */91 inline bool getValue(bool* value) const { return ConvertValue<T, bool >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */92 inline bool getValue(void** value) const { return ConvertValue<T, void* >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */93 inline bool getValue(std::string* value) const { return ConvertValue<T, std::string >(value, value_, zeroise<std::string> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */94 inline bool getValue(orxonox::Vector2* value) const { return ConvertValue<T, orxonox::Vector2 >(value, value_, zeroise<orxonox::Vector2> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */95 inline bool getValue(orxonox::Vector3* value) const { return ConvertValue<T, orxonox::Vector3 >(value, value_, zeroise<orxonox::Vector3> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */96 inline bool getValue(orxonox::Vector4* value) const { return ConvertValue<T, orxonox::Vector4 >(value, value_, zeroise<orxonox::Vector4> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */97 inline bool getValue(orxonox::ColourValue* value) const { return ConvertValue<T, orxonox::ColourValue>(value, value_, zeroise<orxonox::ColourValue>()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */98 inline bool getValue(orxonox::Quaternion* value) const { return ConvertValue<T, orxonox::Quaternion >(value, value_, zeroise<orxonox::Quaternion> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */99 inline bool getValue(orxonox::Radian* value) const { return ConvertValue<T, orxonox::Radian >(value, value_, zeroise<orxonox::Radian> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */100 inline bool getValue(orxonox::Degree* value) const { return ConvertValue<T, orxonox::Degree >(value, value_, zeroise<orxonox::Degree> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */101 102 inline bool setValue(const char& value) { return !(bHasDefaultValue_ = ! ConvertValue<char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */103 inline bool setValue(const unsigned char& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */104 inline bool setValue(const short& value) { return !(bHasDefaultValue_ = ! ConvertValue<short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */105 inline bool setValue(const unsigned short& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */106 inline bool setValue(const int& value) { return !(bHasDefaultValue_ = ! ConvertValue<int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */107 inline bool setValue(const unsigned int& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */108 inline bool setValue(const long& value) { return !(bHasDefaultValue_ = ! ConvertValue<long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */109 inline bool setValue(const unsigned long& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */110 inline bool setValue(const long long& value) { return !(bHasDefaultValue_ = ! ConvertValue<long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */111 inline bool setValue(const unsigned long long& value) { return !(bHasDefaultValue_ = ! ConvertValue<unsigned long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */112 inline bool setValue(const float& value) { return !(bHasDefaultValue_ = ! ConvertValue<float , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */113 inline bool setValue(const double& value) { return !(bHasDefaultValue_ = ! ConvertValue<double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */114 inline bool setValue(const long double& value) { return !(bHasDefaultValue_ = ! ConvertValue<long double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */115 inline bool setValue(const bool& value) { return !(bHasDefaultValue_ = ! ConvertValue<bool , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */116 inline bool setValue( void* const& value) { return !(bHasDefaultValue_ = ! ConvertValue<void* , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */117 inline bool setValue(const std::string& value) { return !(bHasDefaultValue_ = ! ConvertValue<std::string , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */118 inline bool setValue(const orxonox::Vector2& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Vector2 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */119 inline bool setValue(const orxonox::Vector3& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Vector3 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */120 inline bool setValue(const orxonox::Vector4& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Vector4 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */121 inline bool setValue(const orxonox::ColourValue& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::ColourValue, T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */122 inline bool setValue(const orxonox::Quaternion& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Quaternion , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */123 inline bool setValue(const orxonox::Radian& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Radian , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */124 inline bool setValue(const orxonox::Degree& value) { return !(bHasDefaultValue_ = ! ConvertValue<orxonox::Degree , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */78 inline bool getValue(char* value) const { return convertValue<T, char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 79 inline bool getValue(unsigned char* value) const { return convertValue<T, unsigned char >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 80 inline bool getValue(short* value) const { return convertValue<T, short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 81 inline bool getValue(unsigned short* value) const { return convertValue<T, unsigned short >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 82 inline bool getValue(int* value) const { return convertValue<T, int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 83 inline bool getValue(unsigned int* value) const { return convertValue<T, unsigned int >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 84 inline bool getValue(long* value) const { return convertValue<T, long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 85 inline bool getValue(unsigned long* value) const { return convertValue<T, unsigned long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 86 inline bool getValue(long long* value) const { return convertValue<T, long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 87 inline bool getValue(unsigned long long* value) const { return convertValue<T, unsigned long long >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 88 inline bool getValue(float* value) const { return convertValue<T, float >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 89 inline bool getValue(double* value) const { return convertValue<T, double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 90 inline bool getValue(long double* value) const { return convertValue<T, long double >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 91 inline bool getValue(bool* value) const { return convertValue<T, bool >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 92 inline bool getValue(void** value) const { return convertValue<T, void* >(value, value_, 0); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 93 inline bool getValue(std::string* value) const { return convertValue<T, std::string >(value, value_, zeroise<std::string> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 94 inline bool getValue(orxonox::Vector2* value) const { return convertValue<T, orxonox::Vector2 >(value, value_, zeroise<orxonox::Vector2> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 95 inline bool getValue(orxonox::Vector3* value) const { return convertValue<T, orxonox::Vector3 >(value, value_, zeroise<orxonox::Vector3> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 96 inline bool getValue(orxonox::Vector4* value) const { return convertValue<T, orxonox::Vector4 >(value, value_, zeroise<orxonox::Vector4> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 97 inline bool getValue(orxonox::ColourValue* value) const { return convertValue<T, orxonox::ColourValue>(value, value_, zeroise<orxonox::ColourValue>()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 98 inline bool getValue(orxonox::Quaternion* value) const { return convertValue<T, orxonox::Quaternion >(value, value_, zeroise<orxonox::Quaternion> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 99 inline bool getValue(orxonox::Radian* value) const { return convertValue<T, orxonox::Radian >(value, value_, zeroise<orxonox::Radian> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 100 inline bool getValue(orxonox::Degree* value) const { return convertValue<T, orxonox::Degree >(value, value_, zeroise<orxonox::Degree> ()); } /** @brief Assigns the value to the given pointer. The value gets converted if the types don't match. */ 101 102 inline bool setValue(const char& value) { return !(bHasDefaultValue_ = !convertValue<char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 103 inline bool setValue(const unsigned char& value) { return !(bHasDefaultValue_ = !convertValue<unsigned char , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 104 inline bool setValue(const short& value) { return !(bHasDefaultValue_ = !convertValue<short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 105 inline bool setValue(const unsigned short& value) { return !(bHasDefaultValue_ = !convertValue<unsigned short , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 106 inline bool setValue(const int& value) { return !(bHasDefaultValue_ = !convertValue<int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 107 inline bool setValue(const unsigned int& value) { return !(bHasDefaultValue_ = !convertValue<unsigned int , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 108 inline bool setValue(const long& value) { return !(bHasDefaultValue_ = !convertValue<long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 109 inline bool setValue(const unsigned long& value) { return !(bHasDefaultValue_ = !convertValue<unsigned long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 110 inline bool setValue(const long long& value) { return !(bHasDefaultValue_ = !convertValue<long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 111 inline bool setValue(const unsigned long long& value) { return !(bHasDefaultValue_ = !convertValue<unsigned long long , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 112 inline bool setValue(const float& value) { return !(bHasDefaultValue_ = !convertValue<float , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 113 inline bool setValue(const double& value) { return !(bHasDefaultValue_ = !convertValue<double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 114 inline bool setValue(const long double& value) { return !(bHasDefaultValue_ = !convertValue<long double , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 115 inline bool setValue(const bool& value) { return !(bHasDefaultValue_ = !convertValue<bool , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 116 inline bool setValue( void* const& value) { return !(bHasDefaultValue_ = !convertValue<void* , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 117 inline bool setValue(const std::string& value) { return !(bHasDefaultValue_ = !convertValue<std::string , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 118 inline bool setValue(const orxonox::Vector2& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector2 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 119 inline bool setValue(const orxonox::Vector3& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector3 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 120 inline bool setValue(const orxonox::Vector4& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Vector4 , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 121 inline bool setValue(const orxonox::ColourValue& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::ColourValue, T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 122 inline bool setValue(const orxonox::Quaternion& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Quaternion , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 123 inline bool setValue(const orxonox::Radian& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Radian , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 124 inline bool setValue(const orxonox::Degree& value) { return !(bHasDefaultValue_ = !convertValue<orxonox::Degree , T>(&value_, value, zeroise<T>())); } /** @brief Assigns the value by converting it to T. */ 125 125 126 126 inline operator char() const { return getConvertedValue<T, char> (this->value_, 0); } /** @brief Returns the current value, converted to the requested type. */
Note: See TracChangeset
for help on using the changeset viewer.