[Orxonox-commit 4553] r9224 - in code/branches/testing: src/libraries/core src/libraries/core/command src/libraries/network src/libraries/tools src/libraries/util src/orxonox test/util
landauf at orxonox.net
landauf at orxonox.net
Sat May 19 15:03:02 CEST 2012
Author: landauf
Date: 2012-05-19 15:03:02 +0200 (Sat, 19 May 2012)
New Revision: 9224
Modified:
code/branches/testing/src/libraries/core/CommandLineParser.cc
code/branches/testing/src/libraries/core/CommandLineParser.h
code/branches/testing/src/libraries/core/ConfigValueContainer.cc
code/branches/testing/src/libraries/core/Core.cc
code/branches/testing/src/libraries/core/PathConfig.cc
code/branches/testing/src/libraries/core/command/CommandEvaluation.cc
code/branches/testing/src/libraries/core/command/CommandExecutor.cc
code/branches/testing/src/libraries/core/command/TclBind.cc
code/branches/testing/src/libraries/network/Client.cc
code/branches/testing/src/libraries/tools/Shader.cc
code/branches/testing/src/libraries/util/MultiType.h
code/branches/testing/src/orxonox/LevelManager.cc
code/branches/testing/src/orxonox/Main.cc
code/branches/testing/test/util/MultiTypeTest.cc
Log:
renamed set and get functions in MultiType:
- setValue() -> set()
- getXYZ() -> get<xyz>()
(e.g. get<int>() instead of getInt() and get<std::string>() instead of getString())
Modified: code/branches/testing/src/libraries/core/CommandLineParser.cc
===================================================================
--- code/branches/testing/src/libraries/core/CommandLineParser.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/core/CommandLineParser.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -68,9 +68,9 @@
}
else
{
- if (!value_.setValue(value))
+ if (!value_.set(value))
{
- value_.setValue(defaultValue_);
+ value_.set(defaultValue_);
ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
}
else
Modified: code/branches/testing/src/libraries/core/CommandLineParser.h
===================================================================
--- code/branches/testing/src/libraries/core/CommandLineParser.h 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/core/CommandLineParser.h 2012-05-19 13:03:02 UTC (rev 9224)
@@ -199,7 +199,7 @@
template <>
inline void CommandLineParser::getValue<std::string>(const std::string& name, std::string* value)
{
- *value = getArgument(name)->getValue().getString();
+ *value = getArgument(name)->getValue().get<std::string>();
}
/**
@@ -216,7 +216,7 @@
{
OrxAssert(!_getInstance().existsArgument(name),
"Cannot add a command line argument with name '" + name + "' twice.");
- OrxAssert(!MultiType(defaultValue).isType<bool>() || MultiType(defaultValue).getBool() != true,
+ OrxAssert(!MultiType(defaultValue).isType<bool>() || MultiType(defaultValue).get<bool>() != true,
"Boolean command line arguments with positive default values are not supported." << endl
<< "Please use SetCommandLineSwitch and adjust your argument: " << name);
Modified: code/branches/testing/src/libraries/core/ConfigValueContainer.cc
===================================================================
--- code/branches/testing/src/libraries/core/ConfigValueContainer.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/core/ConfigValueContainer.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -69,7 +69,7 @@
this->value_ = defvalue;
this->bIsVector_ = false;
- this->defvalueString_ = this->value_.getString();
+ this->defvalueString_ = this->value_.get<std::string>();
this->update();
}
Modified: code/branches/testing/src/libraries/core/Core.cc
===================================================================
--- code/branches/testing/src/libraries/core/Core.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/core/Core.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -166,7 +166,7 @@
orxout(internal_info) << "Loading config:" << endl;
this->configFileManager_ = new ConfigFileManager();
this->configFileManager_->setFilename(ConfigFileType::Settings,
- CommandLineParser::getValue("settingsFile").getString());
+ CommandLineParser::getValue("settingsFile").get<std::string>());
// Required as well for the config values
orxout(internal_info) << "Loading language:" << endl;
@@ -183,7 +183,7 @@
#if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN)
// Create persistent IO console
- if (CommandLineParser::getValue("noIOConsole").getBool())
+ if (CommandLineParser::getValue("noIOConsole").get<bool>())
{
ModifyConfigValue(bStartIOConsole_, tset, false);
}
@@ -336,7 +336,7 @@
void Core::loadGraphics()
{
orxout(internal_info) << "loading graphics in Core" << endl;
-
+
// Any exception should trigger this, even in upgradeToGraphics (see its remarks)
Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
Modified: code/branches/testing/src/libraries/core/PathConfig.cc
===================================================================
--- code/branches/testing/src/libraries/core/PathConfig.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/core/PathConfig.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -187,7 +187,7 @@
// Check for data path override by the command line
if (!CommandLineParser::getArgument("externalDataPath")->hasDefaultValue())
- externalDataPath_ = CommandLineParser::getValue("externalDataPath").getString();
+ externalDataPath_ = CommandLineParser::getValue("externalDataPath").get<std::string>();
else
externalDataPath_ = specialConfig::externalDataDevDirectory;
}
@@ -226,7 +226,7 @@
// Option to put all the config and log files in a separate folder
if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue())
{
- const std::string& directory(CommandLineParser::getValue("writingPathSuffix").getString());
+ const std::string& directory(CommandLineParser::getValue("writingPathSuffix").get<std::string>());
configPath_ = configPath_ / directory;
logPath_ = logPath_ / directory;
}
Modified: code/branches/testing/src/libraries/core/command/CommandEvaluation.cc
===================================================================
--- code/branches/testing/src/libraries/core/command/CommandEvaluation.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/core/command/CommandEvaluation.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -599,7 +599,7 @@
// print the default value if available
if (command->getExecutor()->defaultValueSet(i))
- output += '=' + command->getExecutor()->getDefaultValue(i).getString() + ']';
+ output += '=' + command->getExecutor()->getDefaultValue(i).get<std::string>() + ']';
else
output += '}';
}
Modified: code/branches/testing/src/libraries/core/command/CommandExecutor.cc
===================================================================
--- code/branches/testing/src/libraries/core/command/CommandExecutor.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/core/command/CommandExecutor.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -132,7 +132,7 @@
*/
/* static */ std::string CommandExecutor::query(const std::string& command, int* error, bool useTcl)
{
- return CommandExecutor::queryMT(command, error, useTcl).getString();
+ return CommandExecutor::queryMT(command, error, useTcl).get<std::string>();
}
/**
Modified: code/branches/testing/src/libraries/core/command/TclBind.cc
===================================================================
--- code/branches/testing/src/libraries/core/command/TclBind.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/core/command/TclBind.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -182,7 +182,7 @@
CommandEvaluation evaluation = CommandExecutor::evaluate(command);
if (bQuery)
- result = evaluation.query(&error).getString();
+ result = evaluation.query(&error).get<std::string>();
else
error = evaluation.execute();
Modified: code/branches/testing/src/libraries/network/Client.cc
===================================================================
--- code/branches/testing/src/libraries/network/Client.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/network/Client.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -67,7 +67,7 @@
gameStateFailure_(false),
timeSinceLastUpdate_(0)
{
- this->setDestination( CommandLineParser::getValue("dest").getString(), CommandLineParser::getValue("port") );
+ this->setDestination( CommandLineParser::getValue("dest").get<std::string>(), CommandLineParser::getValue("port") );
}
Client::~Client()
Modified: code/branches/testing/src/libraries/tools/Shader.cc
===================================================================
--- code/branches/testing/src/libraries/tools/Shader.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/tools/Shader.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -204,9 +204,9 @@
{
// change the value of the parameter depending on its type
if (it->value_.isType<int>())
- passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.getInt());
+ passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.get<int>());
else if (it->value_.isType<float>())
- passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.getFloat());
+ passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.get<float>());
}
else
orxout(internal_warning) << "No pass " << it->pass_ << " in technique " << it->technique_ << " in compositor \"" << this->compositorName_ << "\" or pass has no shader." << endl;
Modified: code/branches/testing/src/libraries/util/MultiType.h
===================================================================
--- code/branches/testing/src/libraries/util/MultiType.h 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/libraries/util/MultiType.h 2012-05-19 13:03:02 UTC (rev 9224)
@@ -296,42 +296,42 @@
inline MultiType(const orxonox::Radian& value) : value_(0) { this->assignValue(value); } ///< Constructor: Assigns the given value and sets the type.
inline MultiType(const orxonox::Degree& value) : value_(0) { this->assignValue(value); } ///< Constructor: Assigns the given value and sets the type.
inline MultiType(const orxonox::mbool& value) : value_(0) { this->assignValue((bool)value); } ///< Constructor: Assigns the given mbool and converts it to bool.
- inline MultiType(const char* value) : value_(0) { this->setValue(std::string(value)); } ///< Constructor: Converts the char array to a std::string, assigns the value and sets the type.
- inline MultiType(const MultiType& other) : value_(0) { this->setValue(other); } ///< Copyconstructor: Assigns value and type of the other MultiType.
+ inline MultiType(const char* value) : value_(0) { this->set(std::string(value)); } ///< Constructor: Converts the char array to a std::string, assigns the value and sets the type.
+ inline MultiType(const MultiType& other) : value_(0) { this->set(other); } ///< Copyconstructor: Assigns value and type of the other MultiType.
/// Destructor: Deletes the MT_Value.
inline ~MultiType() { if (this->value_) { delete this->value_; } }
- template <typename V> inline MultiType& operator=(const V& value) { this->setValue(value); return (*this); } ///< Assigns a new value. The value will be converted to the current type of the MultiType.
- template <typename V> inline MultiType& operator=(V* value) { this->setValue(value); return (*this); } ///< Assigns a pointer.
- inline MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } ///< Assigns the value of the other MultiType and converts it to the current type of the MultiType.
+ template <typename V> inline MultiType& operator=(const V& value) { this->set(value); return (*this); } ///< Assigns a new value. The value will be converted to the current type of the MultiType.
+ template <typename V> inline MultiType& operator=(V* value) { this->set(value); return (*this); } ///< Assigns a pointer.
+ inline MultiType& operator=(const MultiType& other) { this->set(other); return (*this); } ///< Assigns the value of the other MultiType and converts it to the current type of the MultiType.
- inline bool setValue(const char& value);
- inline bool setValue(const unsigned char& value);
- inline bool setValue(const short& value);
- inline bool setValue(const unsigned short& value);
- inline bool setValue(const int& value);
- inline bool setValue(const unsigned int& value);
- inline bool setValue(const long& value);
- inline bool setValue(const unsigned long& value);
- inline bool setValue(const long long& value);
- inline bool setValue(const unsigned long long& value);
- inline bool setValue(const float& value);
- inline bool setValue(const double& value);
- inline bool setValue(const long double& value);
- inline bool setValue(const bool& value);
- inline bool setValue( void* const& value);
- inline bool setValue(const std::string& value);
- inline bool setValue(const orxonox::Vector2& value);
- inline bool setValue(const orxonox::Vector3& value);
- inline bool setValue(const orxonox::Vector4& value);
- inline bool setValue(const orxonox::ColourValue& value);
- inline bool setValue(const orxonox::Quaternion& value);
- inline bool setValue(const orxonox::Radian& value);
- inline bool setValue(const orxonox::Degree& value);
- inline bool setValue(const char* value);
+ inline bool set(const char& value);
+ inline bool set(const unsigned char& value);
+ inline bool set(const short& value);
+ inline bool set(const unsigned short& value);
+ inline bool set(const int& value);
+ inline bool set(const unsigned int& value);
+ inline bool set(const long& value);
+ inline bool set(const unsigned long& value);
+ inline bool set(const long long& value);
+ inline bool set(const unsigned long long& value);
+ inline bool set(const float& value);
+ inline bool set(const double& value);
+ inline bool set(const long double& value);
+ inline bool set(const bool& value);
+ inline bool set( void* const& value);
+ inline bool set(const std::string& value);
+ inline bool set(const orxonox::Vector2& value);
+ inline bool set(const orxonox::Vector3& value);
+ inline bool set(const orxonox::Vector4& value);
+ inline bool set(const orxonox::ColourValue& value);
+ inline bool set(const orxonox::Quaternion& value);
+ inline bool set(const orxonox::Radian& value);
+ inline bool set(const orxonox::Degree& value);
+ inline bool set(const char* value);
/// Assigns a pointer.
- template <typename V> inline bool setValue(V* value)
+ template <typename V> inline bool set(V* value)
{
if (this->value_)
return this->value_->setValue(static_cast<void*>(const_cast<typename Loki::TypeTraits<V>::UnqualifiedType*>(value)));
@@ -339,15 +339,15 @@
return this->assignValue (static_cast<void*>(const_cast<typename Loki::TypeTraits<V>::UnqualifiedType*>(value)));
}
/// Changes the type to T and assigns the new value (which might be of another type than T - it gets converted).
- template <typename T, typename V> inline bool setValue(const V& value) { this->reset<T>(); return this->setValue(value); }
+ template <typename T, typename V> inline bool set(const V& value) { this->reset<T>(); return this->set(value); }
/// Assigns the value of the other MultiType and converts it to the current type.
- bool setValue(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
+ bool set(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
/// Copies the other MultiType by assigning value and type.
inline void copy(const MultiType& other) { if (this == &other) { return; } if (this->value_) { delete this->value_; } this->value_ = (other.value_) ? other.value_->clone() : 0; }
/// Converts the current value to type T.
- template <typename T> inline bool convert() { return this->setValue<T>((typename Loki::TypeTraits<T>::UnqualifiedReferredType)(*this)); }
+ template <typename T> inline bool convert() { return this->set<T>((typename Loki::TypeTraits<T>::UnqualifiedReferredType)(*this)); }
/// Resets value and type. Type will be void afterwards and null() returns true.
inline void reset() { if (this->value_) delete this->value_; this->value_ = 0; }
@@ -426,30 +426,8 @@
inline bool getValue(orxonox::Radian* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } ///< Assigns the value to the given pointer. The value gets converted if the types don't match.
inline bool getValue(orxonox::Degree* value) const { if (this->value_) { return this->value_->getValue(value); } return false; } ///< Assigns the value to the given pointer. The value gets converted if the types don't match.
- inline char getChar() const { return this->operator char(); } ///< Returns the current value, converted to the requested type.
- inline unsigned char getUnsignedChar() const { return this->operator unsigned char(); } ///< Returns the current value, converted to the requested type.
- inline short getShort() const { return this->operator short(); } ///< Returns the current value, converted to the requested type.
- inline unsigned short getUnsignedShort() const { return this->operator unsigned short(); } ///< Returns the current value, converted to the requested type.
- inline int getInt() const { return this->operator int(); } ///< Returns the current value, converted to the requested type.
- inline unsigned int getUnsignedInt() const { return this->operator unsigned int(); } ///< Returns the current value, converted to the requested type.
- inline long getLong() const { return this->operator long(); } ///< Returns the current value, converted to the requested type.
- inline unsigned long getUnsignedLong() const { return this->operator unsigned long(); } ///< Returns the current value, converted to the requested type.
- inline long long getLongLong() const { return this->operator long long(); } ///< Returns the current value, converted to the requested type.
- inline unsigned long long getUnsignedLongLong() const { return this->operator unsigned long long(); } ///< Returns the current value, converted to the requested type.
- inline float getFloat() const { return this->operator float(); } ///< Returns the current value, converted to the requested type.
- inline double getDouble() const { return this->operator double(); } ///< Returns the current value, converted to the requested type.
- inline long double getLongDouble() const { return this->operator long double(); } ///< Returns the current value, converted to the requested type.
- inline bool getBool() const { return this->operator bool(); } ///< Returns the current value, converted to the requested type.
- inline void* getVoid() const { return this->operator void*(); } ///< Returns the current value, converted to the requested type.
- inline std::string getString() const { return this->operator std::string(); } ///< Returns the current value, converted to the requested type.
- inline orxonox::Vector2 getVector2() const { return this->operator orxonox::Vector2(); } ///< Returns the current value, converted to the requested type.
- inline orxonox::Vector3 getVector3() const { return this->operator orxonox::Vector3(); } ///< Returns the current value, converted to the requested type.
- inline orxonox::Vector4 getVector4() const { return this->operator orxonox::Vector4(); } ///< Returns the current value, converted to the requested type.
- inline orxonox::ColourValue getColourValue() const { return this->operator orxonox::ColourValue(); } ///< Returns the current value, converted to the requested type.
- inline orxonox::Quaternion getQuaternion() const { return this->operator orxonox::Quaternion(); } ///< Returns the current value, converted to the requested type.
- inline orxonox::Radian getRadian() const { return this->operator orxonox::Radian(); } ///< Returns the current value, converted to the requested type.
- inline orxonox::Degree getDegree() const { return this->operator orxonox::Degree(); } ///< Returns the current value, converted to the requested type.
- template <typename T> inline T* getPointer() const { return static_cast<T*>(this->getVoid()); } ///< Returns the current value, converted to a T* pointer.
+ /// Returns the current value, converted to the requested type.
+ template <typename T> inline T get() const { return T(); }
private:
inline bool assignValue(const char& value) { if (this->value_ && this->value_->type_ == Type::Char) { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value); return true; } } ///< Assigns a new value by changing type and creating a new container.
@@ -523,14 +501,14 @@
template <> inline bool MultiType::convert<void>() { this->reset(); return true; }
// Specialization to avoid ambiguities with the conversion operator
- template <> inline bool MultiType::convert<std::string>() { return this->setValue<std::string> (this->operator std::string()); } ///< Converts the current value to the given type.
- template <> inline bool MultiType::convert<orxonox::Vector2>() { return this->setValue<orxonox::Vector2> (this->operator orxonox::Vector2()); } ///< Converts the current value to the given type.
- template <> inline bool MultiType::convert<orxonox::Vector3>() { return this->setValue<orxonox::Vector3> (this->operator orxonox::Vector3()); } ///< Converts the current value to the given type.
- template <> inline bool MultiType::convert<orxonox::Vector4>() { return this->setValue<orxonox::Vector4> (this->operator orxonox::Vector4()); } ///< Converts the current value to the given type.
- template <> inline bool MultiType::convert<orxonox::ColourValue>() { return this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } ///< Converts the current value to the given type.
- template <> inline bool MultiType::convert<orxonox::Quaternion>() { return this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion()); } ///< Converts the current value to the given type.
- template <> inline bool MultiType::convert<orxonox::Radian>() { return this->setValue<orxonox::Radian> (this->operator orxonox::Radian()); } ///< Converts the current value to the given type.
- template <> inline bool MultiType::convert<orxonox::Degree>() { return this->setValue<orxonox::Degree> (this->operator orxonox::Degree()); } ///< Converts the current value to the given type.
+ template <> inline bool MultiType::convert<std::string>() { return this->set<std::string> (this->operator std::string()); } ///< Converts the current value to the given type.
+ template <> inline bool MultiType::convert<orxonox::Vector2>() { return this->set<orxonox::Vector2> (this->operator orxonox::Vector2()); } ///< Converts the current value to the given type.
+ template <> inline bool MultiType::convert<orxonox::Vector3>() { return this->set<orxonox::Vector3> (this->operator orxonox::Vector3()); } ///< Converts the current value to the given type.
+ template <> inline bool MultiType::convert<orxonox::Vector4>() { return this->set<orxonox::Vector4> (this->operator orxonox::Vector4()); } ///< Converts the current value to the given type.
+ template <> inline bool MultiType::convert<orxonox::ColourValue>() { return this->set<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } ///< Converts the current value to the given type.
+ template <> inline bool MultiType::convert<orxonox::Quaternion>() { return this->set<orxonox::Quaternion> (this->operator orxonox::Quaternion()); } ///< Converts the current value to the given type.
+ template <> inline bool MultiType::convert<orxonox::Radian>() { return this->set<orxonox::Radian> (this->operator orxonox::Radian()); } ///< Converts the current value to the given type.
+ template <> inline bool MultiType::convert<orxonox::Degree>() { return this->set<orxonox::Degree> (this->operator orxonox::Degree()); } ///< Converts the current value to the given type.
// Specialization to avoid ambiguities with the conversion operator
template <> inline bool MultiType::convert<const std::string&>() { return this->convert<std::string>(); } ///< Converts the current value to the given type.
@@ -566,32 +544,56 @@
template <> _UtilExport void MultiType::createNewValueContainer(const orxonox::Radian& value);
template <> _UtilExport void MultiType::createNewValueContainer(const orxonox::Degree& value);
- inline bool MultiType::setValue(const char& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const unsigned char& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const short& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const unsigned short& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const int& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const unsigned int& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const unsigned long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const long long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const unsigned long long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const float& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const double& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const long double& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const bool& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue( void* const& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const std::string& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const orxonox::Vector2& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const orxonox::Vector3& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const orxonox::Vector4& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const orxonox::ColourValue& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const orxonox::Quaternion& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const orxonox::Radian& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const orxonox::Degree& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const char& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const unsigned char& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const short& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const unsigned short& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const int& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const unsigned int& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const unsigned long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const long long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const unsigned long long& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const float& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const double& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const long double& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const bool& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set( void* const& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const std::string& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const orxonox::Vector2& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const orxonox::Vector3& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const orxonox::Vector4& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const orxonox::ColourValue& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const orxonox::Quaternion& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const orxonox::Radian& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ inline bool MultiType::set(const orxonox::Degree& value) { if (this->value_) { return this->value_->setValue(value); } else { return this->assignValue(value); } } ///< Assigns the given value and converts it to the current type.
+ template <> inline char MultiType::get() const { return this->operator char(); }
+ template <> inline unsigned char MultiType::get() const { return this->operator unsigned char(); }
+ template <> inline short MultiType::get() const { return this->operator short(); }
+ template <> inline unsigned short MultiType::get() const { return this->operator unsigned short(); }
+ template <> inline int MultiType::get() const { return this->operator int(); }
+ template <> inline unsigned int MultiType::get() const { return this->operator unsigned int(); }
+ template <> inline long MultiType::get() const { return this->operator long(); }
+ template <> inline unsigned long MultiType::get() const { return this->operator unsigned long(); }
+ template <> inline long long MultiType::get() const { return this->operator long long(); }
+ template <> inline unsigned long long MultiType::get() const { return this->operator unsigned long long(); }
+ template <> inline float MultiType::get() const { return this->operator float(); }
+ template <> inline double MultiType::get() const { return this->operator double(); }
+ template <> inline long double MultiType::get() const { return this->operator long double(); }
+ template <> inline bool MultiType::get() const { return this->operator bool(); }
+ template <> inline void* MultiType::get() const { return this->operator void*(); }
+ template <> inline std::string MultiType::get() const { return this->operator std::string(); }
+ template <> inline orxonox::Vector2 MultiType::get() const { return this->operator orxonox::Vector2(); }
+ template <> inline orxonox::Vector3 MultiType::get() const { return this->operator orxonox::Vector3(); }
+ template <> inline orxonox::Vector4 MultiType::get() const { return this->operator orxonox::Vector4(); }
+ template <> inline orxonox::ColourValue MultiType::get() const { return this->operator orxonox::ColourValue(); }
+ template <> inline orxonox::Quaternion MultiType::get() const { return this->operator orxonox::Quaternion(); }
+ template <> inline orxonox::Radian MultiType::get() const { return this->operator orxonox::Radian(); }
+ template <> inline orxonox::Degree MultiType::get() const { return this->operator orxonox::Degree(); }
+
/// Assigns the given value and converts it to the current type.
- inline bool MultiType::setValue(const char* value) { if (this->value_) { return this->value_->setValue(std::string(value)); } else { return this->assignValue(std::string(value)); } }
+ inline bool MultiType::set(const char* value) { if (this->value_) { return this->value_->setValue(std::string(value)); } else { return this->assignValue(std::string(value)); } }
}
#endif /* _MultiType_H__ */
Modified: code/branches/testing/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/testing/src/orxonox/LevelManager.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/orxonox/LevelManager.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -64,7 +64,7 @@
// check override
if (!CommandLineParser::getArgument("level")->hasDefaultValue())
{
- ModifyConfigValue(defaultLevelName_, tset, CommandLineParser::getValue("level").getString());
+ ModifyConfigValue(defaultLevelName_, tset, CommandLineParser::getValue("level").get<std::string>());
}
this->compileAvailableLevelList();
Modified: code/branches/testing/src/orxonox/Main.cc
===================================================================
--- code/branches/testing/src/orxonox/Main.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/src/orxonox/Main.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -67,7 +67,7 @@
Game* game = new Game(strCmdLine);
orxout(user_status) << "Finished initialization" << endl;
- if (CommandLineParser::getValue("generateDoc").getString().empty())
+ if (CommandLineParser::getValue("generateDoc").get<std::string>().empty())
{
orxout(internal_info) << "preparing game states" << endl;
@@ -85,22 +85,22 @@
game->requestState("root");
// Some development hacks (not really, but in the future, these calls won't make sense anymore)
- if (CommandLineParser::getValue("standalone").getBool())
+ if (CommandLineParser::getValue("standalone").get<bool>())
Game::getInstance().requestStates("graphics, standalone, level");
- else if (CommandLineParser::getValue("server").getBool())
+ else if (CommandLineParser::getValue("server").get<bool>())
Game::getInstance().requestStates("graphics, server, level");
- else if (CommandLineParser::getValue("client").getBool())
+ else if (CommandLineParser::getValue("client").get<bool>())
Game::getInstance().requestStates("graphics, client, level");
- else if (CommandLineParser::getValue("dedicated").getBool())
+ else if (CommandLineParser::getValue("dedicated").get<bool>())
Game::getInstance().requestStates("server, level");
- else if (CommandLineParser::getValue("dedicatedClient").getBool())
+ else if (CommandLineParser::getValue("dedicatedClient").get<bool>())
Game::getInstance().requestStates("client, level");
/* ADD masterserver command */
- else if (CommandLineParser::getValue("masterserver").getBool())
+ else if (CommandLineParser::getValue("masterserver").get<bool>())
Game::getInstance().requestStates("masterserver");
else
{
- if (!CommandLineParser::getValue("console").getBool())
+ if (!CommandLineParser::getValue("console").get<bool>())
Game::getInstance().requestStates("graphics, mainMenu");
}
Modified: code/branches/testing/test/util/MultiTypeTest.cc
===================================================================
--- code/branches/testing/test/util/MultiTypeTest.cc 2012-05-19 09:35:32 UTC (rev 9223)
+++ code/branches/testing/test/util/MultiTypeTest.cc 2012-05-19 13:03:02 UTC (rev 9224)
@@ -11,9 +11,9 @@
// ? assignment(pointer)
// x assignment(other)
- // x setValue(value)
- // ? setValue(pointer)
- // x setValue<type>(value)
+ // x set(value)
+ // ? set(pointer)
+ // x set<type>(value)
// x convert<type>()
// x reset
@@ -25,7 +25,7 @@
// x (type) conversion
// ? (pointer class) conversion
// x getValue(pointer)
- // x getXXX()
+ // x get<type>()
// ? getPointer()
// x hasDefaultValue()
@@ -44,31 +44,31 @@
/////////////////
// Constructor //
/////////////////
- TEST(MultiType, ValueChar) { char value = -100; MultiType mt(value); EXPECT_TRUE(mt.isType<char>()); EXPECT_EQ(-100, mt.getChar()); }
- TEST(MultiType, ValueUnsignedChar) { unsigned char value = 255u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned char>()); EXPECT_EQ(255u, mt.getUnsignedChar()); }
- TEST(MultiType, ValueShort) { short value = -10000; MultiType mt(value); EXPECT_TRUE(mt.isType<short>()); EXPECT_EQ(-10000, mt.getShort()); }
- TEST(MultiType, ValueUnsignedShort) { unsigned short value = 65535u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned short>()); EXPECT_EQ(65535u, mt.getUnsignedShort()); }
- TEST(MultiType, ValueInt) { int value = -1000000000; MultiType mt(value); EXPECT_TRUE(mt.isType<int>()); EXPECT_EQ(-1000000000, mt.getInt()); }
- TEST(MultiType, ValueUnsignedInt) { unsigned int value = 4000000000u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned int>()); EXPECT_EQ(4000000000u, mt.getUnsignedInt()); }
- TEST(MultiType, ValueLong) { long value = -1000000000; MultiType mt(value); EXPECT_TRUE(mt.isType<long>()); EXPECT_EQ(-1000000000, mt.getLong()); }
- TEST(MultiType, ValueUnsignedLong) { unsigned long value = 4000000000u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned long>()); EXPECT_EQ(4000000000u, mt.getUnsignedLong()); }
- TEST(MultiType, ValueLongLong) { long long value = -1000000000000000000L; MultiType mt(value); EXPECT_TRUE(mt.isType<long long>()); EXPECT_EQ(-1000000000000000000L, mt.getLongLong()); }
- TEST(MultiType, ValueUnsignedLongLong) { unsigned long long value = 4000000000000000000UL; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned long long>()); EXPECT_EQ(4000000000000000000UL, mt.getUnsignedLongLong()); }
- TEST(MultiType, ValueFloat) { float value = 0.123456f; MultiType mt(value); EXPECT_TRUE(mt.isType<float>()); EXPECT_EQ(0.123456f, mt.getFloat()); }
- TEST(MultiType, ValueDouble) { double value = 0.123456789; MultiType mt(value); EXPECT_TRUE(mt.isType<double>()); EXPECT_EQ(0.123456789, mt.getDouble()); }
- TEST(MultiType, ValueLongDouble) { long double value = 0.123456789123456789; MultiType mt(value); EXPECT_TRUE(mt.isType<long double>()); EXPECT_EQ(0.123456789123456789, mt.getLongDouble()); }
- TEST(MultiType, ValueBool) { bool value = true; MultiType mt(value); EXPECT_TRUE(mt.isType<bool>()); EXPECT_EQ(true, mt.getBool()); }
- TEST(MultiType, ValueVoidpointer) { int* pointer = new int; void* value = pointer; MultiType mt(value); EXPECT_TRUE(mt.isType<void*>()); EXPECT_EQ(value, mt.getPointer<void>()); delete pointer; }
- TEST(MultiType, ValueString) { std::string value = "Hello World"; MultiType mt(value); EXPECT_TRUE(mt.isType<std::string>()); EXPECT_EQ("Hello World", mt.getString()); }
- TEST(MultiType, ValueVector2) { Vector2 value = Vector2(11, 22); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector2>()); EXPECT_EQ(Vector2(11, 22), mt.getVector2()); }
- TEST(MultiType, ValueVector3) { Vector3 value = Vector3(11, 22, 33); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector3>()); EXPECT_EQ(Vector3(11, 22, 33), mt.getVector3()); }
- TEST(MultiType, ValueVector4) { Vector4 value = Vector4(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector4>()); EXPECT_EQ(Vector4(11, 22, 33, 44), mt.getVector4()); }
- TEST(MultiType, ValueColourValue) { ColourValue value = ColourValue(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<ColourValue>()); EXPECT_EQ(ColourValue(11, 22, 33, 44), mt.getColourValue()); }
- TEST(MultiType, ValueQuaternion) { Quaternion value = Quaternion(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<Quaternion>()); EXPECT_EQ(Quaternion(11, 22, 33, 44), mt.getQuaternion()); }
- TEST(MultiType, ValueRadian) { Radian value = Radian(0.123); MultiType mt(value); EXPECT_TRUE(mt.isType<Radian>()); EXPECT_EQ(Radian(0.123), mt.getRadian()); }
- TEST(MultiType, ValueDegree) { Degree value = Degree(123); MultiType mt(value); EXPECT_TRUE(mt.isType<Degree>()); EXPECT_EQ(Degree(123), mt.getDegree()); }
- TEST(MultiType, ValueMbool) { mbool value = mbool(true); MultiType mt(value); EXPECT_TRUE(mt.isType<bool>()); EXPECT_EQ(mbool(true), mt.getBool()); }
- TEST(MultiType, ValueCharPointer) { const char* value = "Hello World"; MultiType mt(value); EXPECT_TRUE(mt.isType<std::string>()); EXPECT_EQ("Hello World", mt.getString()); }
+ TEST(MultiType, ValueChar) { char value = -100; MultiType mt(value); EXPECT_TRUE(mt.isType<char>()); EXPECT_EQ(-100, mt.get<char>()); }
+ TEST(MultiType, ValueUnsignedChar) { unsigned char value = 255u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned char>()); EXPECT_EQ(255u, mt.get<unsigned char>()); }
+ TEST(MultiType, ValueShort) { short value = -10000; MultiType mt(value); EXPECT_TRUE(mt.isType<short>()); EXPECT_EQ(-10000, mt.get<short>()); }
+ TEST(MultiType, ValueUnsignedShort) { unsigned short value = 65535u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned short>()); EXPECT_EQ(65535u, mt.get<unsigned short>()); }
+ TEST(MultiType, ValueInt) { int value = -1000000000; MultiType mt(value); EXPECT_TRUE(mt.isType<int>()); EXPECT_EQ(-1000000000, mt.get<int>()); }
+ TEST(MultiType, ValueUnsignedInt) { unsigned int value = 4000000000u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned int>()); EXPECT_EQ(4000000000u, mt.get<unsigned int>()); }
+ TEST(MultiType, ValueLong) { long value = -1000000000; MultiType mt(value); EXPECT_TRUE(mt.isType<long>()); EXPECT_EQ(-1000000000, mt.get<long>()); }
+ TEST(MultiType, ValueUnsignedLong) { unsigned long value = 4000000000u; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned long>()); EXPECT_EQ(4000000000u, mt.get<unsigned long>()); }
+ TEST(MultiType, ValueLongLong) { long long value = -1000000000000000000L; MultiType mt(value); EXPECT_TRUE(mt.isType<long long>()); EXPECT_EQ(-1000000000000000000L, mt.get<long long>()); }
+ TEST(MultiType, ValueUnsignedLongLong) { unsigned long long value = 4000000000000000000UL; MultiType mt(value); EXPECT_TRUE(mt.isType<unsigned long long>()); EXPECT_EQ(4000000000000000000UL, mt.get<unsigned long long>()); }
+ TEST(MultiType, ValueFloat) { float value = 0.123456f; MultiType mt(value); EXPECT_TRUE(mt.isType<float>()); EXPECT_EQ(0.123456f, mt.get<float>()); }
+ TEST(MultiType, ValueDouble) { double value = 0.123456789; MultiType mt(value); EXPECT_TRUE(mt.isType<double>()); EXPECT_EQ(0.123456789, mt.get<double>()); }
+ TEST(MultiType, ValueLongDouble) { long double value = 0.123456789123456789; MultiType mt(value); EXPECT_TRUE(mt.isType<long double>()); EXPECT_EQ(0.123456789123456789, mt.get<long double>()); }
+ TEST(MultiType, ValueBool) { bool value = true; MultiType mt(value); EXPECT_TRUE(mt.isType<bool>()); EXPECT_EQ(true, mt.get<bool>()); }
+ TEST(MultiType, ValueVoidpointer) { int* pointer = new int; void* value = pointer; MultiType mt(value); EXPECT_TRUE(mt.isType<void*>()); EXPECT_EQ(value, mt.get<void*>()); delete pointer; }
+ TEST(MultiType, ValueString) { std::string value = "Hello World"; MultiType mt(value); EXPECT_TRUE(mt.isType<std::string>()); EXPECT_EQ("Hello World", mt.get<std::string>()); }
+ TEST(MultiType, ValueVector2) { Vector2 value = Vector2(11, 22); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector2>()); EXPECT_EQ(Vector2(11, 22), mt.get<Vector2>()); }
+ TEST(MultiType, ValueVector3) { Vector3 value = Vector3(11, 22, 33); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector3>()); EXPECT_EQ(Vector3(11, 22, 33), mt.get<Vector3>()); }
+ TEST(MultiType, ValueVector4) { Vector4 value = Vector4(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<Vector4>()); EXPECT_EQ(Vector4(11, 22, 33, 44), mt.get<Vector4>()); }
+ TEST(MultiType, ValueColourValue) { ColourValue value = ColourValue(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<ColourValue>()); EXPECT_EQ(ColourValue(11, 22, 33, 44), mt.get<ColourValue>()); }
+ TEST(MultiType, ValueQuaternion) { Quaternion value = Quaternion(11, 22, 33, 44); MultiType mt(value); EXPECT_TRUE(mt.isType<Quaternion>()); EXPECT_EQ(Quaternion(11, 22, 33, 44), mt.get<Quaternion>()); }
+ TEST(MultiType, ValueRadian) { Radian value = Radian(0.123); MultiType mt(value); EXPECT_TRUE(mt.isType<Radian>()); EXPECT_EQ(Radian(0.123), mt.get<Radian>()); }
+ TEST(MultiType, ValueDegree) { Degree value = Degree(123); MultiType mt(value); EXPECT_TRUE(mt.isType<Degree>()); EXPECT_EQ(Degree(123), mt.get<Degree>()); }
+ TEST(MultiType, ValueMbool) { mbool value = mbool(true); MultiType mt(value); EXPECT_TRUE(mt.isType<bool>()); EXPECT_EQ(mbool(true), mt.get<bool>()); }
+ TEST(MultiType, ValueCharPointer) { const char* value = "Hello World"; MultiType mt(value); EXPECT_TRUE(mt.isType<std::string>()); EXPECT_EQ("Hello World", mt.get<std::string>()); }
//////////////////////
// Copy-Constructor //
@@ -87,7 +87,7 @@
MultiType mt2(mt1);
EXPECT_TRUE(mt2.isType<float>());
- EXPECT_EQ(0.1234f, mt2.getFloat());
+ EXPECT_EQ(0.1234f, mt2.get<float>());
}
//////////////////////
@@ -103,7 +103,7 @@
EXPECT_FALSE(mt.null());
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(55, mt.getInt());
+ EXPECT_EQ(55, mt.get<int>());
}
TEST(MultiType, AssignmentFloatToInt)
@@ -111,13 +111,13 @@
MultiType mt(66);
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(66, mt.getInt());
+ EXPECT_EQ(66, mt.get<int>());
mt = 77.7f; // will be converted to int
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(77, mt.getInt());
- EXPECT_EQ(77.0f, mt.getFloat());
+ EXPECT_EQ(77, mt.get<int>());
+ EXPECT_EQ(77.0f, mt.get<float>());
}
TEST(MultiType, AssignmentFloatToFloat)
@@ -125,14 +125,14 @@
MultiType mt(66.6f);
EXPECT_TRUE(mt.isType<float>());
- EXPECT_EQ(66, mt.getInt());
- EXPECT_EQ(66.6f, mt.getFloat());
+ EXPECT_EQ(66, mt.get<int>());
+ EXPECT_EQ(66.6f, mt.get<float>());
mt = 77.7f;
EXPECT_TRUE(mt.isType<float>());
- EXPECT_EQ(77, mt.getInt());
- EXPECT_EQ(77.7f, mt.getFloat());
+ EXPECT_EQ(77, mt.get<int>());
+ EXPECT_EQ(77.7f, mt.get<float>());
}
TEST(MultiType, AssignmentFloatToVector3)
@@ -140,13 +140,13 @@
MultiType mt(Vector3(1, 2, 3));
EXPECT_TRUE(mt.isType<Vector3>());
- EXPECT_EQ(Vector3(1, 2, 3), mt.getVector3());
+ EXPECT_EQ(Vector3(1, 2, 3), mt.get<Vector3>());
EXPECT_FALSE(mt.hasDefaultValue());
mt = 77.7f;
EXPECT_TRUE(mt.isType<Vector3>());
- EXPECT_EQ(Vector3::ZERO, mt.getVector3());
+ EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>());
EXPECT_TRUE(mt.hasDefaultValue());
}
@@ -161,31 +161,31 @@
EXPECT_TRUE(mt1.isType<int>());
EXPECT_TRUE(mt2.isType<float>());
- EXPECT_EQ(33, mt1.getInt());
- EXPECT_EQ(33.0f, mt1.getFloat());
- EXPECT_EQ(44.4f, mt2.getFloat());
+ EXPECT_EQ(33, mt1.get<int>());
+ EXPECT_EQ(33.0f, mt1.get<float>());
+ EXPECT_EQ(44.4f, mt2.get<float>());
mt1 = mt2;
EXPECT_TRUE(mt1.isType<int>());
EXPECT_TRUE(mt2.isType<float>());
- EXPECT_EQ(44, mt1.getInt());
- EXPECT_EQ(44.0f, mt1.getFloat());
- EXPECT_EQ(44.4f, mt2.getFloat());
+ EXPECT_EQ(44, mt1.get<int>());
+ EXPECT_EQ(44.0f, mt1.get<float>());
+ EXPECT_EQ(44.4f, mt2.get<float>());
}
- /////////////////////
- // setValue(value) //
- /////////////////////
+ ////////////////
+ // set(value) //
+ ////////////////
TEST(MultiType, SetValueBoolToEmpty)
{
MultiType mt;
- mt.setValue(true);
+ mt.set(true);
EXPECT_TRUE(mt.isType<bool>());
- EXPECT_EQ(true, mt.getBool());
+ EXPECT_EQ(true, mt.get<bool>());
}
TEST(MultiType, SetValueIntToString)
@@ -193,28 +193,28 @@
MultiType mt("Hello");
EXPECT_TRUE(mt.isType<std::string>());
- EXPECT_EQ("Hello", mt.getString());
+ EXPECT_EQ("Hello", mt.get<std::string>());
- mt.setValue(1234);
+ mt.set(1234);
EXPECT_TRUE(mt.isType<std::string>());
- EXPECT_EQ("1234", mt.getString());
+ EXPECT_EQ("1234", mt.get<std::string>());
}
- ///////////////////////////
- // setValue<type>(value) //
- ///////////////////////////
+ //////////////////////
+ // set<type>(value) //
+ //////////////////////
TEST(MultiType, SetValueWithTypeIntToString)
{
MultiType mt("Hello");
EXPECT_TRUE(mt.isType<std::string>());
- EXPECT_EQ("Hello", mt.getString());
+ EXPECT_EQ("Hello", mt.get<std::string>());
- mt.setValue<int>(1234);
+ mt.set<int>(1234);
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(1234, mt.getInt());
+ EXPECT_EQ(1234, mt.get<int>());
}
TEST(MultiType, SetValueWithTypeIntAsStringToString)
@@ -222,12 +222,12 @@
MultiType mt("Hello");
EXPECT_TRUE(mt.isType<std::string>());
- EXPECT_EQ("Hello", mt.getString());
+ EXPECT_EQ("Hello", mt.get<std::string>());
- mt.setValue<int>("1234");
+ mt.set<int>("1234");
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(1234, mt.getInt());
+ EXPECT_EQ(1234, mt.get<int>());
}
TEST(MultiType, SetValueWithTypeIntToInt)
@@ -235,12 +235,12 @@
MultiType mt(4321);
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(4321, mt.getInt());
+ EXPECT_EQ(4321, mt.get<int>());
- mt.setValue<int>(1234);
+ mt.set<int>(1234);
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(1234, mt.getInt());
+ EXPECT_EQ(1234, mt.get<int>());
}
/////////////////////
@@ -252,7 +252,7 @@
mt.convert<int>();
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(0, mt.getInt());
+ EXPECT_EQ(0, mt.get<int>());
// EXPECT_TRUE(mt.hasDefaultValue());
}
@@ -262,14 +262,14 @@
MultiType mt(1.234f);
EXPECT_TRUE(mt.isType<float>());
- EXPECT_EQ(1.234f, mt.getFloat());
- EXPECT_EQ(1, mt.getInt());
+ EXPECT_EQ(1.234f, mt.get<float>());
+ EXPECT_EQ(1, mt.get<int>());
mt.convert<int>();
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(1.0f, mt.getFloat());
- EXPECT_EQ(1, mt.getInt());
+ EXPECT_EQ(1.0f, mt.get<float>());
+ EXPECT_EQ(1, mt.get<int>());
}
TEST(MultiType, ConvertFloatToVector3)
@@ -277,14 +277,14 @@
MultiType mt(1.234f);
EXPECT_TRUE(mt.isType<float>());
- EXPECT_EQ(1.234f, mt.getFloat());
- EXPECT_EQ(Vector3::ZERO, mt.getVector3());
+ EXPECT_EQ(1.234f, mt.get<float>());
+ EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>());
mt.convert<Vector3>();
EXPECT_TRUE(mt.isType<Vector3>());
- EXPECT_EQ(0.0f, mt.getFloat());
- EXPECT_EQ(Vector3::ZERO, mt.getVector3());
+ EXPECT_EQ(0.0f, mt.get<float>());
+ EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>());
// EXPECT_TRUE(mt.hasDefaultValue());
}
@@ -299,14 +299,14 @@
EXPECT_TRUE(mt.isType<int>());
EXPECT_FALSE(mt.isType<void>());
EXPECT_FALSE(mt.null());
- EXPECT_EQ(10, mt.getInt());
+ EXPECT_EQ(10, mt.get<int>());
mt.reset();
EXPECT_FALSE(mt.isType<int>());
EXPECT_TRUE(mt.isType<void>());
EXPECT_TRUE(mt.null());
- EXPECT_EQ(0, mt.getInt());
+ EXPECT_EQ(0, mt.get<int>());
}
///////////////////
@@ -318,13 +318,13 @@
EXPECT_TRUE(mt.isType<int>());
EXPECT_FALSE(mt.isType<float>());
- EXPECT_EQ(10, mt.getInt());
+ EXPECT_EQ(10, mt.get<int>());
mt.reset<float>();
EXPECT_FALSE(mt.isType<int>());
EXPECT_TRUE(mt.isType<float>());
- EXPECT_EQ(0, mt.getInt());
+ EXPECT_EQ(0, mt.get<int>());
}
////////////////
@@ -335,12 +335,12 @@
MultiType mt(10);
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(10, mt.getInt());
+ EXPECT_EQ(10, mt.get<int>());
mt.resetValue();
EXPECT_TRUE(mt.isType<int>());
- EXPECT_EQ(0, mt.getInt());
+ EXPECT_EQ(0, mt.get<int>());
}
/////////////////////
@@ -429,69 +429,69 @@
}
//////////////
- // getXXX() //
+ // get<type>() //
//////////////
TEST(MultiType, GetValueFromInt)
{
MultiType mt(256);
- EXPECT_EQ(0, mt.getChar());
- EXPECT_EQ(0u, mt.getUnsignedChar());
- EXPECT_EQ(256, mt.getShort());
- EXPECT_EQ(256u, mt.getUnsignedShort());
- EXPECT_EQ(256, mt.getInt());
- EXPECT_EQ(256u, mt.getUnsignedInt());
- EXPECT_EQ(256, mt.getLong());
- EXPECT_EQ(256u, mt.getUnsignedLong());
- EXPECT_EQ(256, mt.getLongLong());
- EXPECT_EQ(256u, mt.getUnsignedLongLong());
- EXPECT_EQ(256.0f, mt.getFloat());
- EXPECT_EQ(256.0, mt.getDouble());
- EXPECT_EQ(256.0, mt.getLongDouble());
- EXPECT_TRUE(mt.getBool());
- EXPECT_EQ("256", mt.getString());
+ EXPECT_EQ(0, mt.get<char>());
+ EXPECT_EQ(0u, mt.get<unsigned char>());
+ EXPECT_EQ(256, mt.get<short>());
+ EXPECT_EQ(256u, mt.get<unsigned short>());
+ EXPECT_EQ(256, mt.get<int>());
+ EXPECT_EQ(256u, mt.get<unsigned int>());
+ EXPECT_EQ(256, mt.get<long>());
+ EXPECT_EQ(256u, mt.get<unsigned long>());
+ EXPECT_EQ(256, mt.get<long long>());
+ EXPECT_EQ(256u, mt.get<unsigned long long>());
+ EXPECT_EQ(256.0f, mt.get<float>());
+ EXPECT_EQ(256.0, mt.get<double>());
+ EXPECT_EQ(256.0, mt.get<long double>());
+ EXPECT_TRUE(mt.get<bool>());
+ EXPECT_EQ("256", mt.get<std::string>());
}
TEST(MultiType, GetValueFromFloat)
{
MultiType mt(128.821);
- EXPECT_EQ(-128, mt.getChar());
- EXPECT_EQ(128u, mt.getUnsignedChar());
- EXPECT_EQ(128, mt.getShort());
- EXPECT_EQ(128u, mt.getUnsignedShort());
- EXPECT_EQ(128, mt.getInt());
- EXPECT_EQ(128u, mt.getUnsignedInt());
- EXPECT_EQ(128, mt.getLong());
- EXPECT_EQ(128u, mt.getUnsignedLong());
- EXPECT_EQ(128, mt.getLongLong());
- EXPECT_EQ(128u, mt.getUnsignedLongLong());
- EXPECT_EQ(128.821f, mt.getFloat());
- EXPECT_EQ(128.821, mt.getDouble());
- EXPECT_EQ(128.821, mt.getLongDouble());
- EXPECT_TRUE(mt.getBool());
- EXPECT_EQ("128.821", mt.getString());
+ EXPECT_EQ(-128, mt.get<char>());
+ EXPECT_EQ(128u, mt.get<unsigned char>());
+ EXPECT_EQ(128, mt.get<short>());
+ EXPECT_EQ(128u, mt.get<unsigned short>());
+ EXPECT_EQ(128, mt.get<int>());
+ EXPECT_EQ(128u, mt.get<unsigned int>());
+ EXPECT_EQ(128, mt.get<long>());
+ EXPECT_EQ(128u, mt.get<unsigned long>());
+ EXPECT_EQ(128, mt.get<long long>());
+ EXPECT_EQ(128u, mt.get<unsigned long long>());
+ EXPECT_EQ(128.821f, mt.get<float>());
+ EXPECT_EQ(128.821, mt.get<double>());
+ EXPECT_EQ(128.821, mt.get<long double>());
+ EXPECT_TRUE(mt.get<bool>());
+ EXPECT_EQ("128.821", mt.get<std::string>());
}
TEST(MultiType, GetValueFromString)
{
MultiType mt("0.123");
- EXPECT_EQ('0', mt.getChar());
- EXPECT_EQ('0', mt.getUnsignedChar());
- EXPECT_EQ(0, mt.getShort());
- EXPECT_EQ(0u, mt.getUnsignedShort());
- EXPECT_EQ(0, mt.getInt());
- EXPECT_EQ(0u, mt.getUnsignedInt());
- EXPECT_EQ(0, mt.getLong());
- EXPECT_EQ(0u, mt.getUnsignedLong());
- EXPECT_EQ(0, mt.getLongLong());
- EXPECT_EQ(0u, mt.getUnsignedLongLong());
- EXPECT_EQ(0.123f, mt.getFloat());
- EXPECT_EQ(0.123, mt.getDouble());
- EXPECT_DOUBLE_EQ(0.123, mt.getLongDouble());
- EXPECT_FALSE(mt.getBool());
- EXPECT_EQ("0.123", mt.getString());
+ EXPECT_EQ('0', mt.get<char>());
+ EXPECT_EQ('0', mt.get<unsigned char>());
+ EXPECT_EQ(0, mt.get<short>());
+ EXPECT_EQ(0u, mt.get<unsigned short>());
+ EXPECT_EQ(0, mt.get<int>());
+ EXPECT_EQ(0u, mt.get<unsigned int>());
+ EXPECT_EQ(0, mt.get<long>());
+ EXPECT_EQ(0u, mt.get<unsigned long>());
+ EXPECT_EQ(0, mt.get<long long>());
+ EXPECT_EQ(0u, mt.get<unsigned long long>());
+ EXPECT_EQ(0.123f, mt.get<float>());
+ EXPECT_EQ(0.123, mt.get<double>());
+ EXPECT_DOUBLE_EQ(0.123, mt.get<long double>());
+ EXPECT_FALSE(mt.get<bool>());
+ EXPECT_EQ("0.123", mt.get<std::string>());
}
////////////////////
More information about the Orxonox-commit
mailing list