BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdljsn::JsonUtil Struct Reference

#include <bdljsn_jsonutil.h>

Detailed Description

This struct provides a namespace for utility functions that provide read and write operations to/from Json objects.

See bdljsn_jsonutil

Public Types

typedef bsl::pair< bsl::uint64_t, bsl::uint64_t > LineAndColumnNumber
 

Static Public Member Functions

static int read (Json *result, bsl::istream &input)
 
static int read (Json *result, bsl::istream &input, const ReadOptions &options)
 
static int read (Json *result, bsl::streambuf *input)
 
static int read (Json *result, bsl::streambuf *input, const ReadOptions &options)
 
static int read (Json *result, const bsl::string_view &input)
 
static int read (Json *result, const bsl::string_view &input, const ReadOptions &options)
 
static int read (Json *result, Error *errorDescription, bsl::istream &input)
 
static int read (Json *result, Error *errorDescription, bsl::istream &input, const ReadOptions &options)
 
static int read (Json *result, Error *errorDescription, bsl::streambuf *input)
 
static int read (Json *result, Error *errorDescription, bsl::streambuf *input, const ReadOptions &options)
 
static int read (Json *result, Error *errorDescription, const bsl::string_view &input)
 
static int read (Json *result, Error *errorDescription, const bsl::string_view &input, const ReadOptions &options)
 
static bsl::ostream & printError (bsl::ostream &stream, bsl::istream &input, const Error &error)
 
static bsl::ostream & printError (bsl::ostream &stream, bsl::streambuf *input, const Error &error)
 
static bsl::ostream & printError (bsl::ostream &stream, const bsl::string_view &input, const Error &error)
 
static int write (bsl::ostream &output, const Json &json)
 
static int write (bsl::ostream &output, const Json &json, const WriteOptions &options)
 
static int write (bsl::streambuf *output, const Json &json)
 
static int write (bsl::streambuf *output, const Json &json, const WriteOptions &options)
 
static int write (bsl::string *output, const Json &json)
 
static int write (bsl::string *output, const Json &json, const WriteOptions &options)
 
static int write (std::string *output, const Json &json)
 
static int write (std::string *output, const Json &json, const WriteOptions &options)
 

Member Typedef Documentation

◆ LineAndColumnNumber

typedef bsl::pair<bsl::uint64_t, bsl::uint64_t> bdljsn::JsonUtil::LineAndColumnNumber

Member Function Documentation

◆ printError() [1/3]

bsl::ostream & bdljsn::JsonUtil::printError ( bsl::ostream &  stream,
bsl::istream &  input,
const Error &  error 
)
inlinestatic

Print, to the specified stream, a description of the specified error, containing the line and column in the specified input where the error occurred. Return a reference to the modifiable stream. If error.location() does not refer to a valid location in input an unspecified error description will be written to stream.

Note
Note that the caller should ensure input refers to the same input position as when input was supplied to read (or whatever operation created error).

◆ printError() [2/3]

static bsl::ostream & bdljsn::JsonUtil::printError ( bsl::ostream &  stream,
bsl::streambuf *  input,
const Error &  error 
)
static

◆ printError() [3/3]

bsl::ostream & bdljsn::JsonUtil::printError ( bsl::ostream &  stream,
const bsl::string_view &  input,
const Error &  error 
)
inlinestatic

◆ read() [1/12]

int bdljsn::JsonUtil::read ( Json *  result,
bsl::istream &  input 
)
inlinestatic

Load to the specified result a value-semantic representation of the JSON text in the specified input. Optionally specify an errorDescription that, if an error occurs, is loaded with a description of the error. Optionally specify options which allow altering the maximum nesting depth. Return 0 on success, and a non-zero value if input does not consist of valid JSON text or an error occurs when reading from input. If options.allowTrailingText() is false (the default), then an error will be reported if a valid JSON text is followed by any text that does not consist solely of white-space characters. If options.allowTrailingText() is true, then this function will return success where a valid JSON document is followed by additional text as long as that text is separated from the valid JSON by a delimiter character (i.e., either the JSON text ends in a delimiter, or the text that follows starts with a delimiter). Here, delimiters are white-space characters, [,],{,},,, or ".

◆ read() [2/12]

int bdljsn::JsonUtil::read ( Json *  result,
bsl::istream &  input,
const ReadOptions &  options 
)
inlinestatic

◆ read() [3/12]

int bdljsn::JsonUtil::read ( Json *  result,
bsl::streambuf *  input 
)
inlinestatic

◆ read() [4/12]

int bdljsn::JsonUtil::read ( Json *  result,
bsl::streambuf *  input,
const ReadOptions &  options 
)
inlinestatic

◆ read() [5/12]

int bdljsn::JsonUtil::read ( Json *  result,
const bsl::string_view &  input 
)
inlinestatic

◆ read() [6/12]

int bdljsn::JsonUtil::read ( Json *  result,
const bsl::string_view &  input,
const ReadOptions &  options 
)
inlinestatic

◆ read() [7/12]

int bdljsn::JsonUtil::read ( Json *  result,
Error *  errorDescription,
bsl::istream &  input 
)
inlinestatic

◆ read() [8/12]

int bdljsn::JsonUtil::read ( Json *  result,
Error *  errorDescription,
bsl::istream &  input,
const ReadOptions &  options 
)
inlinestatic

◆ read() [9/12]

int bdljsn::JsonUtil::read ( Json *  result,
Error *  errorDescription,
bsl::streambuf *  input 
)
inlinestatic

◆ read() [10/12]

static int bdljsn::JsonUtil::read ( Json *  result,
Error *  errorDescription,
bsl::streambuf *  input,
const ReadOptions &  options 
)
static

◆ read() [11/12]

int bdljsn::JsonUtil::read ( Json *  result,
Error *  errorDescription,
const bsl::string_view &  input 
)
inlinestatic

◆ read() [12/12]

int bdljsn::JsonUtil::read ( Json *  result,
Error *  errorDescription,
const bsl::string_view &  input,
const ReadOptions &  options 
)
inlinestatic

◆ write() [1/8]

int bdljsn::JsonUtil::write ( bsl::ostream &  output,
const Json &  json 
)
inlinestatic

◆ write() [2/8]

static int bdljsn::JsonUtil::write ( bsl::ostream &  output,
const Json &  json,
const WriteOptions &  options 
)
static

◆ write() [3/8]

int bdljsn::JsonUtil::write ( bsl::streambuf *  output,
const Json &  json 
)
inlinestatic

◆ write() [4/8]

int bdljsn::JsonUtil::write ( bsl::streambuf *  output,
const Json &  json,
const WriteOptions &  options 
)
inlinestatic

◆ write() [5/8]

int bdljsn::JsonUtil::write ( bsl::string *  output,
const Json &  json 
)
inlinestatic

◆ write() [6/8]

int bdljsn::JsonUtil::write ( bsl::string *  output,
const Json &  json,
const WriteOptions &  options 
)
inlinestatic

◆ write() [7/8]

int bdljsn::JsonUtil::write ( std::string *  output,
const Json &  json 
)
inlinestatic

Write to the specified output a JSON text representation of the specified json document, using the optionally specified options for formatting the resulting text. Return 0 on success, and a non-zero value otherwise.

Note
Note that this operation will report an error only if there is an error writing to output.

◆ write() [8/8]

int bdljsn::JsonUtil::write ( std::string *  output,
const Json &  json,
const WriteOptions &  options 
)
inlinestatic

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