#include <bdljsn_stringutil.h>
This class provides utility functions for converting arbitrary UTF-8 sequences into JSON strings and visa versa. See JSON Strings for details of these transformations.
See bdljsn_stringutil
|
| static int | readString (bsl::string *value, const bsl::string_view &string, int flags=e_NONE) |
| |
| static int | readString (std::string *value, const bsl::string_view &string, int flags=e_NONE) |
| |
| static int | readUnquotedString (bsl::string *value, const bsl::string_view &string, int flags=e_NONE) |
| |
| static int | readUnquotedString (std::string *value, const bsl::string_view &string, int flags=e_NONE) |
| |
| static int | writeString (bsl::ostream &stream, const bsl::string_view &string, int flags=e_NONE) |
| |
◆ Flags
| Enumerator |
|---|
| e_NONE | |
| e_ACCEPT_CAPITAL_UNICODE_ESCAPE | |
| e_NO_ESCAPING_FORWARD_SLASH | |
◆ readString() [1/2]
Load to the specified value the UTF-8 codepoint sequence equivalent to the specified (JSON) string (see JSON Strings ). Return 0 on success and a non-zero value otherwise. Optionally specify flags to request variances from certain rules of JSON decoding (see Strictness ).
◆ readString() [2/2]
| int bdljsn::StringUtil::readString |
( |
std::string * |
value, |
|
|
const bsl::string_view & |
string, |
|
|
int |
flags = e_NONE |
|
) |
| |
|
inlinestatic |
◆ readUnquotedString() [1/2]
Load to the specified value the UTF-8 codepoint sequence equivalent to the specified string, that is JSON-compliant absent the leading and trailing double quote characters (see JSON Strings ). Return 0 on success and a non-zero value otherwise. Optionally specify flags to request variances from certain rules of JSON decoding (see Strictness ).
◆ readUnquotedString() [2/2]
| static int bdljsn::StringUtil::readUnquotedString |
( |
std::string * |
value, |
|
|
const bsl::string_view & |
string, |
|
|
int |
flags = e_NONE |
|
) |
| |
|
static |
◆ writeString()
| static int bdljsn::StringUtil::writeString |
( |
bsl::ostream & |
stream, |
|
|
const bsl::string_view & |
string, |
|
|
int |
flags = e_NONE |
|
) |
| |
|
static |
Write to the specified stream a JSON-compliant string that is equivalent to the specified string, an arbitrary UTF-8 codepoint sequence. Return 0 on success and a non-zero value otherwise. The operation fails if string is not a sequence of UTF-8 codepoints or if there is an error writing to stream. See Guarantees: Arbitrary UTF-8 to JSON String for further details.
The documentation for this struct was generated from the following file: