diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/yson_pull/reader.h | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/yson_pull/reader.h')
-rw-r--r-- | library/cpp/yson_pull/reader.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/library/cpp/yson_pull/reader.h b/library/cpp/yson_pull/reader.h new file mode 100644 index 00000000000..f839b190713 --- /dev/null +++ b/library/cpp/yson_pull/reader.h @@ -0,0 +1,37 @@ +#pragma once + +#include "event.h" +#include "input.h" +#include "stream_type.h" + +#include <util/system/yassert.h> + +#include <memory> + +namespace NYsonPull { + namespace NDetail { + class reader_impl; + } + + //! \brief YSON reader facade class. + //! + //! Owns an input stream. + class TReader { + THolder<NInput::IStream> Stream_; + THolder<NDetail::reader_impl> Impl_; + + public: + TReader(THolder<NInput::IStream> stream, EStreamType mode); + TReader(TReader&&) noexcept; + ~TReader(); + + //! \brief Advance stream to next event and return it. + //! + //! Any event data is invalidated by a call to NextEvent(); + const TEvent& NextEvent(); + + //! \brief Get last returned event. + const TEvent& LastEvent() const noexcept; + }; + +} |