aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/key_value_printer.cpp
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commitc2a1af049e9deca890e9923abe64fe6c59060348 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13 /library/cpp/messagebus/key_value_printer.cpp
parent1f553f46fb4f3c5eec631352cdd900a0709016af (diff)
downloadydb-c2a1af049e9deca890e9923abe64fe6c59060348.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/key_value_printer.cpp')
-rw-r--r--library/cpp/messagebus/key_value_printer.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/messagebus/key_value_printer.cpp b/library/cpp/messagebus/key_value_printer.cpp
index 93851eff3a..c8592145c7 100644
--- a/library/cpp/messagebus/key_value_printer.cpp
+++ b/library/cpp/messagebus/key_value_printer.cpp
@@ -1,46 +1,46 @@
#include "key_value_printer.h"
-#include <util/stream/format.h>
-
+#include <util/stream/format.h>
+
TKeyValuePrinter::TKeyValuePrinter(const TString& sep)
- : Sep(sep)
+ : Sep(sep)
{
}
-
+
TKeyValuePrinter::~TKeyValuePrinter() {
}
-
+
void TKeyValuePrinter::AddRowImpl(const TString& key, const TString& value, bool alignLeft) {
- Keys.push_back(key);
- Values.push_back(value);
- AlignLefts.push_back(alignLeft);
-}
-
+ Keys.push_back(key);
+ Values.push_back(value);
+ AlignLefts.push_back(alignLeft);
+}
+
TString TKeyValuePrinter::PrintToString() const {
- if (Keys.empty()) {
+ if (Keys.empty()) {
return TString();
- }
-
- size_t keyWidth = 0;
- size_t valueWidth = 0;
-
- for (size_t i = 0; i < Keys.size(); ++i) {
- keyWidth = Max(keyWidth, Keys.at(i).size());
- valueWidth = Max(valueWidth, Values.at(i).size());
- }
-
- TStringStream ss;
-
- for (size_t i = 0; i < Keys.size(); ++i) {
- ss << RightPad(Keys.at(i), keyWidth);
- ss << Sep;
- if (AlignLefts.at(i)) {
- ss << Values.at(i);
- } else {
- ss << LeftPad(Values.at(i), valueWidth);
- }
- ss << Endl;
- }
-
- return ss.Str();
-}
+ }
+
+ size_t keyWidth = 0;
+ size_t valueWidth = 0;
+
+ for (size_t i = 0; i < Keys.size(); ++i) {
+ keyWidth = Max(keyWidth, Keys.at(i).size());
+ valueWidth = Max(valueWidth, Values.at(i).size());
+ }
+
+ TStringStream ss;
+
+ for (size_t i = 0; i < Keys.size(); ++i) {
+ ss << RightPad(Keys.at(i), keyWidth);
+ ss << Sep;
+ if (AlignLefts.at(i)) {
+ ss << Values.at(i);
+ } else {
+ ss << LeftPad(Values.at(i), valueWidth);
+ }
+ ss << Endl;
+ }
+
+ return ss.Str();
+}