diff options
| author | Anton Samokhvalov <[email protected]> | 2022-02-10 16:45:17 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:17 +0300 |
| commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
| tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/yson_pull/input.h | |
| parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yson_pull/input.h')
| -rw-r--r-- | library/cpp/yson_pull/input.h | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/library/cpp/yson_pull/input.h b/library/cpp/yson_pull/input.h index 97cad449872..2cdfae857eb 100644 --- a/library/cpp/yson_pull/input.h +++ b/library/cpp/yson_pull/input.h @@ -13,69 +13,69 @@ class IInputStream; class IZeroCopyInput; -namespace NYsonPull { - namespace NInput { - //! \brief Input stream adaptor interface. - //! - //! Represents a model of a chunked input data stream. - class IStream { - input_buffer buffer_; - bool at_end_ = false; +namespace NYsonPull { + namespace NInput { + //! \brief Input stream adaptor interface. + //! + //! Represents a model of a chunked input data stream. + class IStream { + input_buffer buffer_; + bool at_end_ = false; - public: - virtual ~IStream() = default; + public: + virtual ~IStream() = default; - bool at_end() const { - return at_end_; - } + bool at_end() const { + return at_end_; + } - input_buffer& buffer() noexcept { - return buffer_; - } - const input_buffer& buffer() const noexcept { - return buffer_; - } + input_buffer& buffer() noexcept { + return buffer_; + } + const input_buffer& buffer() const noexcept { + return buffer_; + } - void fill_buffer() { - while (buffer_.is_empty() && !at_end()) { - at_end_ = do_fill_buffer() == result::at_end; - } - } + void fill_buffer() { + while (buffer_.is_empty() && !at_end()) { + at_end_ = do_fill_buffer() == result::at_end; + } + } - protected: - enum class result { - have_more_data, //! May continue reading - at_end, //! Reached end of stream - }; + protected: + enum class result { + have_more_data, //! May continue reading + at_end, //! Reached end of stream + }; - //! \brief Read next chunk of data. - //! - //! The implementation is to discard the buffer contents - //! and reset the buffer to a next chunk of data. - //! End-of-stream condition is to be reported via return value. - //! - //! Read is assumed to always succeed unless it throws an exception. - virtual result do_fill_buffer() = 0; - }; + //! \brief Read next chunk of data. + //! + //! The implementation is to discard the buffer contents + //! and reset the buffer to a next chunk of data. + //! End-of-stream condition is to be reported via return value. + //! + //! Read is assumed to always succeed unless it throws an exception. + virtual result do_fill_buffer() = 0; + }; - //! \brief Read data from a contiguous memory block (i.e. a string) - //! - //! Does not take ownership on memory. + //! \brief Read data from a contiguous memory block (i.e. a string) + //! + //! Does not take ownership on memory. THolder<IStream> FromMemory(TStringBuf data); - //! \brief Read data from C FILE* object. - //! - //! Does not take ownership on file object. - //! Data is buffered internally regardless of file buffering. + //! \brief Read data from C FILE* object. + //! + //! Does not take ownership on file object. + //! Data is buffered internally regardless of file buffering. THolder<IStream> FromStdioFile(FILE* file, size_t buffer_size = 65536); - //! \brief Read data from POSIX file descriptor. - //! - //! Does not take ownership on streambuf. + //! \brief Read data from POSIX file descriptor. + //! + //! Does not take ownership on streambuf. THolder<IStream> FromPosixFd(int fd, size_t buffer_size = 65536); THolder<IStream> FromZeroCopyInput(IZeroCopyInput* input); THolder<IStream> FromInputStream(IInputStream* input, size_t buffer_size = 65536); - } -} + } +} |
