Quick Links:

bal | bbl | bdl | bsl

Public Types | Static Public Member Functions

bdljsn::StringUtil Struct Reference

#include <bdljsn_stringutil.h>

List of all members.

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)

Detailed Description

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.

See Component bdljsn_stringutil


Member Enumeration Documentation

Enumerator:
e_NONE 
e_ACCEPT_CAPITAL_UNICODE_ESCAPE 

Member Function Documentation

static int bdljsn::StringUtil::readString ( bsl::string value,
const bsl::string_view &  string,
int  flags = e_NONE 
) [static]

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 int bdljsn::StringUtil::readUnquotedString ( bsl::string value,
const bsl::string_view &  string,
int  flags = e_NONE 
) [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 int bdljsn::StringUtil::writeString ( bsl::ostream &  stream,
const bsl::string_view &  string 
) [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.


The documentation for this struct was generated from the following file: