blob: 385b6e09600cc35768b4d4261ee5f2a9510fd835 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#pragma once
#include <util/generic/string.h>
#include <util/generic/typetraits.h>
#include <util/generic/vector.h>
#include <util/string/cast.h>
class TKeyValuePrinter {
private:
TString Sep;
TVector<TString> Keys;
TVector<TString> Values;
TVector<bool> AlignLefts;
public:
TKeyValuePrinter(const TString& sep = TString(": "));
~TKeyValuePrinter();
template <typename TKey, typename TValue>
void AddRow(const TKey& key, const TValue& value, bool leftAlign = !std::is_integral<TValue>::value) {
return AddRowImpl(ToString(key), ToString(value), leftAlign);
}
TString PrintToString() const;
private:
void AddRowImpl(const TString& key, const TString& value, bool leftAlign);
};
|