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
class | Factory
class | Impl
struct | StructuredError

## 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 245 of file reader.h.

## Constructor & Destructor Documentation

## ◆ ~CharReader()

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

## ◆ CharReader()

Json::CharReader::CharReader | ( | std::unique_ptr< Impl > | impl | ) |
| inlineexplicitprotected

Definition at line 296 of file reader.h.

## 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 1982 of file json_reader.cpp.

## ◆ 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 1986 of file json_reader.cpp.

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

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