Go to the documentation of this file.
36 #ifndef __OGRE_ANY_H__
37 #define __OGRE_ANY_H__
65 template<
typename ValueType>
66 explicit Any(
const ValueType & value)
89 template<
typename ValueType>
114 inline friend std::ostream&
operator <<
115 ( std::ostream& o,
const Any& v )
118 v.mContent->writeToStream(o);
140 virtual const std::type_info&
getType()
const = 0;
148 template<
typename ValueType>
160 virtual const std::type_info &
getType()
const
162 return typeid(ValueType);
187 template<
typename ValueType>
193 template<
typename ValueType>
199 "Bad cast from uninitialised Any",
202 else if(
getType() ==
typeid(ValueType))
209 str <<
"Bad cast from type '" <<
getType().name() <<
"' "
210 <<
"to '" <<
typeid(ValueType).name() <<
"'";
217 template <
typename ValueType>
223 "Bad cast from uninitialised Any",
226 else if(
getType() ==
typeid(ValueType))
233 str <<
"Bad cast from type '" <<
getType().name() <<
"' "
234 <<
"to '" <<
typeid(ValueType).name() <<
"'";
255 template<
typename ValueType>
283 template<
typename ValueType>
295 virtual const std::type_info &
getType()
const
297 return typeid(ValueType);
404 template<
typename ValueType>
407 return operand && (std::strcmp(operand->
getType().name(),
typeid(ValueType).name()) == 0)
412 template<
typename ValueType>
415 return any_cast<ValueType>(
const_cast<Any *
>(operand));
418 template<
typename ValueType>
421 const ValueType * result = any_cast<ValueType>(&operand);
425 str <<
"Bad cast from type '" << operand.
getType().name() <<
"' "
426 <<
"to '" <<
typeid(ValueType).name() <<
"'";
#define OGRE_DELETE_T(ptr, T, category)
Free the memory allocated with OGRE_NEW_T. Category is required to be restated to ensure the matching...
virtual placeholder * divide(placeholder *rhs)=0
virtual placeholder * subtract(placeholder *rhs)=0
virtual placeholder * divide(placeholder *rhs)
virtual placeholder * clone() const
Any(const ValueType &value)
virtual placeholder * add(placeholder *rhs)
AnyNumeric(const ValueType &value)
virtual placeholder * clone() const =0
virtual placeholder * add(placeholder *rhs)=0
AnyNumeric operator-(const AnyNumeric &rhs) const
virtual const std::type_info & getType() const
virtual placeholder * multiply(Real factor)
virtual placeholder * multiply(placeholder *rhs)=0
virtual const std::type_info & getType() const
AnyNumeric(placeholder *pholder)
Construct from holder.
virtual placeholder * clone() const
Variant type that can hold Any other type.
AnyNumeric & operator=(const AnyNumeric &rhs)
AnyNumeric & operator/=(const AnyNumeric &rhs)
virtual void writeToStream(std::ostream &o)
StringStream StrStreamType
virtual const std::type_info & getType() const =0
AnyNumeric & operator+=(const AnyNumeric &rhs)
AnyNumeric & operator*=(const AnyNumeric &rhs)
virtual void writeToStream(std::ostream &o)=0
AnyNumeric operator*(Real factor) const
AnyNumeric(const AnyNumeric &other)
virtual void writeToStream(std::ostream &o)
Specialised Any class which has built in arithmetic operators, but can hold only types which support ...
numholder(const ValueType &value)
virtual placeholder * subtract(placeholder *rhs)
ValueType operator()() const
@ MEMCATEGORY_GENERAL
General purpose.
ValueType get(void) const
AnyNumeric operator+(const AnyNumeric &rhs) const
AnyNumeric operator*(const AnyNumeric &rhs) const
void swap(Ogre::SmallVectorImpl< T > &LHS, Ogre::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
const std::type_info & getType() const
AnyNumeric operator/(const AnyNumeric &rhs) const
float Real
Software floating point type.
Any & operator=(const Any &rhs)
Any & operator=(const ValueType &rhs)
#define OGRE_EXCEPT(num, desc, src)
ValueType * any_cast(Any *operand)
AnyNumeric & operator-=(const AnyNumeric &rhs)
holder(const ValueType &value)
#define OGRE_NEW_T(T, category)
Allocate space for one primitive type, external type or non-virtual type with constructor parameters.
friend ValueType * any_cast(Any *)
virtual placeholder * multiply(placeholder *rhs)
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15