Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
jsonl.h
1#ifndef SOURCEMETA_CORE_JSONL_H_
2#define SOURCEMETA_CORE_JSONL_H_
3
4#ifndef SOURCEMETA_CORE_JSONL_EXPORT
5#include <sourcemeta/core/jsonl_export.h>
6#endif
7
8#include <sourcemeta/core/json.h>
9
10// NOLINTBEGIN(misc-include-cleaner)
11#include <sourcemeta/core/jsonl_iterator.h>
12// NOLINTEND(misc-include-cleaner)
13
14#include <cstdint> // std::uint8_t
15#include <istream> // std::basic_istream
16#include <memory> // std::unique_ptr
17
32
33namespace sourcemeta::core {
34
37class SOURCEMETA_CORE_JSONL_EXPORT JSONL {
38public:
40 enum class Mode : std::uint8_t {
42 Raw,
45 };
46
70 JSONL(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
71 Mode mode = Mode::Raw);
72 ~JSONL();
73
74 JSONL(const JSONL &) = delete;
75 auto operator=(const JSONL &) -> JSONL & = delete;
76 JSONL(JSONL &&) = delete;
77 auto operator=(JSONL &&) -> JSONL & = delete;
78
79 using const_iterator = ConstJSONLIterator;
80 auto begin() -> const_iterator;
81 auto end() -> const_iterator;
82 auto cbegin() -> const_iterator;
83 auto cend() -> const_iterator;
84
85private:
86// Exporting symbols that depends on the standard C++ library is considered
87// safe.
88// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN
89#if defined(_MSC_VER)
90#pragma warning(disable : 4251)
91#endif
92 std::basic_istream<JSON::Char, JSON::CharTraits> *stream;
93 struct Internal;
94 std::unique_ptr<Internal> internal;
95#if defined(_MSC_VER)
96#pragma warning(default : 4251)
97#endif
98};
99
100} // namespace sourcemeta::core
101
102#endif
@ GZIP
The gzip coding per RFC 9110 ยง8.4.1.3.
Definition http.h:46
JSONL(std::basic_istream< JSON::Char, JSON::CharTraits > &stream, Mode mode=Mode::Raw)
Mode
The mode of operation for the JSONL parser.
Definition jsonl.h:40
@ Raw
The input stream contains raw JSONL text.
Definition jsonl.h:42
Definition jsonl_iterator.h:23