9 return global_instance;
15 auto const& type =
any.castedType();
19 dst =
any.cast<std::string>();
21 else if(type ==
typeid(int64_t))
23 dst =
any.cast<int64_t>();
25 else if(type ==
typeid(uint64_t))
27 dst =
any.cast<uint64_t>();
29 else if(type ==
typeid(
double))
31 dst =
any.cast<
double>();
52 return nonstd::make_unexpected(
"json object is null");
54 if(source.is_string())
57 BT::TypeInfo::Create<std::string>() };
59 if(source.is_number_unsigned())
61 return Entry{
BT::Any(source.get<uint64_t>()), BT::TypeInfo::Create<uint64_t>() };
63 if(source.is_number_integer())
65 return Entry{
BT::Any(source.get<int64_t>()), BT::TypeInfo::Create<int64_t>() };
67 if(source.is_number_float())
69 return Entry{
BT::Any(source.get<
double>()), BT::TypeInfo::Create<double>() };
71 if(source.is_boolean())
73 return Entry{
BT::Any(source.get<
bool>()), BT::TypeInfo::Create<bool>() };
76 if(!source.contains(
"__type"))
78 return nonstd::make_unexpected(
"Missing field '__type'");
83 return nonstd::make_unexpected(
"Type not found in registered list");
88 return nonstd::make_unexpected(
"Type not found in registered list");
90 return func_it->second(source);
94 std::type_index type)
const
99 return nonstd::make_unexpected(
"Type not found in registered list");
101 return func_it->second(source);