JsonCpp project page | Classes | Namespace | JsonCpp home page

Classes | Public Member Functions | Protected Member Functions | List of all members
Json::CharReader Class Reference

Interface for reading JSON from a char array. More...

`#include <json/reader.h>`

Inheritance diagram for Json::CharReader:
Collaboration diagram for Json::CharReader:

## Classes
struct | StructuredError
class | Factory
class | Impl

## Public Member Functions
virtual | ~CharReader ()=default
virtual bool | parse (char const *beginDoc, char const *endDoc, Value *root, String *errs)
| Read a Value from a JSON document.
std::vector< StructuredError > | getStructuredErrors () const
| Returns a vector of structured errors encountered while parsing.

## Protected Member Functions
| CharReader (std::unique_ptr< Impl > impl)

## Detailed Description

Interface for reading JSON from a char array.

Definition at line 248 of file reader.h.

## Constructor & Destructor Documentation

## ◆ ~CharReader()

virtual Json::CharReader::~CharReader | ( |  | ) |
| virtual default

References getStructuredErrors(), and parse().

## ◆ CharReader()

Json::CharReader::CharReader | ( | std::unique_ptr< Impl > | impl | ) |
| inline explicit protected

Definition at line 299 of file reader.h.

Referenced by Json::CharReader::Factory::newCharReader().

Here is the caller graph for this function:

## Member Function Documentation

## ◆ getStructuredErrors()

std::vector< CharReader::StructuredError > Json::CharReader::getStructuredErrors | ( |  | ) | const

Returns a vector of structured errors encountered while parsing.

Each parse call resets the stored list of errors.

Definition at line 1994 of file json_reader.cpp.

References getStructuredErrors().

Referenced by getStructuredErrors(), and ~CharReader().

Here is the caller graph for this function:

## ◆ parse()

bool Json::CharReader::parse | ( | char const * | beginDoc,
|  | char const * | endDoc,
|  | Value * | root,
|  | String * | errs )
| virtual

Read a Value from a JSON document.

The document must be a UTF-8 encoded string containing the document to read.

Parameters

  | beginDoc | Pointer on the beginning of the UTF-8 encoded string of the document to read.
  | endDoc | Pointer on the end of the UTF-8 encoded string of the document to read. Must be >= beginDoc.
  [out] | root | Contains the root value of the document if it was successfully parsed.
  [out] | errs | Formatted error messages (if not NULL) a user friendly string that lists errors in the parsed document.

Returns
  `true` if the document was successfully parsed, `false` if an error occurred.

Definition at line 1998 of file json_reader.cpp.

References parse().

Referenced by parse(), and ~CharReader().

Here is the caller graph for this function:

The documentation for this class was generated from the following files:

- include/json/reader.h
- src/lib_json/json_reader.cpp