diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
commit | 9123176b341b6f2658cff5132482b8237c1416c8 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /util/stream | |
parent | 59e19371de37995fcb36beb16cd6ec030af960bc (diff) | |
download | ydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/stream')
-rw-r--r-- | util/stream/aligned.h | 2 | ||||
-rw-r--r-- | util/stream/buffer.h | 2 | ||||
-rw-r--r-- | util/stream/buffered.h | 2 | ||||
-rw-r--r-- | util/stream/debug.h | 2 | ||||
-rw-r--r-- | util/stream/file.h | 2 | ||||
-rw-r--r-- | util/stream/format.h | 2 | ||||
-rw-r--r-- | util/stream/input.cpp | 10 | ||||
-rw-r--r-- | util/stream/input.h | 2 | ||||
-rw-r--r-- | util/stream/length.cpp | 58 | ||||
-rw-r--r-- | util/stream/length.h | 40 | ||||
-rw-r--r-- | util/stream/mem.h | 2 | ||||
-rw-r--r-- | util/stream/multi.h | 2 | ||||
-rw-r--r-- | util/stream/null.h | 2 | ||||
-rw-r--r-- | util/stream/output.h | 2 | ||||
-rw-r--r-- | util/stream/pipe.h | 2 | ||||
-rw-r--r-- | util/stream/printf.h | 2 | ||||
-rw-r--r-- | util/stream/str.h | 2 | ||||
-rw-r--r-- | util/stream/tee.h | 2 | ||||
-rw-r--r-- | util/stream/tempbuf.h | 2 | ||||
-rw-r--r-- | util/stream/tokenizer.h | 2 | ||||
-rw-r--r-- | util/stream/walk.h | 2 | ||||
-rw-r--r-- | util/stream/zerocopy.h | 2 | ||||
-rw-r--r-- | util/stream/zlib.h | 2 |
23 files changed, 74 insertions, 74 deletions
diff --git a/util/stream/aligned.h b/util/stream/aligned.h index 5c86beddc6..70e7be05a9 100644 --- a/util/stream/aligned.h +++ b/util/stream/aligned.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" #include "output.h" diff --git a/util/stream/buffer.h b/util/stream/buffer.h index 4ca6128d80..9dc99dbe49 100644 --- a/util/stream/buffer.h +++ b/util/stream/buffer.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "zerocopy_output.h" diff --git a/util/stream/buffered.h b/util/stream/buffered.h index 42405d326c..0847186141 100644 --- a/util/stream/buffered.h +++ b/util/stream/buffered.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "zerocopy_output.h" diff --git a/util/stream/debug.h b/util/stream/debug.h index cbee0ee770..92d6d4b42d 100644 --- a/util/stream/debug.h +++ b/util/stream/debug.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "output.h" diff --git a/util/stream/file.h b/util/stream/file.h index eee86658df..c1cf4f591d 100644 --- a/util/stream/file.h +++ b/util/stream/file.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "fwd.h" #include "input.h" diff --git a/util/stream/format.h b/util/stream/format.h index 04257f5a81..b033208a1b 100644 --- a/util/stream/format.h +++ b/util/stream/format.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "mem.h" #include "output.h" diff --git a/util/stream/input.cpp b/util/stream/input.cpp index 5f545c2bca..6e8170f2f9 100644 --- a/util/stream/input.cpp +++ b/util/stream/input.cpp @@ -120,9 +120,9 @@ TString IInputStream::ReadTo(char ch) { } size_t IInputStream::Skip(size_t sz) { - return DoSkip(sz); -} - + return DoSkip(sz); +} + size_t IInputStream::DoSkip(size_t sz) { if (sz < 128) { return Load(alloca(sz), sz); @@ -143,8 +143,8 @@ size_t IInputStream::DoSkip(size_t sz) { } return total; -} - +} + TString IInputStream::ReadAll() { TString result; TStringOutput stream(result); diff --git a/util/stream/input.h b/util/stream/input.h index 59874fd06e..f0d5807ed2 100644 --- a/util/stream/input.h +++ b/util/stream/input.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/generic/fwd.h> #include <util/generic/noncopyable.h> diff --git a/util/stream/length.cpp b/util/stream/length.cpp index 09968fc2ab..9907fe2ac9 100644 --- a/util/stream/length.cpp +++ b/util/stream/length.cpp @@ -1,32 +1,32 @@ -#include "length.h" - -size_t TLengthLimitedInput::DoRead(void* buf, size_t len) { - const size_t toRead = (size_t)Min<ui64>(Length_, len); - const size_t ret = Slave_->Read(buf, toRead); - - Length_ -= ret; - - return ret; -} - -size_t TLengthLimitedInput::DoSkip(size_t len) { - len = (size_t)Min<ui64>((ui64)len, Length_); - len = Slave_->Skip(len); - Length_ -= len; - return len; -} - -size_t TCountingInput::DoRead(void* buf, size_t len) { - const size_t ret = Slave_->Read(buf, len); - Count_ += ret; - return ret; -} - -size_t TCountingInput::DoSkip(size_t len) { - const size_t ret = Slave_->Skip(len); - Count_ += ret; - return ret; -} +#include "length.h" + +size_t TLengthLimitedInput::DoRead(void* buf, size_t len) { + const size_t toRead = (size_t)Min<ui64>(Length_, len); + const size_t ret = Slave_->Read(buf, toRead); + + Length_ -= ret; + + return ret; +} + +size_t TLengthLimitedInput::DoSkip(size_t len) { + len = (size_t)Min<ui64>((ui64)len, Length_); + len = Slave_->Skip(len); + Length_ -= len; + return len; +} + +size_t TCountingInput::DoRead(void* buf, size_t len) { + const size_t ret = Slave_->Read(buf, len); + Count_ += ret; + return ret; +} + +size_t TCountingInput::DoSkip(size_t len) { + const size_t ret = Slave_->Skip(len); + Count_ += ret; + return ret; +} size_t TCountingInput::DoReadTo(TString& st, char ch) { const size_t ret = Slave_->ReadTo(st, ch); diff --git a/util/stream/length.h b/util/stream/length.h index 7d8e1c4a09..4d508ae24d 100644 --- a/util/stream/length.h +++ b/util/stream/length.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" #include "output.h" @@ -13,58 +13,58 @@ * treat these as separate streams. */ class TLengthLimitedInput: public IInputStream { -public: +public: inline TLengthLimitedInput(IInputStream* slave, ui64 length) noexcept : Slave_(slave) , Length_(length) { - } + } ~TLengthLimitedInput() override = default; inline ui64 Left() const noexcept { - return Length_; - } + return Length_; + } -private: +private: size_t DoRead(void* buf, size_t len) override; size_t DoSkip(size_t len) override; -private: +private: IInputStream* Slave_; - ui64 Length_; -}; + ui64 Length_; +}; /** * Proxy input stream that counts the number of characters read. */ class TCountingInput: public IInputStream { -public: +public: inline TCountingInput(IInputStream* slave) noexcept : Slave_(slave) , Count_() { - } - + } + ~TCountingInput() override = default; - + /** * \returns The total number of characters read from * this stream. */ inline ui64 Counter() const noexcept { - return Count_; - } - -private: + return Count_; + } + +private: size_t DoRead(void* buf, size_t len) override; size_t DoSkip(size_t len) override; size_t DoReadTo(TString& st, char ch) override; ui64 DoReadAll(IOutputStream& out) override; - -private: + +private: IInputStream* Slave_; - ui64 Count_; + ui64 Count_; }; /** diff --git a/util/stream/mem.h b/util/stream/mem.h index 5dd475deb9..18a5d46772 100644 --- a/util/stream/mem.h +++ b/util/stream/mem.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "zerocopy_output.h" diff --git a/util/stream/multi.h b/util/stream/multi.h index 6c62501139..8bfd462d99 100644 --- a/util/stream/multi.h +++ b/util/stream/multi.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" diff --git a/util/stream/null.h b/util/stream/null.h index 87c5bd9470..8c335a9a78 100644 --- a/util/stream/null.h +++ b/util/stream/null.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "output.h" diff --git a/util/stream/output.h b/util/stream/output.h index 29d43d4c25..00eef50b95 100644 --- a/util/stream/output.h +++ b/util/stream/output.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "fwd.h" #include "labeled.h" diff --git a/util/stream/pipe.h b/util/stream/pipe.h index 3f96fa5cc0..18525b9517 100644 --- a/util/stream/pipe.h +++ b/util/stream/pipe.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" #include "output.h" diff --git a/util/stream/printf.h b/util/stream/printf.h index 7067f7eae4..1c7ddc0664 100644 --- a/util/stream/printf.h +++ b/util/stream/printf.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/system/compat.h> diff --git a/util/stream/str.h b/util/stream/str.h index 1d1e99980d..028bd572c0 100644 --- a/util/stream/str.h +++ b/util/stream/str.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "zerocopy_output.h" diff --git a/util/stream/tee.h b/util/stream/tee.h index bf3072f095..c69e232fb9 100644 --- a/util/stream/tee.h +++ b/util/stream/tee.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "output.h" diff --git a/util/stream/tempbuf.h b/util/stream/tempbuf.h index 0e2f2b3040..a6dc001025 100644 --- a/util/stream/tempbuf.h +++ b/util/stream/tempbuf.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "output.h" diff --git a/util/stream/tokenizer.h b/util/stream/tokenizer.h index 6677c3354e..b2398efdd1 100644 --- a/util/stream/tokenizer.h +++ b/util/stream/tokenizer.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" diff --git a/util/stream/walk.h b/util/stream/walk.h index d972458fdd..7e62cb44dc 100644 --- a/util/stream/walk.h +++ b/util/stream/walk.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" diff --git a/util/stream/zerocopy.h b/util/stream/zerocopy.h index 957f6233c1..3315aa3a51 100644 --- a/util/stream/zerocopy.h +++ b/util/stream/zerocopy.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/system/yassert.h> #include <util/system/defaults.h> diff --git a/util/stream/zlib.h b/util/stream/zlib.h index 1d4ca35cbb..e7de7c81b7 100644 --- a/util/stream/zlib.h +++ b/util/stream/zlib.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "fwd.h" #include "input.h" |