tetengo 1.8.2
A multipurpose library set
Loading...
Searching...
No Matches
stream_reader.hpp
Go to the documentation of this file.
1
7#if !defined(TETENGO_JSON_STREAMREADER_HPP)
8#define TETENGO_JSON_STREAMREADER_HPP
9
10#include <cstddef> // IWYU pragma: keep
11#include <istream>
12#include <memory>
13
15
16
17namespace tetengo::json
18{
22 class stream_reader : public reader
23 {
24 public:
25 // static functions
26
32 [[nodiscard]] static std::size_t default_buffer_capacity();
33
34
35 // constructors and destructor
36
45 explicit stream_reader(
46 std::unique_ptr<std::istream>&& p_stream,
47 std::size_t buffer_capacity = default_buffer_capacity());
48
52 virtual ~stream_reader();
53
54
55 private:
56 // types
57
58 class impl;
59
60
61 // variables
62
63 const std::unique_ptr<impl> m_p_impl;
64
65
66 // virtual functions
67
68 virtual bool has_next_impl() const override;
69
70 virtual char peek_impl() const override;
71
72 virtual void next_impl() override;
73
74 virtual const reader& base_reader_impl() const override;
75 };
76
77
78}
79
80
81#endif
A reader.
Definition reader.hpp:19
A stream reader.
Definition stream_reader.hpp:23
stream_reader(std::unique_ptr< std::istream > &&p_stream, std::size_t buffer_capacity=default_buffer_capacity())
Creates a stream reader.
virtual ~stream_reader()
Destroys the stream reader.
static std::size_t default_buffer_capacity()
Returns the default buffer capacity.
A JSON library.
A reader.