|
JWTXX
C++ library for JWT
|
Represents a JSON value that can hold any JSON type. More...
#include <value.h>
Classes | |
| class | Error |
| Value-specific exception. More... | |
| struct | Null |
| Represents a JSON null value. More... | |
Public Types | |
| using | Array = std::vector<Value> |
| Represents a JSON array (vector of Values). | |
| using | Object = std::unordered_map<std::string, Value> |
| Represents a JSON object (string to Value map). | |
Public Member Functions | |
| Value () noexcept | |
| Default constructor. Creates a null value. | |
| Value (bool v) noexcept | |
| Boolean constructor. | |
| Value (int64_t v) noexcept | |
| Integer constructor. | |
| Value (const char *v) noexcept | |
| C-string constructor. | |
| Value (std::string v) noexcept | |
| String constructor. | |
| Value (std::initializer_list< Array::value_type > vs) noexcept | |
| Array initializer list constructor. | |
| Value (Array v) noexcept | |
| Array constructor. | |
| Value (std::initializer_list< Object::value_type > vs) noexcept | |
| Object initializer list constructor. | |
| Value (Object v) noexcept | |
| Object constructor. | |
| Value (const Value &)=default | |
| Copy constructor. | |
| Value (Value &&)=default | |
| Move constructor. | |
| Value & | operator= (const Value &)=default |
| Copy assignment operator. | |
| Value & | operator= (Value &&)=default |
| Move assignment operator. | |
| ~Value ()=default | |
| Destructor. | |
| bool | isNull () const noexcept |
| Checks if the value is null. | |
| bool | isBool () const noexcept |
| Checks if the value is a boolean. | |
| bool | isInteger () const noexcept |
| Checks if the value is an integer. | |
| bool | isString () const noexcept |
| Checks if the value is a string. | |
| bool | isArray () const noexcept |
| Checks if the value is an array. | |
| bool | isObject () const noexcept |
| Checks if the value is an object. | |
| bool | getBool () const |
| Gets the boolean value. | |
| int64_t | getInteger () const |
| Gets the integer value. | |
| std::string | getString () const |
| Gets the string value. | |
| Array | getArray () const |
| Gets the array value. | |
| Object | getObject () const |
| Gets the object value. | |
| std::string | toString () const |
| Converts the value to its JSON string representation. | |
| template<typename F> | |
| auto | visit (F &&f) const |
| Applies a visitor function to the value. | |
Static Public Member Functions | |
| static Value | number (double v) noexcept |
| Creates a floating point number Value. | |
Represents a JSON value that can hold any JSON type.
Value can hold null, boolean, integer, floating point number, string, array, or object. Provides type-safe access with runtime type checking.
|
inlineexplicitnoexcept |
Boolean constructor.
| v | boolean value. |
|
inlineexplicitnoexcept |
Integer constructor.
| v | 64-bit integer value. |
|
inlineexplicitnoexcept |
C-string constructor.
| v | null-terminated C string. |
|
inlineexplicitnoexcept |
String constructor.
| v | string value. |
|
inlineexplicitnoexcept |
Array initializer list constructor.
| vs | initializer list of array elements. |
|
inlineexplicitnoexcept |
Object initializer list constructor.
| vs | initializer list of object key-value pairs. |
|
inlineexplicitnoexcept |
Object constructor.
| v | object value. |
|
inline |
|
inline |
|
inline |
Gets the integer value.
| Error | if the value is not an integer. |
|
inline |
|
inline |
|
inlinenoexcept |
Checks if the value is an array.
|
inlinenoexcept |
Checks if the value is a boolean.
|
inlinenoexcept |
Checks if the value is an integer.
|
inlinenoexcept |
Checks if the value is null.
|
inlinenoexcept |
Checks if the value is an object.
|
inlinenoexcept |
Checks if the value is a string.
|
inlinestaticnoexcept |
|
inline |
Converts the value to its JSON string representation.
|
inline |
Applies a visitor function to the value.
| F | visitor function type. |
| f | visitor function to apply. |