1 #include "simdjson/error.h"
4 namespace SIMDJSON_IMPLEMENTATION {
10 class raw_json_string;
11 class document_stream;
18 static constexpr
size_t DEFAULT_BATCH_SIZE = 1000000;
27 static constexpr
size_t MINIMAL_BATCH_SIZE = 32;
45 simdjson_inline
parser &operator=(
const parser &other) =
delete;
46 simdjson_inline
parser &operator=(
parser &&other) noexcept =
default;
235 simdjson_inline
size_t capacity() const noexcept;
238 simdjson_inline
void set_max_capacity(
size_t max_capacity) noexcept;
245 simdjson_inline
size_t max_depth() const noexcept;
261 #ifdef SIMDJSON_THREADS_ENABLED
321 size_t _max_capacity;
323 std::unique_ptr<uint8_t[]> string_buf{};
324 #if SIMDJSON_DEVELOPMENT_CHECKS
325 std::unique_ptr<token_position[]> start_positions{};
328 friend class json_iterator;
329 friend class document_stream;
A forward-only stream of documents.
A JSON fragment iterator.
simdjson_inline size_t max_capacity() const noexcept
The maximum capacity of this parser (the largest document it is allowed to process).
simdjson_warn_unused simdjson_result< document > iterate(padded_string_view json) &noexcept
Start iterating an on-demand JSON document.
simdjson_inline simdjson_result< std::string_view > unescape(raw_json_string in, uint8_t *&dst, bool allow_replacement=false) const noexcept
Unescape this JSON string, replacing \ with \, with newline, etc.
~parser() noexcept=default
Deallocate the JSON parser.
parser(size_t max_capacity=SIMDJSON_MAXSIZE_BYTES) noexcept
Create a JSON parser.
simdjson_result< document_stream > iterate_many(const uint8_t *buf, size_t len, size_t batch_size=DEFAULT_BATCH_SIZE) noexcept
Parse a buffer containing many JSON documents.
simdjson_inline simdjson_result< std::string_view > unescape_wobbly(raw_json_string in, uint8_t *&dst) const noexcept
Unescape this JSON string, replacing \ with \, with newline, etc.
simdjson_inline size_t max_depth() const noexcept
The maximum depth of this parser (the most deeply nested objects and arrays it can process).
simdjson_warn_unused error_code allocate(size_t capacity, size_t max_depth=DEFAULT_MAX_DEPTH) noexcept
Ensure this parser has enough memory to process JSON documents up to capacity bytes in length and max...
simdjson_inline size_t capacity() const noexcept
The capacity of this parser (the largest document it can process).
A string escaped per JSON rules, terminated with quote (").
An implementation of simdjson for a particular CPU architecture.
User-provided string that promises it has extra padded bytes at the end for use with parser::parse().
@ object
A JSON object ( { "a": 1, "b" 2, ... } )
@ array
A JSON array ( [ 1, 2, 3 ... ] )
We want to support argument-dependent lookup (ADL).
constexpr size_t DEFAULT_MAX_DEPTH
By default, simdjson supports this many nested objects and arrays.
error_code
All possible errors returned by simdjson.
constexpr size_t SIMDJSON_MAXSIZE_BYTES
The maximum document size supported by simdjson.
The result of a simdjson operation that could fail.
String with extra allocation for ease of use with parser::parse()
The result of a simdjson operation that could fail.
simdjson_inline error_code error() const noexcept
The error.
simdjson_inline T & value() &noexcept(false)
Get the result value.