aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson_pull/detail/input/stream.h
diff options
context:
space:
mode:
authorMikhail Borisov <borisov.mikhail@gmail.com>2022-02-10 16:45:40 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:40 +0300
commit5d50718e66d9c037dc587a0211110b7d25a66185 (patch)
treee98df59de24d2ef7c77baed9f41e4875a2fef972 /library/cpp/yson_pull/detail/input/stream.h
parenta6a92afe03e02795227d2641b49819b687f088f8 (diff)
downloadydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/yson_pull/detail/input/stream.h')
-rw-r--r--library/cpp/yson_pull/detail/input/stream.h116
1 files changed, 58 insertions, 58 deletions
diff --git a/library/cpp/yson_pull/detail/input/stream.h b/library/cpp/yson_pull/detail/input/stream.h
index 5ed993f606..791cd5a3f5 100644
--- a/library/cpp/yson_pull/detail/input/stream.h
+++ b/library/cpp/yson_pull/detail/input/stream.h
@@ -1,69 +1,69 @@
-#pragma once
-
+#pragma once
+
#include <library/cpp/yson_pull/detail/macros.h>
-
+
#include <library/cpp/yson_pull/input.h>
-
-#include <util/stream/buffered.h>
-#include <util/stream/file.h>
-#include <util/stream/zerocopy.h>
-#include <util/system/file.h>
-
-namespace NYsonPull {
- namespace NDetail {
- namespace NInput {
- class TStreamBase: public NYsonPull::NInput::IStream {
- protected:
+
+#include <util/stream/buffered.h>
+#include <util/stream/file.h>
+#include <util/stream/zerocopy.h>
+#include <util/system/file.h>
+
+namespace NYsonPull {
+ namespace NDetail {
+ namespace NInput {
+ class TStreamBase: public NYsonPull::NInput::IStream {
+ protected:
result DoFillBufferFrom(IZeroCopyInput& input) {
- void* ptr = nullptr;
- size_t size = input.Next(&ptr);
- if (Y_UNLIKELY(size == 0)) {
- return result::at_end;
- }
- buffer().reset(static_cast<ui8*>(ptr), static_cast<ui8*>(ptr) + size);
- return result::have_more_data;
- }
- };
-
- class TZeroCopy: public TStreamBase {
+ void* ptr = nullptr;
+ size_t size = input.Next(&ptr);
+ if (Y_UNLIKELY(size == 0)) {
+ return result::at_end;
+ }
+ buffer().reset(static_cast<ui8*>(ptr), static_cast<ui8*>(ptr) + size);
+ return result::have_more_data;
+ }
+ };
+
+ class TZeroCopy: public TStreamBase {
IZeroCopyInput* Input;
-
- public:
+
+ public:
explicit TZeroCopy(IZeroCopyInput* input)
- : Input(input)
- {
- }
-
- protected:
- result do_fill_buffer() override {
- return DoFillBufferFrom(*Input);
- }
- };
-
+ : Input(input)
+ {
+ }
+
+ protected:
+ result do_fill_buffer() override {
+ return DoFillBufferFrom(*Input);
+ }
+ };
+
template <typename TBuffered>
- class TOwned: public TStreamBase {
- TBuffered Input;
-
- public:
+ class TOwned: public TStreamBase {
+ TBuffered Input;
+
+ public:
template <typename... Args>
- explicit TOwned(Args&&... args)
- : Input(std::forward<Args>(args)...)
- {
- }
-
- protected:
- result do_fill_buffer() override {
- return DoFillBufferFrom(Input);
- }
- };
-
+ explicit TOwned(Args&&... args)
+ : Input(std::forward<Args>(args)...)
+ {
+ }
+
+ protected:
+ result do_fill_buffer() override {
+ return DoFillBufferFrom(Input);
+ }
+ };
+
class TFHandle: public TOwned<TFileInput> {
- public:
- TFHandle(int fd, size_t buffer_size)
+ public:
+ TFHandle(int fd, size_t buffer_size)
: TOwned<TFileInput>(Duplicate(fd), buffer_size)
- {
- }
- };
- }
+ {
+ }
+ };
+ }
} // namespace NDetail
}