17 #include <boson/config/prelude.hpp> 23 #include <bsoncxx/builder/stream/document.hpp> 24 #include <bsoncxx/json.hpp> 27 BOSON_INLINE_NAMESPACE_BEGIN
37 using document_callback = std::function<void(bsoncxx::document::value)>;
52 int overflow(
int ch)
override;
59 virtual int underflow()
override;
72 BOSON_PRIVATE
int insert(
int ch);
74 document_callback _cb;
75 std::unique_ptr<uint8_t, void (*)(std::uint8_t *)> _data;
77 size_t _bytes_read = 0;
87 bson_ostream(bson_output_streambuf::document_callback cb) : std::ostream(0), bs_buf(cb) {
114 int underflow()
final override;
117 int uflow()
final override;
118 int pbackfail(
int ch)
final override;
119 std::streamsize showmanyc()
final override;
128 std::streampos seekpos(std::streampos sp,
129 std::ios_base::openmode which = std::ios_base::in |
130 std::ios_base::out)
final override;
141 std::streampos seekoff(std::streamoff off, std::ios_base::seekdir way,
142 std::ios_base::openmode which = std::ios_base::in |
143 std::ios_base::out)
final override;
145 const char *
const _begin;
146 const char *
const _end;
147 const char *_current;
168 bson_istream(
const bsoncxx::document::view &v) : std::istream(0), bs_buf(v) {
169 this->rdbuf(&bs_buf);
177 BOSON_INLINE_NAMESPACE_END
180 #include <boson/config/postlude.hpp>
An istream that uses a BSON document as a buffer.
Definition: bson_streambuf.hpp:166
A streambuffer that accepts one or more BSON documents as bytes of BSON data.
Definition: bson_streambuf.hpp:35
Definition: bson_archiver.hpp:70
An ostream that writes bytes of BSON documents into a collection.
Definition: bson_streambuf.hpp:85
An input streambuf that uses an existing byte array as a buffer.
Definition: bson_streambuf.hpp:99