aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /util/stream
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'util/stream')
-rw-r--r--util/stream/aligned.cpp2
-rw-r--r--util/stream/aligned.h8
-rw-r--r--util/stream/buffer.cpp8
-rw-r--r--util/stream/buffer.h12
-rw-r--r--util/stream/buffer_ut.cpp2
-rw-r--r--util/stream/buffered.cpp36
-rw-r--r--util/stream/buffered.h40
-rw-r--r--util/stream/buffered_ut.cpp20
-rw-r--r--util/stream/debug.cpp2
-rw-r--r--util/stream/debug.h10
-rw-r--r--util/stream/direct_io.cpp2
-rw-r--r--util/stream/direct_io.h8
-rw-r--r--util/stream/direct_io_ut.cpp4
-rw-r--r--util/stream/file.cpp20
-rw-r--r--util/stream/file.h44
-rw-r--r--util/stream/file_ut.cpp22
-rw-r--r--util/stream/format.h2
-rw-r--r--util/stream/format_ut.cpp2
-rw-r--r--util/stream/hex_ut.cpp8
-rw-r--r--util/stream/input.cpp16
-rw-r--r--util/stream/input.h22
-rw-r--r--util/stream/input_ut.cpp12
-rw-r--r--util/stream/ios_ut.cpp62
-rw-r--r--util/stream/length.cpp2
-rw-r--r--util/stream/length.h14
-rw-r--r--util/stream/length_ut.cpp8
-rw-r--r--util/stream/mem.cpp4
-rw-r--r--util/stream/mem.h68
-rw-r--r--util/stream/mem_ut.cpp4
-rw-r--r--util/stream/multi.cpp4
-rw-r--r--util/stream/multi.h4
-rw-r--r--util/stream/multi_ut.cpp8
-rw-r--r--util/stream/null.cpp8
-rw-r--r--util/stream/null.h20
-rw-r--r--util/stream/output.cpp12
-rw-r--r--util/stream/output.h18
-rw-r--r--util/stream/pipe.cpp12
-rw-r--r--util/stream/pipe.h16
-rw-r--r--util/stream/printf_ut.cpp4
-rw-r--r--util/stream/str.h32
-rw-r--r--util/stream/str_ut.cpp30
-rw-r--r--util/stream/tee.h2
-rw-r--r--util/stream/tempbuf.cpp2
-rw-r--r--util/stream/tempbuf.h6
-rw-r--r--util/stream/tokenizer.h22
-rw-r--r--util/stream/tokenizer_ut.cpp8
-rw-r--r--util/stream/walk.cpp2
-rw-r--r--util/stream/walk_ut.cpp14
-rw-r--r--util/stream/zerocopy.h4
-rw-r--r--util/stream/zlib.cpp16
-rw-r--r--util/stream/zlib.h12
-rw-r--r--util/stream/zlib_ut.cpp12
52 files changed, 366 insertions, 366 deletions
diff --git a/util/stream/aligned.cpp b/util/stream/aligned.cpp
index 2fd12d15b7..f25d78c719 100644
--- a/util/stream/aligned.cpp
+++ b/util/stream/aligned.cpp
@@ -12,7 +12,7 @@ size_t TAlignedInput::DoSkip(size_t len) {
return ret;
}
-size_t TAlignedInput::DoReadTo(TString& st, char ch) {
+size_t TAlignedInput::DoReadTo(TString& st, char ch) {
size_t ret = Stream_->ReadTo(st, ch);
Position_ += ret;
return ret;
diff --git a/util/stream/aligned.h b/util/stream/aligned.h
index 70e7be05a9..48262d8061 100644
--- a/util/stream/aligned.h
+++ b/util/stream/aligned.h
@@ -44,7 +44,7 @@ public:
private:
size_t DoRead(void* ptr, size_t len) override;
size_t DoSkip(size_t len) override;
- size_t DoReadTo(TString& st, char ch) override;
+ size_t DoReadTo(TString& st, char ch) override;
ui64 DoReadAll(IOutputStream& out) override;
private:
@@ -64,9 +64,9 @@ public:
{
}
- TAlignedOutput(TAlignedOutput&&) noexcept = default;
- TAlignedOutput& operator=(TAlignedOutput&&) noexcept = default;
-
+ TAlignedOutput(TAlignedOutput&&) noexcept = default;
+ TAlignedOutput& operator=(TAlignedOutput&&) noexcept = default;
+
size_t GetCurrentOffset() const {
return Position_;
}
diff --git a/util/stream/buffer.cpp b/util/stream/buffer.cpp
index 2facece4ea..38c1012738 100644
--- a/util/stream/buffer.cpp
+++ b/util/stream/buffer.cpp
@@ -34,7 +34,7 @@ public:
Data_.Append(c);
}
- inline TBuffer& Buffer() const noexcept {
+ inline TBuffer& Buffer() const noexcept {
return Data_;
}
@@ -71,7 +71,7 @@ TBufferOutput& TBufferOutput::operator=(TBufferOutput&&) noexcept = default;
TBufferOutput::~TBufferOutput() = default;
-TBuffer& TBufferOutput::Buffer() const noexcept {
+TBuffer& TBufferOutput::Buffer() const noexcept {
return Impl_->Buffer();
}
@@ -99,11 +99,11 @@ TBufferInput::TBufferInput(const TBuffer& buffer)
TBufferInput::~TBufferInput() = default;
-const TBuffer& TBufferInput::Buffer() const noexcept {
+const TBuffer& TBufferInput::Buffer() const noexcept {
return Buf_;
}
-void TBufferInput::Rewind() noexcept {
+void TBufferInput::Rewind() noexcept {
Readed_ = 0;
}
diff --git a/util/stream/buffer.h b/util/stream/buffer.h
index 9dc99dbe49..feba91cc21 100644
--- a/util/stream/buffer.h
+++ b/util/stream/buffer.h
@@ -37,13 +37,13 @@ public:
TBufferOutput(TBufferOutput&&) noexcept;
TBufferOutput& operator=(TBufferOutput&&) noexcept;
-
- ~TBufferOutput() override;
+
+ ~TBufferOutput() override;
/**
* @returns Buffer that this stream writes into.
*/
- TBuffer& Buffer() const noexcept;
+ TBuffer& Buffer() const noexcept;
private:
size_t DoNext(void** ptr) override;
@@ -69,11 +69,11 @@ public:
*/
TBufferInput(const TBuffer& buffer);
- ~TBufferInput() override;
+ ~TBufferInput() override;
- const TBuffer& Buffer() const noexcept;
+ const TBuffer& Buffer() const noexcept;
- void Rewind() noexcept;
+ void Rewind() noexcept;
protected:
size_t DoNext(const void** ptr, size_t len) override;
diff --git a/util/stream/buffer_ut.cpp b/util/stream/buffer_ut.cpp
index 3494696190..217af94161 100644
--- a/util/stream/buffer_ut.cpp
+++ b/util/stream/buffer_ut.cpp
@@ -25,7 +25,7 @@ Y_UNIT_TEST_SUITE(TBufferTest) {
TBuffer buffer("1234567890", 10);
TBufferInput input(buffer);
- TString tmp;
+ TString tmp;
UNIT_ASSERT_VALUES_EQUAL(input.ReadTo(tmp, '3'), 3);
UNIT_ASSERT_VALUES_EQUAL(tmp, "12");
diff --git a/util/stream/buffered.cpp b/util/stream/buffered.cpp
index a00e592e1c..289ff3d1a5 100644
--- a/util/stream/buffered.cpp
+++ b/util/stream/buffered.cpp
@@ -62,10 +62,10 @@ public:
return MemInput_.Skip(len);
}
- inline size_t ReadTo(TString& st, char to) {
+ inline size_t ReadTo(TString& st, char to) {
st.clear();
- TString s_tmp;
+ TString s_tmp;
size_t ret = 0;
@@ -104,11 +104,11 @@ public:
}
private:
- inline size_t BufLen() const noexcept {
+ inline size_t BufLen() const noexcept {
return AdditionalDataLength();
}
- inline void* Buf() const noexcept {
+ inline void* Buf() const noexcept {
return AdditionalData();
}
@@ -139,7 +139,7 @@ size_t TBufferedInput::DoNext(const void** ptr, size_t len) {
return Impl_->Next(ptr, len);
}
-size_t TBufferedInput::DoReadTo(TString& st, char ch) {
+size_t TBufferedInput::DoReadTo(TString& st, char ch) {
return Impl_->ReadTo(st, ch);
}
@@ -227,11 +227,11 @@ public:
MemOut_.Write(c);
}
- inline void SetFlushPropagateMode(bool mode) noexcept {
+ inline void SetFlushPropagateMode(bool mode) noexcept {
PropagateFlush_ = mode;
}
- inline void SetFinishPropagateMode(bool mode) noexcept {
+ inline void SetFinishPropagateMode(bool mode) noexcept {
PropagateFinish_ = mode;
}
@@ -269,17 +269,17 @@ private:
}
}
- inline size_t Stored() const noexcept {
+ inline size_t Stored() const noexcept {
return Len() - MemOut_.Avail();
}
- inline size_t DownToBufferGranularity(size_t l) const noexcept {
+ inline size_t DownToBufferGranularity(size_t l) const noexcept {
return l - (l % Len());
}
virtual void OnBufferExhausted() = 0;
- virtual void* Buf() const noexcept = 0;
- virtual size_t Len() const noexcept = 0;
+ virtual void* Buf() const noexcept = 0;
+ virtual size_t Len() const noexcept = 0;
private:
IOutputStream* Slave_;
@@ -301,11 +301,11 @@ namespace {
void OnBufferExhausted() final {
}
- void* Buf() const noexcept override {
+ void* Buf() const noexcept override {
return AdditionalData();
}
- size_t Len() const noexcept override {
+ size_t Len() const noexcept override {
return AdditionalDataLength();
}
};
@@ -333,11 +333,11 @@ namespace {
}
}
- void* Buf() const noexcept override {
+ void* Buf() const noexcept override {
return (void*)B_.Data();
}
- size_t Len() const noexcept override {
+ size_t Len() const noexcept override {
return B_.Capacity();
}
@@ -359,7 +359,7 @@ TBufferedOutputBase::TBufferedOutputBase(IOutputStream* slave, size_t buflen)
TBufferedOutputBase::TBufferedOutputBase(TBufferedOutputBase&&) noexcept = default;
TBufferedOutputBase& TBufferedOutputBase::operator=(TBufferedOutputBase&&) noexcept = default;
-TBufferedOutputBase::~TBufferedOutputBase() {
+TBufferedOutputBase::~TBufferedOutputBase() {
try {
Finish();
} catch (...) {
@@ -401,13 +401,13 @@ void TBufferedOutputBase::DoFinish() {
}
}
-void TBufferedOutputBase::SetFlushPropagateMode(bool propagate) noexcept {
+void TBufferedOutputBase::SetFlushPropagateMode(bool propagate) noexcept {
if (Impl_.Get()) {
Impl_->SetFlushPropagateMode(propagate);
}
}
-void TBufferedOutputBase::SetFinishPropagateMode(bool propagate) noexcept {
+void TBufferedOutputBase::SetFinishPropagateMode(bool propagate) noexcept {
if (Impl_.Get()) {
Impl_->SetFinishPropagateMode(propagate);
}
diff --git a/util/stream/buffered.h b/util/stream/buffered.h
index 0847186141..93798e5eca 100644
--- a/util/stream/buffered.h
+++ b/util/stream/buffered.h
@@ -27,7 +27,7 @@ public:
TBufferedInput(TBufferedInput&&) noexcept;
TBufferedInput& operator=(TBufferedInput&&) noexcept;
- ~TBufferedInput() override;
+ ~TBufferedInput() override;
/**
* Switches the underlying stream to the one provided. Does not clear the
@@ -39,7 +39,7 @@ public:
protected:
size_t DoRead(void* buf, size_t len) override;
- size_t DoReadTo(TString& st, char ch) override;
+ size_t DoReadTo(TString& st, char ch) override;
size_t DoSkip(size_t len) override;
size_t DoNext(const void** ptr, size_t len) override;
@@ -81,15 +81,15 @@ public:
TBufferedOutputBase(TBufferedOutputBase&&) noexcept;
TBufferedOutputBase& operator=(TBufferedOutputBase&&) noexcept;
-
- ~TBufferedOutputBase() override;
+
+ ~TBufferedOutputBase() override;
/**
* @param propagate Whether `Flush` and `Finish` calls should
* be propagated to the underlying stream.
* By default they are not.
*/
- inline void SetPropagateMode(bool propagate) noexcept {
+ inline void SetPropagateMode(bool propagate) noexcept {
SetFlushPropagateMode(propagate);
SetFinishPropagateMode(propagate);
}
@@ -99,14 +99,14 @@ public:
* to the underlying stream. By default they
* are not.
*/
- void SetFlushPropagateMode(bool propagate) noexcept;
+ void SetFlushPropagateMode(bool propagate) noexcept;
/**
* @param propagate Whether `Finish` calls should be propagated
* to the underlying stream. By default they
* are not.
*/
- void SetFinishPropagateMode(bool propagate) noexcept;
+ void SetFinishPropagateMode(bool propagate) noexcept;
class TImpl;
@@ -130,10 +130,10 @@ private:
class TBufferedOutput: public TBufferedOutputBase {
public:
TBufferedOutput(IOutputStream* slave, size_t buflen = 8192);
- ~TBufferedOutput() override;
-
- TBufferedOutput(TBufferedOutput&&) noexcept = default;
- TBufferedOutput& operator=(TBufferedOutput&&) noexcept = default;
+ ~TBufferedOutput() override;
+
+ TBufferedOutput(TBufferedOutput&&) noexcept = default;
+ TBufferedOutput& operator=(TBufferedOutput&&) noexcept = default;
};
/**
@@ -145,10 +145,10 @@ public:
class TAdaptiveBufferedOutput: public TBufferedOutputBase {
public:
TAdaptiveBufferedOutput(IOutputStream* slave);
- ~TAdaptiveBufferedOutput() override;
-
- TAdaptiveBufferedOutput(TAdaptiveBufferedOutput&&) noexcept = default;
- TAdaptiveBufferedOutput& operator=(TAdaptiveBufferedOutput&&) noexcept = default;
+ ~TAdaptiveBufferedOutput() override;
+
+ TAdaptiveBufferedOutput(TAdaptiveBufferedOutput&&) noexcept = default;
+ TAdaptiveBufferedOutput& operator=(TAdaptiveBufferedOutput&&) noexcept = default;
};
namespace NPrivate {
@@ -170,13 +170,13 @@ namespace NPrivate {
* A mixin class that turns unbuffered stream into a buffered one.
*
* Note that using this mixin with a stream that is already buffered won't
- * result in double buffering, e.g. `TBuffered<TBuffered<TUnbufferedFileInput>>` and
- * `TBuffered<TUnbufferedFileInput>` are basically the same types.
+ * result in double buffering, e.g. `TBuffered<TBuffered<TUnbufferedFileInput>>` and
+ * `TBuffered<TUnbufferedFileInput>` are basically the same types.
*
* Example usage:
* @code
- * TBuffered<TUnbufferedFileInput> file_input(1024, "/path/to/file");
- * TBuffered<TUnbufferedFileOutput> file_output(1024, "/path/to/file");
+ * TBuffered<TUnbufferedFileInput> file_input(1024, "/path/to/file");
+ * TBuffered<TUnbufferedFileOutput> file_output(1024, "/path/to/file");
* @endcode
* Here 1024 is the size of the buffer.
*/
@@ -211,7 +211,7 @@ public:
*
* Example usage:
* @code
- * TAdaptivelyBuffered<TUnbufferedFileOutput> file_output("/path/to/file");
+ * TAdaptivelyBuffered<TUnbufferedFileOutput> file_output("/path/to/file");
* @endcode
*/
template <class TSlave>
diff --git a/util/stream/buffered_ut.cpp b/util/stream/buffered_ut.cpp
index 41d2fc3030..d6e33fc3d7 100644
--- a/util/stream/buffered_ut.cpp
+++ b/util/stream/buffered_ut.cpp
@@ -2,7 +2,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/random/mersenne.h>
Y_UNIT_TEST_SUITE(TestBufferedIO) {
@@ -12,7 +12,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) {
for (size_t i = 0; i < 1000; ++i) {
const size_t c = r.GenRand() % 10000;
- TString s;
+ TString s;
for (size_t j = 0; j < c; ++j) {
s.append('A' + (r.GenRand() % 10));
@@ -23,8 +23,8 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) {
}
Y_UNIT_TEST(TestEqual) {
- TString s1;
- TString s2;
+ TString s1;
+ TString s2;
Run(TBuffered<TStringOutput>(8000, s1));
Run(TAdaptivelyBuffered<TStringOutput>(s2));
@@ -33,7 +33,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) {
}
Y_UNIT_TEST(Test1) {
- TString s;
+ TString s;
TBuffered<TStringOutput>(100, s).Write("1", 1);
@@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) {
}
Y_UNIT_TEST(Test2) {
- TString s;
+ TString s;
TBuffered<TStringOutput>(1, s).Write("12", 2);
@@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) {
}
Y_UNIT_TEST(Test3) {
- TString s;
+ TString s;
auto&& b = TBuffered<TStringOutput>(1, s);
@@ -108,7 +108,7 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) {
}
Y_UNIT_TEST(TestInput) {
- TString s("0123456789abcdefghijklmn");
+ TString s("0123456789abcdefghijklmn");
TBuffered<TStringInput> in(5, s);
char c;
UNIT_ASSERT_VALUES_EQUAL(in.Read(&c, 1), 1); //1
@@ -129,9 +129,9 @@ Y_UNIT_TEST_SUITE(TestBufferedIO) {
}
Y_UNIT_TEST(TestReadTo) {
- TString s("0123456789abc");
+ TString s("0123456789abc");
TBuffered<TStringInput> in(2, s);
- TString t;
+ TString t;
UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, '7'), 8);
UNIT_ASSERT_VALUES_EQUAL(t, "0123456");
UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, '8'), 1);
diff --git a/util/stream/debug.cpp b/util/stream/debug.cpp
index afd5b3e1c7..b9255b7a85 100644
--- a/util/stream/debug.cpp
+++ b/util/stream/debug.cpp
@@ -45,6 +45,6 @@ IOutputStream& StdDbgStream() noexcept {
return *(Singleton<TDbgSelector>()->Out);
}
-int StdDbgLevel() noexcept {
+int StdDbgLevel() noexcept {
return Singleton<TDbgSelector>()->Level;
}
diff --git a/util/stream/debug.h b/util/stream/debug.h
index 92d6d4b42d..86601ea0ba 100644
--- a/util/stream/debug.h
+++ b/util/stream/debug.h
@@ -12,12 +12,12 @@
*/
class TDebugOutput: public IOutputStream {
public:
- inline TDebugOutput() noexcept = default;
+ inline TDebugOutput() noexcept = default;
~TDebugOutput() override = default;
- TDebugOutput(TDebugOutput&&) noexcept = default;
- TDebugOutput& operator=(TDebugOutput&&) noexcept = default;
-
+ TDebugOutput(TDebugOutput&&) noexcept = default;
+ TDebugOutput& operator=(TDebugOutput&&) noexcept = default;
+
private:
void DoWrite(const void* buf, size_t len) override;
};
@@ -39,7 +39,7 @@ IOutputStream& StdDbgStream() noexcept;
* @see ETraceLevel
* @see DBGTRACE
*/
-int StdDbgLevel() noexcept;
+int StdDbgLevel() noexcept;
/**
* Standard debug stream.
diff --git a/util/stream/direct_io.cpp b/util/stream/direct_io.cpp
index 649033af34..c759d32b8e 100644
--- a/util/stream/direct_io.cpp
+++ b/util/stream/direct_io.cpp
@@ -33,7 +33,7 @@ void TRandomAccessFileOutput::DoFlush() {
File->FlushData();
}
-TBufferedFileOutputEx::TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen)
+TBufferedFileOutputEx::TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen)
: TRandomAccessFileOutput(*(new TDirectIOBufferedFile(path, oMode, buflen)))
, FileHolder(File)
{
diff --git a/util/stream/direct_io.h b/util/stream/direct_io.h
index 2e1f2e07dd..f7dc39d4a0 100644
--- a/util/stream/direct_io.h
+++ b/util/stream/direct_io.h
@@ -21,9 +21,9 @@ class TRandomAccessFileOutput: public IOutputStream {
public:
TRandomAccessFileOutput(TDirectIOBufferedFile& file);
- TRandomAccessFileOutput(TRandomAccessFileOutput&&) noexcept = default;
- TRandomAccessFileOutput& operator=(TRandomAccessFileOutput&&) noexcept = default;
-
+ TRandomAccessFileOutput(TRandomAccessFileOutput&&) noexcept = default;
+ TRandomAccessFileOutput& operator=(TRandomAccessFileOutput&&) noexcept = default;
+
protected:
TDirectIOBufferedFile* File;
@@ -34,7 +34,7 @@ private:
class TBufferedFileOutputEx: public TRandomAccessFileOutput {
public:
- TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen = 1 << 17);
+ TBufferedFileOutputEx(const TString& path, EOpenMode oMode, size_t buflen = 1 << 17);
private:
void DoFlush() override;
diff --git a/util/stream/direct_io_ut.cpp b/util/stream/direct_io_ut.cpp
index 01d09db232..00567f6ed1 100644
--- a/util/stream/direct_io_ut.cpp
+++ b/util/stream/direct_io_ut.cpp
@@ -1,6 +1,6 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/array_size.h>
#include <util/system/env.h>
@@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TDirectIOTests) {
// filling file
// TEMPLATE|TEMPLATE|TEMPLATE|...
- const auto fileName = TString("test.file");
+ const auto fileName = TString("test.file");
auto&& directIOBuffer = TDirectIOBufferedFile{fileName, RdWr | CreateAlways | mode};
{
auto&& output = TRandomAccessFileOutput{directIOBuffer};
diff --git a/util/stream/file.cpp b/util/stream/file.cpp
index dc5d2f6311..dfce45c002 100644
--- a/util/stream/file.cpp
+++ b/util/stream/file.cpp
@@ -3,7 +3,7 @@
#include <util/memory/blob.h>
#include <util/generic/yexception.h>
-TUnbufferedFileInput::TUnbufferedFileInput(const TString& path)
+TUnbufferedFileInput::TUnbufferedFileInput(const TString& path)
: File_(path, OpenExisting | RdOnly | Seq)
{
if (!File_.IsOpen()) {
@@ -11,7 +11,7 @@ TUnbufferedFileInput::TUnbufferedFileInput(const TString& path)
}
}
-TUnbufferedFileInput::TUnbufferedFileInput(const TFile& file)
+TUnbufferedFileInput::TUnbufferedFileInput(const TFile& file)
: File_(file)
{
if (!File_.IsOpen()) {
@@ -19,11 +19,11 @@ TUnbufferedFileInput::TUnbufferedFileInput(const TFile& file)
}
}
-size_t TUnbufferedFileInput::DoRead(void* buf, size_t len) {
+size_t TUnbufferedFileInput::DoRead(void* buf, size_t len) {
return File_.ReadOrFail(buf, len);
}
-size_t TUnbufferedFileInput::DoSkip(size_t len) {
+size_t TUnbufferedFileInput::DoSkip(size_t len) {
if (len < 384) {
/* Base implementation calls DoRead, which results in one system call
* instead of three as in fair skip implementation. For small sizes
@@ -42,7 +42,7 @@ size_t TUnbufferedFileInput::DoSkip(size_t len) {
return newPos - oldPos;
}
-TUnbufferedFileOutput::TUnbufferedFileOutput(const TString& path)
+TUnbufferedFileOutput::TUnbufferedFileOutput(const TString& path)
: File_(path, CreateAlways | WrOnly | Seq)
{
if (!File_.IsOpen()) {
@@ -50,7 +50,7 @@ TUnbufferedFileOutput::TUnbufferedFileOutput(const TString& path)
}
}
-TUnbufferedFileOutput::TUnbufferedFileOutput(const TFile& file)
+TUnbufferedFileOutput::TUnbufferedFileOutput(const TFile& file)
: File_(file)
{
if (!File_.IsOpen()) {
@@ -58,13 +58,13 @@ TUnbufferedFileOutput::TUnbufferedFileOutput(const TFile& file)
}
}
-TUnbufferedFileOutput::~TUnbufferedFileOutput() = default;
+TUnbufferedFileOutput::~TUnbufferedFileOutput() = default;
-void TUnbufferedFileOutput::DoWrite(const void* buf, size_t len) {
+void TUnbufferedFileOutput::DoWrite(const void* buf, size_t len) {
File_.Write(buf, len);
}
-void TUnbufferedFileOutput::DoFlush() {
+void TUnbufferedFileOutput::DoFlush() {
if (File_.IsOpen()) {
File_.Flush();
}
@@ -87,7 +87,7 @@ TMappedFileInput::TMappedFileInput(const TFile& file)
Reset(Impl_->Data(), Impl_->Size());
}
-TMappedFileInput::TMappedFileInput(const TString& path)
+TMappedFileInput::TMappedFileInput(const TString& path)
: TMemoryInput(nullptr, 0)
, Impl_(new TImpl(TFile(path, OpenExisting | RdOnly)))
{
diff --git a/util/stream/file.h b/util/stream/file.h
index c1cf4f591d..11b2ee7ff2 100644
--- a/util/stream/file.h
+++ b/util/stream/file.h
@@ -15,15 +15,15 @@
*/
/**
- * Unbuffered file input stream.
+ * Unbuffered file input stream.
*
* Note that the input is not buffered, which means that `ReadLine` calls will
* be _very_ slow.
*/
-class TUnbufferedFileInput: public IInputStream {
+class TUnbufferedFileInput: public IInputStream {
public:
- TUnbufferedFileInput(const TFile& file);
- TUnbufferedFileInput(const TString& path);
+ TUnbufferedFileInput(const TFile& file);
+ TUnbufferedFileInput(const TString& path);
private:
size_t DoRead(void* buf, size_t len) override;
@@ -39,8 +39,8 @@ private:
class TMappedFileInput: public TMemoryInput {
public:
TMappedFileInput(const TFile& file);
- TMappedFileInput(const TString& path);
- ~TMappedFileInput() override;
+ TMappedFileInput(const TString& path);
+ ~TMappedFileInput() override;
private:
class TImpl;
@@ -53,15 +53,15 @@ private:
* Note that the output is unbuffered, thus writing in many small chunks is
* likely to be quite slow.
*/
-class TUnbufferedFileOutput: public IOutputStream {
+class TUnbufferedFileOutput: public IOutputStream {
public:
- TUnbufferedFileOutput(const TString& path);
- TUnbufferedFileOutput(const TFile& file);
- ~TUnbufferedFileOutput() override;
-
- TUnbufferedFileOutput(TUnbufferedFileOutput&&) noexcept = default;
- TUnbufferedFileOutput& operator=(TUnbufferedFileOutput&&) noexcept = default;
+ TUnbufferedFileOutput(const TString& path);
+ TUnbufferedFileOutput(const TFile& file);
+ ~TUnbufferedFileOutput() override;
+ TUnbufferedFileOutput(TUnbufferedFileOutput&&) noexcept = default;
+ TUnbufferedFileOutput& operator=(TUnbufferedFileOutput&&) noexcept = default;
+
private:
void DoWrite(const void* buf, size_t len) override;
void DoFlush() override;
@@ -75,34 +75,34 @@ private:
*
* @see TBuffered
*/
-class TFileInput: public TBuffered<TUnbufferedFileInput> {
+class TFileInput: public TBuffered<TUnbufferedFileInput> {
public:
template <class T>
- inline TFileInput(T&& t, size_t buf = 1 << 13)
- : TBuffered<TUnbufferedFileInput>(buf, std::forward<T>(t))
+ inline TFileInput(T&& t, size_t buf = 1 << 13)
+ : TBuffered<TUnbufferedFileInput>(buf, std::forward<T>(t))
{
}
- ~TFileInput() override = default;
+ ~TFileInput() override = default;
};
/**
* Buffered file output stream.
*
- * Currently deprecated, please use TFileOutput in new code.
+ * Currently deprecated, please use TFileOutput in new code.
*
* @deprecated
* @see TBuffered
*/
-class TFixedBufferFileOutput: public TBuffered<TUnbufferedFileOutput> {
+class TFixedBufferFileOutput: public TBuffered<TUnbufferedFileOutput> {
public:
template <class T>
- inline TFixedBufferFileOutput(T&& t, size_t buf = 1 << 13)
- : TBuffered<TUnbufferedFileOutput>(buf, std::forward<T>(t))
+ inline TFixedBufferFileOutput(T&& t, size_t buf = 1 << 13)
+ : TBuffered<TUnbufferedFileOutput>(buf, std::forward<T>(t))
{
}
- ~TFixedBufferFileOutput() override = default;
+ ~TFixedBufferFileOutput() override = default;
};
/** @} */
diff --git a/util/stream/file_ut.cpp b/util/stream/file_ut.cpp
index ac0f09796e..f6d4315564 100644
--- a/util/stream/file_ut.cpp
+++ b/util/stream/file_ut.cpp
@@ -13,32 +13,32 @@ Y_UNIT_TEST_SUITE(TFileTest) {
TTempFile tmp(TmpFileName);
{
- TUnbufferedFileOutput output(TmpFileName);
+ TUnbufferedFileOutput output(TmpFileName);
output.Write(TmpFileContents, strlen(TmpFileContents));
}
{
- TUnbufferedFileInput input(TmpFileName);
- TString s = input.ReadAll();
+ TUnbufferedFileInput input(TmpFileName);
+ TString s = input.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(s, TmpFileContents);
}
{
- TUnbufferedFileInput input(TmpFileName);
+ TUnbufferedFileInput input(TmpFileName);
input.Skip(TmpFileSubstring - TmpFileContents);
- TString s = input.ReadAll();
+ TString s = input.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(s, "chivalrous plan");
}
{
- TUnbufferedFileOutput output(TFile::ForAppend(TmpFileName));
+ TUnbufferedFileOutput output(TFile::ForAppend(TmpFileName));
output.Write(TmpFileContents, strlen(TmpFileContents));
}
{
- TUnbufferedFileInput input(TmpFileName);
- TString s = input.ReadAll();
- UNIT_ASSERT_VALUES_EQUAL(s, TString::Join(TmpFileContents, TmpFileContents));
+ TUnbufferedFileInput input(TmpFileName);
+ TString s = input.ReadAll();
+ UNIT_ASSERT_VALUES_EQUAL(s, TString::Join(TmpFileContents, TmpFileContents));
}
}
@@ -46,13 +46,13 @@ Y_UNIT_TEST_SUITE(TFileTest) {
TTempFile tmp(TmpFileName);
{
- TUnbufferedFileOutput output(TmpFileName);
+ TUnbufferedFileOutput output(TmpFileName);
/* Write nothing. */
}
{
TMappedFileInput input(TmpFileName);
- TString s = input.ReadAll();
+ TString s = input.ReadAll();
UNIT_ASSERT(s.empty());
}
}
diff --git a/util/stream/format.h b/util/stream/format.h
index b033208a1b..830516991f 100644
--- a/util/stream/format.h
+++ b/util/stream/format.h
@@ -113,7 +113,7 @@ namespace NFormatPrivate {
if (str[0] == '-') {
stream << '-';
- str.Skip(1);
+ str.Skip(1);
}
if (value.Flags & HF_ADDX) {
diff --git a/util/stream/format_ut.cpp b/util/stream/format_ut.cpp
index 43245aeb48..3c83bce4a4 100644
--- a/util/stream/format_ut.cpp
+++ b/util/stream/format_ut.cpp
@@ -54,7 +54,7 @@ Y_UNIT_TEST_SUITE(TOutputStreamFormattingTest) {
}
{
TStringStream ss;
- TUtf16String w = UTF8ToWide("abcи");
+ TUtf16String w = UTF8ToWide("abcи");
ss << HexText<wchar16>(w);
UNIT_ASSERT_VALUES_EQUAL("0061 0062 0063 0438", ss.Str());
}
diff --git a/util/stream/hex_ut.cpp b/util/stream/hex_ut.cpp
index 5074a0b616..c1b80ef5f7 100644
--- a/util/stream/hex_ut.cpp
+++ b/util/stream/hex_ut.cpp
@@ -4,14 +4,14 @@
#include "str.h"
Y_UNIT_TEST_SUITE(THexCodingTest) {
- void TestImpl(const TString& data) {
- TString encoded;
+ void TestImpl(const TString& data) {
+ TString encoded;
TStringOutput encodedOut(encoded);
HexEncode(data.data(), data.size(), encodedOut);
UNIT_ASSERT_EQUAL(encoded.size(), data.size() * 2);
- TString decoded;
+ TString decoded;
TStringOutput decodedOut(decoded);
HexDecode(encoded.data(), encoded.size(), decodedOut);
@@ -19,7 +19,7 @@ Y_UNIT_TEST_SUITE(THexCodingTest) {
}
Y_UNIT_TEST(TestEncodeDecodeToStream) {
- TString data = "100ABAcaba500,$%0987123456 \n\t\x01\x02\x03.";
+ TString data = "100ABAcaba500,$%0987123456 \n\t\x01\x02\x03.";
TestImpl(data);
}
diff --git a/util/stream/input.cpp b/util/stream/input.cpp
index 6e8170f2f9..eb99b10809 100644
--- a/util/stream/input.cpp
+++ b/util/stream/input.cpp
@@ -4,7 +4,7 @@
#include <util/charset/wide.h>
#include <util/memory/tempbuf.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/yexception.h>
#include <util/generic/singleton.h>
#include <util/string/cast.h>
@@ -89,7 +89,7 @@ size_t IInputStream::ReadLine(TString& st) {
}
size_t IInputStream::ReadLine(TUtf16String& w) {
- TString s;
+ TString s;
size_t result = ReadLine(s);
if (result) {
@@ -100,7 +100,7 @@ size_t IInputStream::ReadLine(TUtf16String& w) {
}
TString IInputStream::ReadLine() {
- TString ret;
+ TString ret;
if (!ReadLine(ret)) {
ythrow yexception() << "can not read line from stream";
@@ -110,7 +110,7 @@ TString IInputStream::ReadLine() {
}
TString IInputStream::ReadTo(char ch) {
- TString ret;
+ TString ret;
if (!ReadTo(ret, ch)) {
ythrow yexception() << "can not read from stream";
@@ -146,7 +146,7 @@ size_t IInputStream::DoSkip(size_t sz) {
}
TString IInputStream::ReadAll() {
- TString result;
+ TString result;
TStringOutput stream(result);
DoReadAll(stream);
@@ -190,7 +190,7 @@ namespace {
free(B_);
}
- size_t DoReadTo(TString& st, char ch) override {
+ size_t DoReadTo(TString& st, char ch) override {
auto&& guard = Guard(M_);
(void)guard;
@@ -227,7 +227,7 @@ namespace {
using TGetLine = TGetLineBase;
#else
struct TGetLine: public TGetLineBase {
- size_t DoReadTo(TString& st, char ch) override {
+ size_t DoReadTo(TString& st, char ch) override {
if (ch == '\n') {
size_t len = 0;
auto r = fgetln(F_, &len);
@@ -285,7 +285,7 @@ void In<TString>(IInputStream& i, TString& s) {
template <>
void In<TUtf16String>(IInputStream& i, TUtf16String& w) {
- TString s;
+ TString s;
ReadUpToDelimiter(i, s);
if (s.empty()) {
diff --git a/util/stream/input.h b/util/stream/input.h
index f0d5807ed2..f4432f7553 100644
--- a/util/stream/input.h
+++ b/util/stream/input.h
@@ -1,7 +1,7 @@
#pragma once
#include <util/generic/fwd.h>
-#include <util/generic/noncopyable.h>
+#include <util/generic/noncopyable.h>
#include <util/system/defaults.h>
class IOutputStream;
@@ -21,11 +21,11 @@ public:
IInputStream(IInputStream&&) noexcept {
}
-
+
IInputStream& operator=(IInputStream&&) noexcept {
- return *this;
+ return *this;
}
-
+
/**
* Reads some data from the stream. Note that this function might read less
* data than what was requested. Use `Load` function if you want to read as
@@ -66,7 +66,7 @@ public:
* @returns Total number of characters read from the stream.
* A return value of zero signals end of stream.
*/
- inline size_t ReadTo(TString& st, char ch) {
+ inline size_t ReadTo(TString& st, char ch) {
return DoReadTo(st, ch);
}
@@ -98,7 +98,7 @@ public:
*
* @returns Contents of this stream as a string.
*/
- TString ReadAll();
+ TString ReadAll();
/**
* Reads all data from this stream and writes it into a provided output
@@ -119,7 +119,7 @@ public:
* because end of stream has already been
* reached.
*/
- TString ReadLine();
+ TString ReadLine();
/**
* Reads all characters from the stream until the given character is
@@ -132,7 +132,7 @@ public:
* because end of stream has already been
* reached.
*/
- TString ReadTo(char ch);
+ TString ReadTo(char ch);
/**
* Reads all data from the stream until the first occurrence of '\n' and
@@ -143,7 +143,7 @@ public:
* @returns Total number of characters read from the stream.
* A return value of zero signals end of stream.
*/
- size_t ReadLine(TString& st);
+ size_t ReadLine(TString& st);
/**
* Reads UTF8 encoded characters from the stream the first occurrence of '\n',
@@ -155,7 +155,7 @@ public:
* @returns Total number of characters read from the stream.
* A return value of zero signals end of stream.
*/
- size_t ReadLine(TUtf16String& w);
+ size_t ReadLine(TUtf16String& w);
/**
* Skips some data from the stream without reading / copying it. Note that
@@ -204,7 +204,7 @@ protected:
* A return value of zero signals end of stream.
* @throws yexception If IO error occurs.
*/
- virtual size_t DoReadTo(TString& st, char ch);
+ virtual size_t DoReadTo(TString& st, char ch);
/**
* Reads all data from this stream and writes it into a provided output
diff --git a/util/stream/input_ut.cpp b/util/stream/input_ut.cpp
index 4a93f5458e..dddb657def 100644
--- a/util/stream/input_ut.cpp
+++ b/util/stream/input_ut.cpp
@@ -61,7 +61,7 @@ private:
class TNoOutput: public IOutputStream {
public:
- TNoOutput() = default;
+ TNoOutput() = default;
protected:
void DoWrite(const void*, size_t) override {
@@ -70,7 +70,7 @@ protected:
class TSimpleStringInput: public IInputStream {
public:
- TSimpleStringInput(const TString& string)
+ TSimpleStringInput(const TString& string)
: String_(string)
{
}
@@ -89,7 +89,7 @@ protected:
}
private:
- TString String_;
+ TString String_;
};
Y_UNIT_TEST_SUITE(TInputTest) {
@@ -108,7 +108,7 @@ Y_UNIT_TEST_SUITE(TInputTest) {
TSimpleStringInput in("0123456789abc");
- TString t;
+ TString t;
UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, '7'), 8);
UNIT_ASSERT_VALUES_EQUAL(t, "0123456");
UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, 'z'), 5);
@@ -120,7 +120,7 @@ Y_UNIT_TEST_SUITE(TInputTest) {
Y_UNIT_TEST(TestReadLine) {
TSimpleStringInput in("1\n22\n333");
- TString t;
+ TString t;
UNIT_ASSERT_VALUES_EQUAL(in.ReadLine(t), 2);
UNIT_ASSERT_VALUES_EQUAL(t, "1");
UNIT_ASSERT_VALUES_EQUAL(in.ReadLine(t), 3);
@@ -148,7 +148,7 @@ Y_UNIT_TEST_SUITE(TInputTest) {
stdIn.ForInput(text,
[=] {
- TString value;
+ TString value;
Cin.ReadTo(value, delim);
UNIT_ASSERT_VALUES_EQUAL(value, expectedValue);
});
diff --git a/util/stream/ios_ut.cpp b/util/stream/ios_ut.cpp
index 139f4296e5..3785c1d727 100644
--- a/util/stream/ios_ut.cpp
+++ b/util/stream/ios_ut.cpp
@@ -53,14 +53,14 @@ public:
UNIT_TEST_SUITE_REGISTRATION(TStreamsTest);
void TStreamsTest::TestIStreamOperators() {
- TString data("first line\r\nsecond\t\xd1\x82\xd0\xb5\xd1\x81\xd1\x82 line\r\n 1 -4 59 4320000000009999999 c\n -1.5 1e-110");
+ TString data("first line\r\nsecond\t\xd1\x82\xd0\xb5\xd1\x81\xd1\x82 line\r\n 1 -4 59 4320000000009999999 c\n -1.5 1e-110");
TStringInput si(data);
- TString l1;
- TString l2;
- TString l3;
- TUtf16String w1;
- TString l4;
+ TString l1;
+ TString l2;
+ TString l3;
+ TUtf16String w1;
+ TString l4;
ui16 i1;
i16 i2;
i32 i3;
@@ -120,7 +120,7 @@ void TStreamsTest::TestStringStream() {
}
void TStreamsTest::TestGenericRead() {
- TString s("1234567890");
+ TString s("1234567890");
TStringInput si(s);
char buf[1024];
@@ -131,7 +131,7 @@ void TStreamsTest::TestGenericRead() {
}
void TStreamsTest::TestGenericWrite() {
- TString s;
+ TString s;
TStringOutput so(s);
so.Write("123456", 6);
@@ -141,7 +141,7 @@ void TStreamsTest::TestGenericWrite() {
}
void TStreamsTest::TestReadLine() {
- TString data("1234\r\n5678\nqw");
+ TString data("1234\r\n5678\nqw");
TStringInput si(data);
UNIT_ASSERT_EQUAL(si.ReadLine(), "1234");
@@ -171,7 +171,7 @@ void TStreamsTest::TestMemoryStream() {
class TMyStringOutput: public IOutputStream {
public:
- inline TMyStringOutput(TString& s, size_t buflen) noexcept
+ inline TMyStringOutput(TString& s, size_t buflen) noexcept
: S_(s)
, BufLen_(buflen)
{
@@ -185,7 +185,7 @@ public:
}
void DoWriteV(const TPart* p, size_t count) override {
- TString s;
+ TString s;
for (size_t i = 0; i < count; ++i) {
s.append((const char*)p[i].buf, p[i].len);
@@ -200,14 +200,14 @@ private:
};
void TStreamsTest::TestBufferedIO() {
- TString s;
+ TString s;
{
const size_t buflen = 7;
TBuffered<TMyStringOutput> bo(buflen, s, buflen);
for (size_t i = 0; i < 1000; ++i) {
- TString str(" ");
+ TString str(" ");
str += ToString(i % 10);
bo.Write(str.data(), str.size());
@@ -223,7 +223,7 @@ void TStreamsTest::TestBufferedIO() {
TBuffered<TStringInput> bi(buflen, s);
for (size_t i = 0; i < 1000; ++i) {
- TString str(" ");
+ TString str(" ");
str += ToString(i % 10);
char buf[3];
@@ -241,7 +241,7 @@ void TStreamsTest::TestBufferedIO() {
{
const size_t buflen = 13;
TBuffered<TMyStringOutput> bo(buflen, s, buflen);
- TString f = "1234567890";
+ TString f = "1234567890";
for (size_t i = 0; i < 10; ++i) {
f += f;
@@ -257,7 +257,7 @@ void TStreamsTest::TestBufferedIO() {
void TStreamsTest::TestBufferStream() {
TBufferStream stream;
- TString s = "test";
+ TString s = "test";
stream.Write(s.data(), s.size());
char buf[5];
@@ -281,7 +281,7 @@ void TStreamsTest::TestBufferStream() {
namespace {
class TStringListInput: public IWalkInput {
public:
- TStringListInput(const TVector<TString>& data)
+ TStringListInput(const TVector<TString>& data)
: Data_(data)
, Index_(0)
{
@@ -293,14 +293,14 @@ namespace {
return 0;
}
- const TString& string = Data_[Index_++];
+ const TString& string = Data_[Index_++];
*ptr = string.data();
return string.size();
}
private:
- const TVector<TString>& Data_;
+ const TVector<TString>& Data_;
size_t Index_;
};
@@ -332,7 +332,7 @@ namespace {
"123",
"\t\r "};
void TestStreamReadTo1(IInputStream& input, const char* comment) {
- TString tmp;
+ TString tmp;
input.ReadTo(tmp, 'c');
UNIT_ASSERT_VALUES_EQUAL_C(tmp, "111a222b333", comment);
@@ -348,7 +348,7 @@ namespace {
}
void TestStreamReadTo2(IInputStream& input, const char* comment) {
- TString s;
+ TString s;
size_t i = 0;
while (input.ReadLine(s)) {
UNIT_ASSERT_C(i < Y_ARRAY_SIZE(Expected), comment);
@@ -368,7 +368,7 @@ namespace {
}
void TestStrokaInput(IInputStream& input, const char* comment) {
- TString line;
+ TString line;
ui32 i = 0;
TInstant start = Now();
while (input.ReadLine(line)) {
@@ -379,7 +379,7 @@ namespace {
}
template <class T>
- void TestStreamReadTo(const TString& text, T test) {
+ void TestStreamReadTo(const TString& text, T test) {
TStringInput is(text);
test(is, "TStringInput");
TMemoryInput mi(text.data(), text.size());
@@ -390,7 +390,7 @@ namespace {
TStringInput slave(text);
TBufferedInput bdi(&slave);
test(bdi, "TBufferedInput");
- TVector<TString> lst(1, text);
+ TVector<TString> lst(1, text);
TStringListInput sli(lst);
test(sli, "IWalkInput");
}
@@ -400,15 +400,15 @@ void TStreamsTest::TestReadTo() {
TestStreamReadTo("111a222b333c444d555e666f", TestStreamReadTo1);
TestStreamReadTo(Text, TestStreamReadTo2);
TestStreamReadTo("111a222b333c444d555e666f", TestStreamReadTo3);
- TString withZero = "one";
+ TString withZero = "one";
withZero.append('\0').append("two").append('\0').append("three");
TestStreamReadTo(withZero, TestStreamReadTo4);
}
void TStreamsTest::TestStrokaInput() {
- TString s;
+ TString s;
for (ui32 i = 0; i < 100000; ++i) {
- TVector<char> d(i % 1000, 'a');
+ TVector<char> d(i % 1000, 'a');
s.append(d.data(), d.size());
s.append('\n');
}
@@ -416,9 +416,9 @@ void TStreamsTest::TestStrokaInput() {
}
void TStreamsTest::TestWtrokaInput() {
- const TString s(Text);
+ const TString s(Text);
TStringInput is(s);
- TUtf16String w;
+ TUtf16String w;
size_t i = 0;
while (is.ReadLine(w)) {
@@ -430,12 +430,12 @@ void TStreamsTest::TestWtrokaInput() {
}
void TStreamsTest::TestWtrokaOutput() {
- TString s;
+ TString s;
TStringOutput os(s);
const size_t n = sizeof(Expected) / sizeof(Expected[0]);
for (size_t i = 0; i < n; ++i) {
- TUtf16String w = UTF8ToWide(Expected[i]);
+ TUtf16String w = UTF8ToWide(Expected[i]);
os << w;
diff --git a/util/stream/length.cpp b/util/stream/length.cpp
index 9907fe2ac9..7358d01c9a 100644
--- a/util/stream/length.cpp
+++ b/util/stream/length.cpp
@@ -28,7 +28,7 @@ size_t TCountingInput::DoSkip(size_t len) {
return ret;
}
-size_t TCountingInput::DoReadTo(TString& st, char ch) {
+size_t TCountingInput::DoReadTo(TString& st, char ch) {
const size_t ret = Slave_->ReadTo(st, ch);
Count_ += ret;
return ret;
diff --git a/util/stream/length.h b/util/stream/length.h
index 4d508ae24d..fd7aa18799 100644
--- a/util/stream/length.h
+++ b/util/stream/length.h
@@ -22,7 +22,7 @@ public:
~TLengthLimitedInput() override = default;
- inline ui64 Left() const noexcept {
+ inline ui64 Left() const noexcept {
return Length_;
}
@@ -52,14 +52,14 @@ public:
* \returns The total number of characters read from
* this stream.
*/
- inline ui64 Counter() const noexcept {
+ inline ui64 Counter() const noexcept {
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;
+ size_t DoReadTo(TString& st, char ch) override;
ui64 DoReadAll(IOutputStream& out) override;
private:
@@ -80,14 +80,14 @@ public:
~TCountingOutput() override = default;
- TCountingOutput(TCountingOutput&&) noexcept = default;
- TCountingOutput& operator=(TCountingOutput&&) noexcept = default;
-
+ TCountingOutput(TCountingOutput&&) noexcept = default;
+ TCountingOutput& operator=(TCountingOutput&&) noexcept = default;
+
/**
* \returns The total number of characters written
* into this stream.
*/
- inline ui64 Counter() const noexcept {
+ inline ui64 Counter() const noexcept {
return Count_;
}
diff --git a/util/stream/length_ut.cpp b/util/stream/length_ut.cpp
index 8968448954..3dd7f44abc 100644
--- a/util/stream/length_ut.cpp
+++ b/util/stream/length_ut.cpp
@@ -2,7 +2,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
Y_UNIT_TEST_SUITE(TestLengthIO) {
Y_UNIT_TEST(TestLengthLimitedInput) {
@@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(TestLengthIO) {
TStringStream s1("abc\ndef\n");
TCountingInput l1(&s1);
- TString s;
+ TString s;
l1.ReadLine(s);
UNIT_ASSERT_VALUES_EQUAL(l1.Counter(), 4);
@@ -41,10 +41,10 @@ Y_UNIT_TEST_SUITE(TestLengthIO) {
l1.Write('1');
UNIT_ASSERT_VALUES_EQUAL(l1.Counter(), 1);
- l1.Write(TString("abcd"));
+ l1.Write(TString("abcd"));
UNIT_ASSERT_VALUES_EQUAL(l1.Counter(), 5);
- TString buf("aaa");
+ TString buf("aaa");
IOutputStream::TPart parts[] = {{buf.data(), buf.size()}, {buf.data(), buf.size()}, {buf.data(), buf.size()}};
l1.Write(parts, 3);
UNIT_ASSERT_VALUES_EQUAL(l1.Counter(), 14);
diff --git a/util/stream/mem.cpp b/util/stream/mem.cpp
index 22a3339e27..ac6cefd36c 100644
--- a/util/stream/mem.cpp
+++ b/util/stream/mem.cpp
@@ -2,13 +2,13 @@
#include <util/generic/yexception.h>
-TMemoryInput::TMemoryInput() noexcept
+TMemoryInput::TMemoryInput() noexcept
: Buf_(nullptr)
, Len_(0)
{
}
-TMemoryInput::TMemoryInput(const void* buf, size_t len) noexcept
+TMemoryInput::TMemoryInput(const void* buf, size_t len) noexcept
: Buf_((const char*)buf)
, Len_(len)
{
diff --git a/util/stream/mem.h b/util/stream/mem.h
index 18a5d46772..771d13d067 100644
--- a/util/stream/mem.h
+++ b/util/stream/mem.h
@@ -15,7 +15,7 @@
*/
class TMemoryInput: public IZeroCopyInputFastReadTo {
public:
- TMemoryInput() noexcept;
+ TMemoryInput() noexcept;
/**
* Constructs a stream that reads from the provided memory block. It's up
@@ -25,29 +25,29 @@ public:
* @param buf Memory block to use.
* @param len Size of the memory block.
*/
- TMemoryInput(const void* buf, size_t len) noexcept;
+ TMemoryInput(const void* buf, size_t len) noexcept;
explicit TMemoryInput(const TStringBuf buf) noexcept;
- ~TMemoryInput() override;
+ ~TMemoryInput() override;
- TMemoryInput(const TMemoryInput& other) noexcept
+ TMemoryInput(const TMemoryInput& other) noexcept
: IZeroCopyInputFastReadTo()
- , Buf_(other.Buf_)
- , Len_(other.Len_)
- {
- }
-
- TMemoryInput& operator=(const TMemoryInput& other) noexcept {
- if (this != &other) {
- Buf_ = other.Buf_;
- Len_ = other.Len_;
- }
-
- return *this;
- }
-
- TMemoryInput(TMemoryInput&&) noexcept = default;
- TMemoryInput& operator=(TMemoryInput&&) noexcept = default;
-
+ , Buf_(other.Buf_)
+ , Len_(other.Len_)
+ {
+ }
+
+ TMemoryInput& operator=(const TMemoryInput& other) noexcept {
+ if (this != &other) {
+ Buf_ = other.Buf_;
+ Len_ = other.Len_;
+ }
+
+ return *this;
+ }
+
+ TMemoryInput(TMemoryInput&&) noexcept = default;
+ TMemoryInput& operator=(TMemoryInput&&) noexcept = default;
+
/**
* Initializes this stream with a new memory block. It's up to the
* user to make sure that the memory block doesn't get freed while this
@@ -56,7 +56,7 @@ public:
* @param buf New memory block to use.
* @param len Size of the new memory block.
*/
- void Reset(const void* buf, size_t len) noexcept {
+ void Reset(const void* buf, size_t len) noexcept {
Buf_ = (const char*)buf;
Len_ = len;
}
@@ -64,14 +64,14 @@ public:
/**
* @returns Whether there is more data in the stream.
*/
- bool Exhausted() const noexcept {
+ bool Exhausted() const noexcept {
return !Avail();
}
/**
* @returns Number of bytes available in the stream.
*/
- size_t Avail() const noexcept {
+ size_t Avail() const noexcept {
return Len_;
}
@@ -79,7 +79,7 @@ public:
* @returns Current read position in the memory block
* used by this stream.
*/
- const char* Buf() const noexcept {
+ const char* Buf() const noexcept {
return Buf_;
}
@@ -118,16 +118,16 @@ public:
* @param buf Memory block to use.
* @param len Size of the memory block.
*/
- TMemoryOutput(void* buf, size_t len) noexcept
+ TMemoryOutput(void* buf, size_t len) noexcept
: Buf_(static_cast<char*>(buf))
, End_(Buf_ + len)
{
}
- ~TMemoryOutput() override;
-
- TMemoryOutput(TMemoryOutput&&) noexcept = default;
- TMemoryOutput& operator=(TMemoryOutput&&) noexcept = default;
+ ~TMemoryOutput() override;
+ TMemoryOutput(TMemoryOutput&&) noexcept = default;
+ TMemoryOutput& operator=(TMemoryOutput&&) noexcept = default;
+
/**
* Initializes this stream with a new memory block. It's up to the
* user to make sure that the memory block doesn't get freed while this
@@ -136,7 +136,7 @@ public:
* @param buf New memory block to use.
* @param len Size of the new memory block.
*/
- inline void Reset(void* buf, size_t len) noexcept {
+ inline void Reset(void* buf, size_t len) noexcept {
Buf_ = static_cast<char*>(buf);
End_ = Buf_ + len;
}
@@ -145,7 +145,7 @@ public:
* @returns Whether there is more space in the
* stream for writing.
*/
- inline bool Exhausted() const noexcept {
+ inline bool Exhausted() const noexcept {
return !Avail();
}
@@ -153,7 +153,7 @@ public:
* @returns Number of bytes available for writing
* in the stream.
*/
- inline size_t Avail() const noexcept {
+ inline size_t Avail() const noexcept {
return End_ - Buf_;
}
@@ -161,7 +161,7 @@ public:
* @returns Current write position in the memory block
* used by this stream.
*/
- inline char* Buf() const noexcept {
+ inline char* Buf() const noexcept {
return Buf_;
}
diff --git a/util/stream/mem_ut.cpp b/util/stream/mem_ut.cpp
index f388ae66ac..5bc35d73bc 100644
--- a/util/stream/mem_ut.cpp
+++ b/util/stream/mem_ut.cpp
@@ -4,10 +4,10 @@
Y_UNIT_TEST_SUITE(TestMemIO) {
Y_UNIT_TEST(TestReadTo) {
- TString s("0123456789abc");
+ TString s("0123456789abc");
TMemoryInput in(s);
- TString t;
+ TString t;
UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, '7'), 8);
UNIT_ASSERT_VALUES_EQUAL(t, "0123456");
UNIT_ASSERT_VALUES_EQUAL(in.ReadTo(t, 'z'), 5);
diff --git a/util/stream/multi.cpp b/util/stream/multi.cpp
index b2354298a0..23ebb23e7f 100644
--- a/util/stream/multi.cpp
+++ b/util/stream/multi.cpp
@@ -22,7 +22,7 @@ size_t TMultiInput::DoRead(void* buf, size_t len) {
return C_->Read(buf, len);
}
-size_t TMultiInput::DoReadTo(TString& st, char ch) {
+size_t TMultiInput::DoReadTo(TString& st, char ch) {
size_t ret = C_->ReadTo(st, ch);
if (ret == st.size() + 1) { // found a symbol, not eof
return ret;
@@ -34,7 +34,7 @@ size_t TMultiInput::DoReadTo(TString& st, char ch) {
if (ret == 0) {
ret += C_->ReadTo(st, ch);
} else {
- TString tmp;
+ TString tmp;
ret += C_->ReadTo(tmp, ch);
st += tmp;
}
diff --git a/util/stream/multi.h b/util/stream/multi.h
index 8bfd462d99..2098b2732f 100644
--- a/util/stream/multi.h
+++ b/util/stream/multi.h
@@ -13,12 +13,12 @@
class TMultiInput: public IInputStream {
public:
TMultiInput(IInputStream* f, IInputStream* s) noexcept;
- ~TMultiInput() override;
+ ~TMultiInput() override;
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;
+ size_t DoReadTo(TString& st, char ch) override;
private:
IInputStream* C_;
diff --git a/util/stream/multi_ut.cpp b/util/stream/multi_ut.cpp
index fc2553b533..46611639bc 100644
--- a/util/stream/multi_ut.cpp
+++ b/util/stream/multi_ut.cpp
@@ -15,16 +15,16 @@ Y_UNIT_TEST_SUITE(TestMultiInput) {
{
}
void TestReadToResult(char c, size_t expectedRetval,
- const TString& expectedValue,
- const TString& initValue = "") {
- TString t = initValue;
+ const TString& expectedValue,
+ const TString& initValue = "") {
+ TString t = initValue;
UNIT_ASSERT_VALUES_EQUAL(MultiInput.ReadTo(t, c), expectedRetval);
UNIT_ASSERT_VALUES_EQUAL(t, expectedValue);
}
};
Y_UNIT_TEST(TestReadTo) {
- TString t;
+ TString t;
TTestCase simpleCase("0123456789abc", "defghijk");
simpleCase.TestReadToResult('7', 8, "0123456");
diff --git a/util/stream/null.cpp b/util/stream/null.cpp
index 4e8b298145..54ae12e894 100644
--- a/util/stream/null.cpp
+++ b/util/stream/null.cpp
@@ -2,11 +2,11 @@
#include <util/generic/singleton.h>
-TNullIO& NPrivate::StdNullStream() noexcept {
+TNullIO& NPrivate::StdNullStream() noexcept {
return *SingletonWithPriority<TNullIO, 4>();
}
-TNullInput::TNullInput() noexcept {
+TNullInput::TNullInput() noexcept {
}
TNullInput::~TNullInput() = default;
@@ -23,14 +23,14 @@ size_t TNullInput::DoNext(const void**, size_t) {
return 0;
}
-TNullOutput::TNullOutput() noexcept = default;
+TNullOutput::TNullOutput() noexcept = default;
TNullOutput::~TNullOutput() = default;
void TNullOutput::DoWrite(const void* /*buf*/, size_t /*len*/) {
}
-TNullIO::TNullIO() noexcept {
+TNullIO::TNullIO() noexcept {
}
TNullIO::~TNullIO() = default;
diff --git a/util/stream/null.h b/util/stream/null.h
index 8c335a9a78..efccfaab4c 100644
--- a/util/stream/null.h
+++ b/util/stream/null.h
@@ -13,8 +13,8 @@
*/
class TNullInput: public IZeroCopyInput {
public:
- TNullInput() noexcept;
- ~TNullInput() override;
+ TNullInput() noexcept;
+ ~TNullInput() override;
private:
size_t DoRead(void* buf, size_t len) override;
@@ -27,12 +27,12 @@ private:
*/
class TNullOutput: public IOutputStream {
public:
- TNullOutput() noexcept;
- ~TNullOutput() override;
-
- TNullOutput(TNullOutput&&) noexcept = default;
- TNullOutput& operator=(TNullOutput&&) noexcept = default;
+ TNullOutput() noexcept;
+ ~TNullOutput() override;
+ TNullOutput(TNullOutput&&) noexcept = default;
+ TNullOutput& operator=(TNullOutput&&) noexcept = default;
+
private:
void DoWrite(const void* buf, size_t len) override;
};
@@ -45,12 +45,12 @@ private:
*/
class TNullIO: public TNullInput, public TNullOutput {
public:
- TNullIO() noexcept;
- ~TNullIO() override;
+ TNullIO() noexcept;
+ ~TNullIO() override;
};
namespace NPrivate {
- TNullIO& StdNullStream() noexcept;
+ TNullIO& StdNullStream() noexcept;
}
/**
diff --git a/util/stream/output.cpp b/util/stream/output.cpp
index db81b81b70..6ca2952f7f 100644
--- a/util/stream/output.cpp
+++ b/util/stream/output.cpp
@@ -23,7 +23,7 @@
#if defined(_win_)
#include <io.h>
#endif
-
+
constexpr size_t MAX_UTF8_BYTES = 4; // UTF-8-encoded code point takes between 1 and 4 bytes
IOutputStream::IOutputStream() noexcept = default;
@@ -260,13 +260,13 @@ namespace {
class TAndroidStdOutput: public IOutputStream {
public:
- inline TAndroidStdOutput(TLogFuncPtr logFuncPtr) noexcept
+ inline TAndroidStdOutput(TLogFuncPtr logFuncPtr) noexcept
: Buffer()
, LogFuncPtr(logFuncPtr)
{
}
- virtual ~TAndroidStdOutput() {
+ virtual ~TAndroidStdOutput() {
}
private:
@@ -298,7 +298,7 @@ namespace {
{
}
- virtual ~TStdErr() {
+ virtual ~TStdErr() {
}
private:
@@ -314,7 +314,7 @@ namespace {
{
}
- virtual ~TStdOut() {
+ virtual ~TStdOut() {
}
private:
@@ -341,7 +341,7 @@ namespace {
namespace {
class TStdOutput: public IOutputStream {
public:
- inline TStdOutput(FILE* f) noexcept
+ inline TStdOutput(FILE* f) noexcept
: F_(f)
{
}
diff --git a/util/stream/output.h b/util/stream/output.h
index 00eef50b95..0dc723e6f0 100644
--- a/util/stream/output.h
+++ b/util/stream/output.h
@@ -3,8 +3,8 @@
#include "fwd.h"
#include "labeled.h"
-#include <util/generic/noncopyable.h>
-#include <util/generic/string.h>
+#include <util/generic/noncopyable.h>
+#include <util/generic/string.h>
#include <util/generic/strbuf.h>
#include <util/generic/typetraits.h>
@@ -24,7 +24,7 @@ public:
* Data block for output.
*/
struct TPart {
- inline TPart(const void* Buf, size_t Len) noexcept
+ inline TPart(const void* Buf, size_t Len) noexcept
: buf(Buf)
, len(Len)
{
@@ -36,7 +36,7 @@ public:
{
}
- inline TPart() noexcept
+ inline TPart() noexcept
: buf(nullptr)
, len(0)
{
@@ -44,7 +44,7 @@ public:
inline ~TPart() = default;
- static inline TPart CrLf() noexcept {
+ static inline TPart CrLf() noexcept {
return TPart("\r\n", 2);
}
@@ -57,11 +57,11 @@ public:
IOutputStream(IOutputStream&&) noexcept {
}
-
+
IOutputStream& operator=(IOutputStream&&) noexcept {
- return *this;
- };
-
+ return *this;
+ };
+
/**
* Writes into this stream.
*
diff --git a/util/stream/pipe.cpp b/util/stream/pipe.cpp
index 51be1934a7..0fc2d721f4 100644
--- a/util/stream/pipe.cpp
+++ b/util/stream/pipe.cpp
@@ -7,7 +7,7 @@
class TPipeBase::TImpl {
public:
- inline TImpl(const TString& command, const char* mode)
+ inline TImpl(const TString& command, const char* mode)
: Pipe_(nullptr)
{
#ifndef _freebsd_
@@ -21,7 +21,7 @@ public:
}
}
- inline ~TImpl() {
+ inline ~TImpl() {
if (Pipe_ != nullptr) {
::pclose(Pipe_);
}
@@ -31,14 +31,14 @@ public:
FILE* Pipe_;
};
-TPipeBase::TPipeBase(const TString& command, const char* mode)
+TPipeBase::TPipeBase(const TString& command, const char* mode)
: Impl_(new TImpl(command, mode))
{
}
TPipeBase::~TPipeBase() = default;
-TPipeInput::TPipeInput(const TString& command)
+TPipeInput::TPipeInput(const TString& command)
: TPipeBase(command, "r")
{
}
@@ -61,7 +61,7 @@ size_t TPipeInput::DoRead(void* buf, size_t len) {
return bytesRead;
}
-TPipeOutput::TPipeOutput(const TString& command)
+TPipeOutput::TPipeOutput(const TString& command)
: TPipeBase(command, "w")
{
}
@@ -87,7 +87,7 @@ TPipedBase::TPipedBase(PIPEHANDLE fd)
{
}
-TPipedBase::~TPipedBase() {
+TPipedBase::~TPipedBase() {
if (Handle_.IsOpen()) {
Handle_.Close();
}
diff --git a/util/stream/pipe.h b/util/stream/pipe.h
index 18525b9517..8ffdbd1bdc 100644
--- a/util/stream/pipe.h
+++ b/util/stream/pipe.h
@@ -5,7 +5,7 @@
#include <util/system/pipe.h>
#include <util/generic/ptr.h>
-#include <util/generic/string.h>
+#include <util/generic/string.h>
/**
* @addtogroup Streams_Pipes
@@ -24,8 +24,8 @@ protected:
* @param mode Data transfer mode for the pipe. Use
* "r" for reading and "w" for writing.
*/
- TPipeBase(const TString& command, const char* mode);
- virtual ~TPipeBase();
+ TPipeBase(const TString& command, const char* mode);
+ virtual ~TPipeBase();
protected:
class TImpl;
@@ -45,7 +45,7 @@ public:
*
* @param command Command line to start a process with.
*/
- TPipeInput(const TString& command);
+ TPipeInput(const TString& command);
private:
size_t DoRead(void* buf, size_t len) override;
@@ -64,7 +64,7 @@ public:
*
* @param command Command line to start a process with.
*/
- TPipeOutput(const TString& command);
+ TPipeOutput(const TString& command);
/**
* Waits for the process to terminate and throws an exception if it ended
@@ -79,7 +79,7 @@ private:
class TPipedBase {
protected:
TPipedBase(PIPEHANDLE fd);
- virtual ~TPipedBase();
+ virtual ~TPipedBase();
protected:
TPipeHandle Handle_;
@@ -91,7 +91,7 @@ protected:
class TPipedInput: public TPipedBase, public IInputStream {
public:
TPipedInput(PIPEHANDLE fd);
- ~TPipedInput() override;
+ ~TPipedInput() override;
private:
size_t DoRead(void* buf, size_t len) override;
@@ -103,7 +103,7 @@ private:
class TPipedOutput: public TPipedBase, public IOutputStream {
public:
TPipedOutput(PIPEHANDLE fd);
- ~TPipedOutput() override;
+ ~TPipedOutput() override;
private:
void DoWrite(const void* buf, size_t len) override;
diff --git a/util/stream/printf_ut.cpp b/util/stream/printf_ut.cpp
index 0eab167062..d96789e96a 100644
--- a/util/stream/printf_ut.cpp
+++ b/util/stream/printf_ut.cpp
@@ -2,7 +2,7 @@
#include "printf.h"
#include "str.h"
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <library/cpp/testing/unittest/registar.h>
@@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(TStreamPrintfTest) {
}
Y_UNIT_TEST(TestLargePrintf) {
- TString s = NUnitTest::RandomString(1000000);
+ TString s = NUnitTest::RandomString(1000000);
TStringStream ss;
Printf(ss, "%s", s.data());
diff --git a/util/stream/str.h b/util/stream/str.h
index 028bd572c0..a3695b6840 100644
--- a/util/stream/str.h
+++ b/util/stream/str.h
@@ -3,7 +3,7 @@
#include "zerocopy.h"
#include "zerocopy_output.h"
-#include <util/generic/string.h>
+#include <util/generic/string.h>
#include <util/generic/noncopyable.h>
#include <util/generic/store_policy.h>
@@ -29,19 +29,19 @@ public:
*
* @param s String to read from.
*/
- inline TStringInput(const TString& s) noexcept
+ inline TStringInput(const TString& s) noexcept
: S_(&s)
, Pos_(0)
{
}
- TStringInput(const TString&&) = delete;
+ TStringInput(const TString&&) = delete;
- ~TStringInput() override;
-
- TStringInput(TStringInput&&) noexcept = default;
- TStringInput& operator=(TStringInput&&) noexcept = default;
+ ~TStringInput() override;
+ TStringInput(TStringInput&&) noexcept = default;
+ TStringInput& operator=(TStringInput&&) noexcept = default;
+
inline void Swap(TStringInput& s) noexcept {
DoSwap(S_, s.S_);
DoSwap(Pos_, s.Pos_);
@@ -73,14 +73,14 @@ public:
*
* @param s String to append to.
*/
- inline TStringOutput(TString& s) noexcept
+ inline TStringOutput(TString& s) noexcept
: S_(&s)
{
}
TStringOutput(TStringOutput&& s) noexcept = default;
- ~TStringOutput() override;
+ ~TStringOutput() override;
/**
* @param size Number of additional characters to
@@ -107,7 +107,7 @@ private:
/**
* String input/output stream, similar to `std::stringstream`.
*/
-class TStringStream: private TEmbedPolicy<TString>, public TStringInput, public TStringOutput {
+class TStringStream: private TEmbedPolicy<TString>, public TStringInput, public TStringOutput {
using TEmbeddedString = TEmbedPolicy<TString>;
public:
@@ -118,7 +118,7 @@ public:
{
}
- inline TStringStream(const TString& string)
+ inline TStringStream(const TString& string)
: TEmbeddedString(string)
, TStringInput(*TEmbeddedString::Ptr())
, TStringOutput(*TEmbeddedString::Ptr())
@@ -140,7 +140,7 @@ public:
return *this;
}
- ~TStringStream() override;
+ ~TStringStream() override;
/**
* @returns Whether @c this contains any data
@@ -152,14 +152,14 @@ public:
/**
* @returns String that this stream is writing into.
*/
- inline TString& Str() noexcept {
+ inline TString& Str() noexcept {
return *Ptr();
}
/**
* @returns String that this stream is writing into.
*/
- inline const TString& Str() const noexcept {
+ inline const TString& Str() const noexcept {
return *Ptr();
}
@@ -168,7 +168,7 @@ public:
* in this stream. The data is guaranteed
* to be null-terminated.
*/
- inline const char* Data() const noexcept {
+ inline const char* Data() const noexcept {
return Ptr()->data();
}
@@ -178,7 +178,7 @@ public:
* as the total number of characters
* available for reading.
*/
- inline size_t Size() const noexcept {
+ inline size_t Size() const noexcept {
return Ptr()->size();
}
diff --git a/util/stream/str_ut.cpp b/util/stream/str_ut.cpp
index fc6b46c31a..416c924b30 100644
--- a/util/stream/str_ut.cpp
+++ b/util/stream/str_ut.cpp
@@ -8,39 +8,39 @@ const T ReturnConstTemp();
Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
Y_UNIT_TEST(Lvalue) {
- TString str = "Hello, World!";
+ TString str = "Hello, World!";
TStringInput input(str);
- TString result = input.ReadAll();
+ TString result = input.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(result, str);
}
Y_UNIT_TEST(ConstRef) {
- TString str = "Hello, World!";
- const TString& r = str;
+ TString str = "Hello, World!";
+ const TString& r = str;
TStringInput input(r);
- TString result = input.ReadAll();
+ TString result = input.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(result, str);
}
Y_UNIT_TEST(NonConstRef) {
- TString str = "Hello, World!";
- TString& r = str;
+ TString str = "Hello, World!";
+ TString& r = str;
TStringInput input(r);
- TString result = input.ReadAll();
+ TString result = input.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(result, str);
}
Y_UNIT_TEST(Transfer) {
- TString inputString = "some_string";
+ TString inputString = "some_string";
TStringInput input(inputString);
- TString outputString;
+ TString outputString;
TStringOutput output(outputString);
TransferData(&input, &output);
@@ -49,9 +49,9 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
}
Y_UNIT_TEST(SkipReadAll) {
- TString string0 = "All animals are equal, but some animals are more equal than others.";
+ TString string0 = "All animals are equal, but some animals are more equal than others.";
- TString string1;
+ TString string1;
for (size_t i = 1; i <= string0.size(); i++) {
string1 += string0.substr(0, i);
}
@@ -63,7 +63,7 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
left -= input0.Skip(left);
}
- TString string2 = input0.ReadAll();
+ TString string2 = input0.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(string2, string1.substr(5));
}
@@ -78,8 +78,8 @@ Y_UNIT_TEST_SUITE(TStringInputOutputTest) {
}
Y_UNIT_TEST(TestReadTo) {
- TString s("0123456789abc");
- TString t;
+ TString s("0123456789abc");
+ TString t;
TStringInput in0(s);
UNIT_ASSERT_VALUES_EQUAL(in0.ReadTo(t, '7'), 8);
diff --git a/util/stream/tee.h b/util/stream/tee.h
index c69e232fb9..197d242ff5 100644
--- a/util/stream/tee.h
+++ b/util/stream/tee.h
@@ -13,7 +13,7 @@
class TTeeOutput: public IOutputStream {
public:
TTeeOutput(IOutputStream* l, IOutputStream* r) noexcept;
- ~TTeeOutput() override;
+ ~TTeeOutput() override;
private:
void DoWrite(const void* buf, size_t len) override;
diff --git a/util/stream/tempbuf.cpp b/util/stream/tempbuf.cpp
index 801a1fabb0..1f00c22dd3 100644
--- a/util/stream/tempbuf.cpp
+++ b/util/stream/tempbuf.cpp
@@ -1,7 +1,7 @@
#include "tempbuf.h"
namespace {
- static inline size_t Next(size_t size) noexcept {
+ static inline size_t Next(size_t size) noexcept {
return size * 2;
}
}
diff --git a/util/stream/tempbuf.h b/util/stream/tempbuf.h
index a6dc001025..71a2a08d84 100644
--- a/util/stream/tempbuf.h
+++ b/util/stream/tempbuf.h
@@ -5,9 +5,9 @@
#include <util/memory/tempbuf.h>
class TTempBufOutput: public IOutputStream, public TTempBuf {
-public:
+public:
inline TTempBufOutput() = default;
-
+
explicit TTempBufOutput(size_t size)
: TTempBuf(size)
{
@@ -15,7 +15,7 @@ public:
TTempBufOutput(TTempBufOutput&&) noexcept = default;
TTempBufOutput& operator=(TTempBufOutput&&) noexcept = default;
-
+
protected:
void DoWrite(const void* data, size_t len) override;
};
diff --git a/util/stream/tokenizer.h b/util/stream/tokenizer.h
index b2398efdd1..944aada3a5 100644
--- a/util/stream/tokenizer.h
+++ b/util/stream/tokenizer.h
@@ -31,7 +31,7 @@ public:
{
}
- inline TIterator() noexcept
+ inline TIterator() noexcept
: Parent_(nullptr)
, Data_(nullptr)
, Len_(0)
@@ -45,11 +45,11 @@ public:
Next();
}
- inline bool operator==(const TIterator& l) const noexcept {
+ inline bool operator==(const TIterator& l) const noexcept {
return AtEnd_ == l.AtEnd_;
}
- inline bool operator!=(const TIterator& l) const noexcept {
+ inline bool operator!=(const TIterator& l) const noexcept {
return !(*this == l);
}
@@ -57,7 +57,7 @@ public:
* @return Return null-terminated character array with current token.
* The pointer may be invalid after iterator increment.
*/
- inline const char* Data() const noexcept {
+ inline const char* Data() const noexcept {
Y_ASSERT(!AtEnd_);
return Data_;
@@ -66,17 +66,17 @@ public:
/**
* @return Length of current token.
*/
- inline size_t Length() const noexcept {
+ inline size_t Length() const noexcept {
Y_ASSERT(!AtEnd_);
return Len_;
}
- inline TIterator* operator->() noexcept {
+ inline TIterator* operator->() noexcept {
return this;
}
- inline TStringBuf operator*() noexcept {
+ inline TStringBuf operator*() noexcept {
return TStringBuf{Data_, Len_};
}
@@ -166,7 +166,7 @@ public:
return TIterator{this};
}
- inline TIterator end() noexcept {
+ inline TIterator end() noexcept {
return {};
}
@@ -180,11 +180,11 @@ private:
return bytesRead;
}
- inline char* BufBegin() noexcept {
+ inline char* BufBegin() noexcept {
return Buf_.Data();
}
- inline char* BufEnd() noexcept {
+ inline char* BufEnd() noexcept {
return Buf_.Data() + Buf_.Capacity();
}
@@ -206,7 +206,7 @@ private:
* Predicate for `TStreamTokenizer` that uses '\\n' as a delimiter.
*/
struct TEol {
- inline bool operator()(char ch) const noexcept {
+ inline bool operator()(char ch) const noexcept {
return ch == '\n';
}
};
diff --git a/util/stream/tokenizer_ut.cpp b/util/stream/tokenizer_ut.cpp
index afc566da86..957b8cc3e0 100644
--- a/util/stream/tokenizer_ut.cpp
+++ b/util/stream/tokenizer_ut.cpp
@@ -108,7 +108,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {
Y_UNIT_TEST(CustomPredicateTest) {
struct TIsVerticalBar {
- inline bool operator()(const char ch) const noexcept {
+ inline bool operator()(const char ch) const noexcept {
return '|' == ch;
}
};
@@ -132,7 +132,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {
Y_UNIT_TEST(CustomPredicateSecondTest) {
struct TIsVerticalBar {
- inline bool operator()(const char ch) const noexcept {
+ inline bool operator()(const char ch) const noexcept {
return '|' == ch || ',' == ch;
}
};
@@ -157,7 +157,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {
Y_UNIT_TEST(FalsePredicateTest) {
struct TAlwaysFalse {
- inline bool operator()(const char) const noexcept {
+ inline bool operator()(const char) const noexcept {
return false;
}
};
@@ -178,7 +178,7 @@ Y_UNIT_TEST_SUITE(TStreamTokenizerTests) {
Y_UNIT_TEST(TruePredicateTest) {
struct TAlwaysTrue {
- inline bool operator()(const char) const noexcept {
+ inline bool operator()(const char) const noexcept {
return true;
}
};
diff --git a/util/stream/walk.cpp b/util/stream/walk.cpp
index 57dc9ab036..280f7e9f10 100644
--- a/util/stream/walk.cpp
+++ b/util/stream/walk.cpp
@@ -1,6 +1,6 @@
#include "walk.h"
-#include <util/generic/string.h>
+#include <util/generic/string.h>
void IWalkInput::DoUndo(size_t len) {
Len_ += len;
diff --git a/util/stream/walk_ut.cpp b/util/stream/walk_ut.cpp
index e0a783799f..ed75b4e2ba 100644
--- a/util/stream/walk_ut.cpp
+++ b/util/stream/walk_ut.cpp
@@ -4,7 +4,7 @@
class TStringListInput: public IWalkInput {
public:
- TStringListInput(const TVector<TString>& data)
+ TStringListInput(const TVector<TString>& data)
: Data_(data)
, Index_(0)
{
@@ -16,20 +16,20 @@ protected:
return 0;
}
- const TString& string = Data_[Index_++];
+ const TString& string = Data_[Index_++];
*ptr = string.data();
return string.size();
}
private:
- const TVector<TString>& Data_;
+ const TVector<TString>& Data_;
size_t Index_;
};
Y_UNIT_TEST_SUITE(TWalkTest) {
Y_UNIT_TEST(ReadTo) {
- TVector<TString> data;
+ TVector<TString> data;
data.push_back("111a");
data.push_back("222b");
data.push_back("333c");
@@ -39,17 +39,17 @@ Y_UNIT_TEST_SUITE(TWalkTest) {
TStringListInput input(data);
- TString tmp1 = input.ReadTo('c');
+ TString tmp1 = input.ReadTo('c');
UNIT_ASSERT_VALUES_EQUAL(tmp1, "111a222b333");
char tmp2;
input.Read(&tmp2, 1);
UNIT_ASSERT_VALUES_EQUAL(tmp2, '4');
- TString tmp3 = input.ReadTo('6');
+ TString tmp3 = input.ReadTo('6');
UNIT_ASSERT_VALUES_EQUAL(tmp3, "44d555e");
- TString tmp4 = input.ReadAll();
+ TString tmp4 = input.ReadAll();
UNIT_ASSERT_VALUES_EQUAL(tmp4, "66f");
}
}
diff --git a/util/stream/zerocopy.h b/util/stream/zerocopy.h
index 3315aa3a51..583985f57f 100644
--- a/util/stream/zerocopy.h
+++ b/util/stream/zerocopy.h
@@ -25,7 +25,7 @@ public:
IZeroCopyInput(IZeroCopyInput&&) noexcept = default;
IZeroCopyInput& operator=(IZeroCopyInput&&) noexcept = default;
-
+
/**
* Returns the next data chunk from this input stream.
*
@@ -70,7 +70,7 @@ public:
IZeroCopyInputFastReadTo& operator=(IZeroCopyInputFastReadTo&&) noexcept = default;
protected:
- size_t DoReadTo(TString& st, char ch) override;
+ size_t DoReadTo(TString& st, char ch) override;
private:
/**
diff --git a/util/stream/zlib.cpp b/util/stream/zlib.cpp
index 60f4e9439f..7e065aab61 100644
--- a/util/stream/zlib.cpp
+++ b/util/stream/zlib.cpp
@@ -22,17 +22,17 @@ namespace {
class TZLibCommon {
public:
- inline TZLibCommon() noexcept {
+ inline TZLibCommon() noexcept {
memset(Z(), 0, sizeof(*Z()));
}
inline ~TZLibCommon() = default;
- inline const char* GetErrMsg() const noexcept {
+ inline const char* GetErrMsg() const noexcept {
return Z()->msg != nullptr ? Z()->msg : "unknown error";
}
- inline z_stream* Z() const noexcept {
+ inline z_stream* Z() const noexcept {
return (z_stream*)(&Z_);
}
@@ -40,7 +40,7 @@ namespace {
z_stream Z_;
};
- static inline ui32 MaxPortion(size_t s) noexcept {
+ static inline ui32 MaxPortion(size_t s) noexcept {
return (ui32)Min<size_t>(Max<ui32>(), s);
}
@@ -225,7 +225,7 @@ public:
Z()->avail_out = TmpBufLen();
}
- inline ~TImpl() {
+ inline ~TImpl() {
deflateEnd(Z());
}
@@ -305,11 +305,11 @@ public:
}
private:
- inline unsigned char* TmpBuf() noexcept {
+ inline unsigned char* TmpBuf() noexcept {
return (unsigned char*)AdditionalData();
}
- inline size_t TmpBufLen() const noexcept {
+ inline size_t TmpBufLen() const noexcept {
return AdditionalDataLength();
}
@@ -347,7 +347,7 @@ void TZLibCompress::TDestruct::Destroy(TImpl* impl) {
delete impl;
}
-TZLibCompress::~TZLibCompress() {
+TZLibCompress::~TZLibCompress() {
try {
Finish();
} catch (...) {
diff --git a/util/stream/zlib.h b/util/stream/zlib.h
index e7de7c81b7..c571d98251 100644
--- a/util/stream/zlib.h
+++ b/util/stream/zlib.h
@@ -62,7 +62,7 @@ public:
*/
void SetAllowMultipleStreams(bool allowMultipleStreams);
- ~TZLibDecompress() override;
+ ~TZLibDecompress() override;
protected:
size_t DoRead(void* buf, size_t size) override;
@@ -86,19 +86,19 @@ public:
{
}
- inline TParams& SetType(ZLib::StreamType type) noexcept {
+ inline TParams& SetType(ZLib::StreamType type) noexcept {
Type = type;
return *this;
}
- inline TParams& SetCompressionLevel(size_t level) noexcept {
+ inline TParams& SetCompressionLevel(size_t level) noexcept {
CompressionLevel = level;
return *this;
}
- inline TParams& SetBufLen(size_t buflen) noexcept {
+ inline TParams& SetBufLen(size_t buflen) noexcept {
BufLen = buflen;
return *this;
@@ -133,7 +133,7 @@ public:
Init(TParams(out).SetType(type).SetCompressionLevel(compression_level).SetBufLen(buflen));
}
- ~TZLibCompress() override;
+ ~TZLibCompress() override;
private:
void Init(const TParams& opts);
@@ -167,7 +167,7 @@ public:
{
}
- ~TBufferedZLibDecompress() override;
+ ~TBufferedZLibDecompress() override;
};
/** @} */
diff --git a/util/stream/zlib_ut.cpp b/util/stream/zlib_ut.cpp
index 2290b4a9de..022bca5f3f 100644
--- a/util/stream/zlib_ut.cpp
+++ b/util/stream/zlib_ut.cpp
@@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) {
static const TString DATA2 = "cn8wk2bd9vb3vdfif83g1ks94bfiovtwv";
Y_UNIT_TEST(Compress) {
- TUnbufferedFileOutput o(ZDATA);
+ TUnbufferedFileOutput o(ZDATA);
TZLibCompress c(&o, ZLib::ZLib);
c.Write(DATA.data(), DATA.size());
@@ -68,7 +68,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) {
TTempFile tmpFile(ZDATA);
{
- TUnbufferedFileInput i(ZDATA);
+ TUnbufferedFileInput i(ZDATA);
TZLibDecompress d(&i);
UNIT_ASSERT_EQUAL(d.ReadAll(), DATA);
@@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) {
// Check that Decompress(Compress(X) + Compress(Y)) == X + Y
TTempFile tmpFile(ZDATA);
{
- TUnbufferedFileOutput o(ZDATA);
+ TUnbufferedFileOutput o(ZDATA);
TZLibCompress c1(&o, ZLib::ZLib);
c1.Write(DATA.data(), DATA.size());
c1.Finish();
@@ -104,7 +104,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) {
o.Finish();
}
{
- TUnbufferedFileInput i(ZDATA);
+ TUnbufferedFileInput i(ZDATA);
TZLibDecompress d(&i);
UNIT_ASSERT_EQUAL(d.ReadAll(), DATA + DATA2);
@@ -130,7 +130,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) {
// Check that Decompress(Compress(X) + Compress(Y)) == X when single stream is allowed
TTempFile tmpFile(ZDATA);
{
- TUnbufferedFileOutput o(ZDATA);
+ TUnbufferedFileOutput o(ZDATA);
TZLibCompress c1(&o, ZLib::ZLib);
c1.Write(DATA.data(), DATA.size());
c1.Finish();
@@ -140,7 +140,7 @@ Y_UNIT_TEST_SUITE(TZLibTest) {
o.Finish();
}
{
- TUnbufferedFileInput i(ZDATA);
+ TUnbufferedFileInput i(ZDATA);
TZLibDecompress d(&i);
d.SetAllowMultipleStreams(false);