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>
218 ValueType
get(void)
const
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);
366 static_cast<numplaceholder*>(
mContent)->multiply(factor));
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() <<
"'";