Changeset 7284 for code/trunk/src/libraries/util/MultiType.h
- Timestamp:
- Aug 31, 2010, 3:37:40 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/util/MultiType.h
r7268 r7284 77 77 #include <OgreColourValue.h> 78 78 #include <loki/TypeTraits.h> 79 #include "mbool.h" 79 80 80 81 namespace orxonox … … 265 266 inline MultiType(const orxonox::Radian& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 266 267 inline MultiType(const orxonox::Degree& value) : value_(0) { this->assignValue(value); } /** @brief Constructor: Assigns the given value and sets the type. */ 268 inline MultiType(const orxonox::mbool& value) : value_(0) { this->assignValue((bool)value); } /** @brief Constructor: Assigns the given mbool and converts it to bool. */ 267 269 inline MultiType(const char* value) : value_(0) { this->setValue(std::string(value)); } /** @brief Constructor: Converts the char array to a std::string, assigns the value and sets the type. */ 268 270 inline MultiType(const MultiType& other) : value_(0) { this->setValue(other); } /** @brief Copyconstructor: Assigns value and type of the other MultiType. */ … … 318 320 inline void copy(const MultiType& other) { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; } 319 321 320 template <typename T> inline bool convert() { return this->setValue<T>(( T)(*this)); } /** @brief Converts the current value to type T. */322 template <typename T> inline bool convert() { return this->setValue<T>((typename Loki::TypeTraits<T>::UnqualifiedReferredType)(*this)); } /** @brief Converts the current value to type T. */ 321 323 inline bool convert(const MultiType& other) { return this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */ 322 324 bool convert(MT_Type::Value type); … … 350 352 351 353 /** @brief Checks whether the value is a default one. */ 352 bool hasDefaultValue() const { return this->value_->hasDefaultValue(); } 354 bool hasDefaultValue() const { return this->value_->hasDefaultValue(); } 355 356 /** @brief Checks if the MT contains no value. */ 357 bool null() const { return (!this->value_); } 353 358 354 359 operator char() const; … … 487 492 template <> inline bool MultiType::isType<orxonox::Degree>() const { return (this->value_ && this->value_->type_ == MT_Type::Degree); } /** @brief Returns true if the current type equals the given type. */ 488 493 494 template <> inline bool MultiType::convert<void>() { this->reset(); return true; } /** @brief Deletes the content, type becomes MT_Type::Null. */ 495 489 496 // Specialization to avoid ambiguities with the conversion operator 490 497 template <> inline bool MultiType::convert<std::string>() { return this->setValue<std::string> (this->operator std::string()); } /** @brief Converts the current value to the given type. */
Note: See TracChangeset
for help on using the changeset viewer.