aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson_pull/buffer.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/yson_pull/buffer.h
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/yson_pull/buffer.h')
-rw-r--r--library/cpp/yson_pull/buffer.h122
1 files changed, 61 insertions, 61 deletions
diff --git a/library/cpp/yson_pull/buffer.h b/library/cpp/yson_pull/buffer.h
index 04c9220ef3..e434872c5e 100644
--- a/library/cpp/yson_pull/buffer.h
+++ b/library/cpp/yson_pull/buffer.h
@@ -6,74 +6,74 @@
#include <cstddef>
namespace NYsonPull {
- //! \brief A non-owning buffer model.
- //!
- //! Represents a \p pos pointer moving between \p begin and \p end.
- template <typename T>
- class buffer {
- T* begin_ = nullptr;
- T* pos_ = nullptr;
- T* end_ = nullptr;
+ //! \brief A non-owning buffer model.
+ //!
+ //! Represents a \p pos pointer moving between \p begin and \p end.
+ template <typename T>
+ class buffer {
+ T* begin_ = nullptr;
+ T* pos_ = nullptr;
+ T* end_ = nullptr;
- public:
- T* begin() const noexcept {
- return begin_;
- }
- T* pos() const noexcept {
- return pos_;
- }
- T* end() const noexcept {
- return end_;
- }
+ public:
+ T* begin() const noexcept {
+ return begin_;
+ }
+ T* pos() const noexcept {
+ return pos_;
+ }
+ T* end() const noexcept {
+ return end_;
+ }
- //! \brief Amount of data after current position.
- size_t available() const noexcept {
- return end_ - pos_;
- }
+ //! \brief Amount of data after current position.
+ size_t available() const noexcept {
+ return end_ - pos_;
+ }
- //! \brief Amount of data before current position.
- size_t used() const noexcept {
- return pos_ - begin_;
- }
+ //! \brief Amount of data before current position.
+ size_t used() const noexcept {
+ return pos_ - begin_;
+ }
- //! \brief Move current position \p nbytes forward.
- void advance(size_t nbytes) noexcept {
- Y_ASSERT(pos_ + nbytes <= end_);
- pos_ += nbytes;
- }
+ //! \brief Move current position \p nbytes forward.
+ void advance(size_t nbytes) noexcept {
+ Y_ASSERT(pos_ + nbytes <= end_);
+ pos_ += nbytes;
+ }
- //! \brief Reset buffer pointers.
- void reset(T* new_begin, T* new_end, T* new_pos) {
- begin_ = new_begin;
- pos_ = new_pos;
- end_ = new_end;
- }
+ //! \brief Reset buffer pointers.
+ void reset(T* new_begin, T* new_end, T* new_pos) {
+ begin_ = new_begin;
+ pos_ = new_pos;
+ end_ = new_end;
+ }
- //! \brief Reset buffer to beginning
- void reset(T* new_begin, T* new_end) {
- reset(new_begin, new_end, new_begin);
- }
- };
+ //! \brief Reset buffer to beginning
+ void reset(T* new_begin, T* new_end) {
+ reset(new_begin, new_end, new_begin);
+ }
+ };
- class output_buffer: public buffer<ui8> {
- public:
- //! \brief An output buffer is empty when there is no data written to it.
- bool is_empty() const noexcept {
- return pos() == begin();
- }
+ class output_buffer: public buffer<ui8> {
+ public:
+ //! \brief An output buffer is empty when there is no data written to it.
+ bool is_empty() const noexcept {
+ return pos() == begin();
+ }
- //! \brief An output buffer is full when there is no space to write more data to it.
- bool is_full() const noexcept {
- return pos() == end();
- }
- };
+ //! \brief An output buffer is full when there is no space to write more data to it.
+ bool is_full() const noexcept {
+ return pos() == end();
+ }
+ };
- class input_buffer: public buffer<const ui8> {
- public:
- //! An input stream is empty when there is no data to read in it.
- bool is_empty() const noexcept {
- return pos() == end();
- }
- };
+ class input_buffer: public buffer<const ui8> {
+ public:
+ //! An input stream is empty when there is no data to read in it.
+ bool is_empty() const noexcept {
+ return pos() == end();
+ }
+ };
-}
+}