 |
simdjson
0.3.1
Ridiculously Fast JSON
|
1 #ifndef SIMDJSON_DOCUMENT_STREAM_H
2 #define SIMDJSON_DOCUMENT_STREAM_H
5 #include "simdjson/document.h"
7 namespace simdjson::dom {
62 really_inline
document_stream(dom::
parser &
parser, const uint8_t *buf,
size_t len,
size_t batch_size, error_code error = SUCCESS) noexcept;
90 inline error_code json_parse() noexcept;
99 inline
size_t get_current_buffer_loc()
const {
return current_buffer_loc; }
105 inline size_t get_n_parsed_docs()
const {
return n_parsed_docs; }
111 inline size_t get_n_bytes_parsed()
const {
return n_bytes_parsed; }
113 inline const uint8_t *buf()
const {
return _buf + buf_start; }
115 inline void advance(
size_t offset) { buf_start += offset; }
117 inline size_t remaining()
const {
return _len - buf_start; }
125 bool load_next_batch{
true};
126 size_t current_buffer_loc{0};
127 #ifdef SIMDJSON_THREADS_ENABLED
128 size_t last_json_buffer_loc{0};
130 size_t n_parsed_docs{0};
131 size_t n_bytes_parsed{0};
132 error_code error{SUCCESS_AND_HAS_MORE};
133 #ifdef SIMDJSON_THREADS_ENABLED
134 error_code stage1_is_ok_thread{SUCCESS};
135 std::thread stage_1_thread;
136 dom::parser parser_thread;
138 friend class dom::parser;
143 #endif // SIMDJSON_DOCUMENT_STREAM_H
An iterator through a forward-only stream of documents.
really_inline simdjson_result< element > operator*() noexcept
Get the current document (or error).
really_inline iterator begin() noexcept
Start iterating the documents in the stream.
The result of a simdjson operation that could fail.
iterator & operator++() noexcept
Advance to the next document.
A persistent document parser.
really_inline bool operator!=(const iterator &other) const noexcept
Check if we're at the end yet.
A forward-only stream of documents.
really_inline iterator end() noexcept
The end of the stream, for iterator comparison purposes.