|
BDE 4.14.0 Production release
|
#include <bdljsn_stringutil.h>
Public Types | |
| enum | Flags { e_NONE = 0 , e_ACCEPT_CAPITAL_UNICODE_ESCAPE = 1 << 0 } |
Static Public Member Functions | |
| static int | readString (bsl::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 | writeString (bsl::ostream &stream, const bsl::string_view &string) |
This class provides utility functions for converting arbitrary UTF-8 sequences into JSON strings and visa versa. See {JSON Strings} in {DESCRIPTION} for details of these transformations.
|
inlinestatic |
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}).
|
static |
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}).
|
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 {Conventions: Arbitrary UTF-8 to JSON String} for further details.