37#include "OgreException.h"
67 virtual const std::type_info&
GetType()
const = 0;
98 virtual const std::type_info&
GetType()
const
100 return typeid(ValueType);
120 template<
typename ValueType>
friend ValueType*
any_cast(
SAny *);
132 template<
typename ValueType>
explicit SAny(
const ValueType& value) :
mContent(new
holder<ValueType>(value))
208 OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"Bad cast from uninitialised SAny",
"SAny::operator()");
209 else if(
GetType() ==
typeid(ValueType))
213 std::ostringstream
str;
214 str <<
"Bad cast from type '" <<
GetType().name() <<
"' " <<
"to '" <<
typeid(ValueType).name() <<
"'";
215 OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
str.str(),
"SAny::operator()");
286 return typeid(ValueType);
452 if(operand && operand->
GetType() ==
typeid(ValueType))
460template<
typename ValueType>
const ValueType*
any_cast(
const SAny* operand)
462 return any_cast<ValueType>(
const_cast<SAny*
>(operand));
469 const ValueType* result = any_cast<ValueType>(&operand);
472 std::ostringstream
str;
473 str <<
"Bad cast from type '" << operand.
GetType().name() <<
"' " <<
"to '" <<
typeid(ValueType).name() <<
"'";
474 OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
str.str(),
"any_cast");
virtual const std::type_info & GetType() const
virtual placeholder * Clone() const
virtual void WriteToStream(std::ostream &o)
holder(const ValueType &value)
virtual const std::type_info & GetType() const =0
virtual void WriteToStream(std::ostream &o)=0
virtual placeholder * Clone() const =0
friend ValueType * any_cast(SAny *)
friend std::ostream & operator<<(std::ostream &o, const SAny &v)
SAny & operator=(const ValueType &rhs)
SAny(const ValueType &value)
const std::type_info & GetType() const
SAny & operator=(const SAny &rhs)
ValueType operator()() const
virtual placeholder * Multiply(placeholder *rhs)
virtual placeholder * Add(placeholder *rhs)
virtual void WriteToStream(std::ostream &o)
virtual const std::type_info & GetType() const
virtual placeholder * Clone() const
virtual placeholder * Subtract(placeholder *rhs)
numholder(const ValueType &value)
virtual placeholder * Multiply(float factor)
virtual placeholder * Divide(placeholder *rhs)
virtual placeholder * Add(placeholder *rhs)=0
virtual placeholder * Multiply(placeholder *rhs)=0
virtual placeholder * Divide(placeholder *rhs)=0
virtual placeholder * Subtract(placeholder *rhs)=0
virtual placeholder * Multiply(float factor)=0
SAnyNumeric operator/(const SAnyNumeric &rhs) const
SAnyNumeric(const ValueType &value)
SAnyNumeric operator+(const SAnyNumeric &rhs) const
SAnyNumeric(const SAnyNumeric &other)
SAnyNumeric & operator-=(const SAnyNumeric &rhs)
SAnyNumeric & operator*=(const SAnyNumeric &rhs)
SAnyNumeric & operator/=(const SAnyNumeric &rhs)
SAnyNumeric operator*(float factor) const
SAnyNumeric(placeholder *pholder)
SAnyNumeric & operator+=(const SAnyNumeric &rhs)
SAnyNumeric operator-(const SAnyNumeric &rhs) const
SAnyNumeric & operator=(const SAnyNumeric &rhs)
SAnyNumeric operator*(const SAnyNumeric &rhs) const
ValueType * any_cast(SAny *operand)
STBI_EXTERN unsigned long const char * str