Adapt getAs function to proper naming scheme.
This commit is contained in:
@@ -300,7 +300,7 @@ namespace chaiscript
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Target, typename Source>
|
template<typename Target, typename Source>
|
||||||
Target getAsAux()
|
Target get_as_aux()
|
||||||
{
|
{
|
||||||
return static_cast<Target>(*static_cast<const Source *>(bv.get_const_ptr()));
|
return static_cast<Target>(*static_cast<const Source *>(bv.get_const_ptr()));
|
||||||
}
|
}
|
||||||
@@ -332,42 +332,42 @@ namespace chaiscript
|
|||||||
validate_boxed_number(bv);
|
validate_boxed_number(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Target> Target getAs()
|
template<typename Target> Target get_as()
|
||||||
{
|
{
|
||||||
const Type_Info &inp_ = bv.get_type_info();
|
const Type_Info &inp_ = bv.get_type_info();
|
||||||
|
|
||||||
if (inp_ == typeid(int)) {
|
if (inp_ == typeid(int)) {
|
||||||
return getAsAux<Target, int>();
|
return get_as_aux<Target, int>();
|
||||||
} else if (inp_ == typeid(double)) {
|
} else if (inp_ == typeid(double)) {
|
||||||
return getAsAux<Target, double>();
|
return get_as_aux<Target, double>();
|
||||||
} else if (inp_ == typeid(float)) {
|
} else if (inp_ == typeid(float)) {
|
||||||
return getAsAux<Target, float>();
|
return get_as_aux<Target, float>();
|
||||||
} else if (inp_ == typeid(long double)) {
|
} else if (inp_ == typeid(long double)) {
|
||||||
return getAsAux<Target, long double>();
|
return get_as_aux<Target, long double>();
|
||||||
} else if (inp_ == typeid(char)) {
|
} else if (inp_ == typeid(char)) {
|
||||||
return getAsAux<Target, char>();
|
return get_as_aux<Target, char>();
|
||||||
} else if (inp_ == typeid(unsigned int)) {
|
} else if (inp_ == typeid(unsigned int)) {
|
||||||
return getAsAux<Target, unsigned int>();
|
return get_as_aux<Target, unsigned int>();
|
||||||
} else if (inp_ == typeid(long)) {
|
} else if (inp_ == typeid(long)) {
|
||||||
return getAsAux<Target, long>();
|
return get_as_aux<Target, long>();
|
||||||
} else if (inp_ == typeid(unsigned long)) {
|
} else if (inp_ == typeid(unsigned long)) {
|
||||||
return getAsAux<Target, unsigned long>();
|
return get_as_aux<Target, unsigned long>();
|
||||||
} else if (inp_ == typeid(boost::int8_t)) {
|
} else if (inp_ == typeid(boost::int8_t)) {
|
||||||
return getAsAux<Target, boost::int8_t>();
|
return get_as_aux<Target, boost::int8_t>();
|
||||||
} else if (inp_ == typeid(boost::int16_t)) {
|
} else if (inp_ == typeid(boost::int16_t)) {
|
||||||
return getAsAux<Target, boost::int16_t>();
|
return get_as_aux<Target, boost::int16_t>();
|
||||||
} else if (inp_ == typeid(boost::int32_t)) {
|
} else if (inp_ == typeid(boost::int32_t)) {
|
||||||
return getAsAux<Target, boost::int32_t>();
|
return get_as_aux<Target, boost::int32_t>();
|
||||||
} else if (inp_ == typeid(boost::int64_t)) {
|
} else if (inp_ == typeid(boost::int64_t)) {
|
||||||
return getAsAux<Target, boost::int64_t>();
|
return get_as_aux<Target, boost::int64_t>();
|
||||||
} else if (inp_ == typeid(boost::uint8_t)) {
|
} else if (inp_ == typeid(boost::uint8_t)) {
|
||||||
return getAsAux<Target, boost::uint8_t>();
|
return get_as_aux<Target, boost::uint8_t>();
|
||||||
} else if (inp_ == typeid(boost::uint16_t)) {
|
} else if (inp_ == typeid(boost::uint16_t)) {
|
||||||
return getAsAux<Target, boost::uint16_t>();
|
return get_as_aux<Target, boost::uint16_t>();
|
||||||
} else if (inp_ == typeid(boost::uint32_t)) {
|
} else if (inp_ == typeid(boost::uint32_t)) {
|
||||||
return getAsAux<Target, boost::uint32_t>();
|
return get_as_aux<Target, boost::uint32_t>();
|
||||||
} else if (inp_ == typeid(boost::uint64_t)) {
|
} else if (inp_ == typeid(boost::uint64_t)) {
|
||||||
return getAsAux<Target, boost::uint64_t>();
|
return get_as_aux<Target, boost::uint64_t>();
|
||||||
} else {
|
} else {
|
||||||
throw boost::bad_any_cast();
|
throw boost::bad_any_cast();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user