Go to the documentation of this file. 1 #ifndef JWT_CPP_BOOSTJSON_TRAITS_H
2 #define JWT_CPP_BOOSTJSON_TRAITS_H
4 #define JWT_DISABLE_PICOJSON
7 #include <boost/json.hpp>
12 namespace json = boost::json;
25 if (val.kind() == json::kind::bool_)
return type::boolean;
26 if (val.kind() == json::kind::int64)
return type::integer;
27 if (val.kind() == json::kind::uint64)
29 if (val.kind() == json::kind::double_)
return type::number;
30 if (val.kind() == json::kind::string)
return type::string;
34 throw std::logic_error(
"invalid type");
39 return val.get_object();
44 return val.get_array();
48 if (val.kind() != json::kind::string)
throw std::bad_cast();
54 case json::kind::int64:
return val.get_int64();
55 case json::kind::uint64:
return static_cast<int64_t
>(val.get_uint64());
56 default:
throw std::bad_cast();
61 if (val.kind() != json::kind::bool_)
throw std::bad_cast();
62 return val.get_bool();
66 if (val.kind() != json::kind::double_)
throw std::bad_cast();
67 return val.get_double();
80 #endif // JWT_CPP_BOOSTJSON_TRAITS_H
double number_type
Definition: traits.h:18
basic_json<> json
default JSON class
Definition: json.hpp:3472
std::string string_type
Definition: traits.h:17
static array_type as_array(const value_type &val)
Definition: traits.h:42
static bool parse(value_type &val, string_type str)
Definition: traits.h:70
static number_type as_number(const value_type &val)
Definition: traits.h:65
bool boolean_type
Definition: traits.h:20
static jwt::json::type get_type(const value_type &val)
Definition: traits.h:22
const string const string EntityVideoSourcesCommandDataType CscPoint3d CscPoint3d bool
Definition: environmentEntitiesCommands.h:545
JSON Web Token.
Definition: base.h:20
static integer_type as_int(const value_type &val)
Definition: traits.h:52
std::int64_t integer_type
Definition: traits.h:19
value::object object
Definition: picojson.h:210
std::string parse(value &out, Iter &pos, const Iter &last)
Definition: picojson.h:1098
static std::string serialize(const value_type &val)
Definition: traits.h:75
type
Generic JSON types used in JWTs.
Definition: jwt.h:1794
static string_type as_string(const value_type &val)
Definition: traits.h:47
static object_type as_object(const value_type &val)
Definition: traits.h:37
value::array array
Definition: picojson.h:209
static boolean_type as_bool(const value_type &val)
Definition: traits.h:60
json::array array_type
Definition: traits.h:16
json::value value_type
Definition: traits.h:14
json::object object_type
Definition: traits.h:15