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
commit1f553f46fb4f3c5eec631352cdd900a0709016af (patch)
treea231fba2c03b440becaea6c86a2702d0bfb0336e /library/cpp/messagebus/key_value_printer.cpp
parentc4de7efdedc25b49cbea74bd589eecb61b55b60a (diff)
downloadydb-1f553f46fb4f3c5eec631352cdd900a0709016af.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 1 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 c8592145c7..93851eff3a 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();
+}