|
xrpld
|
JSON (JavaScript Object Notation). More...
Namespaces | |
| namespace | detail |
Classes | |
| class | Compact |
| Decorator for streaming out compact json. More... | |
| class | DefaultValueAllocator |
| struct | DummyValueAllocatorInitializer |
| struct | Error |
| class | FastWriter |
| Outputs a Value in JSON format without formatting (not human friendly). More... | |
| struct | JsonMissingKeyError |
| struct | JsonTypeMismatchError |
| class | Reader |
| Unserialize a JSON document into a Value. More... | |
| class | StaticString |
| Lightweight wrapper to tag static string. More... | |
| class | StyledStreamWriter |
| Writes a Value in JSON format in a human friendly way, to a stream rather than to a string. More... | |
| class | StyledWriter |
| Writes a Value in JSON format in a human friendly way. More... | |
| class | Value |
| Represents a JSON value. More... | |
| class | ValueAllocator |
| Experimental do not use: Allocator to customize member name and string value memory management done by Value. More... | |
| class | ValueConstIterator |
| const iterator for object and array value. More... | |
| class | ValueIterator |
| Iterator for object and array value. More... | |
| class | ValueIteratorBase |
| base class for Value iterators. More... | |
| class | WriterBase |
| Abstract class for writers. More... | |
Typedefs | |
| using | Int = int |
| using | UInt = unsigned int |
| using | Output = std::function<void(std::string_view)> |
Enumerations | |
| enum class | ValueType { Null = 0 , Int , UInt , Real , String , Boolean , Array , Object } |
| Type of the value held by a Value object. More... | |
Functions | |
| std::istream & | operator>> (std::istream &, Value &) |
| Read from 'sin' into 'root'. | |
| bool | operator== (StaticString x, StaticString y) |
| bool | operator== (std::string const &x, StaticString y) |
| bool | operator== (StaticString x, std::string const &y) |
| Value | toJson (xrpl::Number const &number) |
| bool | operator== (Value const &x, Value const &y) |
| template<class T> requires std::convertible_to<T const&, std::string_view> && (!std::same_as<T, std::nullptr_t>) | |
| bool | operator== (Value const &value, T const &text) |
| Compares a value with the characters of a string, in place. | |
| bool | operator< (Value const &x, Value const &y) |
| bool | operator<= (Value const &x, Value const &y) |
| bool | operator> (Value const &x, Value const &y) |
| bool | operator>= (Value const &x, Value const &y) |
| std::string | valueToString (Int value) |
| std::string | valueToString (UInt value) |
| std::string | valueToString (double value) |
| std::string | valueToString (bool value) |
| std::string | valueToQuotedString (char const *value) |
| std::ostream & | operator<< (std::ostream &, Value const &root) |
| Output using the StyledStreamWriter. | |
| template<class Write> | |
| void | stream (json::Value const &jv, Write const &write) |
| Stream compact JSON to the specified function. | |
| Output | stringOutput (std::string &s) |
| std::string | to_string (Value const &) |
| Writes a json::Value to an std::string. | |
| std::string | pretty (Value const &) |
| Writes a json::Value to an std::string. | |
| template<> | |
| xrpl::AccountID | getOrThrow (json::Value const &v, xrpl::SField const &field) |
| template<class T> | |
| T | getOrThrow (json::Value const &v, xrpl::SField const &field) |
| template<> | |
| std::string | getOrThrow (json::Value const &v, xrpl::SField const &field) |
| template<> | |
| bool | getOrThrow (json::Value const &v, xrpl::SField const &field) |
| template<> | |
| std::uint64_t | getOrThrow (json::Value const &v, xrpl::SField const &field) |
| template<> | |
| xrpl::Buffer | getOrThrow (json::Value const &v, xrpl::SField const &field) |
| template<class T> | |
| std::optional< T > | getOptional (json::Value const &v, xrpl::SField const &field) |
| template<> | |
| xrpl::PublicKey | getOrThrow (json::Value const &v, xrpl::SField const &field) |
| template<> | |
| xrpl::STAmount | getOrThrow (json::Value const &v, xrpl::SField const &field) |
| static std::string | codePointToUTF8 (unsigned int cp) |
| static ValueAllocator *& | valueAllocator () |
| static int | integerCmp (Int i, UInt ui) |
| static bool | isControlCharacter (char ch) |
| static bool | containsControlCharacter (char const *str) |
| static void | uintToString (unsigned int value, char *¤t) |
Variables | |
| static struct json::DummyValueAllocatorInitializer | gDummyValueAllocatorInitializer |
JSON (JavaScript Object Notation).
| using json::Int = int |
Definition at line 6 of file json_forwards.h.
| using json::UInt = unsigned int |
Definition at line 7 of file json_forwards.h.
| using json::Output = std::function<void(std::string_view)> |
|
strong |
Type of the value held by a Value object.
Definition at line 25 of file json_value.h.
| std::istream & json::operator>> | ( | std::istream & | sin, |
| Value & | root ) |
Read from 'sin' into 'root'.
Always keep comments from the input JSON.
This can be used to read a file into a particular sub-object. For example:
Result:
* {
* "dir": {
* "file": {
* // The input stream JSON would be nested here.
* }
* }
* }
* | std::exception | on parse error. |
Definition at line 916 of file json_reader.cpp.
| bool json::operator== | ( | StaticString | x, |
| StaticString | y ) |
Definition at line 75 of file json_value.h.
| bool json::operator== | ( | std::string const & | x, |
| StaticString | y ) |
Definition at line 81 of file json_value.h.
| bool json::operator== | ( | StaticString | x, |
| std::string const & | y ) |
Definition at line 87 of file json_value.h.
| Value json::toJson | ( | xrpl::Number const & | number | ) |
Definition at line 491 of file json_value.h.
Definition at line 447 of file json_value.cpp.
| bool json::operator== | ( | Value const & | value, |
| T const & | text ) |
Compares a value with the characters of a string, in place.
Any right-hand side that converts to a string view takes this path: a literal, a char const*, a std::string or a view. Deduction matches each exactly, ahead of its conversion to a Value. A 0 deduces as int, which no view accepts, and nullptr is excluded, so both compare through Value like every other type.
| T | A type that converts to std::string_view, except std::nullptr_t. |
| value | The value to compare. |
| text | The characters to compare it against. A null pointer reads as empty text. |
Definition at line 519 of file json_value.h.
Definition at line 391 of file json_value.cpp.
Definition at line 541 of file json_value.h.
Definition at line 548 of file json_value.h.
Definition at line 554 of file json_value.h.
| std::string json::valueToString | ( | Int | value | ) |
Definition at line 49 of file json_writer.cpp.
| std::string json::valueToString | ( | UInt | value | ) |
Definition at line 68 of file json_writer.cpp.
| std::string json::valueToString | ( | double | value | ) |
Definition at line 78 of file json_writer.cpp.
| std::string json::valueToString | ( | bool | value | ) |
Definition at line 95 of file json_writer.cpp.
| std::string json::valueToQuotedString | ( | char const * | value | ) |
Definition at line 101 of file json_writer.cpp.
| std::ostream & json::operator<< | ( | std::ostream & | sout, |
| Value const & | root ) |
Output using the StyledStreamWriter.
Definition at line 721 of file json_writer.cpp.
| void json::stream | ( | json::Value const & | jv, |
| Write const & | write ) |
Stream compact JSON to the specified function.
| jv | The json::Value to write |
| write | Invocable with signature void(void const*, std::size_t) that is called when output should be written to the stream. |
Definition at line 285 of file json_writer.h.
| Output json::stringOutput | ( | std::string & | s | ) |
| std::string json::to_string | ( | Value const & | value | ) |
Writes a json::Value to an std::string.
Definition at line 10 of file to_string.cpp.
| std::string json::pretty | ( | Value const & | value | ) |
Writes a json::Value to an std::string.
Definition at line 16 of file to_string.cpp.
| xrpl::AccountID json::getOrThrow | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 126 of file AccountID.h.
| T json::getOrThrow | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 59 of file json_get_or_throw.h.
| std::string json::getOrThrow | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 66 of file json_get_or_throw.h.
| bool json::getOrThrow | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 82 of file json_get_or_throw.h.
| std::uint64_t json::getOrThrow | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 99 of file json_get_or_throw.h.
| xrpl::Buffer json::getOrThrow | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 132 of file json_get_or_throw.h.
| std::optional< T > json::getOptional | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 147 of file json_get_or_throw.h.
| xrpl::PublicKey json::getOrThrow | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 286 of file PublicKey.h.
| xrpl::STAmount json::getOrThrow | ( | json::Value const & | v, |
| xrpl::SField const & | field ) |
Definition at line 830 of file STAmount.h.
|
static |
Definition at line 23 of file json_reader.cpp.
|
static |
Definition at line 72 of file json_value.cpp.
Definition at line 379 of file json_value.cpp.
|
static |
Definition at line 20 of file json_writer.cpp.
|
static |
Definition at line 26 of file json_writer.cpp.
|
static |
Definition at line 37 of file json_writer.cpp.
|
static |