Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9224 for code/branches


Ignore:
Timestamp:
May 19, 2012, 3:03:02 PM (12 years ago)
Author:
landauf
Message:

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())

Location:
code/branches/testing
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • code/branches/testing/src/libraries/core/CommandLineParser.cc

    r9222 r9224  
    6969        else
    7070        {
    71             if (!value_.setValue(value))
    72             {
    73                 value_.setValue(defaultValue_);
     71            if (!value_.set(value))
     72            {
     73                value_.set(defaultValue_);
    7474                ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
    7575            }
  • code/branches/testing/src/libraries/core/CommandLineParser.h

    r9222 r9224  
    200200    inline void CommandLineParser::getValue<std::string>(const std::string& name, std::string* value)
    201201    {
    202         *value = getArgument(name)->getValue().getString();
     202        *value = getArgument(name)->getValue().get<std::string>();
    203203    }
    204204
     
    217217        OrxAssert(!_getInstance().existsArgument(name),
    218218            "Cannot add a command line argument with name '" + name + "' twice.");
    219         OrxAssert(!MultiType(defaultValue).isType<bool>() || MultiType(defaultValue).getBool() != true,
     219        OrxAssert(!MultiType(defaultValue).isType<bool>() || MultiType(defaultValue).get<bool>() != true,
    220220               "Boolean command line arguments with positive default values are not supported." << endl
    221221            << "Please use SetCommandLineSwitch and adjust your argument: " << name);
  • code/branches/testing/src/libraries/core/ConfigValueContainer.cc

    r9222 r9224  
    7070        this->bIsVector_ = false;
    7171
    72         this->defvalueString_ = this->value_.getString();
     72        this->defvalueString_ = this->value_.get<std::string>();
    7373        this->update();
    7474    }
  • code/branches/testing/src/libraries/core/Core.cc

    r8858 r9224  
    167167        this->configFileManager_ = new ConfigFileManager();
    168168        this->configFileManager_->setFilename(ConfigFileType::Settings,
    169             CommandLineParser::getValue("settingsFile").getString());
     169            CommandLineParser::getValue("settingsFile").get<std::string>());
    170170
    171171        // Required as well for the config values
     
    184184#if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN)
    185185        // Create persistent IO console
    186         if (CommandLineParser::getValue("noIOConsole").getBool())
     186        if (CommandLineParser::getValue("noIOConsole").get<bool>())
    187187        {
    188188            ModifyConfigValue(bStartIOConsole_, tset, false);
     
    337337    {
    338338        orxout(internal_info) << "loading graphics in Core" << endl;
    339        
     339
    340340        // Any exception should trigger this, even in upgradeToGraphics (see its remarks)
    341341        Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
  • code/branches/testing/src/libraries/core/PathConfig.cc

    r8858 r9224  
    188188            // Check for data path override by the command line
    189189            if (!CommandLineParser::getArgument("externalDataPath")->hasDefaultValue())
    190                 externalDataPath_ = CommandLineParser::getValue("externalDataPath").getString();
     190                externalDataPath_ = CommandLineParser::getValue("externalDataPath").get<std::string>();
    191191            else
    192192                externalDataPath_ = specialConfig::externalDataDevDirectory;
     
    227227        if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue())
    228228        {
    229             const std::string& directory(CommandLineParser::getValue("writingPathSuffix").getString());
     229            const std::string& directory(CommandLineParser::getValue("writingPathSuffix").get<std::string>());
    230230            configPath_ = configPath_ / directory;
    231231            logPath_    = logPath_    / directory;
  • code/branches/testing/src/libraries/core/command/CommandEvaluation.cc

    r9222 r9224  
    600600            // print the default value if available
    601601            if (command->getExecutor()->defaultValueSet(i))
    602                 output += '=' + command->getExecutor()->getDefaultValue(i).getString() + ']';
     602                output += '=' + command->getExecutor()->getDefaultValue(i).get<std::string>() + ']';
    603603            else
    604604                output += '}';
  • code/branches/testing/src/libraries/core/command/CommandExecutor.cc

    r9222 r9224  
    133133    /* static */ std::string CommandExecutor::query(const std::string& command, int* error, bool useTcl)
    134134    {
    135         return CommandExecutor::queryMT(command, error, useTcl).getString();
     135        return CommandExecutor::queryMT(command, error, useTcl).get<std::string>();
    136136    }
    137137
  • code/branches/testing/src/libraries/core/command/TclBind.cc

    r8858 r9224  
    183183
    184184        if (bQuery)
    185             result = evaluation.query(&error).getString();
     185            result = evaluation.query(&error).get<std::string>();
    186186        else
    187187            error = evaluation.execute();
  • code/branches/testing/src/libraries/network/Client.cc

    r8858 r9224  
    6868      timeSinceLastUpdate_(0)
    6969  {
    70     this->setDestination( CommandLineParser::getValue("dest").getString(), CommandLineParser::getValue("port") );
     70    this->setDestination( CommandLineParser::getValue("dest").get<std::string>(), CommandLineParser::getValue("port") );
    7171  }
    7272
  • code/branches/testing/src/libraries/tools/Shader.cc

    r9222 r9224  
    205205                    // change the value of the parameter depending on its type
    206206                    if (it->value_.isType<int>())
    207                         passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.getInt());
     207                        passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.get<int>());
    208208                    else if (it->value_.isType<float>())
    209                         passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.getFloat());
     209                        passPtr->getFragmentProgramParameters()->setNamedConstant(it->parameter_, it->value_.get<float>());
    210210                }
    211211                else
  • code/branches/testing/src/libraries/util/MultiType.h

    r9223 r9224  
    297297            inline MultiType(const orxonox::Degree& value)      : value_(0) { this->assignValue(value); }           ///< Constructor: Assigns the given value and sets the type.
    298298            inline MultiType(const orxonox::mbool& value)       : value_(0) { this->assignValue((bool)value); }     ///< Constructor: Assigns the given mbool and converts it to bool.
    299             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.
    300             inline MultiType(const MultiType& other)            : value_(0) { this->setValue(other); }              ///< Copyconstructor: Assigns value and type of the other MultiType.
     299            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.
     300            inline MultiType(const MultiType& other)            : value_(0) { this->set(other); }                   ///< Copyconstructor: Assigns value and type of the other MultiType.
    301301
    302302            /// Destructor: Deletes the MT_Value.
    303303            inline ~MultiType() { if (this->value_) { delete this->value_; } }
    304304
    305             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.
    306             template <typename V> inline MultiType& operator=(V* value)               { this->setValue(value); return (*this); } ///< Assigns a pointer.
    307             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.
    308 
    309             inline bool                                   setValue(const char& value);
    310             inline bool                                   setValue(const unsigned char& value);
    311             inline bool                                   setValue(const short& value);
    312             inline bool                                   setValue(const unsigned short& value);
    313             inline bool                                   setValue(const int& value);
    314             inline bool                                   setValue(const unsigned int& value);
    315             inline bool                                   setValue(const long& value);
    316             inline bool                                   setValue(const unsigned long& value);
    317             inline bool                                   setValue(const long long& value);
    318             inline bool                                   setValue(const unsigned long long& value);
    319             inline bool                                   setValue(const float& value);
    320             inline bool                                   setValue(const double& value);
    321             inline bool                                   setValue(const long double& value);
    322             inline bool                                   setValue(const bool& value);
    323             inline bool                                   setValue(      void* const& value);
    324             inline bool                                   setValue(const std::string& value);
    325             inline bool                                   setValue(const orxonox::Vector2& value);
    326             inline bool                                   setValue(const orxonox::Vector3& value);
    327             inline bool                                   setValue(const orxonox::Vector4& value);
    328             inline bool                                   setValue(const orxonox::ColourValue& value);
    329             inline bool                                   setValue(const orxonox::Quaternion& value);
    330             inline bool                                   setValue(const orxonox::Radian& value);
    331             inline bool                                   setValue(const orxonox::Degree& value);
    332             inline bool                                   setValue(const char* value);
     305            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.
     306            template <typename V> inline MultiType& operator=(V* value)               { this->set(value); return (*this); } ///< Assigns a pointer.
     307            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.
     308
     309            inline bool                                   set(const char& value);
     310            inline bool                                   set(const unsigned char& value);
     311            inline bool                                   set(const short& value);
     312            inline bool                                   set(const unsigned short& value);
     313            inline bool                                   set(const int& value);
     314            inline bool                                   set(const unsigned int& value);
     315            inline bool                                   set(const long& value);
     316            inline bool                                   set(const unsigned long& value);
     317            inline bool                                   set(const long long& value);
     318            inline bool                                   set(const unsigned long long& value);
     319            inline bool                                   set(const float& value);
     320            inline bool                                   set(const double& value);
     321            inline bool                                   set(const long double& value);
     322            inline bool                                   set(const bool& value);
     323            inline bool                                   set(      void* const& value);
     324            inline bool                                   set(const std::string& value);
     325            inline bool                                   set(const orxonox::Vector2& value);
     326            inline bool                                   set(const orxonox::Vector3& value);
     327            inline bool                                   set(const orxonox::Vector4& value);
     328            inline bool                                   set(const orxonox::ColourValue& value);
     329            inline bool                                   set(const orxonox::Quaternion& value);
     330            inline bool                                   set(const orxonox::Radian& value);
     331            inline bool                                   set(const orxonox::Degree& value);
     332            inline bool                                   set(const char* value);
    333333            /// Assigns a pointer.
    334             template <typename V> inline bool setValue(V* value)
     334            template <typename V> inline bool set(V* value)
    335335            {
    336336                if (this->value_)
     
    340340            }
    341341            /// Changes the type to T and assigns the new value (which might be of another type than T - it gets converted).
    342             template <typename T, typename V> inline bool setValue(const V& value) { this->reset<T>(); return this->setValue(value); }
     342            template <typename T, typename V> inline bool set(const V& value) { this->reset<T>(); return this->set(value); }
    343343            /// Assigns the value of the other MultiType and converts it to the current type.
    344             bool                                          setValue(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
     344            bool                                          set(const MultiType& other) { if (this->value_) { return this->value_->assimilate(other); } else { if (other.value_) { this->value_ = other.value_->clone(); } return true; } }
    345345
    346346            /// Copies the other MultiType by assigning value and type.
     
    348348
    349349            /// Converts the current value to type T.
    350             template <typename T> inline bool convert()                    { return this->setValue<T>((typename Loki::TypeTraits<T>::UnqualifiedReferredType)(*this));  }
     350            template <typename T> inline bool convert()                    { return this->set<T>((typename Loki::TypeTraits<T>::UnqualifiedReferredType)(*this));  }
    351351
    352352            /// Resets value and type. Type will be void afterwards and null() returns true.
     
    427427            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.
    428428
    429             inline char                     getChar()             const { return this->operator char();                 } ///< Returns the current value, converted to the requested type.
    430             inline unsigned char            getUnsignedChar()     const { return this->operator unsigned char();        } ///< Returns the current value, converted to the requested type.
    431             inline short                    getShort()            const { return this->operator short();                } ///< Returns the current value, converted to the requested type.
    432             inline unsigned short           getUnsignedShort()    const { return this->operator unsigned short();       } ///< Returns the current value, converted to the requested type.
    433             inline int                      getInt()              const { return this->operator int();                  } ///< Returns the current value, converted to the requested type.
    434             inline unsigned int             getUnsignedInt()      const { return this->operator unsigned int();         } ///< Returns the current value, converted to the requested type.
    435             inline long                     getLong()             const { return this->operator long();                 } ///< Returns the current value, converted to the requested type.
    436             inline unsigned long            getUnsignedLong()     const { return this->operator unsigned long();        } ///< Returns the current value, converted to the requested type.
    437             inline long long                getLongLong()         const { return this->operator long long();            } ///< Returns the current value, converted to the requested type.
    438             inline unsigned long long       getUnsignedLongLong() const { return this->operator unsigned long long();   } ///< Returns the current value, converted to the requested type.
    439             inline float                    getFloat()            const { return this->operator float();                } ///< Returns the current value, converted to the requested type.
    440             inline double                   getDouble()           const { return this->operator double();               } ///< Returns the current value, converted to the requested type.
    441             inline long double              getLongDouble()       const { return this->operator long double();          } ///< Returns the current value, converted to the requested type.
    442             inline bool                     getBool()             const { return this->operator bool();                 } ///< Returns the current value, converted to the requested type.
    443             inline void*                    getVoid()             const { return this->operator void*();                } ///< Returns the current value, converted to the requested type.
    444             inline std::string              getString()           const { return this->operator std::string();          } ///< Returns the current value, converted to the requested type.
    445             inline orxonox::Vector2         getVector2()          const { return this->operator orxonox::Vector2();     } ///< Returns the current value, converted to the requested type.
    446             inline orxonox::Vector3         getVector3()          const { return this->operator orxonox::Vector3();     } ///< Returns the current value, converted to the requested type.
    447             inline orxonox::Vector4         getVector4()          const { return this->operator orxonox::Vector4();     } ///< Returns the current value, converted to the requested type.
    448             inline orxonox::ColourValue     getColourValue()      const { return this->operator orxonox::ColourValue(); } ///< Returns the current value, converted to the requested type.
    449             inline orxonox::Quaternion      getQuaternion()       const { return this->operator orxonox::Quaternion();  } ///< Returns the current value, converted to the requested type.
    450             inline orxonox::Radian          getRadian()           const { return this->operator orxonox::Radian();      } ///< Returns the current value, converted to the requested type.
    451             inline orxonox::Degree          getDegree()           const { return this->operator orxonox::Degree();      } ///< Returns the current value, converted to the requested type.
    452             template <typename T> inline T* getPointer()          const { return static_cast<T*>(this->getVoid());      } ///< Returns the current value, converted to a T* pointer.
     429            /// Returns the current value, converted to the requested type.
     430            template <typename T> inline T get() const { return T(); }
    453431
    454432        private:
     
    524502
    525503    // Specialization to avoid ambiguities with the conversion operator
    526     template <> inline bool MultiType::convert<std::string>()          { return this->setValue<std::string>         (this->operator std::string());          } ///< Converts the current value to the given type.
    527     template <> inline bool MultiType::convert<orxonox::Vector2>()     { return this->setValue<orxonox::Vector2>    (this->operator orxonox::Vector2());     } ///< Converts the current value to the given type.
    528     template <> inline bool MultiType::convert<orxonox::Vector3>()     { return this->setValue<orxonox::Vector3>    (this->operator orxonox::Vector3());     } ///< Converts the current value to the given type.
    529     template <> inline bool MultiType::convert<orxonox::Vector4>()     { return this->setValue<orxonox::Vector4>    (this->operator orxonox::Vector4());     } ///< Converts the current value to the given type.
    530     template <> inline bool MultiType::convert<orxonox::ColourValue>() { return this->setValue<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } ///< Converts the current value to the given type.
    531     template <> inline bool MultiType::convert<orxonox::Quaternion>()  { return this->setValue<orxonox::Quaternion> (this->operator orxonox::Quaternion());  } ///< Converts the current value to the given type.
    532     template <> inline bool MultiType::convert<orxonox::Radian>()      { return this->setValue<orxonox::Radian>     (this->operator orxonox::Radian());      } ///< Converts the current value to the given type.
    533     template <> inline bool MultiType::convert<orxonox::Degree>()      { return this->setValue<orxonox::Degree>     (this->operator orxonox::Degree());      } ///< Converts the current value to the given type.
     504    template <> inline bool MultiType::convert<std::string>()          { return this->set<std::string>         (this->operator std::string());          } ///< Converts the current value to the given type.
     505    template <> inline bool MultiType::convert<orxonox::Vector2>()     { return this->set<orxonox::Vector2>    (this->operator orxonox::Vector2());     } ///< Converts the current value to the given type.
     506    template <> inline bool MultiType::convert<orxonox::Vector3>()     { return this->set<orxonox::Vector3>    (this->operator orxonox::Vector3());     } ///< Converts the current value to the given type.
     507    template <> inline bool MultiType::convert<orxonox::Vector4>()     { return this->set<orxonox::Vector4>    (this->operator orxonox::Vector4());     } ///< Converts the current value to the given type.
     508    template <> inline bool MultiType::convert<orxonox::ColourValue>() { return this->set<orxonox::ColourValue>(this->operator orxonox::ColourValue()); } ///< Converts the current value to the given type.
     509    template <> inline bool MultiType::convert<orxonox::Quaternion>()  { return this->set<orxonox::Quaternion> (this->operator orxonox::Quaternion());  } ///< Converts the current value to the given type.
     510    template <> inline bool MultiType::convert<orxonox::Radian>()      { return this->set<orxonox::Radian>     (this->operator orxonox::Radian());      } ///< Converts the current value to the given type.
     511    template <> inline bool MultiType::convert<orxonox::Degree>()      { return this->set<orxonox::Degree>     (this->operator orxonox::Degree());      } ///< Converts the current value to the given type.
    534512
    535513    // Specialization to avoid ambiguities with the conversion operator
     
    567545    template <> _UtilExport void MultiType::createNewValueContainer(const orxonox::Degree& value);
    568546
    569     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.
    570     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.
    571     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.
    572     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.
    573     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.
    574     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.
    575     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.
    576     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.
    577     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.
    578     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.
    579     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.
    580     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.
    581     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.
    582     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.
    583     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.
    584     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.
    585     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.
    586     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.
    587     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.
    588     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.
    589     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.
    590     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.
    591     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.
     547    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.
     548    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.
     549    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.
     550    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.
     551    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.
     552    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.
     553    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.
     554    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.
     555    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.
     556    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.
     557    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.
     558    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.
     559    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.
     560    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.
     561    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.
     562    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.
     563    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.
     564    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.
     565    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.
     566    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.
     567    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.
     568    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.
     569    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.
     570
     571    template <> inline char                     MultiType::get() const { return this->operator char();                 }
     572    template <> inline unsigned char            MultiType::get() const { return this->operator unsigned char();        }
     573    template <> inline short                    MultiType::get() const { return this->operator short();                }
     574    template <> inline unsigned short           MultiType::get() const { return this->operator unsigned short();       }
     575    template <> inline int                      MultiType::get() const { return this->operator int();                  }
     576    template <> inline unsigned int             MultiType::get() const { return this->operator unsigned int();         }
     577    template <> inline long                     MultiType::get() const { return this->operator long();                 }
     578    template <> inline unsigned long            MultiType::get() const { return this->operator unsigned long();        }
     579    template <> inline long long                MultiType::get() const { return this->operator long long();            }
     580    template <> inline unsigned long long       MultiType::get() const { return this->operator unsigned long long();   }
     581    template <> inline float                    MultiType::get() const { return this->operator float();                }
     582    template <> inline double                   MultiType::get() const { return this->operator double();               }
     583    template <> inline long double              MultiType::get() const { return this->operator long double();          }
     584    template <> inline bool                     MultiType::get() const { return this->operator bool();                 }
     585    template <> inline void*                    MultiType::get() const { return this->operator void*();                }
     586    template <> inline std::string              MultiType::get() const { return this->operator std::string();          }
     587    template <> inline orxonox::Vector2         MultiType::get() const { return this->operator orxonox::Vector2();     }
     588    template <> inline orxonox::Vector3         MultiType::get() const { return this->operator orxonox::Vector3();     }
     589    template <> inline orxonox::Vector4         MultiType::get() const { return this->operator orxonox::Vector4();     }
     590    template <> inline orxonox::ColourValue     MultiType::get() const { return this->operator orxonox::ColourValue(); }
     591    template <> inline orxonox::Quaternion      MultiType::get() const { return this->operator orxonox::Quaternion();  }
     592    template <> inline orxonox::Radian          MultiType::get() const { return this->operator orxonox::Radian();      }
     593    template <> inline orxonox::Degree          MultiType::get() const { return this->operator orxonox::Degree();      }
    592594
    593595    /// Assigns the given value and converts it to the current type.
    594     inline bool MultiType::setValue(const char* value)                  { if (this->value_) { return this->value_->setValue(std::string(value)); } else { return this->assignValue(std::string(value)); } }
     596    inline bool MultiType::set(const char* value)                  { if (this->value_) { return this->value_->setValue(std::string(value)); } else { return this->assignValue(std::string(value)); } }
    595597}
    596598
  • code/branches/testing/src/orxonox/LevelManager.cc

    r8891 r9224  
    6565        if (!CommandLineParser::getArgument("level")->hasDefaultValue())
    6666        {
    67             ModifyConfigValue(defaultLevelName_, tset, CommandLineParser::getValue("level").getString());
     67            ModifyConfigValue(defaultLevelName_, tset, CommandLineParser::getValue("level").get<std::string>());
    6868        }
    6969
  • code/branches/testing/src/orxonox/Main.cc

    r8858 r9224  
    6868        orxout(user_status) << "Finished initialization" << endl;
    6969
    70         if (CommandLineParser::getValue("generateDoc").getString().empty())
     70        if (CommandLineParser::getValue("generateDoc").get<std::string>().empty())
    7171        {
    7272            orxout(internal_info) << "preparing game states" << endl;
     
    8686
    8787            // Some development hacks (not really, but in the future, these calls won't make sense anymore)
    88             if (CommandLineParser::getValue("standalone").getBool())
     88            if (CommandLineParser::getValue("standalone").get<bool>())
    8989                Game::getInstance().requestStates("graphics, standalone, level");
    90             else if (CommandLineParser::getValue("server").getBool())
     90            else if (CommandLineParser::getValue("server").get<bool>())
    9191                Game::getInstance().requestStates("graphics, server, level");
    92             else if (CommandLineParser::getValue("client").getBool())
     92            else if (CommandLineParser::getValue("client").get<bool>())
    9393                Game::getInstance().requestStates("graphics, client, level");
    94             else if (CommandLineParser::getValue("dedicated").getBool())
     94            else if (CommandLineParser::getValue("dedicated").get<bool>())
    9595                Game::getInstance().requestStates("server, level");
    96             else if (CommandLineParser::getValue("dedicatedClient").getBool())
     96            else if (CommandLineParser::getValue("dedicatedClient").get<bool>())
    9797                Game::getInstance().requestStates("client, level");
    9898            /* ADD masterserver command */
    99             else if (CommandLineParser::getValue("masterserver").getBool())
     99            else if (CommandLineParser::getValue("masterserver").get<bool>())
    100100                Game::getInstance().requestStates("masterserver");
    101101            else
    102102            {
    103                 if (!CommandLineParser::getValue("console").getBool())
     103                if (!CommandLineParser::getValue("console").get<bool>())
    104104                    Game::getInstance().requestStates("graphics, mainMenu");
    105105            }
  • code/branches/testing/test/util/MultiTypeTest.cc

    r9223 r9224  
    1212    // x assignment(other)
    1313
    14     // x setValue(value)
    15     // ? setValue(pointer)
    16     // x setValue<type>(value)
     14    // x set(value)
     15    // ? set(pointer)
     16    // x set<type>(value)
    1717
    1818    // x convert<type>()
     
    2626    // ? (pointer class) conversion
    2727    // x getValue(pointer)
    28     // x getXXX()
     28    // x get<type>()
    2929    // ? getPointer()
    3030
     
    4545    // Constructor //
    4646    /////////////////
    47     TEST(MultiType, ValueChar)              { char value = -100;                                MultiType mt(value);    EXPECT_TRUE(mt.isType<char>());                 EXPECT_EQ(-100, mt.getChar()); }
    48     TEST(MultiType, ValueUnsignedChar)      { unsigned char value = 255u;                       MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned char>());        EXPECT_EQ(255u, mt.getUnsignedChar()); }
    49     TEST(MultiType, ValueShort)             { short value = -10000;                             MultiType mt(value);    EXPECT_TRUE(mt.isType<short>());                EXPECT_EQ(-10000, mt.getShort()); }
    50     TEST(MultiType, ValueUnsignedShort)     { unsigned short value = 65535u;                    MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned short>());       EXPECT_EQ(65535u, mt.getUnsignedShort()); }
    51     TEST(MultiType, ValueInt)               { int value = -1000000000;                          MultiType mt(value);    EXPECT_TRUE(mt.isType<int>());                  EXPECT_EQ(-1000000000, mt.getInt()); }
    52     TEST(MultiType, ValueUnsignedInt)       { unsigned int value = 4000000000u;                 MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned int>());         EXPECT_EQ(4000000000u, mt.getUnsignedInt()); }
    53     TEST(MultiType, ValueLong)              { long value = -1000000000;                         MultiType mt(value);    EXPECT_TRUE(mt.isType<long>());                 EXPECT_EQ(-1000000000, mt.getLong()); }
    54     TEST(MultiType, ValueUnsignedLong)      { unsigned long value = 4000000000u;                MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned long>());        EXPECT_EQ(4000000000u, mt.getUnsignedLong()); }
    55     TEST(MultiType, ValueLongLong)          { long long value = -1000000000000000000L;          MultiType mt(value);    EXPECT_TRUE(mt.isType<long long>());            EXPECT_EQ(-1000000000000000000L, mt.getLongLong()); }
    56     TEST(MultiType, ValueUnsignedLongLong)  { unsigned long long value = 4000000000000000000UL; MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned long long>());   EXPECT_EQ(4000000000000000000UL, mt.getUnsignedLongLong()); }
    57     TEST(MultiType, ValueFloat)             { float value = 0.123456f;                          MultiType mt(value);    EXPECT_TRUE(mt.isType<float>());                EXPECT_EQ(0.123456f, mt.getFloat()); }
    58     TEST(MultiType, ValueDouble)            { double value = 0.123456789;                       MultiType mt(value);    EXPECT_TRUE(mt.isType<double>());               EXPECT_EQ(0.123456789, mt.getDouble()); }
    59     TEST(MultiType, ValueLongDouble)        { long double value = 0.123456789123456789;         MultiType mt(value);    EXPECT_TRUE(mt.isType<long double>());          EXPECT_EQ(0.123456789123456789, mt.getLongDouble()); }
    60     TEST(MultiType, ValueBool)              { bool value = true;                                MultiType mt(value);    EXPECT_TRUE(mt.isType<bool>());                 EXPECT_EQ(true, mt.getBool()); }
    61     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; }
    62     TEST(MultiType, ValueString)            { std::string value = "Hello World";                MultiType mt(value);    EXPECT_TRUE(mt.isType<std::string>());          EXPECT_EQ("Hello World", mt.getString()); }
    63     TEST(MultiType, ValueVector2)           { Vector2 value = Vector2(11, 22);                  MultiType mt(value);    EXPECT_TRUE(mt.isType<Vector2>());              EXPECT_EQ(Vector2(11, 22), mt.getVector2()); }
    64     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()); }
    65     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()); }
    66     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()); }
    67     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()); }
    68     TEST(MultiType, ValueRadian)            { Radian value = Radian(0.123);                     MultiType mt(value);    EXPECT_TRUE(mt.isType<Radian>());               EXPECT_EQ(Radian(0.123), mt.getRadian()); }
    69     TEST(MultiType, ValueDegree)            { Degree value = Degree(123);                       MultiType mt(value);    EXPECT_TRUE(mt.isType<Degree>());               EXPECT_EQ(Degree(123), mt.getDegree()); }
    70     TEST(MultiType, ValueMbool)             { mbool value = mbool(true);                        MultiType mt(value);    EXPECT_TRUE(mt.isType<bool>());                 EXPECT_EQ(mbool(true), mt.getBool()); }
    71     TEST(MultiType, ValueCharPointer)       { const char* value = "Hello World";                MultiType mt(value);    EXPECT_TRUE(mt.isType<std::string>());          EXPECT_EQ("Hello World", mt.getString()); }
     47    TEST(MultiType, ValueChar)              { char value = -100;                                MultiType mt(value);    EXPECT_TRUE(mt.isType<char>());                 EXPECT_EQ(-100, mt.get<char>()); }
     48    TEST(MultiType, ValueUnsignedChar)      { unsigned char value = 255u;                       MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned char>());        EXPECT_EQ(255u, mt.get<unsigned char>()); }
     49    TEST(MultiType, ValueShort)             { short value = -10000;                             MultiType mt(value);    EXPECT_TRUE(mt.isType<short>());                EXPECT_EQ(-10000, mt.get<short>()); }
     50    TEST(MultiType, ValueUnsignedShort)     { unsigned short value = 65535u;                    MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned short>());       EXPECT_EQ(65535u, mt.get<unsigned short>()); }
     51    TEST(MultiType, ValueInt)               { int value = -1000000000;                          MultiType mt(value);    EXPECT_TRUE(mt.isType<int>());                  EXPECT_EQ(-1000000000, mt.get<int>()); }
     52    TEST(MultiType, ValueUnsignedInt)       { unsigned int value = 4000000000u;                 MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned int>());         EXPECT_EQ(4000000000u, mt.get<unsigned int>()); }
     53    TEST(MultiType, ValueLong)              { long value = -1000000000;                         MultiType mt(value);    EXPECT_TRUE(mt.isType<long>());                 EXPECT_EQ(-1000000000, mt.get<long>()); }
     54    TEST(MultiType, ValueUnsignedLong)      { unsigned long value = 4000000000u;                MultiType mt(value);    EXPECT_TRUE(mt.isType<unsigned long>());        EXPECT_EQ(4000000000u, mt.get<unsigned long>()); }
     55    TEST(MultiType, ValueLongLong)          { long long value = -1000000000000000000L;          MultiType mt(value);    EXPECT_TRUE(mt.isType<long long>());            EXPECT_EQ(-1000000000000000000L, mt.get<long long>()); }
     56    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>()); }
     57    TEST(MultiType, ValueFloat)             { float value = 0.123456f;                          MultiType mt(value);    EXPECT_TRUE(mt.isType<float>());                EXPECT_EQ(0.123456f, mt.get<float>()); }
     58    TEST(MultiType, ValueDouble)            { double value = 0.123456789;                       MultiType mt(value);    EXPECT_TRUE(mt.isType<double>());               EXPECT_EQ(0.123456789, mt.get<double>()); }
     59    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>()); }
     60    TEST(MultiType, ValueBool)              { bool value = true;                                MultiType mt(value);    EXPECT_TRUE(mt.isType<bool>());                 EXPECT_EQ(true, mt.get<bool>()); }
     61    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; }
     62    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>()); }
     63    TEST(MultiType, ValueVector2)           { Vector2 value = Vector2(11, 22);                  MultiType mt(value);    EXPECT_TRUE(mt.isType<Vector2>());              EXPECT_EQ(Vector2(11, 22), mt.get<Vector2>()); }
     64    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>()); }
     65    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>()); }
     66    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>()); }
     67    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>()); }
     68    TEST(MultiType, ValueRadian)            { Radian value = Radian(0.123);                     MultiType mt(value);    EXPECT_TRUE(mt.isType<Radian>());               EXPECT_EQ(Radian(0.123), mt.get<Radian>()); }
     69    TEST(MultiType, ValueDegree)            { Degree value = Degree(123);                       MultiType mt(value);    EXPECT_TRUE(mt.isType<Degree>());               EXPECT_EQ(Degree(123), mt.get<Degree>()); }
     70    TEST(MultiType, ValueMbool)             { mbool value = mbool(true);                        MultiType mt(value);    EXPECT_TRUE(mt.isType<bool>());                 EXPECT_EQ(mbool(true), mt.get<bool>()); }
     71    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>()); }
    7272
    7373    //////////////////////
     
    8888
    8989        EXPECT_TRUE(mt2.isType<float>());
    90         EXPECT_EQ(0.1234f, mt2.getFloat());
     90        EXPECT_EQ(0.1234f, mt2.get<float>());
    9191    }
    9292
     
    104104        EXPECT_FALSE(mt.null());
    105105        EXPECT_TRUE(mt.isType<int>());
    106         EXPECT_EQ(55, mt.getInt());
     106        EXPECT_EQ(55, mt.get<int>());
    107107    }
    108108
     
    112112
    113113        EXPECT_TRUE(mt.isType<int>());
    114         EXPECT_EQ(66, mt.getInt());
     114        EXPECT_EQ(66, mt.get<int>());
    115115
    116116        mt = 77.7f; // will be converted to int
    117117
    118118        EXPECT_TRUE(mt.isType<int>());
    119         EXPECT_EQ(77, mt.getInt());
    120         EXPECT_EQ(77.0f, mt.getFloat());
     119        EXPECT_EQ(77, mt.get<int>());
     120        EXPECT_EQ(77.0f, mt.get<float>());
    121121    }
    122122
     
    126126
    127127        EXPECT_TRUE(mt.isType<float>());
    128         EXPECT_EQ(66, mt.getInt());
    129         EXPECT_EQ(66.6f, mt.getFloat());
     128        EXPECT_EQ(66, mt.get<int>());
     129        EXPECT_EQ(66.6f, mt.get<float>());
    130130
    131131        mt = 77.7f;
    132132
    133133        EXPECT_TRUE(mt.isType<float>());
    134         EXPECT_EQ(77, mt.getInt());
    135         EXPECT_EQ(77.7f, mt.getFloat());
     134        EXPECT_EQ(77, mt.get<int>());
     135        EXPECT_EQ(77.7f, mt.get<float>());
    136136    }
    137137
     
    141141
    142142        EXPECT_TRUE(mt.isType<Vector3>());
    143         EXPECT_EQ(Vector3(1, 2, 3), mt.getVector3());
     143        EXPECT_EQ(Vector3(1, 2, 3), mt.get<Vector3>());
    144144        EXPECT_FALSE(mt.hasDefaultValue());
    145145
     
    147147
    148148        EXPECT_TRUE(mt.isType<Vector3>());
    149         EXPECT_EQ(Vector3::ZERO, mt.getVector3());
     149        EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>());
    150150        EXPECT_TRUE(mt.hasDefaultValue());
    151151    }
     
    162162        EXPECT_TRUE(mt2.isType<float>());
    163163
    164         EXPECT_EQ(33, mt1.getInt());
    165         EXPECT_EQ(33.0f, mt1.getFloat());
    166         EXPECT_EQ(44.4f, mt2.getFloat());
     164        EXPECT_EQ(33, mt1.get<int>());
     165        EXPECT_EQ(33.0f, mt1.get<float>());
     166        EXPECT_EQ(44.4f, mt2.get<float>());
    167167
    168168        mt1 = mt2;
     
    171171        EXPECT_TRUE(mt2.isType<float>());
    172172
    173         EXPECT_EQ(44, mt1.getInt());
    174         EXPECT_EQ(44.0f, mt1.getFloat());
    175         EXPECT_EQ(44.4f, mt2.getFloat());
    176     }
    177 
    178     /////////////////////
    179     // setValue(value) //
    180     /////////////////////
     173        EXPECT_EQ(44, mt1.get<int>());
     174        EXPECT_EQ(44.0f, mt1.get<float>());
     175        EXPECT_EQ(44.4f, mt2.get<float>());
     176    }
     177
     178    ////////////////
     179    // set(value) //
     180    ////////////////
    181181    TEST(MultiType, SetValueBoolToEmpty)
    182182    {
    183183        MultiType mt;
    184184
    185         mt.setValue(true);
     185        mt.set(true);
    186186
    187187        EXPECT_TRUE(mt.isType<bool>());
    188         EXPECT_EQ(true, mt.getBool());
     188        EXPECT_EQ(true, mt.get<bool>());
    189189    }
    190190
     
    194194
    195195        EXPECT_TRUE(mt.isType<std::string>());
    196         EXPECT_EQ("Hello", mt.getString());
    197 
    198         mt.setValue(1234);
     196        EXPECT_EQ("Hello", mt.get<std::string>());
     197
     198        mt.set(1234);
    199199
    200200        EXPECT_TRUE(mt.isType<std::string>());
    201         EXPECT_EQ("1234", mt.getString());
    202     }
    203 
    204     ///////////////////////////
    205     // setValue<type>(value) //
    206     ///////////////////////////
     201        EXPECT_EQ("1234", mt.get<std::string>());
     202    }
     203
     204    //////////////////////
     205    // set<type>(value) //
     206    //////////////////////
    207207    TEST(MultiType, SetValueWithTypeIntToString)
    208208    {
     
    210210
    211211        EXPECT_TRUE(mt.isType<std::string>());
    212         EXPECT_EQ("Hello", mt.getString());
    213 
    214         mt.setValue<int>(1234);
    215 
    216         EXPECT_TRUE(mt.isType<int>());
    217         EXPECT_EQ(1234, mt.getInt());
     212        EXPECT_EQ("Hello", mt.get<std::string>());
     213
     214        mt.set<int>(1234);
     215
     216        EXPECT_TRUE(mt.isType<int>());
     217        EXPECT_EQ(1234, mt.get<int>());
    218218    }
    219219
     
    223223
    224224        EXPECT_TRUE(mt.isType<std::string>());
    225         EXPECT_EQ("Hello", mt.getString());
    226 
    227         mt.setValue<int>("1234");
    228 
    229         EXPECT_TRUE(mt.isType<int>());
    230         EXPECT_EQ(1234, mt.getInt());
     225        EXPECT_EQ("Hello", mt.get<std::string>());
     226
     227        mt.set<int>("1234");
     228
     229        EXPECT_TRUE(mt.isType<int>());
     230        EXPECT_EQ(1234, mt.get<int>());
    231231    }
    232232
     
    236236
    237237        EXPECT_TRUE(mt.isType<int>());
    238         EXPECT_EQ(4321, mt.getInt());
    239 
    240         mt.setValue<int>(1234);
    241 
    242         EXPECT_TRUE(mt.isType<int>());
    243         EXPECT_EQ(1234, mt.getInt());
     238        EXPECT_EQ(4321, mt.get<int>());
     239
     240        mt.set<int>(1234);
     241
     242        EXPECT_TRUE(mt.isType<int>());
     243        EXPECT_EQ(1234, mt.get<int>());
    244244    }
    245245
     
    253253
    254254        EXPECT_TRUE(mt.isType<int>());
    255         EXPECT_EQ(0, mt.getInt());
     255        EXPECT_EQ(0, mt.get<int>());
    256256
    257257//        EXPECT_TRUE(mt.hasDefaultValue());
     
    263263
    264264        EXPECT_TRUE(mt.isType<float>());
    265         EXPECT_EQ(1.234f, mt.getFloat());
    266         EXPECT_EQ(1, mt.getInt());
     265        EXPECT_EQ(1.234f, mt.get<float>());
     266        EXPECT_EQ(1, mt.get<int>());
    267267
    268268        mt.convert<int>();
    269269
    270270        EXPECT_TRUE(mt.isType<int>());
    271         EXPECT_EQ(1.0f, mt.getFloat());
    272         EXPECT_EQ(1, mt.getInt());
     271        EXPECT_EQ(1.0f, mt.get<float>());
     272        EXPECT_EQ(1, mt.get<int>());
    273273    }
    274274
     
    278278
    279279        EXPECT_TRUE(mt.isType<float>());
    280         EXPECT_EQ(1.234f, mt.getFloat());
    281         EXPECT_EQ(Vector3::ZERO, mt.getVector3());
     280        EXPECT_EQ(1.234f, mt.get<float>());
     281        EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>());
    282282
    283283        mt.convert<Vector3>();
    284284
    285285        EXPECT_TRUE(mt.isType<Vector3>());
    286         EXPECT_EQ(0.0f, mt.getFloat());
    287         EXPECT_EQ(Vector3::ZERO, mt.getVector3());
     286        EXPECT_EQ(0.0f, mt.get<float>());
     287        EXPECT_EQ(Vector3::ZERO, mt.get<Vector3>());
    288288
    289289//        EXPECT_TRUE(mt.hasDefaultValue());
     
    300300        EXPECT_FALSE(mt.isType<void>());
    301301        EXPECT_FALSE(mt.null());
    302         EXPECT_EQ(10, mt.getInt());
     302        EXPECT_EQ(10, mt.get<int>());
    303303
    304304        mt.reset();
     
    307307        EXPECT_TRUE(mt.isType<void>());
    308308        EXPECT_TRUE(mt.null());
    309         EXPECT_EQ(0, mt.getInt());
     309        EXPECT_EQ(0, mt.get<int>());
    310310    }
    311311
     
    319319        EXPECT_TRUE(mt.isType<int>());
    320320        EXPECT_FALSE(mt.isType<float>());
    321         EXPECT_EQ(10, mt.getInt());
     321        EXPECT_EQ(10, mt.get<int>());
    322322
    323323        mt.reset<float>();
     
    325325        EXPECT_FALSE(mt.isType<int>());
    326326        EXPECT_TRUE(mt.isType<float>());
    327         EXPECT_EQ(0, mt.getInt());
     327        EXPECT_EQ(0, mt.get<int>());
    328328    }
    329329
     
    336336
    337337        EXPECT_TRUE(mt.isType<int>());
    338         EXPECT_EQ(10, mt.getInt());
     338        EXPECT_EQ(10, mt.get<int>());
    339339
    340340        mt.resetValue();
    341341
    342342        EXPECT_TRUE(mt.isType<int>());
    343         EXPECT_EQ(0, mt.getInt());
     343        EXPECT_EQ(0, mt.get<int>());
    344344    }
    345345
     
    430430
    431431    //////////////
    432     // getXXX() //
     432    // get<type>() //
    433433    //////////////
    434434    TEST(MultiType, GetValueFromInt)
     
    436436        MultiType mt(256);
    437437
    438         EXPECT_EQ(0, mt.getChar());
    439         EXPECT_EQ(0u, mt.getUnsignedChar());
    440         EXPECT_EQ(256, mt.getShort());
    441         EXPECT_EQ(256u, mt.getUnsignedShort());
    442         EXPECT_EQ(256, mt.getInt());
    443         EXPECT_EQ(256u, mt.getUnsignedInt());
    444         EXPECT_EQ(256, mt.getLong());
    445         EXPECT_EQ(256u, mt.getUnsignedLong());
    446         EXPECT_EQ(256, mt.getLongLong());
    447         EXPECT_EQ(256u, mt.getUnsignedLongLong());
    448         EXPECT_EQ(256.0f, mt.getFloat());
    449         EXPECT_EQ(256.0, mt.getDouble());
    450         EXPECT_EQ(256.0, mt.getLongDouble());
    451         EXPECT_TRUE(mt.getBool());
    452         EXPECT_EQ("256", mt.getString());
     438        EXPECT_EQ(0, mt.get<char>());
     439        EXPECT_EQ(0u, mt.get<unsigned char>());
     440        EXPECT_EQ(256, mt.get<short>());
     441        EXPECT_EQ(256u, mt.get<unsigned short>());
     442        EXPECT_EQ(256, mt.get<int>());
     443        EXPECT_EQ(256u, mt.get<unsigned int>());
     444        EXPECT_EQ(256, mt.get<long>());
     445        EXPECT_EQ(256u, mt.get<unsigned long>());
     446        EXPECT_EQ(256, mt.get<long long>());
     447        EXPECT_EQ(256u, mt.get<unsigned long long>());
     448        EXPECT_EQ(256.0f, mt.get<float>());
     449        EXPECT_EQ(256.0, mt.get<double>());
     450        EXPECT_EQ(256.0, mt.get<long double>());
     451        EXPECT_TRUE(mt.get<bool>());
     452        EXPECT_EQ("256", mt.get<std::string>());
    453453    }
    454454
     
    457457        MultiType mt(128.821);
    458458
    459         EXPECT_EQ(-128, mt.getChar());
    460         EXPECT_EQ(128u, mt.getUnsignedChar());
    461         EXPECT_EQ(128, mt.getShort());
    462         EXPECT_EQ(128u, mt.getUnsignedShort());
    463         EXPECT_EQ(128, mt.getInt());
    464         EXPECT_EQ(128u, mt.getUnsignedInt());
    465         EXPECT_EQ(128, mt.getLong());
    466         EXPECT_EQ(128u, mt.getUnsignedLong());
    467         EXPECT_EQ(128, mt.getLongLong());
    468         EXPECT_EQ(128u, mt.getUnsignedLongLong());
    469         EXPECT_EQ(128.821f, mt.getFloat());
    470         EXPECT_EQ(128.821, mt.getDouble());
    471         EXPECT_EQ(128.821, mt.getLongDouble());
    472         EXPECT_TRUE(mt.getBool());
    473         EXPECT_EQ("128.821", mt.getString());
     459        EXPECT_EQ(-128, mt.get<char>());
     460        EXPECT_EQ(128u, mt.get<unsigned char>());
     461        EXPECT_EQ(128, mt.get<short>());
     462        EXPECT_EQ(128u, mt.get<unsigned short>());
     463        EXPECT_EQ(128, mt.get<int>());
     464        EXPECT_EQ(128u, mt.get<unsigned int>());
     465        EXPECT_EQ(128, mt.get<long>());
     466        EXPECT_EQ(128u, mt.get<unsigned long>());
     467        EXPECT_EQ(128, mt.get<long long>());
     468        EXPECT_EQ(128u, mt.get<unsigned long long>());
     469        EXPECT_EQ(128.821f, mt.get<float>());
     470        EXPECT_EQ(128.821, mt.get<double>());
     471        EXPECT_EQ(128.821, mt.get<long double>());
     472        EXPECT_TRUE(mt.get<bool>());
     473        EXPECT_EQ("128.821", mt.get<std::string>());
    474474    }
    475475
     
    478478        MultiType mt("0.123");
    479479
    480         EXPECT_EQ('0', mt.getChar());
    481         EXPECT_EQ('0', mt.getUnsignedChar());
    482         EXPECT_EQ(0, mt.getShort());
    483         EXPECT_EQ(0u, mt.getUnsignedShort());
    484         EXPECT_EQ(0, mt.getInt());
    485         EXPECT_EQ(0u, mt.getUnsignedInt());
    486         EXPECT_EQ(0, mt.getLong());
    487         EXPECT_EQ(0u, mt.getUnsignedLong());
    488         EXPECT_EQ(0, mt.getLongLong());
    489         EXPECT_EQ(0u, mt.getUnsignedLongLong());
    490         EXPECT_EQ(0.123f, mt.getFloat());
    491         EXPECT_EQ(0.123, mt.getDouble());
    492         EXPECT_DOUBLE_EQ(0.123, mt.getLongDouble());
    493         EXPECT_FALSE(mt.getBool());
    494         EXPECT_EQ("0.123", mt.getString());
     480        EXPECT_EQ('0', mt.get<char>());
     481        EXPECT_EQ('0', mt.get<unsigned char>());
     482        EXPECT_EQ(0, mt.get<short>());
     483        EXPECT_EQ(0u, mt.get<unsigned short>());
     484        EXPECT_EQ(0, mt.get<int>());
     485        EXPECT_EQ(0u, mt.get<unsigned int>());
     486        EXPECT_EQ(0, mt.get<long>());
     487        EXPECT_EQ(0u, mt.get<unsigned long>());
     488        EXPECT_EQ(0, mt.get<long long>());
     489        EXPECT_EQ(0u, mt.get<unsigned long long>());
     490        EXPECT_EQ(0.123f, mt.get<float>());
     491        EXPECT_EQ(0.123, mt.get<double>());
     492        EXPECT_DOUBLE_EQ(0.123, mt.get<long double>());
     493        EXPECT_FALSE(mt.get<bool>());
     494        EXPECT_EQ("0.123", mt.get<std::string>());
    495495    }
    496496
Note: See TracChangeset for help on using the changeset viewer.