JSON write value. More...
Classes | |
union | number |
Public Types | |
using | object = std::unordered_map< std::string, wvalue > |
using | list = std::vector< wvalue > |
Public Member Functions | |
type | t () const |
wvalue () | |
wvalue (std::nullptr_t) | |
wvalue (bool value) | |
wvalue (std::uint8_t value) | |
wvalue (std::uint16_t value) | |
wvalue (std::uint32_t value) | |
wvalue (std::uint64_t value) | |
wvalue (std::int8_t value) | |
wvalue (std::int16_t value) | |
wvalue (std::int32_t value) | |
wvalue (std::int64_t value) | |
wvalue (float value) | |
wvalue (double value) | |
wvalue (char const *value) | |
wvalue (std::string const &value) | |
wvalue (std::string &&value) | |
wvalue (std::initializer_list< std::pair< std::string const, wvalue >> initializer_list) | |
wvalue (object const &value) | |
wvalue (object &&value) | |
wvalue (const list &r) | |
wvalue (list &r) | |
wvalue (const rvalue &r) | |
Create a write value from a read value (useful for editing JSON strings). More... | |
wvalue (const wvalue &r) | |
wvalue (wvalue &&r) | |
wvalue & | operator= (wvalue &&r) |
void | clear () |
Used for compatibility, same as reset() More... | |
void | reset () |
wvalue & | operator= (std::nullptr_t) |
wvalue & | operator= (bool value) |
wvalue & | operator= (double value) |
wvalue & | operator= (unsigned short value) |
wvalue & | operator= (short value) |
wvalue & | operator= (long long value) |
wvalue & | operator= (long value) |
wvalue & | operator= (int value) |
wvalue & | operator= (unsigned long long value) |
wvalue & | operator= (unsigned long value) |
wvalue & | operator= (unsigned int value) |
wvalue & | operator= (const char *str) |
wvalue & | operator= (const std::string &str) |
wvalue & | operator= (list &&v) |
template<typename T > | |
wvalue & | operator= (const std::vector< T > &v) |
wvalue & | operator= (std::initializer_list< std::pair< std::string const, wvalue >> initializer_list) |
wvalue & | operator= (object const &value) |
wvalue & | operator= (object &&value) |
wvalue & | operator= (std::function< std::string(std::string &)> &&func) |
wvalue & | operator[] (unsigned index) |
int | count (const std::string &str) |
wvalue & | operator[] (const std::string &str) |
std::vector< std::string > | keys () const |
std::string | execute (std::string txt="") const |
std::size_t | size () const |
If the wvalue is a list, it returns the length of the list, otherwise it returns 1. More... | |
size_t | estimate_length () const |
Returns an estimated size of the value in bytes. More... | |
std::string | dump () const |
Public Attributes | |
std::string | content_type |
Private Member Functions | |
void | dump_string (const std::string &str, std::string &out) const |
void | dump_internal (const wvalue &v, std::string &out) const |
Private Attributes | |
type | t_ {type::Null} |
The type of the value. More... | |
num_type | nt {num_type::Null} |
The specific type of the number if t_ is a number. More... | |
union crow::json::wvalue::number | num |
Value if type is a number. More... | |
std::string | s |
Value if type is a string. More... | |
std::unique_ptr< list > | l |
Value if type is a list. More... | |
std::unique_ptr< object > | o |
Value if type is a JSON object. More... | |
std::function< std::string(std::string &)> | f |
Value if type is a function (C++ lambda) More... | |
Friends | |
class | crow::mustache::template_t |
JSON write value.
Value can mean any json value, including a JSON object.
Write means this class is used to primarily assemble JSON objects using keys and values and export those into a string.
using crow::json::wvalue::object = std::unordered_map<std::string, wvalue> |
using crow::json::wvalue::list = std::vector<wvalue> |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Create a write value from a read value (useful for editing JSON strings).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
If the wvalue is a list, it returns the length of the list, otherwise it returns 1.
|
inline |
Returns an estimated size of the value in bytes.
|
inlineprivate |
|
inlineprivate |
|
inlinevirtual |
|
friend |
|
private |
The type of the value.
|
private |
The specific type of the number if t_ is a number.
|
private |
Value if type is a number.
|
private |
Value if type is a string.
|
private |
Value if type is a list.
|
private |
Value if type is a JSON object.
|
private |
Value if type is a function (C++ lambda)
|
inherited |