- Timestamp:
- Dec 30, 2015, 8:53:54 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/util/MultiType.h
r10978 r11001 354 354 template <typename T> inline bool getValue(T* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } 355 355 356 /// Returns the current value, converted to the requested type. This base implementation works only for pointers. All other supported types are 357 /// implemented in specialized functions at the bottom of this file. 358 template <typename T> inline T get() const { return static_cast<T>(this->get<void*>()); } 356 /// Returns the current value, converted to the requested type. 357 template <typename T> /* for normal types */ typename std::enable_if<!std::is_pointer<T>::value, T>::type 358 inline /*T*/ get() const { return (this->value_ ? this->value_->get<T>() : NilValue<T>()); } 359 /// Returns the current value, converted to a pointer of the requested type. 360 template <typename T> /* for pointers */ typename std::enable_if<std::is_pointer<T>::value, T>::type 361 inline /*T*/ get() const { return this->value_ ? static_cast<T>(this->value_->get<void*>()) : nullptr; } 359 362 360 363 … … 475 478 template <> inline bool MultiType::isType<void>() const { return this->null(); } 476 479 template <> inline bool MultiType::convert<void>() { this->reset(); return true; } 477 478 template <> inline char MultiType::get() const { return (this->value_ ? this->value_->get<char>() : 0); }479 template <> inline unsigned char MultiType::get() const { return (this->value_ ? this->value_->get<unsigned char>() : 0); }480 template <> inline short MultiType::get() const { return (this->value_ ? this->value_->get<short>() : 0); }481 template <> inline unsigned short MultiType::get() const { return (this->value_ ? this->value_->get<unsigned short>() : 0); }482 template <> inline int MultiType::get() const { return (this->value_ ? this->value_->get<int>() : 0); }483 template <> inline unsigned int MultiType::get() const { return (this->value_ ? this->value_->get<unsigned int>() : 0); }484 template <> inline long MultiType::get() const { return (this->value_ ? this->value_->get<long>() : 0); }485 template <> inline unsigned long MultiType::get() const { return (this->value_ ? this->value_->get<unsigned long>() : 0); }486 template <> inline long long MultiType::get() const { return (this->value_ ? this->value_->get<long long>() : 0); }487 template <> inline unsigned long long MultiType::get() const { return (this->value_ ? this->value_->get<unsigned long long>() : 0); }488 template <> inline float MultiType::get() const { return (this->value_ ? this->value_->get<float>() : 0); }489 template <> inline double MultiType::get() const { return (this->value_ ? this->value_->get<double>() : 0); }490 template <> inline long double MultiType::get() const { return (this->value_ ? this->value_->get<long double>() : 0); }491 template <> inline bool MultiType::get() const { return (this->value_ ? this->value_->get<bool>() : 0); }492 template <> inline void* MultiType::get() const { return (this->value_ ? this->value_->get<void*>() : nullptr); }493 template <> inline std::string MultiType::get() const { return (this->value_ ? this->value_->get<std::string>() : NilValue<std::string>()); }494 template <> inline orxonox::Vector2 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector2>() : NilValue<orxonox::Vector2>()); }495 template <> inline orxonox::Vector3 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector3>() : NilValue<orxonox::Vector3>()); }496 template <> inline orxonox::Vector4 MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector4>() : NilValue<orxonox::Vector4>()); }497 template <> inline orxonox::ColourValue MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::ColourValue>() : NilValue<orxonox::ColourValue>()); }498 template <> inline orxonox::Quaternion MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Quaternion>() : NilValue<orxonox::Quaternion>()); }499 template <> inline orxonox::Radian MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Radian>() : NilValue<orxonox::Radian>()); }500 template <> inline orxonox::Degree MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Degree>() : NilValue<orxonox::Degree>()); }501 480 502 481 template <> _UtilExport void MultiType::createNewValueContainer(const char& value);
Note: See TracChangeset
for help on using the changeset viewer.