FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
template<typename T >
const T FB::variant::convert_cast ( ) const

Converts the stored value to the requested type if possible and returns the resulting value. If the conversion is not possible, throws bad_variant_cast.

Supported destination types include:

  • all numeric types
  • std::string (stored in UTF8 if needed)
  • std::wstring (converted from UTF8 if needed)
  • bool
  • STL container types (from a FB::JSObjectPtr containing an array javascript object)
  • STL dict types (from a FB::JSObjectPtr containing a javascript object)
converted value of the specified type

Definition at line 667 of file variant.h.

Referenced by FB::JSObject::GetArrayValues(), FB::JSObject::GetObjectValues(), FB::ActiveX::IDispatchAPI::GetProperty(), FB::ActiveX::IDispatchAPI::HasProperty(), FB::ActiveX::IDispatchAPI::RemoveProperty(), and FB::ActiveX::IDispatchAPI::SetProperty().

668  {
669  return variant_detail::conversion::convert_variant(*this, variant_detail::conversion::type_spec<T>());
670  }