Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit 579430ad1f.
PrevUpHomeNext
basic_parser::write_some (1 of 2 overloads)

Parse some of an input string as JSON, incrementally.

Synopsis
std::size_t
write_some(
    bool more,
    char const* data,
    std::size_t size,
    system::error_code& ec);
Description

This function parses the JSON in the specified buffer, calling the handler to emit each SAX parsing event. The parse proceeds from the current state, which is at the beginning of a new JSON or in the middle of the current JSON if any characters were already parsed.

The characters in the buffer are processed starting from the beginning, until one of the following conditions is met:

The supplied buffer does not need to contain the entire JSON. Subsequent calls can provide more serialized data, allowing JSON to be processed incrementally. The end of the serialized JSON can be indicated by passing more = false.

Complexity

Linear in size.

Exception Safety

Basic guarantee. Calls to the handler may throw. Upon error or exception, subsequent calls will fail until reset is called to parse a new JSON.

Return Value

The number of characters successfully parsed, which may be smaller than size.

Parameters

Name

Description

more

true if there are possibly more buffers in the current JSON, otherwise false.

data

A pointer to a buffer of size characters to parse.

size

The number of characters pointed to by data.

ec

Set to the error, if any occurred.


PrevUpHomeNext