aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream
diff options
context:
space:
mode:
authorkimkim <kimkim@yandex-team.ru>2022-02-10 16:49:28 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:28 +0300
commit10807864acf73d00f425a23b442aac2cf34403a8 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/stream
parent13f84424ed9975f6827d9786087c6fe6ea265cda (diff)
downloadydb-10807864acf73d00f425a23b442aac2cf34403a8.tar.gz
Restoring authorship annotation for <kimkim@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream')
-rw-r--r--util/stream/buffer.h2
-rw-r--r--util/stream/buffered.h2
-rw-r--r--util/stream/debug.cpp2
-rw-r--r--util/stream/file.cpp2
-rw-r--r--util/stream/input.cpp120
-rw-r--r--util/stream/input.h14
-rw-r--r--util/stream/ios_ut.cpp54
-rw-r--r--util/stream/mem.cpp2
-rw-r--r--util/stream/pipe.h2
-rw-r--r--util/stream/zerocopy.h4
-rw-r--r--util/stream/zlib.h6
11 files changed, 105 insertions, 105 deletions
diff --git a/util/stream/buffer.h b/util/stream/buffer.h
index f46dca73aa..9dc99dbe49 100644
--- a/util/stream/buffer.h
+++ b/util/stream/buffer.h
@@ -3,7 +3,7 @@
#include "zerocopy.h"
#include "zerocopy_output.h"
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
class TBuffer;
diff --git a/util/stream/buffered.h b/util/stream/buffered.h
index 405eeb6217..0847186141 100644
--- a/util/stream/buffered.h
+++ b/util/stream/buffered.h
@@ -4,7 +4,7 @@
#include "zerocopy_output.h"
#include <utility>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/generic/typetraits.h>
#include <util/generic/store_policy.h>
diff --git a/util/stream/debug.cpp b/util/stream/debug.cpp
index 260dc2ad38..afd5b3e1c7 100644
--- a/util/stream/debug.cpp
+++ b/util/stream/debug.cpp
@@ -10,7 +10,7 @@
void TDebugOutput::DoWrite(const void* buf, size_t len) {
if (len != fwrite(buf, 1, len, stderr)) {
- ythrow yexception() << "write failed(" << LastSystemErrorText() << ")";
+ ythrow yexception() << "write failed(" << LastSystemErrorText() << ")";
}
}
diff --git a/util/stream/file.cpp b/util/stream/file.cpp
index 71b1721c45..dc5d2f6311 100644
--- a/util/stream/file.cpp
+++ b/util/stream/file.cpp
@@ -1,6 +1,6 @@
#include "file.h"
-#include <util/memory/blob.h>
+#include <util/memory/blob.h>
#include <util/generic/yexception.h>
TUnbufferedFileInput::TUnbufferedFileInput(const TString& path)
diff --git a/util/stream/input.cpp b/util/stream/input.cpp
index e86190baf8..6e8170f2f9 100644
--- a/util/stream/input.cpp
+++ b/util/stream/input.cpp
@@ -5,7 +5,7 @@
#include <util/charset/wide.h>
#include <util/memory/tempbuf.h>
#include <util/generic/string.h>
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
#include <util/generic/singleton.h>
#include <util/string/cast.h>
#include <util/system/compat.h>
@@ -103,7 +103,7 @@ TString IInputStream::ReadLine() {
TString ret;
if (!ReadLine(ret)) {
- ythrow yexception() << "can not read line from stream";
+ ythrow yexception() << "can not read line from stream";
}
return ret;
@@ -113,7 +113,7 @@ TString IInputStream::ReadTo(char ch) {
TString ret;
if (!ReadTo(ret, ch)) {
- ythrow yexception() << "can not read from stream";
+ ythrow yexception() << "can not read from stream";
}
return ret;
@@ -253,64 +253,64 @@ namespace {
IInputStream& NPrivate::StdInStream() noexcept {
return *SingletonWithPriority<TGetLine, 4>();
}
-
-// implementation of >> operator
-
+
+// implementation of >> operator
+
// helper functions
-
+
static inline bool IsStdDelimiter(char c) {
- return (c == '\0') || (c == ' ') || (c == '\r') || (c == '\n') || (c == '\t');
-}
-
+ return (c == '\0') || (c == ' ') || (c == '\r') || (c == '\n') || (c == '\t');
+}
+
static void ReadUpToDelimiter(IInputStream& i, TString& s) {
- char c;
- while (i.ReadChar(c)) { // skip delimiters
+ char c;
+ while (i.ReadChar(c)) { // skip delimiters
if (!IsStdDelimiter(c)) {
- s += c;
- break;
- }
- }
+ s += c;
+ break;
+ }
+ }
while (i.ReadChar(c) && !IsStdDelimiter(c)) { // read data (with trailing delimiter)
- s += c;
- }
-}
-
-// specialization for string-related stuff
-
-template <>
+ s += c;
+ }
+}
+
+// specialization for string-related stuff
+
+template <>
void In<TString>(IInputStream& i, TString& s) {
s.resize(0);
- ReadUpToDelimiter(i, s);
-}
-
-template <>
+ ReadUpToDelimiter(i, s);
+}
+
+template <>
void In<TUtf16String>(IInputStream& i, TUtf16String& w) {
TString s;
- ReadUpToDelimiter(i, s);
-
- if (s.empty()) {
- w.erase();
- } else {
+ ReadUpToDelimiter(i, s);
+
+ if (s.empty()) {
+ w.erase();
+ } else {
w = UTF8ToWide(s);
- }
-}
-
+ }
+}
+
// specialization for char types
-
+
#define SPEC_FOR_CHAR(T) \
template <> \
void In<T>(IInputStream & i, T & t) { \
i.ReadChar((char&)t); \
}
-
-SPEC_FOR_CHAR(char)
-SPEC_FOR_CHAR(unsigned char)
-SPEC_FOR_CHAR(signed char)
-
-#undef SPEC_FOR_CHAR
-
-// specialization for number types
-
+
+SPEC_FOR_CHAR(char)
+SPEC_FOR_CHAR(unsigned char)
+SPEC_FOR_CHAR(signed char)
+
+#undef SPEC_FOR_CHAR
+
+// specialization for number types
+
#define SPEC_FOR_NUMBER(T) \
template <> \
void In<T>(IInputStream & i, T & t) { \
@@ -327,18 +327,18 @@ SPEC_FOR_CHAR(signed char)
} \
t = FromString<T, char>(buf, pos); \
}
-
-SPEC_FOR_NUMBER(signed short)
-SPEC_FOR_NUMBER(signed int)
-SPEC_FOR_NUMBER(signed long int)
-SPEC_FOR_NUMBER(signed long long int)
-SPEC_FOR_NUMBER(unsigned short)
-SPEC_FOR_NUMBER(unsigned int)
-SPEC_FOR_NUMBER(unsigned long int)
-SPEC_FOR_NUMBER(unsigned long long int)
-
-SPEC_FOR_NUMBER(float)
-SPEC_FOR_NUMBER(double)
-SPEC_FOR_NUMBER(long double)
-
-#undef SPEC_FOR_NUMBER
+
+SPEC_FOR_NUMBER(signed short)
+SPEC_FOR_NUMBER(signed int)
+SPEC_FOR_NUMBER(signed long int)
+SPEC_FOR_NUMBER(signed long long int)
+SPEC_FOR_NUMBER(unsigned short)
+SPEC_FOR_NUMBER(unsigned int)
+SPEC_FOR_NUMBER(unsigned long int)
+SPEC_FOR_NUMBER(unsigned long long int)
+
+SPEC_FOR_NUMBER(float)
+SPEC_FOR_NUMBER(double)
+SPEC_FOR_NUMBER(long double)
+
+#undef SPEC_FOR_NUMBER
diff --git a/util/stream/input.h b/util/stream/input.h
index e7e113d575..f0d5807ed2 100644
--- a/util/stream/input.h
+++ b/util/stream/input.h
@@ -43,7 +43,7 @@ public:
return DoRead(buf, len);
}
-
+
/**
* Reads one character from the stream.
*
@@ -243,9 +243,9 @@ ui64 TransferData(IInputStream* in, IOutputStream* out);
* @throws `yexception` on invalid input or end of stream.
* @see Out(IOutputStream&, T&)
*/
-template <typename T>
+template <typename T>
void In(IInputStream& in, T& value);
-
+
/**
* Reads a value from the stream.
*
@@ -255,12 +255,12 @@ void In(IInputStream& in, T& value);
* @throws `yexception` on invalid input or end of stream.
* @see operator<<(IOutputStream&, T&)
*/
-template <typename T>
+template <typename T>
inline IInputStream& operator>>(IInputStream& in, T& value) {
In<T>(in, value);
- return in;
-}
-
+ return in;
+}
+
namespace NPrivate {
IInputStream& StdInStream() noexcept;
}
diff --git a/util/stream/ios_ut.cpp b/util/stream/ios_ut.cpp
index 5430c90686..139f4296e5 100644
--- a/util/stream/ios_ut.cpp
+++ b/util/stream/ios_ut.cpp
@@ -54,38 +54,38 @@ 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");
- TStringInput si(data);
-
+ TStringInput si(data);
+
TString l1;
TString l2;
TString l3;
TUtf16String w1;
TString l4;
- ui16 i1;
- i16 i2;
- i32 i3;
- ui64 i4;
- char c1;
- unsigned char c2;
- float f1;
- double f2;
-
- si >> l1 >> l2 >> l3 >> w1 >> l4 >> i1 >> i2 >> i3 >> i4 >> c1 >> c2 >> f1 >> f2;
-
- UNIT_ASSERT_EQUAL(l1, "first");
- UNIT_ASSERT_EQUAL(l2, "line");
- UNIT_ASSERT_EQUAL(l3, "second");
- UNIT_ASSERT_EQUAL(l4, "line");
- UNIT_ASSERT_EQUAL(i1, 1);
- UNIT_ASSERT_EQUAL(i2, -4);
- UNIT_ASSERT_EQUAL(i3, 59);
- UNIT_ASSERT_EQUAL(i4, 4320000000009999999ULL);
- UNIT_ASSERT_EQUAL(c1, 'c');
- UNIT_ASSERT_EQUAL(c2, '\n');
- UNIT_ASSERT_EQUAL(f1, -1.5);
- UNIT_ASSERT_EQUAL(f2, 1e-110);
-}
-
+ ui16 i1;
+ i16 i2;
+ i32 i3;
+ ui64 i4;
+ char c1;
+ unsigned char c2;
+ float f1;
+ double f2;
+
+ si >> l1 >> l2 >> l3 >> w1 >> l4 >> i1 >> i2 >> i3 >> i4 >> c1 >> c2 >> f1 >> f2;
+
+ UNIT_ASSERT_EQUAL(l1, "first");
+ UNIT_ASSERT_EQUAL(l2, "line");
+ UNIT_ASSERT_EQUAL(l3, "second");
+ UNIT_ASSERT_EQUAL(l4, "line");
+ UNIT_ASSERT_EQUAL(i1, 1);
+ UNIT_ASSERT_EQUAL(i2, -4);
+ UNIT_ASSERT_EQUAL(i3, 59);
+ UNIT_ASSERT_EQUAL(i4, 4320000000009999999ULL);
+ UNIT_ASSERT_EQUAL(c1, 'c');
+ UNIT_ASSERT_EQUAL(c2, '\n');
+ UNIT_ASSERT_EQUAL(f1, -1.5);
+ UNIT_ASSERT_EQUAL(f2, 1e-110);
+}
+
void TStreamsTest::TestStringStream() {
TStringStream s;
diff --git a/util/stream/mem.cpp b/util/stream/mem.cpp
index 20d825195c..22a3339e27 100644
--- a/util/stream/mem.cpp
+++ b/util/stream/mem.cpp
@@ -1,6 +1,6 @@
#include "mem.h"
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
TMemoryInput::TMemoryInput() noexcept
: Buf_(nullptr)
diff --git a/util/stream/pipe.h b/util/stream/pipe.h
index 793be6d16f..18525b9517 100644
--- a/util/stream/pipe.h
+++ b/util/stream/pipe.h
@@ -4,7 +4,7 @@
#include "output.h"
#include <util/system/pipe.h>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/generic/string.h>
/**
diff --git a/util/stream/zerocopy.h b/util/stream/zerocopy.h
index 7fdae10bd6..3315aa3a51 100644
--- a/util/stream/zerocopy.h
+++ b/util/stream/zerocopy.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/system/yassert.h>
-#include <util/system/defaults.h>
+#include <util/system/yassert.h>
+#include <util/system/defaults.h>
#include <util/generic/ylimits.h>
#include "input.h"
diff --git a/util/stream/zlib.h b/util/stream/zlib.h
index e27649a0fe..e7de7c81b7 100644
--- a/util/stream/zlib.h
+++ b/util/stream/zlib.h
@@ -5,9 +5,9 @@
#include "output.h"
#include "buffered.h"
-#include <util/system/defaults.h>
-#include <util/generic/ptr.h>
-#include <util/generic/yexception.h>
+#include <util/system/defaults.h>
+#include <util/generic/ptr.h>
+#include <util/generic/yexception.h>
/**
* @addtogroup Streams_Archs