JSON value. A container that holds a single bool, int64, uint64, double, JSON string, JSON array, or JSON object. More...
#include </home/runner/work/metall/metall/include/metall/json/value.hpp>
Public Types | |
using | allocator_type = Alloc |
using | string_type = basic_string< char, std::char_traits< char >, typename std::allocator_traits< allocator_type >::template rebind_alloc< char > > |
using | object_type = object< Alloc > |
using | array_type = array< Alloc > |
Public Member Functions | |
value () | |
Constructor. | |
value (const allocator_type &alloc) | |
Constructor. | |
value (const value &other) | |
Copy constructor. | |
value (const value &other, const allocator_type &alloc) | |
Allocator-extended copy constructor. | |
value (value &&other) noexcept | |
Move constructor. | |
value (value &&other, const allocator_type &alloc) noexcept | |
Allocator-extended move constructor. | |
~value () noexcept | |
Destructor. | |
value & | operator= (const value &other) |
Copy assignment operator. | |
value & | operator= (value &&other) noexcept |
Move assignment operator. | |
void | swap (value &other) noexcept |
Swap contents. | |
value & | operator= (const bool b) |
Assign a bool value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const signed char i) |
Assign a char value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const short i) |
Assign a short value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const int i) |
Assign an int value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const long i) |
Assign a long value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const long long i) |
Assign a long long value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const unsigned char u) |
Assign an unsigned char value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const unsigned short u) |
Assign an unsigned short value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const unsigned int u) |
Assign an unsigned int value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const unsigned long u) |
Assign an unsigned long value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const unsigned long long u) |
Assign an unsigned long long value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (std::nullptr_t) |
Assign a null value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const double d) |
Assign a double value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (std::string_view s) |
Assign a std::string_view value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const char *const s) |
Assign a const char* value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const string_type &s) |
Assign a string_type value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (string_type &&s) |
Assign a string_type value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const array_type &arr) |
Assign an array_type value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (array_type &&arr) |
Assign an array_type value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (const object_type &obj) |
Assign an object_type value. Allocates a memory storage or destroy the old content, if necessary. | |
value & | operator= (object_type &&obj) |
Assign an object_type value. Allocates a memory storage or destroy the old content, if necessary. | |
void | emplace_null () |
Set a null. The old content is destroyed. | |
bool & | emplace_bool () |
Set a bool and return a reference. The old content is destroyed. | |
std::int64_t & | emplace_int64 () |
Set a int64 and return a reference. The old content is destroyed. | |
std::uint64_t & | emplace_uint64 () |
Set a uint64 and return a reference. The old content is destroyed. | |
double & | emplace_double () |
Set a double and return a reference. The old content is destroyed. | |
string_type & | emplace_string () |
Set an empty string and return a reference. The old content is destroyed. | |
array_type & | emplace_array () |
Set an empty array and return a reference. The old content is destroyed. | |
object_type & | emplace_object () |
Set an empty object and return a reference. The old content is destroyed. | |
bool & | as_bool () |
Return a reference to the underlying bool, or throw an exception. | |
const bool & | as_bool () const |
Return a const reference to the underlying bool, or throw an exception. | |
std::int64_t & | as_int64 () |
Return a reference to the underlying std::int64_t, or throw an exception. | |
const std::int64_t & | as_int64 () const |
Return a const reference to the underlying std::int64_t, or throw an exception. | |
std::uint64_t & | as_uint64 () |
Return a reference to the underlying std::uint64_t, or throw an exception. | |
const std::uint64_t & | as_uint64 () const |
Return a const reference to the underlying std::uint64_t, or throw an exception. | |
double & | as_double () |
Return a reference to the underlying double, or throw an exception. | |
const double & | as_double () const |
Return a const reference to the underlying double, or throw an exception. | |
string_type & | as_string () |
Return a reference to the underlying string, or throw an exception. | |
const string_type & | as_string () const |
Return a const reference to the underlying string, or throw an exception. | |
array_type & | as_array () |
Return a reference to the underlying array, or throw an exception. | |
const array_type & | as_array () const |
Return a const reference to the underlying array, or throw an exception. | |
object_type & | as_object () |
Return a reference to the underlying object, or throw an exception. | |
const object_type & | as_object () const |
Return a const reference to the underlying object, or throw an exception. | |
bool | is_null () const noexcept |
Return true if this is a null. | |
bool | is_bool () const noexcept |
Return true if this is a bool. | |
bool | is_int64 () const noexcept |
Return true if this is a int64. | |
bool | is_uint64 () const noexcept |
Return true if this is a uint64. | |
bool | is_double () const noexcept |
Return true if this is a double. | |
bool | is_string () const noexcept |
Return true if this is a string. | |
bool | is_array () const noexcept |
Return true if this is an array. | |
bool | is_object () const noexcept |
Return true if this is a object. | |
allocator_type | get_allocator () const noexcept |
Return an allocator object. | |
Friends | |
bool | operator== (const value &lhs, const value &rhs) noexcept |
Equal operator. | |
bool | operator!= (const value &lhs, const value &rhs) noexcept |
Return true if two values are not equal. Two values are equal when they are the same kind and their referenced values are equal, or when they are both integral types and their integral representations are equal. | |
JSON value. A container that holds a single bool, int64, uint64, double, JSON string, JSON array, or JSON object.
using metall::json::value< Alloc >::allocator_type = Alloc |
using metall::json::value< Alloc >::string_type = basic_string<char, std::char_traits<char>, typename std::allocator_traits< allocator_type>::template rebind_alloc<char> > |
using metall::json::value< Alloc >::object_type = object<Alloc> |
using metall::json::value< Alloc >::array_type = array<Alloc> |
|
inline |
Constructor.
|
inlineexplicit |
Constructor.
alloc | An allocator object. |
|
inline |
Copy constructor.
|
inline |
Allocator-extended copy constructor.
|
inlinenoexcept |
Move constructor.
|
inlinenoexcept |
Allocator-extended move constructor.
|
inlinenoexcept |
Destructor.
|
inline |
Copy assignment operator.
|
inlinenoexcept |
Move assignment operator.
|
inlinenoexcept |
Swap contents.
|
inline |
Assign a bool value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a char value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a short value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an int value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a long value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a long long value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an unsigned char value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an unsigned short value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an unsigned int value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an unsigned long value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an unsigned long long value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a null value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a double value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a std::string_view value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a const char* value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a string_type value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign a string_type value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an array_type value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an array_type value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an object_type value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Assign an object_type value. Allocates a memory storage or destroy the old content, if necessary.
|
inline |
Set a null. The old content is destroyed.
|
inline |
Set a bool and return a reference. The old content is destroyed.
|
inline |
Set a int64 and return a reference. The old content is destroyed.
|
inline |
Set a uint64 and return a reference. The old content is destroyed.
|
inline |
Set a double and return a reference. The old content is destroyed.
|
inline |
Set an empty string and return a reference. The old content is destroyed.
|
inline |
Set an empty array and return a reference. The old content is destroyed.
|
inline |
Set an empty object and return a reference. The old content is destroyed.
|
inline |
Return a reference to the underlying bool, or throw an exception.
|
inline |
Return a const reference to the underlying bool, or throw an exception.
|
inline |
Return a reference to the underlying std::int64_t, or throw an exception.
|
inline |
Return a const reference to the underlying std::int64_t, or throw an exception.
|
inline |
Return a reference to the underlying std::uint64_t, or throw an exception.
|
inline |
Return a const reference to the underlying std::uint64_t, or throw an exception.
|
inline |
Return a reference to the underlying double, or throw an exception.
|
inline |
Return a const reference to the underlying double, or throw an exception.
|
inline |
Return a reference to the underlying string, or throw an exception.
|
inline |
Return a const reference to the underlying string, or throw an exception.
|
inline |
Return a reference to the underlying array, or throw an exception.
|
inline |
Return a const reference to the underlying array, or throw an exception.
|
inline |
Return a reference to the underlying object, or throw an exception.
|
inline |
Return a const reference to the underlying object, or throw an exception.
|
inlinenoexcept |
Return true if this is a null.
|
inlinenoexcept |
Return true if this is a bool.
|
inlinenoexcept |
Return true if this is a int64.
|
inlinenoexcept |
Return true if this is a uint64.
|
inlinenoexcept |
Return true if this is a double.
|
inlinenoexcept |
Return true if this is a string.
|
inlinenoexcept |
Return true if this is an array.
|
inlinenoexcept |
Return true if this is a object.
|
inlinenoexcept |
Return an allocator object.
|
friend |
Equal operator.
|
friend |
Return true
if two values are not equal. Two values are equal when they are the same kind and their referenced values are equal, or when they are both integral types and their integral representations are equal.