diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/yson_pull/output.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yson_pull/output.h')
-rw-r--r-- | library/cpp/yson_pull/output.h | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/yson_pull/output.h b/library/cpp/yson_pull/output.h index fbe8a84ce7..2d78107a93 100644 --- a/library/cpp/yson_pull/output.h +++ b/library/cpp/yson_pull/output.h @@ -15,42 +15,42 @@ //! \brief Output stream adaptor interface. //! //! Represents a model of an optionally-buffered writer. -namespace NYsonPull { - namespace NOutput { - class IStream { - output_buffer buffer_; +namespace NYsonPull { + namespace NOutput { + class IStream { + output_buffer buffer_; - public: - virtual ~IStream() = default; + public: + virtual ~IStream() = default; - output_buffer& buffer() noexcept { - return buffer_; - } - const output_buffer& buffer() const noexcept { - return buffer_; - } + output_buffer& buffer() noexcept { + return buffer_; + } + const output_buffer& buffer() const noexcept { + return buffer_; + } - void flush_buffer(TStringBuf extra = {}) { - if (!extra.empty() || !buffer_.is_empty()) { - do_flush_buffer(extra); - } - while (!buffer_.is_empty()) { - do_flush_buffer({}); - } - } + void flush_buffer(TStringBuf extra = {}) { + if (!extra.empty() || !buffer_.is_empty()) { + do_flush_buffer(extra); + } + while (!buffer_.is_empty()) { + do_flush_buffer({}); + } + } - protected: - //! \brief Flush data to underlying stream. - //! - //! The implementation is to flush the buffer contents AND - //! extra argument to underlying stream. - //! - //! This way, at zero buffer size this interface implements an unbuffered - //! stream (with an added cost of a virtual call per each write). - //! - //! Write is assumed to always succeed unless it throws an exception. - virtual void do_flush_buffer(TStringBuf extra) = 0; - }; + protected: + //! \brief Flush data to underlying stream. + //! + //! The implementation is to flush the buffer contents AND + //! extra argument to underlying stream. + //! + //! This way, at zero buffer size this interface implements an unbuffered + //! stream (with an added cost of a virtual call per each write). + //! + //! Write is assumed to always succeed unless it throws an exception. + virtual void do_flush_buffer(TStringBuf extra) = 0; + }; //! \brief Write data to C FILE* object. THolder<IStream> FromStdioFile(FILE* file, size_t buffer_size = 0); @@ -61,5 +61,5 @@ namespace NYsonPull { THolder<IStream> FromOutputStream(IOutputStream* output, size_t buffer_size = 65536); THolder<IStream> FromString(TString* output, size_t buffer_size = 1024); - } -} + } +} |