122 #ifndef _Converter_H__ 123 #define _Converter_H__ 130 #include <type_traits> 136 #ifdef ORXONOX_COMPILER_MSVC 137 # pragma warning(push) 138 # pragma warning(disable:4244) 148 template <
class FromType,
class ToType>
154 <<
" to type " <<
typeid(ToType).name() << endl;
160 template <
class FromType,
class ToType>
165 ToType* temp =
dynamic_cast<ToType*
>(input);
187 template <
class FromType,
class ToType>
205 template <
class FromType>
220 template <
class FromType>
228 std::ostringstream oss;
232 (*output) = oss.str();
248 template <
class ToType>
251 std::string input(static_cast<std::istringstream&>(instream).str());
257 template <
class ToType>
265 std::istringstream iss(input);
267 if (iss >> (*output))
283 template <
class FromType,
class ToType>
290 template <
class FromType,
class ToType>
293 (*output) =
static_cast<ToType
>(input);
307 template <
class FromType,
class ToType>
310 static constexpr
bool probe = std::is_convertible<FromType, ToType>::value;
334 template <
class FromType,
class ToType>
355 template<
class FromType,
class ToType>
368 template<
class FromType,
class ToType>
387 template<
class ToType,
class FromType>
400 template <
class ToType>
405 return convertValue<std::string, ToType>(output, input);
480 #ifdef ORXONOX_COMPILER_MSVC 481 # pragma warning(pop) static ORX_FORCEINLINE bool convert(ToType *output, const char *input)
Definition: Convert.h:403
static ORX_FORCEINLINE bool convert(std::string *output, const unsigned char input)
Definition: Convert.h:423
#define _UtilExport
Definition: UtilPrereqs.h:60
ORX_FORCEINLINE ToType multi_cast(const FromType &input)
Converts any value to any other as long as there exists a conversion.
Definition: Convert.h:388
ORX_FORCEINLINE bool operator<<(std::ostream &outstream, const FromType &input)
Fallback operator <<() (delegates to orxonox::ConverterFallback)
Definition: Convert.h:206
static ORX_FORCEINLINE bool convert(ToType *output, const FromType &input)
Definition: Convert.h:190
Definition: TypeManip.h:34
::std::string string
Definition: gtest-port.h:756
static ORX_FORCEINLINE bool convert(std::string *output, const bool &input)
Definition: Convert.h:461
Default template if no orxonox::ConverterExplicit is available.
Definition: Convert.h:308
Output level, used for warnings which are important for developers.
Definition: OutputDefinitions.h:96
Default template. No conversion available at all.
Definition: Convert.h:149
ORX_FORCEINLINE ToType getConvertedValue(const FromType &input, const ToType &fallback)
Directly returns the converted value, but uses the fallback on failure.
Definition: Convert.h:369
static ORX_FORCEINLINE bool convert(std::string *output, const FromType &input)
Definition: Convert.h:223
Fallback template for stringstream.
Definition: Convert.h:188
static ORX_FORCEINLINE bool convert(char *output, const std::string &input)
Definition: Convert.h:433
ORX_FORCEINLINE bool convertImplicitely(ToType *output, const FromType &input, Loki::Int2Type< false >)
Template delegates to ConverterStringStream
Definition: Convert.h:284
OutputStream & orxout(OutputLevel level=level::debug_output, const OutputContextContainer &context=context::undefined())
This helper function returns a reference to a commonly used instance of OutputStream.
Definition: Output.h:81
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
ORX_FORCEINLINE bool convertValue(ToType *output, const FromType &input)
Converts any value to any other as long as there exists a conversion.
Definition: Convert.h:335
static ORX_FORCEINLINE bool convert(unsigned char *output, const std::string &input)
Definition: Convert.h:446
Shared library macros, enums, constants and forward declarations for the util library ...
std::istream & operator>>(std::istream &in, orxonox::Radian &radian)
Function for reading a Radian from a stream.
Definition: Math.cc:66
Extra namespace to avoid exposing the iostream operators in it.
Definition: Convert.h:202
std::ostream & operator<<(std::ostream &out, const std::set< const Identifier * > &list)
Lists the names of all Identifiers in a std::set<const Identifier*>.
Definition: Identifier.cc:466
static ORX_FORCEINLINE bool convert(ToType **output, FromType *const input)
Definition: Convert.h:163
Defines the helper function orxout() and includes all necessary headers to use the output system...
ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION() fallback()
Fallback implementation, returns an empty list.
Definition: ArgumentCompletionFunctions.cc:67
#define ORX_FORCEINLINE
Definition: OrxonoxConfig.h:95
static ORX_FORCEINLINE bool convert(ToType *output, const std::string &input)
Definition: Convert.h:260
static ORX_FORCEINLINE bool convert(ToType *output, const FromType &input)
Definition: Convert.h:311
static ORX_FORCEINLINE bool convert(std::string *output, const char input)
Definition: Convert.h:413
static ORX_FORCEINLINE bool convert(ToType *, const FromType &)
Definition: Convert.h:151