Orxonox
0.0.5 Codename: Arcturus
|
Functions that convert values between different types. More...
#include "UtilPrereqs.h"
#include <string>
#include <sstream>
#include <typeinfo>
#include <type_traits>
#include <loki/TypeManip.h>
#include "Output.h"
Go to the source code of this file.
Classes | |
struct | ConverterStringStream< FromType, ToType > |
Fallback template for stringstream. More... | |
struct | ConverterStringStream< FromType, std::string > |
Template that evaluates whether we can convert to std::string via ostringstream. More... | |
struct | ConverterStringStream< std::string, ToType > |
Template that evaluates whether we can convert from std::string via istringstream. More... | |
struct | orxonox::ConverterExplicit< FromType, ToType > |
Default template if no orxonox::ConverterExplicit is available. More... | |
struct | orxonox::ConverterExplicit< bool, std::string > |
Conversion from bool to std::string. More... | |
struct | orxonox::ConverterExplicit< char, std::string > |
Conversion would exhibit ambiguous << or >> operators when using iostream. More... | |
struct | orxonox::ConverterExplicit< const char *, ToType > |
Delegates conversion from const char* to std::string. More... | |
struct | orxonox::ConverterExplicit< std::string, bool > |
Conversion from std::string to bool. More... | |
struct | orxonox::ConverterExplicit< std::string, char > |
Conversion would exhibit ambiguous << or >> operators when using iostream. More... | |
struct | orxonox::ConverterExplicit< std::string, unsigned char > |
Conversion would exhibit ambiguous << or >> operators when using iostream. More... | |
struct | orxonox::ConverterExplicit< unsigned char, std::string > |
Conversion would exhibit ambiguous << or >> operators when using iostream. More... | |
struct | orxonox::ConverterFallback< FromType, ToType > |
Default template. No conversion available at all. More... | |
struct | orxonox::ConverterFallback< FromType *, ToType * > |
If all else fails, try a dynamic_cast for pointer types. More... | |
Namespaces | |
fallbackTemplates | |
Extra namespace to avoid exposing the iostream operators in it. | |
orxonox | |
Die Wagnis Klasse hat die folgenden Aufgaben: | |
Functions | |
template<class FromType , class ToType > | |
ORX_FORCEINLINE bool | orxonox::convertImplicitely (ToType *output, const FromType &input, Loki::Int2Type< false >) |
Template delegates to ConverterStringStream More... | |
template<class FromType , class ToType > | |
ORX_FORCEINLINE bool | orxonox::convertImplicitely (ToType *output, const FromType &input, Loki::Int2Type< true >) |
Makes an implicit cast from FromType to ToType. More... | |
template<class FromType , class ToType > | |
ORX_FORCEINLINE bool | orxonox::convertValue (ToType *output, const FromType &input) |
Converts any value to any other as long as there exists a conversion. More... | |
template<class FromType , class ToType > | |
ORX_FORCEINLINE bool | orxonox::convertValue (ToType *output, const FromType &input, const ToType &fallback) |
Converts any value to any other as long as there exists a conversion. More... | |
template<class FromType , class ToType > | |
ORX_FORCEINLINE ToType | orxonox::getConvertedValue (const FromType &input, const ToType &fallback) |
Directly returns the converted value, but uses the fallback on failure. More... | |
template<class ToType , class FromType > | |
ORX_FORCEINLINE ToType | orxonox::multi_cast (const FromType &input) |
Converts any value to any other as long as there exists a conversion. More... | |
template<class FromType > | |
ORX_FORCEINLINE bool | fallbackTemplates::operator<< (std::ostream &outstream, const FromType &input) |
Fallback operator <<() (delegates to orxonox::ConverterFallback) More... | |
template<class ToType > | |
ORX_FORCEINLINE bool | fallbackTemplates::operator>> (std::istream &instream, ToType &output) |
Fallback operator >>() (delegates to orxonox::ConverterFallback) More... | |
Functions that convert values between different types.
The back end of these functions are the actual implementations for the specific conversions, for instance from Ogre::Vector3 to std::string and vice versa. Some of them also use the iostream operators. <br> The real deal is evaluating which function is needed for a conversion based on the input and output type. But there are lots of catches in conjunction with templates which explains why there are so many functions in this file. <br> <br>