aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkartynnik <kartynnik@yandex-team.ru>2022-02-10 16:48:07 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:07 +0300
commitdf6128370874866447314ec18d8e67fc7bde40b4 (patch)
treeb222e5ac2e2e98872661c51ccceee5da0d291e13
parentca2a705e6e39e85df30054d7e806e572de9cfe23 (diff)
downloadydb-df6128370874866447314ec18d8e67fc7bde40b4.tar.gz
Restoring authorship annotation for <kartynnik@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--contrib/libs/pire/pire/extra/count.cpp2
-rw-r--r--contrib/libs/pire/pire/inline.l10
-rw-r--r--contrib/libs/pire/pire/run.h18
-rw-r--r--contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp396
-rw-r--r--library/cpp/binsaver/class_factory.h8
-rw-r--r--library/cpp/colorizer/ut/colorizer_ut.cpp32
-rw-r--r--library/cpp/colorizer/ut/ya.make14
-rw-r--r--library/cpp/containers/compact_vector/compact_vector.cpp2
-rw-r--r--library/cpp/containers/compact_vector/compact_vector.h8
-rw-r--r--library/cpp/containers/compact_vector/ut/ya.make20
-rw-r--r--library/cpp/containers/compact_vector/ya.make18
-rw-r--r--library/cpp/containers/stack_vector/stack_vec.cpp2
-rw-r--r--library/cpp/containers/stack_vector/stack_vec.h136
-rw-r--r--library/cpp/containers/stack_vector/stack_vec_ut.cpp96
-rw-r--r--library/cpp/containers/stack_vector/ut/ya.make18
-rw-r--r--library/cpp/containers/stack_vector/ya.make16
-rw-r--r--library/cpp/coroutine/engine/iostatus.h4
-rw-r--r--library/cpp/dbg_output/DONT_COMMIT.h14
-rw-r--r--library/cpp/dbg_output/auto.h28
-rw-r--r--library/cpp/dbg_output/colorscheme.h54
-rw-r--r--library/cpp/dbg_output/dump.h16
-rw-r--r--library/cpp/dbg_output/dumpers.h24
-rw-r--r--library/cpp/dbg_output/engine.h30
-rw-r--r--library/cpp/dbg_output/ut/dbg_output_ut.cpp92
-rw-r--r--library/cpp/dbg_output/ut/ya.make14
-rw-r--r--library/cpp/dbg_output/ya.make6
-rw-r--r--library/cpp/protobuf/json/proto2json.h6
-rw-r--r--library/cpp/protobuf/json/ut/json.h6
-rw-r--r--library/cpp/protobuf/json/ut/proto2json_ut.cpp10
-rw-r--r--library/cpp/string_utils/url/url.cpp8
-rw-r--r--library/cpp/string_utils/url/url_ut.cpp2
-rw-r--r--library/cpp/uri/uri.cpp2
-rw-r--r--tools/ya.make8
-rw-r--r--util/generic/algorithm.h42
-rw-r--r--util/generic/algorithm_ut.cpp6
-rw-r--r--util/generic/iterator.h6
-rw-r--r--util/generic/iterator_ut.cpp10
-rw-r--r--util/generic/va_args.cpp16
-rw-r--r--util/generic/va_args.h12
-rwxr-xr-xutil/generic/va_args_gen.py56
-rw-r--r--util/generic/va_args_ut.cpp22
-rw-r--r--util/stream/labeled.h10
-rw-r--r--util/stream/labeled_ut.cpp18
-rw-r--r--util/stream/output.h4
-rw-r--r--util/ysafeptr.h4
45 files changed, 663 insertions, 663 deletions
diff --git a/contrib/libs/pire/pire/extra/count.cpp b/contrib/libs/pire/pire/extra/count.cpp
index c4aa3d62c1..468ff61d92 100644
--- a/contrib/libs/pire/pire/extra/count.cpp
+++ b/contrib/libs/pire/pire/extra/count.cpp
@@ -801,7 +801,7 @@ CountingScanner::CountingScanner(const Fsm& re, const Fsm& sep)
Y_ASSERT(!"Wrong transition size for backup");
NewState ns(*mr.begin(), *br.begin());
- PIRE_IFDEBUG(NewState savedNs = ns);
+ PIRE_IFDEBUG(NewState savedNs = ns);
unsigned long outputs = 0;
PIRE_IFDEBUG(ystring dbgout);
diff --git a/contrib/libs/pire/pire/inline.l b/contrib/libs/pire/pire/inline.l
index a79e857b77..a4d2e1a836 100644
--- a/contrib/libs/pire/pire/inline.l
+++ b/contrib/libs/pire/pire/inline.l
@@ -137,7 +137,7 @@ void eatComment(void (*action)(char));
Pire::Lexer lexer(i->c_str(), i->c_str() + i->size());
bool surround = false;
bool greedy = false;
- bool reverse = false;
+ bool reverse = false;
for (const char* option = (i+1)->c_str(); *option; ++option) {
if (*option == 'i')
lexer.AddFeature(Pire::Features::CaseInsensitive());
@@ -149,8 +149,8 @@ void eatComment(void (*action)(char));
lexer.AddFeature(Pire::Features::AndNotSupport());
else if (*option == 'g')
greedy = true;
- else if (*option == 'r')
- reverse = true;
+ else if (*option == 'r')
+ reverse = true;
else
Die() << "unknown option " << *option << "";
}
@@ -162,8 +162,8 @@ void eatComment(void (*action)(char));
catch (std::exception& e) {
Die() << "" << filename << ":" << line << ": " << e.what() << "";
}
- if (reverse)
- fsm.Reverse();
+ if (reverse)
+ fsm.Reverse();
if (greedy && surround)
Die() << "greedy and surround options are incompatible";
if (greedy)
diff --git a/contrib/libs/pire/pire/run.h b/contrib/libs/pire/pire/run.h
index b3d3f3fc4f..f6e1ff734d 100644
--- a/contrib/libs/pire/pire/run.h
+++ b/contrib/libs/pire/pire/run.h
@@ -11,7 +11,7 @@
* it under the terms of the GNU Lesser Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ *
* Pire is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -68,7 +68,7 @@ namespace Impl {
PIRE_FORCED_INLINE PIRE_HOT_FUNCTION
Action operator()(const Scanner&, const typename Scanner::State&, const char*) const { return Continue; }
};
-
+
template<class Scanner>
struct ShortestPrefixPred {
explicit ShortestPrefixPred(const char*& pos): m_pos(&pos) {}
@@ -80,17 +80,17 @@ namespace Impl {
*m_pos = pos;
return Stop;
} else {
- return (sc.Dead(st) ? Stop : Continue);
+ return (sc.Dead(st) ? Stop : Continue);
}
}
private:
const char** m_pos;
};
-
+
template<class Scanner>
struct LongestPrefixPred {
explicit LongestPrefixPred(const char*& pos): m_pos(&pos) {}
-
+
PIRE_FORCED_INLINE PIRE_HOT_FUNCTION
Action operator()(const Scanner& sc, const typename Scanner::State& st, const char* pos) const
{
@@ -270,7 +270,7 @@ namespace Impl {
}
#endif
-
+
template<class Scanner>
void Run(const Scanner& sc, typename Scanner::State& st, TStringBuf str)
{
@@ -337,7 +337,7 @@ const char* ShortestPrefix(const Scanner& sc, const char* begin, const char* end
return prefix.data() + prefix.size();
}
-
+
/// The same as above, but scans string in reverse direction
/// (consider using Fsm::Reverse() for using in this function).
/// Returns default constructed string_view{} if there is no matching suffix
@@ -389,12 +389,12 @@ inline std::string_view ShortestSuffix(const Scanner& scanner, std::string_view
if (throughEndMark)
Step(scanner, state, EndMark);
PIRE_IFDEBUG(Cdbg << "Running ShortestSuffix on string " << ystring(str) << Endl);
- PIRE_IFDEBUG(Cdbg << "Initial state " << StDump(scanner, state) << Endl);
+ PIRE_IFDEBUG(Cdbg << "Initial state " << StDump(scanner, state) << Endl);
while (begin != str.data() && !scanner.Final(state) && !scanner.Dead(state)) {
--begin;
scanner.Next(state, (unsigned char)*begin);
- PIRE_IFDEBUG(Cdbg << *rbegin << " => state " << StDump(scanner, state) << Endl);
+ PIRE_IFDEBUG(Cdbg << *rbegin << " => state " << StDump(scanner, state) << Endl);
}
if (throughBeginMark)
Step(scanner, state, BeginMark);
diff --git a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp
index 467919ef5a..cd96aa0565 100644
--- a/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp
+++ b/contrib/tools/protoc/plugins/cpp_styleguide/cpp_styleguide.cpp
@@ -70,28 +70,28 @@ namespace NPlugins {
}
virtual void GenerateAccessorDeclarations(io::Printer* printer) = 0;
- virtual void GenerateJSONPrinting(io::Printer* printer) = 0;
+ virtual void GenerateJSONPrinting(io::Printer* printer) = 0;
protected:
- void GenerateRepeatedJSONPrinting(io::Printer* printer, const char* itemPrinter) {
- printer->Print("out << '[';\n");
- printer->Print("{\n");
- printer->Indent();
- printer->Print("const char* separator = \"\";\n");
+ void GenerateRepeatedJSONPrinting(io::Printer* printer, const char* itemPrinter) {
+ printer->Print("out << '[';\n");
+ printer->Print("{\n");
+ printer->Indent();
+ printer->Print("const char* separator = \"\";\n");
printer->Print(Variables_, "for (size_t _index = 0; _index < $rname$Size(); ++_index) {\n");
- printer->Indent();
- printer->Print("out << separator;\n");
- printer->Print(Variables_, itemPrinter);
- printer->Print(";\n");
- printer->Print("separator = \",\";\n");
- printer->Outdent();
- printer->Print("}\n");
- printer->Outdent();
- printer->Print("}\n");
- printer->Print("out << ']';\n");
- }
-
- protected:
+ printer->Indent();
+ printer->Print("out << separator;\n");
+ printer->Print(Variables_, itemPrinter);
+ printer->Print(";\n");
+ printer->Print("separator = \",\";\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ printer->Outdent();
+ printer->Print("}\n");
+ printer->Print("out << ']';\n");
+ }
+
+ protected:
const FieldDescriptor* Field_;
TVariables Variables_;
};
@@ -115,10 +115,10 @@ namespace NPlugins {
"inline const $type$& Get$RName$() const { return $name$(); }\n"
"inline $type$* Mutable$RName$() { return mutable_$name$(); }\n");
}
-
- void GenerateJSONPrinting(io::Printer* printer) override {
- printer->Print(Variables_, "Get$rname$().PrintJSON(out);\n");
- }
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
+ printer->Print(Variables_, "Get$rname$().PrintJSON(out);\n");
+ }
};
class TMapFieldExtGenerator: public TFieldExtGenerator {
@@ -230,10 +230,10 @@ namespace NPlugins {
" Mutable$RName$() { return mutable_$name$(); }\n"
);
}
-
- void GenerateJSONPrinting(io::Printer* printer) override {
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
GenerateRepeatedJSONPrinting(printer, "Get$rname$(_index).PrintJSON(out)");
- }
+ }
};
class TStringFieldExtGenerator: public TFieldExtGenerator {
@@ -279,10 +279,10 @@ namespace NPlugins {
}
}
-
- void GenerateJSONPrinting(io::Printer* printer) override {
- printer->Print(Variables_, "::google::protobuf::io::PrintJSONString(out, Get$rname$());\n");
- }
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
+ printer->Print(Variables_, "::google::protobuf::io::PrintJSONString(out, Get$rname$());\n");
+ }
};
class TRepeatedStringFieldExtGenerator: public TFieldExtGenerator {
@@ -348,13 +348,13 @@ namespace NPlugins {
printer->Indent();
}
}
-
- void GenerateJSONPrinting(io::Printer* printer) override {
- GenerateRepeatedJSONPrinting(
- printer,
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
+ GenerateRepeatedJSONPrinting(
+ printer,
"::google::protobuf::io::PrintJSONString(out, Get$rname$(_index))"
- );
- }
+ );
+ }
};
class TEnumFieldExtGenerator: public TFieldExtGenerator {
@@ -377,10 +377,10 @@ namespace NPlugins {
"inline void Set$RName$($type$ value) { set_$name$(value); }\n"
);
}
-
- void GenerateJSONPrinting(io::Printer* printer) override {
- printer->Print(Variables_, "out << (int)Get$rname$();\n");
- }
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
+ printer->Print(Variables_, "out << (int)Get$rname$();\n");
+ }
};
class TRepeatedEnumFieldExtGenerator: public TFieldExtGenerator {
@@ -410,10 +410,10 @@ namespace NPlugins {
"inline ::google::protobuf::RepeatedField<int>* Mutable$RName$() { return mutable_$name$(); }\n"
);
}
-
- void GenerateJSONPrinting(io::Printer* printer) override {
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
GenerateRepeatedJSONPrinting(printer, "out << (int)Get$rname$(_index)");
- }
+ }
};
class TPrimitiveFieldExtGenerator: public TFieldExtGenerator {
@@ -435,10 +435,10 @@ namespace NPlugins {
"inline void Set$RName$($type$ value) { set_$name$(value); }\n"
);
}
-
- void GenerateJSONPrinting(io::Printer* printer) override {
- printer->Print(Variables_, "out << Get$rname$();\n");
- }
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
+ printer->Print(Variables_, "out << Get$rname$();\n");
+ }
};
class TRepeatedPrimitiveFieldExtGenerator: public TFieldExtGenerator {
@@ -473,60 +473,60 @@ namespace NPlugins {
" Mutable$RName$() { return mutable_$name$(); }\n"
);
}
-
- void GenerateJSONPrinting(io::Printer* printer) override {
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
GenerateRepeatedJSONPrinting(printer, "out << Get$rname$(_index)");
- }
+ }
};
- class TBoolFieldExtGenerator: public TPrimitiveFieldExtGenerator {
- public:
- TBoolFieldExtGenerator(const FieldDescriptor* field)
- : TPrimitiveFieldExtGenerator(field)
- {
- }
-
- void GenerateJSONPrinting(io::Printer* printer) override {
- printer->Print(Variables_, "out << (Get$rname$() ? \"true\" : \"false\");\n");
- }
- };
-
- class TRepeatedBoolFieldExtGenerator: public TRepeatedPrimitiveFieldExtGenerator {
- public:
- TRepeatedBoolFieldExtGenerator(const FieldDescriptor* field)
- : TRepeatedPrimitiveFieldExtGenerator(field)
- {
- }
-
- void GenerateJSONPrinting(io::Printer* printer) override {
+ class TBoolFieldExtGenerator: public TPrimitiveFieldExtGenerator {
+ public:
+ TBoolFieldExtGenerator(const FieldDescriptor* field)
+ : TPrimitiveFieldExtGenerator(field)
+ {
+ }
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
+ printer->Print(Variables_, "out << (Get$rname$() ? \"true\" : \"false\");\n");
+ }
+ };
+
+ class TRepeatedBoolFieldExtGenerator: public TRepeatedPrimitiveFieldExtGenerator {
+ public:
+ TRepeatedBoolFieldExtGenerator(const FieldDescriptor* field)
+ : TRepeatedPrimitiveFieldExtGenerator(field)
+ {
+ }
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
GenerateRepeatedJSONPrinting(printer, "out << (Get$rname$(_index) ? \"true\" : \"false\")");
- }
- };
-
- class TFloatFieldExtGenerator: public TPrimitiveFieldExtGenerator {
- public:
- TFloatFieldExtGenerator(const FieldDescriptor* field)
- : TPrimitiveFieldExtGenerator(field)
- {
- }
-
- void GenerateJSONPrinting(io::Printer* printer) override {
- printer->Print(Variables_, "out << double(Get$rname$());\n");
- }
- };
-
- class TRepeatedFloatFieldExtGenerator: public TRepeatedPrimitiveFieldExtGenerator {
- public:
- TRepeatedFloatFieldExtGenerator(const FieldDescriptor* field)
- : TRepeatedPrimitiveFieldExtGenerator(field)
- {
- }
-
- void GenerateJSONPrinting(io::Printer* printer) override {
+ }
+ };
+
+ class TFloatFieldExtGenerator: public TPrimitiveFieldExtGenerator {
+ public:
+ TFloatFieldExtGenerator(const FieldDescriptor* field)
+ : TPrimitiveFieldExtGenerator(field)
+ {
+ }
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
+ printer->Print(Variables_, "out << double(Get$rname$());\n");
+ }
+ };
+
+ class TRepeatedFloatFieldExtGenerator: public TRepeatedPrimitiveFieldExtGenerator {
+ public:
+ TRepeatedFloatFieldExtGenerator(const FieldDescriptor* field)
+ : TRepeatedPrimitiveFieldExtGenerator(field)
+ {
+ }
+
+ void GenerateJSONPrinting(io::Printer* printer) override {
GenerateRepeatedJSONPrinting(printer, "out << double(Get$rname$(_index))");
- }
- };
-
+ }
+ };
+
// borrowed mostly from protobuf/compiler/cpp/cpp_extension.cc
class TExtensionGenerator {
public:
@@ -616,10 +616,10 @@ namespace NPlugins {
return new TMapFieldExtGenerator(field);
}
return new TRepeatedMessageFieldExtGenerator(field);
- case FieldDescriptor::CPPTYPE_BOOL:
- return new TRepeatedBoolFieldExtGenerator(field);
- case FieldDescriptor::CPPTYPE_FLOAT:
- return new TRepeatedFloatFieldExtGenerator(field);
+ case FieldDescriptor::CPPTYPE_BOOL:
+ return new TRepeatedBoolFieldExtGenerator(field);
+ case FieldDescriptor::CPPTYPE_FLOAT:
+ return new TRepeatedFloatFieldExtGenerator(field);
case FieldDescriptor::CPPTYPE_STRING:
switch (field->options().ctype()) {
default: // RepeatedStringFieldExtGenerator handles unknown ctypes.
@@ -635,10 +635,10 @@ namespace NPlugins {
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_MESSAGE:
return new TMessageFieldExtGenerator(field);
- case FieldDescriptor::CPPTYPE_BOOL:
- return new TBoolFieldExtGenerator(field);
- case FieldDescriptor::CPPTYPE_FLOAT:
- return new TFloatFieldExtGenerator(field);
+ case FieldDescriptor::CPPTYPE_BOOL:
+ return new TBoolFieldExtGenerator(field);
+ case FieldDescriptor::CPPTYPE_FLOAT:
+ return new TFloatFieldExtGenerator(field);
case FieldDescriptor::CPPTYPE_STRING:
switch (field->options().ctype()) {
default: // StringFieldGenerator handles unknown ctypes.
@@ -684,21 +684,21 @@ namespace NPlugins {
void GenerateClassDefinitionExtension() {
GenerateSaveLoadImplementation();
- GenerateJSONImplementation();
+ GenerateJSONImplementation();
for (auto& nestedGenerator: NestedGenerators_) {
nestedGenerator.GenerateClassDefinitionExtension();
}
}
- void GenerateDebugOutputExtension() {
- GenerateDebugOutput();
-
+ void GenerateDebugOutputExtension() {
+ GenerateDebugOutput();
+
for (auto& nestedGenerator: NestedGenerators_) {
nestedGenerator.GenerateDebugOutputExtension();
- }
- }
-
+ }
+ }
+
void GenerateTypedefOutputExtension(bool nested) {
GenerateTypedefOutput(nested);
@@ -709,10 +709,10 @@ namespace NPlugins {
void GenerateClassExtension() {
- GenerateDebugStringImplementation();
+ GenerateDebugStringImplementation();
for (auto& nestedGenerator: NestedGenerators_) {
nestedGenerator.GenerateClassExtension();
- }
+ }
}
void GenerateDeclarations() {
@@ -775,8 +775,8 @@ namespace NPlugins {
for (auto& oneofGenerator: OneofGenerators_) {
oneofGenerator.GenerateDeclarations(&printer);
}
- TVariables vars;
- vars["class"] = ClassName(Descriptor_, false);
+ TVariables vars;
+ vars["class"] = ClassName(Descriptor_, false);
if (!IsLiteRuntimeMessage(Descriptor_)) {
printer.Print("TProtoStringType ShortUtf8DebugString() const;\n");
@@ -788,9 +788,9 @@ namespace NPlugins {
printer.Print("void Save(IOutputStream* output) const;\n");
printer.Print("void Load(IInputStream* input);\n");
}
- printer.Print("// End of Yandex-specific extension\n");
- }
-
+ printer.Print("// End of Yandex-specific extension\n");
+ }
+
void GenerateSaveLoadImplementation() {
TProtoStringType fileName = SourceFileName(Descriptor_->file());
TProtoStringType scope = "namespace_scope";
@@ -812,15 +812,15 @@ namespace NPlugins {
}
}
- void GenerateDebugStringImplementation() {
- TProtoStringType fileName = SourceFileName(Descriptor_->file());
- TProtoStringType scope = "namespace_scope";
+ void GenerateDebugStringImplementation() {
+ TProtoStringType fileName = SourceFileName(Descriptor_->file());
+ TProtoStringType scope = "namespace_scope";
std::unique_ptr<io::ZeroCopyOutputStream> output(
- OutputDirectory_->OpenForInsert(fileName, scope));
- io::Printer printer(output.get(), '$');
-
- TVariables vars;
- vars["class"] = Classname_;
+ OutputDirectory_->OpenForInsert(fileName, scope));
+ io::Printer printer(output.get(), '$');
+
+ TVariables vars;
+ vars["class"] = Classname_;
if (!IsLiteRuntimeMessage(Descriptor_)) {
printer.Print("// Yandex-specific extension\n");
printer.Print(vars, "TProtoStringType $class$::ShortUtf8DebugString() const {\n");
@@ -830,65 +830,65 @@ namespace NPlugins {
}
}
- void GenerateJSONImplementation() {
+ void GenerateJSONImplementation() {
if (IsLiteRuntimeMessage(Descriptor_)) {
return;
}
TProtoStringType fileName = SourceFileName(Descriptor_->file());
- TProtoStringType scope = "namespace_scope";
+ TProtoStringType scope = "namespace_scope";
std::unique_ptr<io::ZeroCopyOutputStream> output(
- OutputDirectory_->OpenForInsert(fileName, scope));
- io::Printer printer(output.get(), '$');
- printer.Print("// Yandex JSON extension\n");
- TVariables vars;
- vars["class"] = ClassName(Descriptor_, true);
+ OutputDirectory_->OpenForInsert(fileName, scope));
+ io::Printer printer(output.get(), '$');
+ printer.Print("// Yandex JSON extension\n");
+ TVariables vars;
+ vars["class"] = ClassName(Descriptor_, true);
printer.Print(vars, "inline void $class$::PrintJSON(IOutputStream& out) const {\n");
-
- printer.Indent();
- printer.Print("out << '{';\n");
- if (Descriptor_->field_count() > 0) {
- printer.Print("const char* sep = \"\";\n");
- }
- for (int i = 0; i < Descriptor_->field_count(); i++) {
- const FieldDescriptor* field = Descriptor_->field(i);
-
- TVariables vars;
- SetCommonFieldVariables(field, &vars);
-
- if (field->is_repeated()) {
+
+ printer.Indent();
+ printer.Print("out << '{';\n");
+ if (Descriptor_->field_count() > 0) {
+ printer.Print("const char* sep = \"\";\n");
+ }
+ for (int i = 0; i < Descriptor_->field_count(); i++) {
+ const FieldDescriptor* field = Descriptor_->field(i);
+
+ TVariables vars;
+ SetCommonFieldVariables(field, &vars);
+
+ if (field->is_repeated()) {
// map or repeated field in both proto3 and proto2 syntax
- printer.Print(vars, "if ($rname$Size() > 0) {\n");
+ printer.Print(vars, "if ($rname$Size() > 0) {\n");
} else if (field->has_presence()) {
// any optional or required field in proto2 syntax
// message-field or any oneof field in proto3 syntax
printer.Print(vars, "if (Has$rname$()) {\n");
- } else {
+ } else {
// string, enum or primitive field in proto3 syntax
printer.Print(vars, "if (Get$rname$()) {\n");
- }
-
- printer.Indent();
- printer.Print("out << sep;\n");
- printer.Print(vars, "out << \"\\\"$rname$\\\":\";\n");
- FieldGenerators_[i]->GenerateJSONPrinting(&printer);
- printer.Print(vars, "sep = \",\";\n");
- printer.Outdent();
- printer.Print("}\n");
- }
- printer.Print("out << '}';\n");
- printer.Outdent();
- printer.Print("}\n");
-
- printer.Print("// End of Yandex JSON extension\n");
- }
-
- void GenerateDebugOutput() {
- TProtoStringType fileName = SourceFileName(Descriptor_->file());
- TProtoStringType scope = "global_scope";
+ }
+
+ printer.Indent();
+ printer.Print("out << sep;\n");
+ printer.Print(vars, "out << \"\\\"$rname$\\\":\";\n");
+ FieldGenerators_[i]->GenerateJSONPrinting(&printer);
+ printer.Print(vars, "sep = \",\";\n");
+ printer.Outdent();
+ printer.Print("}\n");
+ }
+ printer.Print("out << '}';\n");
+ printer.Outdent();
+ printer.Print("}\n");
+
+ printer.Print("// End of Yandex JSON extension\n");
+ }
+
+ void GenerateDebugOutput() {
+ TProtoStringType fileName = SourceFileName(Descriptor_->file());
+ TProtoStringType scope = "global_scope";
std::unique_ptr<io::ZeroCopyOutputStream> output(
- OutputDirectory_->OpenForInsert(fileName, scope));
- io::Printer printer(output.get(), '$');
+ OutputDirectory_->OpenForInsert(fileName, scope));
+ io::Printer printer(output.get(), '$');
if (!IsLiteRuntimeMessage(Descriptor_)) {
printer.Print("// Yandex debug output extension\n");
TVariables vars;
@@ -899,8 +899,8 @@ namespace NPlugins {
printer.Print("}\n");
printer.Print("// End of Yandex debug output extension\n");
}
- }
-
+ }
+
void GenerateTypedefOutput(bool nested) {
if (!GenerateYaStyle(Descriptor_->file()))
return;
@@ -937,8 +937,8 @@ namespace NPlugins {
class TFileExtGenerator {
public:
TFileExtGenerator(const FileDescriptor* file, OutputDirectory* output_directory)
- : File_(file)
- , OutputDirectory_(output_directory)
+ : File_(file)
+ , OutputDirectory_(output_directory)
{
MessageGenerators_.reserve(file->message_type_count());
for (size_t i = 0; i < file->message_type_count(); i++) {
@@ -947,8 +947,8 @@ namespace NPlugins {
}
void GenerateHeaderExtensions() {
- GenerateHeaderIncludeExtensions();
-
+ GenerateHeaderIncludeExtensions();
+
for (auto& messageGenerator: MessageGenerators_) {
messageGenerator.GenerateTypedefOutputExtension(false);
messageGenerator.GenerateDeclarations();
@@ -956,43 +956,43 @@ namespace NPlugins {
}
void GenerateSourceExtensions() {
- GenerateSourceIncludeExtensions();
-
+ GenerateSourceIncludeExtensions();
+
for (auto& messageGenerator: MessageGenerators_) {
messageGenerator.GenerateDefinitions();
}
}
private:
- void GenerateSourceIncludeExtensions() {
- TProtoStringType fileName = SourceFileName(File_);
- TProtoStringType scope = "includes";
+ void GenerateSourceIncludeExtensions() {
+ TProtoStringType fileName = SourceFileName(File_);
+ TProtoStringType scope = "includes";
std::unique_ptr<io::ZeroCopyOutputStream> output(
- OutputDirectory_->OpenForInsert(fileName, scope));
- io::Printer printer(output.get(), '$');
+ OutputDirectory_->OpenForInsert(fileName, scope));
+ io::Printer printer(output.get(), '$');
printer.Print("#include <google/protobuf/messagext.h>\n");
- }
-
- void GenerateHeaderIncludeExtensions() {
- TProtoStringType fileName = HeaderFileName(File_);
- TProtoStringType scope = "includes";
+ }
+
+ void GenerateHeaderIncludeExtensions() {
+ TProtoStringType fileName = HeaderFileName(File_);
+ TProtoStringType scope = "includes";
std::unique_ptr<io::ZeroCopyOutputStream> output(
- OutputDirectory_->OpenForInsert(fileName, scope));
- io::Printer printer(output.get(), '$');
+ OutputDirectory_->OpenForInsert(fileName, scope));
+ io::Printer printer(output.get(), '$');
printer.Print("#include <google/protobuf/json_util.h>\n");
- }
-
- private:
- const FileDescriptor* File_;
+ }
+
+ private:
+ const FileDescriptor* File_;
OutputDirectory* OutputDirectory_;
size_t MessageTypeCount_;
std::vector<TMessageExtGenerator> MessageGenerators_;
};
bool TCppStyleGuideExtensionGenerator::Generate(const FileDescriptor* file,
- const TProtoStringType&,
+ const TProtoStringType&,
OutputDirectory* outputDirectory,
- TProtoStringType*) const {
+ TProtoStringType*) const {
TFileExtGenerator fileGenerator(file, outputDirectory);
@@ -1000,7 +1000,7 @@ namespace NPlugins {
fileGenerator.GenerateHeaderExtensions();
// Generate cc file.
- fileGenerator.GenerateSourceExtensions();
+ fileGenerator.GenerateSourceExtensions();
return true;
}
@@ -1010,7 +1010,7 @@ namespace NPlugins {
}
int main(int argc, char* argv[]) {
-#ifdef _MSC_VER
+#ifdef _MSC_VER
// Don't print a silly message or stick a modal dialog box in my face,
// please.
_set_abort_behavior(0, ~0);
diff --git a/library/cpp/binsaver/class_factory.h b/library/cpp/binsaver/class_factory.h
index 7b95a974fc..e83512331b 100644
--- a/library/cpp/binsaver/class_factory.h
+++ b/library/cpp/binsaver/class_factory.h
@@ -63,15 +63,15 @@ public:
(void)p;
return VFT2TypeID(&typeid(TT));
}
-
+
void GetAllTypeIDs(TVector<int>& typeIds) const {
- typeIds.clear();
+ typeIds.clear();
for (typename CTypeNewHash::const_iterator iter = typeInfo.begin();
iter != typeInfo.end();
++iter) {
typeIds.push_back(iter->first);
- }
- }
+ }
+ }
};
////////////////////////////////////////////////////////////////////////////////////////////////////
template <class T>
diff --git a/library/cpp/colorizer/ut/colorizer_ut.cpp b/library/cpp/colorizer/ut/colorizer_ut.cpp
index a7b1c14f4f..20341440af 100644
--- a/library/cpp/colorizer/ut/colorizer_ut.cpp
+++ b/library/cpp/colorizer/ut/colorizer_ut.cpp
@@ -1,29 +1,29 @@
#include <library/cpp/colorizer/colors.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
#include <util/stream/str.h>
-
-#include <util/string/escape.h>
-
+
+#include <util/string/escape.h>
+
Y_UNIT_TEST_SUITE(ColorizerTest) {
Y_UNIT_TEST(BasicTest) {
- NColorizer::TColors colors;
- colors.Enable();
+ NColorizer::TColors colors;
+ colors.Enable();
UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.BlueColor()), "\\x1B[22;34m");
UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.ForeBlue()), "\\x1B[34m");
- colors.Disable();
- UNIT_ASSERT(colors.BlueColor().Empty());
- }
-
+ colors.Disable();
+ UNIT_ASSERT(colors.BlueColor().Empty());
+ }
+
Y_UNIT_TEST(ResettingTest) {
- NColorizer::TColors colors;
- colors.Enable();
- // 22;39, not 0, should be used so that only foreground changes
+ NColorizer::TColors colors;
+ colors.Enable();
+ // 22;39, not 0, should be used so that only foreground changes
UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.OldColor()), "\\x1B[22;39m");
UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.Reset()), "\\x1B[0m");
- // 22, not 0, should be used to reset boldness
+ // 22, not 0, should be used to reset boldness
UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.PurpleColor()), "\\x1B[22;35m");
- }
+ }
Y_UNIT_TEST(PrintAnsi) {
UNIT_ASSERT_STRINGS_EQUAL(EscapeC(ToString(NColorizer::BLUE)), "\\x1B[0m\\x1B[0;34m");
@@ -60,4 +60,4 @@ Y_UNIT_TEST_SUITE(ColorizerTest) {
UNIT_ASSERT_VALUES_EQUAL(NColorizer::TotalAnsiEscapeCodeLen("some [0;1;2;3m text"), 0);
UNIT_ASSERT_VALUES_EQUAL(NColorizer::TotalAnsiEscapeCodeLen("some\033[m text"), 3);
}
-}
+}
diff --git a/library/cpp/colorizer/ut/ya.make b/library/cpp/colorizer/ut/ya.make
index 65f2b4fed8..8a28c189af 100644
--- a/library/cpp/colorizer/ut/ya.make
+++ b/library/cpp/colorizer/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST_FOR(library/cpp/colorizer)
-
+
OWNER(pg)
-
-SRCS(
- colorizer_ut.cpp
-)
-
-END()
+
+SRCS(
+ colorizer_ut.cpp
+)
+
+END()
diff --git a/library/cpp/containers/compact_vector/compact_vector.cpp b/library/cpp/containers/compact_vector/compact_vector.cpp
index 5be2899957..cca77643e9 100644
--- a/library/cpp/containers/compact_vector/compact_vector.cpp
+++ b/library/cpp/containers/compact_vector/compact_vector.cpp
@@ -1 +1 @@
-#include "compact_vector.h"
+#include "compact_vector.h"
diff --git a/library/cpp/containers/compact_vector/compact_vector.h b/library/cpp/containers/compact_vector/compact_vector.h
index a06009653c..dbe7473f0c 100644
--- a/library/cpp/containers/compact_vector/compact_vector.h
+++ b/library/cpp/containers/compact_vector/compact_vector.h
@@ -2,12 +2,12 @@
#include <util/generic/yexception.h>
#include <util/generic/utility.h>
-#include <util/memory/alloc.h>
-#include <util/stream/output.h>
+#include <util/memory/alloc.h>
+#include <util/stream/output.h>
#include <util/system/yassert.h>
#include <cstdlib>
-
+
// vector that is 8 bytes when empty (TVector is 24 bytes)
template <typename T>
@@ -102,7 +102,7 @@ public:
void Reserve(size_t newCapacity) {
if (newCapacity <= Capacity()) {
} else if (Ptr == nullptr) {
- void* mem = ::malloc(sizeof(THeader) + newCapacity * sizeof(T));
+ void* mem = ::malloc(sizeof(THeader) + newCapacity * sizeof(T));
if (mem == nullptr)
ythrow yexception() << "out of memory";
Ptr = (T*)(((THeader*)mem) + 1);
diff --git a/library/cpp/containers/compact_vector/ut/ya.make b/library/cpp/containers/compact_vector/ut/ya.make
index 9be40910b0..5e655bc619 100644
--- a/library/cpp/containers/compact_vector/ut/ya.make
+++ b/library/cpp/containers/compact_vector/ut/ya.make
@@ -1,11 +1,11 @@
-UNITTEST()
-
-OWNER(nga)
-
+UNITTEST()
+
+OWNER(nga)
+
SRCDIR(library/cpp/containers/compact_vector)
-
-SRCS(
- compact_vector_ut.cpp
-)
-
-END()
+
+SRCS(
+ compact_vector_ut.cpp
+)
+
+END()
diff --git a/library/cpp/containers/compact_vector/ya.make b/library/cpp/containers/compact_vector/ya.make
index ec25bce8f8..6c23e8d0c1 100644
--- a/library/cpp/containers/compact_vector/ya.make
+++ b/library/cpp/containers/compact_vector/ya.make
@@ -1,9 +1,9 @@
-LIBRARY()
-
-OWNER(nga)
-
-SRCS(
- compact_vector.cpp
-)
-
-END()
+LIBRARY()
+
+OWNER(nga)
+
+SRCS(
+ compact_vector.cpp
+)
+
+END()
diff --git a/library/cpp/containers/stack_vector/stack_vec.cpp b/library/cpp/containers/stack_vector/stack_vec.cpp
index aa84285b9a..21c0ab3f11 100644
--- a/library/cpp/containers/stack_vector/stack_vec.cpp
+++ b/library/cpp/containers/stack_vector/stack_vec.cpp
@@ -1 +1 @@
-#include "stack_vec.h"
+#include "stack_vec.h"
diff --git a/library/cpp/containers/stack_vector/stack_vec.h b/library/cpp/containers/stack_vector/stack_vec.h
index 1cefef2c73..fcc5d9a2a5 100644
--- a/library/cpp/containers/stack_vector/stack_vec.h
+++ b/library/cpp/containers/stack_vector/stack_vec.h
@@ -1,22 +1,22 @@
-#pragma once
-
-#include <util/generic/vector.h>
+#pragma once
+
+#include <util/generic/vector.h>
#include <util/ysaveload.h>
-
+
#include <type_traits>
-// A vector preallocated on the stack.
-// After exceeding the preconfigured stack space falls back to the heap.
+// A vector preallocated on the stack.
+// After exceeding the preconfigured stack space falls back to the heap.
// Publicly inherits TVector, but disallows swap (and hence shrink_to_fit, also operator= is reimplemented via copying).
-//
-// Inspired by: http://qt-project.org/doc/qt-4.8/qvarlengtharray.html#details
-
+//
+// Inspired by: http://qt-project.org/doc/qt-4.8/qvarlengtharray.html#details
+
template <typename T, size_t CountOnStack = 256, bool UseFallbackAlloc = true, class Alloc = std::allocator<T>>
-class TStackVec;
-
+class TStackVec;
+
template <typename T, class Alloc = std::allocator<T>>
using TSmallVec = TStackVec<T, 16, true, Alloc>;
-
+
template <typename T, size_t CountOnStack = 256>
using TStackOnlyVec = TStackVec<T, CountOnStack, false>;
@@ -24,27 +24,27 @@ namespace NPrivate {
template <class Alloc, class StackAlloc, typename T, typename U>
struct TRebind {
typedef TReboundAllocator<Alloc, U> other;
- };
-
+ };
+
template <class Alloc, class StackAlloc, typename T>
struct TRebind<Alloc, StackAlloc, T, T> {
- typedef StackAlloc other;
- };
-
+ typedef StackAlloc other;
+ };
+
template <typename T, size_t CountOnStack, bool UseFallbackAlloc, class Alloc = std::allocator<T>>
class TStackBasedAllocator: public Alloc {
- public:
+ public:
typedef TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, Alloc> TSelf;
-
+
using typename Alloc::difference_type;
- using typename Alloc::size_type;
+ using typename Alloc::size_type;
using typename Alloc::value_type;
-
+
template <class U>
struct rebind: public ::NPrivate::TRebind<Alloc, TSelf, T, U> {
- };
-
- public:
+ };
+
+ public:
TStackBasedAllocator() = default;
template <
@@ -61,26 +61,26 @@ namespace NPrivate {
if (!IsStorageUsed && CountOnStack >= n) {
IsStorageUsed = true;
return reinterpret_cast<T*>(&StackBasedStorage[0]);
- } else {
+ } else {
if constexpr (!UseFallbackAlloc) {
Y_FAIL(
"Stack storage overflow. Capacity: %d, requested: %d", (int)CountOnStack, int(n));
}
return FallbackAllocator().allocate(n);
- }
- }
-
+ }
+ }
+
void deallocate(T* p, size_type n) {
if (p >= reinterpret_cast<T*>(&StackBasedStorage[0]) &&
p < reinterpret_cast<T*>(&StackBasedStorage[CountOnStack])) {
Y_VERIFY(IsStorageUsed);
IsStorageUsed = false;
- } else {
+ } else {
FallbackAllocator().deallocate(p, n);
- }
- }
-
- private:
+ }
+ }
+
+ private:
std::aligned_storage_t<sizeof(T), alignof(T)> StackBasedStorage[CountOnStack];
bool IsStorageUsed = false;
@@ -88,53 +88,53 @@ namespace NPrivate {
Alloc& FallbackAllocator() noexcept {
return static_cast<Alloc&>(*this);
}
- };
+ };
}
-
+
template <typename T, size_t CountOnStack, bool UseFallbackAlloc, class Alloc>
class TStackVec: public TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>> {
private:
using TBase = TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>>;
using TAllocator = typename TBase::allocator_type;
-public:
+public:
using typename TBase::const_iterator;
using typename TBase::const_reverse_iterator;
- using typename TBase::iterator;
- using typename TBase::reverse_iterator;
+ using typename TBase::iterator;
+ using typename TBase::reverse_iterator;
using typename TBase::size_type;
- using typename TBase::value_type;
-
-public:
+ using typename TBase::value_type;
+
+public:
TStackVec(const TAllocator& alloc = TAllocator())
: TBase(alloc)
- {
- TBase::reserve(CountOnStack);
- }
-
+ {
+ TBase::reserve(CountOnStack);
+ }
+
explicit TStackVec(size_type count, const TAllocator& alloc = TAllocator())
: TBase(alloc)
- {
- if (count <= CountOnStack) {
- TBase::reserve(CountOnStack);
- }
- TBase::resize(count);
- }
-
+ {
+ if (count <= CountOnStack) {
+ TBase::reserve(CountOnStack);
+ }
+ TBase::resize(count);
+ }
+
TStackVec(size_type count, const T& val, const TAllocator& alloc = TAllocator())
: TBase(alloc)
- {
- if (count <= CountOnStack) {
- TBase::reserve(CountOnStack);
- }
- TBase::assign(count, val);
- }
-
+ {
+ if (count <= CountOnStack) {
+ TBase::reserve(CountOnStack);
+ }
+ TBase::assign(count, val);
+ }
+
TStackVec(const TStackVec& src)
: TStackVec(src.begin(), src.end())
- {
- }
-
+ {
+ }
+
template <class A>
TStackVec(const TVector<T, A>& src)
: TStackVec(src.begin(), src.end())
@@ -166,14 +166,14 @@ public:
}
}
-public:
+public:
void swap(TStackVec&) = delete;
- void shrink_to_fit() = delete;
-
+ void shrink_to_fit() = delete;
+
TStackVec& operator=(const TStackVec& src) {
TBase::assign(src.begin(), src.end());
- return *this;
- }
+ return *this;
+ }
template <class A>
TStackVec& operator=(const TVector<T, A>& src) {
@@ -185,7 +185,7 @@ public:
TBase::assign(il.begin(), il.end());
return *this;
}
-};
+};
template <typename T, size_t CountOnStack, class Alloc>
class TSerializer<TStackVec<T, CountOnStack, true, Alloc>>: public TVectorSerializer<TStackVec<T, CountOnStack, true, Alloc>> {
diff --git a/library/cpp/containers/stack_vector/stack_vec_ut.cpp b/library/cpp/containers/stack_vector/stack_vec_ut.cpp
index 0325b614c0..19f9677781 100644
--- a/library/cpp/containers/stack_vector/stack_vec_ut.cpp
+++ b/library/cpp/containers/stack_vector/stack_vec_ut.cpp
@@ -1,7 +1,7 @@
-#include "stack_vec.h"
-
+#include "stack_vec.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
namespace {
struct TNotCopyAssignable {
const int Value;
@@ -45,19 +45,19 @@ namespace {
Y_UNIT_TEST_SUITE(TStackBasedVectorTest) {
Y_UNIT_TEST(TestCreateEmpty) {
- TStackVec<int> ints;
- UNIT_ASSERT_EQUAL(ints.size(), 0);
- }
-
+ TStackVec<int> ints;
+ UNIT_ASSERT_EQUAL(ints.size(), 0);
+ }
+
Y_UNIT_TEST(TestCreateNonEmpty) {
- TStackVec<int> ints(5);
- UNIT_ASSERT_EQUAL(ints.size(), 5);
-
- for (size_t i = 0; i < ints.size(); ++i) {
- UNIT_ASSERT_EQUAL(ints[i], 0);
- }
- }
-
+ TStackVec<int> ints(5);
+ UNIT_ASSERT_EQUAL(ints.size(), 5);
+
+ for (size_t i = 0; i < ints.size(); ++i) {
+ UNIT_ASSERT_EQUAL(ints[i], 0);
+ }
+ }
+
Y_UNIT_TEST(TestReallyOnStack) {
const TStackVec<int> vec(5);
@@ -65,39 +65,39 @@ Y_UNIT_TEST_SUITE(TStackBasedVectorTest) {
(const char*)&vec <= (const char*)&vec[0] &&
(const char*)&vec[0] <= (const char*)&vec + sizeof(vec)
);
- }
-
+ }
+
Y_UNIT_TEST(TestFallback) {
- TSmallVec<int> ints;
- for (int i = 0; i < 14; ++i) {
- ints.push_back(i);
- }
-
- for (size_t i = 0; i < ints.size(); ++i) {
- UNIT_ASSERT_EQUAL(ints[i], (int)i);
- }
-
- for (int i = 14; i < 20; ++i) {
- ints.push_back(i);
- }
-
- for (size_t i = 0; i < ints.size(); ++i) {
- UNIT_ASSERT_EQUAL(ints[i], (int)i);
- }
-
- TSmallVec<int> ints2 = ints;
-
- for (size_t i = 0; i < ints2.size(); ++i) {
- UNIT_ASSERT_EQUAL(ints2[i], (int)i);
- }
-
- TSmallVec<int> ints3;
- ints3 = ints2;
-
- for (size_t i = 0; i < ints3.size(); ++i) {
- UNIT_ASSERT_EQUAL(ints3[i], (int)i);
- }
- }
+ TSmallVec<int> ints;
+ for (int i = 0; i < 14; ++i) {
+ ints.push_back(i);
+ }
+
+ for (size_t i = 0; i < ints.size(); ++i) {
+ UNIT_ASSERT_EQUAL(ints[i], (int)i);
+ }
+
+ for (int i = 14; i < 20; ++i) {
+ ints.push_back(i);
+ }
+
+ for (size_t i = 0; i < ints.size(); ++i) {
+ UNIT_ASSERT_EQUAL(ints[i], (int)i);
+ }
+
+ TSmallVec<int> ints2 = ints;
+
+ for (size_t i = 0; i < ints2.size(); ++i) {
+ UNIT_ASSERT_EQUAL(ints2[i], (int)i);
+ }
+
+ TSmallVec<int> ints3;
+ ints3 = ints2;
+
+ for (size_t i = 0; i < ints3.size(); ++i) {
+ UNIT_ASSERT_EQUAL(ints3[i], (int)i);
+ }
+ }
Y_UNIT_TEST(TestCappedSize) {
TStackVec<int, 8, false> ints;
@@ -141,4 +141,4 @@ Y_UNIT_TEST_SUITE(TStackBasedVectorTest) {
}
UNIT_ASSERT_VALUES_EQUAL(count, 3);
}
-}
+}
diff --git a/library/cpp/containers/stack_vector/ut/ya.make b/library/cpp/containers/stack_vector/ut/ya.make
index da5a9d0b11..1d70496954 100644
--- a/library/cpp/containers/stack_vector/ut/ya.make
+++ b/library/cpp/containers/stack_vector/ut/ya.make
@@ -1,11 +1,11 @@
-UNITTEST()
-
+UNITTEST()
+
OWNER(ilnurkh)
-
+
SRCDIR(library/cpp/containers/stack_vector)
-
-SRCS(
- stack_vec_ut.cpp
-)
-
-END()
+
+SRCS(
+ stack_vec_ut.cpp
+)
+
+END()
diff --git a/library/cpp/containers/stack_vector/ya.make b/library/cpp/containers/stack_vector/ya.make
index 3c31a00b70..cfb63295ec 100644
--- a/library/cpp/containers/stack_vector/ya.make
+++ b/library/cpp/containers/stack_vector/ya.make
@@ -1,11 +1,11 @@
-LIBRARY()
-
+LIBRARY()
+
OWNER(ilnurkh)
-
-SRCS(
- stack_vec.cpp
-)
-
-END()
+
+SRCS(
+ stack_vec.cpp
+)
+
+END()
RECURSE_FOR_TESTS(ut)
diff --git a/library/cpp/coroutine/engine/iostatus.h b/library/cpp/coroutine/engine/iostatus.h
index 99c2fb8e90..bf6036805d 100644
--- a/library/cpp/coroutine/engine/iostatus.h
+++ b/library/cpp/coroutine/engine/iostatus.h
@@ -1,7 +1,7 @@
#pragma once
-#include <util/generic/yexception.h>
-
+#include <util/generic/yexception.h>
+
class TIOStatus {
public:
TIOStatus(int status) noexcept
diff --git a/library/cpp/dbg_output/DONT_COMMIT.h b/library/cpp/dbg_output/DONT_COMMIT.h
index 0493d7e094..e7b3182c20 100644
--- a/library/cpp/dbg_output/DONT_COMMIT.h
+++ b/library/cpp/dbg_output/DONT_COMMIT.h
@@ -1,9 +1,9 @@
-#pragma once
-
-// Including this file is possible without modifying PEERDIR (for debug purposes).
-// The latter is allowed only locally, so this file is named
-// in such a way that including it prevents from committing the #include via ARC-1205.
-
+#pragma once
+
+// Including this file is possible without modifying PEERDIR (for debug purposes).
+// The latter is allowed only locally, so this file is named
+// in such a way that including it prevents from committing the #include via ARC-1205.
+
#define DBGDUMP_INLINE_IF_INCLUDED inline
#include "dump.cpp"
@@ -12,5 +12,5 @@
#include <library/cpp/colorizer/colors.cpp>
#include <library/cpp/colorizer/output.cpp>
-
+
#undef DBGDUMP_INLINE_IF_INCLUDED
diff --git a/library/cpp/dbg_output/auto.h b/library/cpp/dbg_output/auto.h
index bfac869ae6..8d96167f6a 100644
--- a/library/cpp/dbg_output/auto.h
+++ b/library/cpp/dbg_output/auto.h
@@ -1,15 +1,15 @@
-#pragma once
-
-#include <util/generic/va_args.h>
-
-// int a = 1, b = 2; Cout << LabeledDump(a, b, 1 + 2); yields {"a": 1, "b": 2, "1 + 2": 3}
-#define LabeledDump(...) \
+#pragma once
+
+#include <util/generic/va_args.h>
+
+// int a = 1, b = 2; Cout << LabeledDump(a, b, 1 + 2); yields {"a": 1, "b": 2, "1 + 2": 3}
+#define LabeledDump(...) \
'{' Y_PASS_VA_ARGS(Y_MAP_ARGS_WITH_LAST(__LABELED_DUMP_NONLAST__, __LABELED_DUMP_IMPL__, __VA_ARGS__)) << '}'
-#define __LABELED_DUMP_IMPL__(x) << "\"" #x "\": " << DbgDump(x)
-#define __LABELED_DUMP_NONLAST__(x) __LABELED_DUMP_IMPL__(x) << ", "
-
-// Usage: struct TMyStruct { int A, B; }; DEFINE_DUMPER(TMyStruct, A, B); Cout << TMyStruct{3, 4};
-// yields {"A": 3, "B": 4}
+#define __LABELED_DUMP_IMPL__(x) << "\"" #x "\": " << DbgDump(x)
+#define __LABELED_DUMP_NONLAST__(x) __LABELED_DUMP_IMPL__(x) << ", "
+
+// Usage: struct TMyStruct { int A, B; }; DEFINE_DUMPER(TMyStruct, A, B); Cout << TMyStruct{3, 4};
+// yields {"A": 3, "B": 4}
#define DEFINE_DUMPER(C, ...) \
template <> \
struct TDumper<C> { \
@@ -17,6 +17,6 @@
static inline void Dump(S& s, const C& v) { \
s << DumpRaw("{") Y_PASS_VA_ARGS(Y_MAP_ARGS_WITH_LAST(__DEFINE_DUMPER_NONLAST__, __DEFINE_DUMPER_IMPL__, __VA_ARGS__)) << DumpRaw("}"); \
} \
- };
-#define __DEFINE_DUMPER_IMPL__(x) << DumpRaw("\"" #x "\": ") << v.x
-#define __DEFINE_DUMPER_NONLAST__(x) __DEFINE_DUMPER_IMPL__(x) << DumpRaw(", ")
+ };
+#define __DEFINE_DUMPER_IMPL__(x) << DumpRaw("\"" #x "\": ") << v.x
+#define __DEFINE_DUMPER_NONLAST__(x) __DEFINE_DUMPER_IMPL__(x) << DumpRaw(", ")
diff --git a/library/cpp/dbg_output/colorscheme.h b/library/cpp/dbg_output/colorscheme.h
index 1c2b12f00b..a5b9cf749a 100644
--- a/library/cpp/dbg_output/colorscheme.h
+++ b/library/cpp/dbg_output/colorscheme.h
@@ -1,17 +1,17 @@
-#pragma once
-
-#include "engine.h"
+#pragma once
+
+#include "engine.h"
#include <library/cpp/colorizer/output.h>
-
-#ifndef DBG_OUTPUT_DEFAULT_COLOR_SCHEME
+
+#ifndef DBG_OUTPUT_DEFAULT_COLOR_SCHEME
#define DBG_OUTPUT_DEFAULT_COLOR_SCHEME NDbgDump::NColorScheme::TPlain
-#endif
-
-#define DBG_OUTPUT_COLOR_HANDLER(NAME) \
+#endif
+
+#define DBG_OUTPUT_COLOR_HANDLER(NAME) \
template <class S> \
- inline void NAME(S& stream)
-
-namespace NDbgDump {
+ inline void NAME(S& stream)
+
+namespace NDbgDump {
namespace NColorScheme {
/// Start by copying this one if you want to define a custom color scheme.
struct TPlain {
@@ -28,7 +28,7 @@ namespace NDbgDump {
DBG_OUTPUT_COLOR_HANDLER(ResetType) {
Y_UNUSED(stream);
}
-
+
// Background color modifiers
DBG_OUTPUT_COLOR_HANDLER(Key) {
Y_UNUSED(stream);
@@ -40,7 +40,7 @@ namespace NDbgDump {
Y_UNUSED(stream);
}
};
-
+
/// Use this one if you want colors but are lazy enough to define a custom color scheme.
/// Be careful enough to use DumpRaw for avoiding an endless recursion.
/// Enforce controls whether colors should be applied even if stdout is not a TTY.
@@ -51,8 +51,8 @@ namespace NDbgDump {
if (Enforce) {
Colors.Enable();
}
- }
-
+ }
+
// Foreground color modifiers
DBG_OUTPUT_COLOR_HANDLER(Markup) {
stream << DumpRaw(Colors.LightGreenColor());
@@ -66,35 +66,35 @@ namespace NDbgDump {
DBG_OUTPUT_COLOR_HANDLER(ResetType) {
stream << DumpRaw(Colors.OldColor());
}
-
+
// Background color modifiers
// TODO: support backgrounds in library/cpp/colorizer
DBG_OUTPUT_COLOR_HANDLER(Key) {
if (Depth++ == 0 && Colors.IsTTY()) {
stream << DumpRaw(TStringBuf("\033[42m"));
}
- }
+ }
DBG_OUTPUT_COLOR_HANDLER(Value) {
if (Depth++ == 0 && Colors.IsTTY()) {
stream << DumpRaw(TStringBuf("\033[44m"));
}
- }
+ }
DBG_OUTPUT_COLOR_HANDLER(ResetRole) {
if (--Depth == 0 && Colors.IsTTY()) {
stream << DumpRaw(TStringBuf("\033[49m"));
}
- }
-
+ }
+
private:
NColorizer::TColors Colors;
size_t Depth = 0;
};
}
}
-
-namespace NPrivate {
- template <typename CS>
- struct TColorSchemeContainer {
- CS ColorScheme;
- };
-}
+
+namespace NPrivate {
+ template <typename CS>
+ struct TColorSchemeContainer {
+ CS ColorScheme;
+ };
+}
diff --git a/library/cpp/dbg_output/dump.h b/library/cpp/dbg_output/dump.h
index bb64ca36d5..c7efa105ee 100644
--- a/library/cpp/dbg_output/dump.h
+++ b/library/cpp/dbg_output/dump.h
@@ -2,8 +2,8 @@
#include "engine.h"
#include "dumpers.h"
-#include "auto.h"
-#include "colorscheme.h"
+#include "auto.h"
+#include "colorscheme.h"
#include <util/stream/format.h>
#include <util/system/type_name.h>
@@ -21,7 +21,7 @@
namespace NPrivate {
template <class TColorScheme>
struct TTraitsShallow {
- struct TDump: public TDumpBase, public TColorSchemeContainer<TColorScheme> {
+ struct TDump: public TDumpBase, public TColorSchemeContainer<TColorScheme> {
template <typename... Args>
inline TDump(Args&&... args)
: TDumpBase(std::forward<Args>(args)...)
@@ -41,7 +41,7 @@ namespace NPrivate {
template <class TColorScheme>
struct TTraitsDeep {
- struct TDump: public TDumpBase, public TColorSchemeContainer<TColorScheme> {
+ struct TDump: public TDumpBase, public TColorSchemeContainer<TColorScheme> {
template <typename... Args>
inline TDump(Args&&... args)
: TDumpBase(std::forward<Args>(args)...)
@@ -95,12 +95,12 @@ namespace NPrivate {
}
}
-template <class T, class TColorScheme = DBG_OUTPUT_DEFAULT_COLOR_SCHEME>
-static inline ::NPrivate::TDbgDump<T, ::NPrivate::TTraitsShallow<TColorScheme>> DbgDump(const T& t) {
+template <class T, class TColorScheme = DBG_OUTPUT_DEFAULT_COLOR_SCHEME>
+static inline ::NPrivate::TDbgDump<T, ::NPrivate::TTraitsShallow<TColorScheme>> DbgDump(const T& t) {
return {std::addressof(t)};
}
-template <class T, class TColorScheme = DBG_OUTPUT_DEFAULT_COLOR_SCHEME>
-static inline ::NPrivate::TDbgDump<T, ::NPrivate::TTraitsDeep<TColorScheme>> DbgDumpDeep(const T& t) {
+template <class T, class TColorScheme = DBG_OUTPUT_DEFAULT_COLOR_SCHEME>
+static inline ::NPrivate::TDbgDump<T, ::NPrivate::TTraitsDeep<TColorScheme>> DbgDumpDeep(const T& t) {
return {std::addressof(t)};
}
diff --git a/library/cpp/dbg_output/dumpers.h b/library/cpp/dbg_output/dumpers.h
index 43a21c208e..4868e97da0 100644
--- a/library/cpp/dbg_output/dumpers.h
+++ b/library/cpp/dbg_output/dumpers.h
@@ -74,18 +74,18 @@ template <class A, class B>
struct TDumper<std::pair<A, B>> {
template <class S>
static inline void Dump(S& s, const std::pair<A, B>& v) {
- s.ColorScheme.Key(s);
- s.ColorScheme.Literal(s);
- s << v.first;
- s.ColorScheme.ResetType(s);
- s.ColorScheme.ResetRole(s);
- s.ColorScheme.Markup(s);
- s << DumpRaw(" -> ");
- s.ColorScheme.Value(s);
- s.ColorScheme.Literal(s);
- s << v.second;
- s.ColorScheme.ResetType(s);
- s.ColorScheme.ResetRole(s);
+ s.ColorScheme.Key(s);
+ s.ColorScheme.Literal(s);
+ s << v.first;
+ s.ColorScheme.ResetType(s);
+ s.ColorScheme.ResetRole(s);
+ s.ColorScheme.Markup(s);
+ s << DumpRaw(" -> ");
+ s.ColorScheme.Value(s);
+ s.ColorScheme.Literal(s);
+ s << v.second;
+ s.ColorScheme.ResetType(s);
+ s.ColorScheme.ResetRole(s);
}
};
diff --git a/library/cpp/dbg_output/engine.h b/library/cpp/dbg_output/engine.h
index 140a766952..f13c728c39 100644
--- a/library/cpp/dbg_output/engine.h
+++ b/library/cpp/dbg_output/engine.h
@@ -76,10 +76,10 @@ struct TRawLiteral {
template <class TChar>
static inline TRawLiteral<TChar> DumpRaw(const TBasicStringBuf<TChar>& s) noexcept {
- return {s};
-}
-
-template <class TChar>
+ return {s};
+}
+
+template <class TChar>
static inline TRawLiteral<TChar> DumpRaw(const TChar* s) noexcept {
return {s};
}
@@ -130,7 +130,7 @@ struct TCharDumper {
template <class S, class V>
static inline void OutSequence(S& s, const V& v, const char* openTag, const char* closeTag) {
- s.ColorScheme.Markup(s);
+ s.ColorScheme.Markup(s);
s << DumpRaw(openTag);
{
@@ -139,21 +139,21 @@ static inline void OutSequence(S& s, const V& v, const char* openTag, const char
for (const auto& x : v) {
if (cnt) {
- s.ColorScheme.Markup(s);
+ s.ColorScheme.Markup(s);
s << DumpRaw(", ");
}
- s << IndentNewLine();
- s.ColorScheme.Literal(s);
- s << x;
+ s << IndentNewLine();
+ s.ColorScheme.Literal(s);
+ s << x;
++cnt;
}
}
- s << IndentNewLine();
- s.ColorScheme.Markup(s);
- s << DumpRaw(closeTag);
- s.ColorScheme.ResetType(s);
+ s << IndentNewLine();
+ s.ColorScheme.Markup(s);
+ s << DumpRaw(closeTag);
+ s.ColorScheme.ResetType(s);
}
struct TAssocDumper {
@@ -173,8 +173,8 @@ struct TSeqDumper {
struct TStrDumper {
template <class S, class V>
static inline void Dump(S& s, const V& v) {
- s.ColorScheme.String(s);
+ s.ColorScheme.String(s);
s.String(v);
- s.ColorScheme.ResetType(s);
+ s.ColorScheme.ResetType(s);
}
};
diff --git a/library/cpp/dbg_output/ut/dbg_output_ut.cpp b/library/cpp/dbg_output/ut/dbg_output_ut.cpp
index 7839504bce..7b285c84cb 100644
--- a/library/cpp/dbg_output/ut/dbg_output_ut.cpp
+++ b/library/cpp/dbg_output/ut/dbg_output_ut.cpp
@@ -1,17 +1,17 @@
#include <library/cpp/dbg_output/dump.h>
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/stream/str.h>
+
+#include <util/stream/str.h>
#include <util/string/builder.h>
-#include <util/string/escape.h>
+#include <util/string/escape.h>
#include <util/generic/map.h>
-
+
namespace {
struct TX {
inline TX() {
N = this;
}
-
+
TX* N;
};
}
@@ -24,22 +24,22 @@ struct TDumper<TX> {
}
};
-namespace TMyNS {
- struct TMyStruct {
- int A, B;
- };
-}
-DEFINE_DUMPER(TMyNS::TMyStruct, A, B)
-
+namespace TMyNS {
+ struct TMyStruct {
+ int A, B;
+ };
+}
+DEFINE_DUMPER(TMyNS::TMyStruct, A, B)
+
Y_UNIT_TEST_SUITE(TContainerPrintersTest) {
Y_UNIT_TEST(TestVectorInt) {
- TStringStream out;
+ TStringStream out;
out << DbgDump(TVector<int>({1, 2, 3, 4, 5}));
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "[1, 2, 3, 4, 5]");
- }
-
+ }
+
Y_UNIT_TEST(TestMapCharToCharArray) {
- TStringStream out;
+ TStringStream out;
TMap<char, const char*> m;
@@ -49,51 +49,51 @@ Y_UNIT_TEST_SUITE(TContainerPrintersTest) {
out << DbgDump(m);
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "{'a' -> \"SMALL LETTER A\", 'b' -> (empty)}");
- }
-
+ }
+
Y_UNIT_TEST(TestVectorOfVectors) {
- TStringStream out;
+ TStringStream out;
TVector<TVector<wchar16>> vec(2);
- vec[0].push_back(0);
+ vec[0].push_back(0);
vec[1] = {wchar16('a')};
out << DbgDump(vec);
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "[[w'\\0'], [w'a']]");
- }
+ }
Y_UNIT_TEST(TestInfinite) {
UNIT_ASSERT(!!(TStringBuilder() << DbgDumpDeep(TX())));
}
-
+
Y_UNIT_TEST(TestLabeledDump) {
- TStringStream out;
- int a = 1, b = 2;
- out << LabeledDump(a, b, 1 + 2);
+ TStringStream out;
+ int a = 1, b = 2;
+ out << LabeledDump(a, b, 1 + 2);
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "{\"a\": 1, \"b\": 2, \"1 + 2\": 3}");
- }
-
+ }
+
Y_UNIT_TEST(TestStructDumper) {
- TStringStream out;
- out << DbgDump(TMyNS::TMyStruct{3, 4});
+ TStringStream out;
+ out << DbgDump(TMyNS::TMyStruct{3, 4});
UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "{\"A\": 3, \"B\": 4}");
- }
-
+ }
+
Y_UNIT_TEST(TestColors) {
using TComplex = TMap<TString, TMap<int, char>>;
- TComplex test;
- test["a"][1] = '7';
- test["b"][2] = '6';
- TStringStream out;
- out << DbgDump<TComplex, NDbgDump::NColorScheme::TEyebleed</* Enforce = */ true>>(test);
- UNIT_ASSERT_STRINGS_EQUAL(
- EscapeC(out.Str()),
- "\\x1B[1;32m{\\x1B[1;31m\\x1B[42m\\x1B[1;31m\\x1B[1;33m\\\"a\\\"\\x1B[22;39m\\x1B[22;39m"
- "\\x1B[49m\\x1B[1;32m -> \\x1B[44m\\x1B[1;31m\\x1B[1;32m{\\x1B[1;31m\\x1B[1;31m1"
- "\\x1B[22;39m\\x1B[1;32m -> \\x1B[1;31m'7'\\x1B[22;39m\\x1B[1;32m}"
- "\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m, \\x1B[1;31m\\x1B[42m\\x1B[1;31m\\x1B[1;33m"
- "\\\"b\\\"\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m -> "
- "\\x1B[44m\\x1B[1;31m\\x1B[1;32m{\\x1B[1;31m\\x1B[1;31m2\\x1B[22;39m\\x1B[1;32m -> "
+ TComplex test;
+ test["a"][1] = '7';
+ test["b"][2] = '6';
+ TStringStream out;
+ out << DbgDump<TComplex, NDbgDump::NColorScheme::TEyebleed</* Enforce = */ true>>(test);
+ UNIT_ASSERT_STRINGS_EQUAL(
+ EscapeC(out.Str()),
+ "\\x1B[1;32m{\\x1B[1;31m\\x1B[42m\\x1B[1;31m\\x1B[1;33m\\\"a\\\"\\x1B[22;39m\\x1B[22;39m"
+ "\\x1B[49m\\x1B[1;32m -> \\x1B[44m\\x1B[1;31m\\x1B[1;32m{\\x1B[1;31m\\x1B[1;31m1"
+ "\\x1B[22;39m\\x1B[1;32m -> \\x1B[1;31m'7'\\x1B[22;39m\\x1B[1;32m}"
+ "\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m, \\x1B[1;31m\\x1B[42m\\x1B[1;31m\\x1B[1;33m"
+ "\\\"b\\\"\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m -> "
+ "\\x1B[44m\\x1B[1;31m\\x1B[1;32m{\\x1B[1;31m\\x1B[1;31m2\\x1B[22;39m\\x1B[1;32m -> "
"\\x1B[1;31m'6'\\x1B[22;39m\\x1B[1;32m}\\x1B[22;39m\\x1B[22;39m\\x1B[49m\\x1B[1;32m}\\x1B[22;39m");
- }
+ }
Y_UNIT_TEST(SmallIntOrChar) {
char c = 'e';
@@ -103,4 +103,4 @@ Y_UNIT_TEST_SUITE(TContainerPrintersTest) {
UNIT_ASSERT_VALUES_EQUAL(TStringBuilder() << DbgDump(i), "-100");
UNIT_ASSERT_VALUES_EQUAL(TStringBuilder() << DbgDump(u), "10");
}
-}
+}
diff --git a/library/cpp/dbg_output/ut/ya.make b/library/cpp/dbg_output/ut/ya.make
index 77a8f38976..201601295d 100644
--- a/library/cpp/dbg_output/ut/ya.make
+++ b/library/cpp/dbg_output/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST_FOR(library/cpp/dbg_output)
-
+
OWNER(pg)
-
-SRCS(
- dbg_output_ut.cpp
-)
-
-END()
+
+SRCS(
+ dbg_output_ut.cpp
+)
+
+END()
diff --git a/library/cpp/dbg_output/ya.make b/library/cpp/dbg_output/ya.make
index f8f75fa330..7d54108f93 100644
--- a/library/cpp/dbg_output/ya.make
+++ b/library/cpp/dbg_output/ya.make
@@ -2,10 +2,10 @@ LIBRARY()
OWNER(pg)
-PEERDIR(
+PEERDIR(
library/cpp/colorizer
-)
-
+)
+
SRCS(
dump.cpp
dumpers.cpp
diff --git a/library/cpp/protobuf/json/proto2json.h b/library/cpp/protobuf/json/proto2json.h
index c7770a62b8..89a1781a40 100644
--- a/library/cpp/protobuf/json/proto2json.h
+++ b/library/cpp/protobuf/json/proto2json.h
@@ -10,7 +10,7 @@
#include <util/generic/fwd.h>
#include <util/generic/vector.h>
#include <util/generic/yexception.h>
-#include <util/stream/str.h>
+#include <util/stream/str.h>
#include <functional>
@@ -51,7 +51,7 @@ namespace NProtobufJson {
inline void Proto2Json(const T& proto, TStringStream& out) {
out << proto.AsJSON();
}
-
+
/// @throw yexception
void Proto2Json(const NProtoBuf::Message& proto, TString& str,
const TProto2JsonConfig& config);
@@ -75,4 +75,4 @@ namespace NProtobufJson {
return result;
}
-}
+}
diff --git a/library/cpp/protobuf/json/ut/json.h b/library/cpp/protobuf/json/ut/json.h
index 2ee855cf61..c1f108e6e4 100644
--- a/library/cpp/protobuf/json/ut/json.h
+++ b/library/cpp/protobuf/json/ut/json.h
@@ -55,9 +55,9 @@ namespace NProtobufJsonTest {
#define UNIT_ASSERT_JSONS_EQUAL(lhs, rhs) \
if (lhs != rhs) { \
- UNIT_ASSERT_STRINGS_EQUAL(lhs.GetStringRobust(), rhs.GetStringRobust()); \
- }
-
+ UNIT_ASSERT_STRINGS_EQUAL(lhs.GetStringRobust(), rhs.GetStringRobust()); \
+ }
+
#define UNIT_ASSERT_JSON_STRINGS_EQUAL(lhs, rhs) \
if (lhs != rhs) { \
NJson::TJsonValue _lhs_json, _rhs_json; \
diff --git a/library/cpp/protobuf/json/ut/proto2json_ut.cpp b/library/cpp/protobuf/json/ut/proto2json_ut.cpp
index f447f5bb5f..07e52d7f2f 100644
--- a/library/cpp/protobuf/json/ut/proto2json_ut.cpp
+++ b/library/cpp/protobuf/json/ut/proto2json_ut.cpp
@@ -201,7 +201,7 @@ Y_UNIT_TEST(TestFlatRepeated) {
UNIT_ASSERT_JSONS_EQUAL(json, modelJson);
} // streamed
}
-
+
TProto2JsonConfig config;
config.SetMissingRepeatedKeyMode(TProto2JsonConfig::MissingKeySkip);
@@ -358,7 +358,7 @@ Y_UNIT_TEST(TestCompositeRepeated) {
{
NJson::TJsonValue json;
UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, json));
- UNIT_ASSERT_JSONS_EQUAL(json, modelJson);
+ UNIT_ASSERT_JSONS_EQUAL(json, modelJson);
}
{
@@ -366,7 +366,7 @@ Y_UNIT_TEST(TestCompositeRepeated) {
NJson::TJsonValue json;
UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, jsonStream));
UNIT_ASSERT(ReadJsonTree(&jsonStream, &json));
- UNIT_ASSERT_JSONS_EQUAL(json, modelJson);
+ UNIT_ASSERT_JSONS_EQUAL(json, modelJson);
} // streamed
}
} // TestCompositeRepeated
@@ -518,12 +518,12 @@ Y_UNIT_TEST(TestMissingRepeatedKeyNoConfig) {
TFlatRepeated proto;
NJson::TJsonValue modelJson(NJson::JSON_MAP);
NJson::TJsonValue json;
-
+
UNIT_ASSERT_NO_EXCEPTION(Proto2Json(proto, json));
UNIT_ASSERT_JSONS_EQUAL(json, modelJson);
}
} // TestMissingRepeatedKeyNoConfig
-
+
Y_UNIT_TEST(TestMissingRepeatedKeyConfig) {
{
TFlatRepeated proto;
diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp
index 2e7c68a7ae..85f4ac5d69 100644
--- a/library/cpp/string_utils/url/url.cpp
+++ b/library/cpp/string_utils/url/url.cpp
@@ -125,10 +125,10 @@ TStringBuf CutSchemePrefix(const TStringBuf url) noexcept {
template <bool KeepPort>
static inline TStringBuf GetHostAndPortImpl(const TStringBuf url) {
- TStringBuf urlNoScheme = url;
+ TStringBuf urlNoScheme = url;
+
+ urlNoScheme.Skip(GetHttpPrefixSize(url));
- urlNoScheme.Skip(GetHttpPrefixSize(url));
-
struct TDelim: public str_spn {
inline TDelim()
: str_spn(KeepPort ? "/;?#" : "/:;?#")
@@ -137,7 +137,7 @@ static inline TStringBuf GetHostAndPortImpl(const TStringBuf url) {
};
const auto& nonHostCharacters = *Singleton<TDelim>();
- const char* firstNonHostCharacter = nonHostCharacters.brk(urlNoScheme.begin(), urlNoScheme.end());
+ const char* firstNonHostCharacter = nonHostCharacters.brk(urlNoScheme.begin(), urlNoScheme.end());
if (firstNonHostCharacter != urlNoScheme.end()) {
return urlNoScheme.substr(0, firstNonHostCharacter - urlNoScheme.data());
diff --git a/library/cpp/string_utils/url/url_ut.cpp b/library/cpp/string_utils/url/url_ut.cpp
index 63b579db7d..1588013893 100644
--- a/library/cpp/string_utils/url/url_ut.cpp
+++ b/library/cpp/string_utils/url/url_ut.cpp
@@ -15,7 +15,7 @@ Y_UNIT_TEST_SUITE(TUtilUrlTest) {
UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe:8080"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru/bebe:8080"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080/bebe"));
- UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("https://ya.ru:8080/bebe"));
+ UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("https://ya.ru:8080/bebe"));
UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("www.ya.ru:8080/bebe"));
UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("https://www.ya.ru:8080/bebe"));
UNIT_ASSERT_VALUES_EQUAL("ya.ru:8080", GetHostAndPort("ya.ru:8080/bebe"));
diff --git a/library/cpp/uri/uri.cpp b/library/cpp/uri/uri.cpp
index a44a05acbe..56a9a4e5ef 100644
--- a/library/cpp/uri/uri.cpp
+++ b/library/cpp/uri/uri.cpp
@@ -41,7 +41,7 @@ namespace NUri {
continue;
if (ch == '_') { // non-standard case we allow for certain hosts
- domainLevelOfUnderscore = domainLevel;
+ domainLevelOfUnderscore = domainLevel;
continue;
}
diff --git a/tools/ya.make b/tools/ya.make
index e599e59daf..51a6b8b426 100644
--- a/tools/ya.make
+++ b/tools/ya.make
@@ -51,7 +51,7 @@ RECURSE(
go_fake_xcrun
groupgen
hilite
- host_canonizer
+ host_canonizer
hostdump
hostpire
html2cpp
@@ -66,11 +66,11 @@ RECURSE(
lemmas_merger_builder
lemmer-test
lemmer-test/tests
- lenval_debug
+ lenval_debug
lua
memcheck
mirrorsWrapper
- misc_index_print
+ misc_index_print
mkdocs_builder
mkdocs_builder/arcadium_helper_plugin
mkdocs_builder/mkdocs_yandex
@@ -172,7 +172,7 @@ RECURSE(
url
urlmenuindexer
urlseq_print
- voice
+ voice
webxmltest
wizard_yt
ygetparam
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h
index ec8c0e9fae..badfb88993 100644
--- a/util/generic/algorithm.h
+++ b/util/generic/algorithm.h
@@ -34,35 +34,35 @@ namespace NPrivate {
}
template <class T>
-static inline void Sort(T f, T l) {
+static inline void Sort(T f, T l) {
std::sort(f, l);
}
template <class T, class C>
-static inline void Sort(T f, T l, C c) {
+static inline void Sort(T f, T l, C c) {
std::sort(f, l, c);
}
-template <class TContainer>
-static inline void Sort(TContainer& container) {
- Sort(container.begin(), container.end());
-}
-
-template <class TContainer, typename TCompare>
-static inline void Sort(TContainer& container, TCompare compare) {
- Sort(container.begin(), container.end(), compare);
-}
-
-template <class TIterator, typename TGetKey>
-static inline void SortBy(TIterator begin, TIterator end, const TGetKey& getKey) {
+template <class TContainer>
+static inline void Sort(TContainer& container) {
+ Sort(container.begin(), container.end());
+}
+
+template <class TContainer, typename TCompare>
+static inline void Sort(TContainer& container, TCompare compare) {
+ Sort(container.begin(), container.end(), compare);
+}
+
+template <class TIterator, typename TGetKey>
+static inline void SortBy(TIterator begin, TIterator end, const TGetKey& getKey) {
Sort(begin, end, [&](auto&& left, auto&& right) { return getKey(left) < getKey(right); });
-}
-
-template <class TContainer, typename TGetKey>
-static inline void SortBy(TContainer& container, const TGetKey& getKey) {
- SortBy(container.begin(), container.end(), getKey);
-}
-
+}
+
+template <class TContainer, typename TGetKey>
+static inline void SortBy(TContainer& container, const TGetKey& getKey) {
+ SortBy(container.begin(), container.end(), getKey);
+}
+
template <class T>
static inline void StableSort(T f, T l) {
std::stable_sort(f, l);
diff --git a/util/generic/algorithm_ut.cpp b/util/generic/algorithm_ut.cpp
index e281def406..8d732fcc0c 100644
--- a/util/generic/algorithm_ut.cpp
+++ b/util/generic/algorithm_ut.cpp
@@ -430,7 +430,7 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {
UNIT_ASSERT_VALUES_EQUAL(IsSorted(v2.begin(), v2.end(), TLess<int>()), false);
UNIT_ASSERT_VALUES_EQUAL(IsSorted(v2.begin(), v2.end(), TGreater<int>()), false);
}
-
+
Y_UNIT_TEST(IsSortedByTest) {
TVector<int> v0;
UNIT_ASSERT_VALUES_EQUAL(IsSortedBy(v0.begin(), v0.end(), std::negate<int>()), true);
@@ -505,8 +505,8 @@ Y_UNIT_TEST_SUITE(TAlgorithm) {
TVector<int> collection = {10, 2, 7};
SortBy(collection, [](int x) { return -x; });
TVector<int> expected = {10, 7, 2};
- UNIT_ASSERT_VALUES_EQUAL(collection, expected);
- }
+ UNIT_ASSERT_VALUES_EQUAL(collection, expected);
+ }
Y_UNIT_TEST(StableSortByTest) {
TVector<int> collection = {404, 101, 106, 203, 102, 205, 401};
diff --git a/util/generic/iterator.h b/util/generic/iterator.h
index 71a375a550..19e9d20976 100644
--- a/util/generic/iterator.h
+++ b/util/generic/iterator.h
@@ -127,13 +127,13 @@ public:
return TIterator();
}
};
-
+
/**
* Transform given reverse iterator into forward iterator pointing to the same element.
*
* @see http://stackoverflow.com/a/1830240
*/
-template <class TIterator>
+template <class TIterator>
auto ToForwardIterator(TIterator iter) {
return std::next(iter).base();
-}
+}
diff --git a/util/generic/iterator_ut.cpp b/util/generic/iterator_ut.cpp
index 1694c59b9c..00be19e10e 100644
--- a/util/generic/iterator_ut.cpp
+++ b/util/generic/iterator_ut.cpp
@@ -1,14 +1,14 @@
-#include "iterator.h"
-
+#include "iterator.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TIterator) {
Y_UNIT_TEST(ToForwardIteratorTest) {
TVector<int> x = {1, 2};
UNIT_ASSERT_VALUES_EQUAL(*std::prev(x.end()), *ToForwardIterator(x.rbegin()));
UNIT_ASSERT_VALUES_EQUAL(*ToForwardIterator(std::prev(x.rend())), *x.begin());
- }
-}
+ }
+}
Y_UNIT_TEST_SUITE(TInputRangeAdaptor) {
class TSquaresGenerator: public TInputRangeAdaptor<TSquaresGenerator> {
diff --git a/util/generic/va_args.cpp b/util/generic/va_args.cpp
index dd8c18ea6c..2266d05a0d 100644
--- a/util/generic/va_args.cpp
+++ b/util/generic/va_args.cpp
@@ -1,15 +1,15 @@
-#include "va_args.h"
-
-// Test that it compiles
-#define __DUMMY__(x)
+#include "va_args.h"
+
+// Test that it compiles
+#define __DUMMY__(x)
Y_MAP_ARGS(__DUMMY__, 1, 2, 3);
-#define __DUMMY_LAST__(x)
+#define __DUMMY_LAST__(x)
Y_MAP_ARGS_WITH_LAST(__DUMMY__, __DUMMY_LAST__, 1, 2, 3);
#undef __DUMMY_LAST__
#undef __DUMMY__
-
-#define __MULTI_DUMMY__(x, y)
-#define __MULTI_DUMMY_PROXY__(x) __MULTI_DUMMY__ x
+
+#define __MULTI_DUMMY__(x, y)
+#define __MULTI_DUMMY_PROXY__(x) __MULTI_DUMMY__ x
Y_MAP_ARGS(__MULTI_DUMMY_PROXY__, (1, 2), (3, 4));
#undef __MULTI_DUMMY_PROXY__
#undef __MULTI_DUMMY__
diff --git a/util/generic/va_args.h b/util/generic/va_args.h
index 8680520c72..33498d47ed 100644
--- a/util/generic/va_args.h
+++ b/util/generic/va_args.h
@@ -1,9 +1,9 @@
-#pragma once
-
+#pragma once
+
/// @file va_args.h
///
/// Some handy macros for preprocessor metaprogramming.
-
+
// NOTE: this file has been generated with "./va_args_gen.py", do not edit -- use the generator instead
// DO_NOT_STYLE
@@ -17,14 +17,14 @@
* See http://stackoverflow.com/questions/5134523/msvc-doesnt-expand-va-args-correctly
*/
#define Y_PASS_VA_ARGS(x) x
-
+
/**
* Count number of arguments in `__VA_ARGS__`.
* Doesn't work with empty arguments list.
*/
#define Y_COUNT_ARGS(...) Y_PASS_VA_ARGS(__Y_COUNT_ARGS(__VA_ARGS__, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
#define __Y_COUNT_ARGS(_50, _49, _48, _47, _46, _45, _44, _43, _42, _41, _40, _39, _38, _37, _36, _35, _34, _33, _32, _31, _30, _29, _28, _27, _26, _25, _24, _23, _22, _21, _20, _19, _18, _17, _16, _15, _14, _13, _12, _11, _10, _9, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) N
-
+
/**
* Get the i-th element from `__VA_ARGS__`.
*/
@@ -80,7 +80,7 @@
#define __Y_GET_ARG_48(_0, _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, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, ...) _48
#define __Y_GET_ARG_49(_0, _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, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, ...) _49
#define __Y_GET_ARG_50(_0, _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, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, ...) _50
-
+
/**
* Expands a macro for each of the variable arguments.
* Doesn't work with empty arguments list.
diff --git a/util/generic/va_args_gen.py b/util/generic/va_args_gen.py
index b7d3537bae..232b53fca6 100755
--- a/util/generic/va_args_gen.py
+++ b/util/generic/va_args_gen.py
@@ -1,19 +1,19 @@
-#!/usr/bin/env python
+#!/usr/bin/env python
"""
Generates some handy macros for preprocessor metaprogramming.
-
+
"""
from __future__ import print_function
-import sys
+import sys
import textwrap
-
+
if sys.version_info >= (3, 0, 0):
xrange = range
-
-def generate(limit):
+
+def generate(limit):
print('#pragma once')
print(textwrap.dedent('''
/// @file va_args.h
@@ -28,7 +28,7 @@ def generate(limit):
print('')
print('#include <util/system/defaults.h>')
print('')
-
+
pass_va_args()
count(limit)
get_elem(limit)
@@ -39,8 +39,8 @@ def generate(limit):
all_but_last(limit)
last(limit)
impl_dispatcher()
-
-
+
+
def pass_va_args():
print(textwrap.dedent('''
/**
@@ -51,8 +51,8 @@ def pass_va_args():
*/
'''.rstrip()))
print('#define Y_PASS_VA_ARGS(x) x')
-
-
+
+
def count(limit):
print(textwrap.dedent('''
/**
@@ -66,7 +66,7 @@ def count(limit):
'__Y_COUNT_ARGS(__VA_ARGS__, {}))'.format(numbers))
print('#define __Y_COUNT_ARGS({}, N, ...) N'.format(u_numbers))
-
+
def get_elem(limit):
print(textwrap.dedent('''
/**
@@ -78,8 +78,8 @@ def get_elem(limit):
for i in xrange(0, limit + 1):
args = ', '.join(map('_{}'.format, xrange(i + 1)))
print('#define __Y_GET_ARG_{}({}, ...) _{}'.format(i, args, i))
-
-
+
+
def map_args(limit):
print(textwrap.dedent('''
/**
@@ -94,8 +94,8 @@ def map_args(limit):
for i in xrange(2, limit + 1):
print('#define __Y_MAP_ARGS_{}(ACTION, x, ...) ACTION(x) Y_PASS_VA_ARGS(__Y_MAP_ARGS_{}('
'ACTION, __VA_ARGS__))'.format(i, i - 1))
-
-
+
+
def map_args_n(limit):
print(textwrap.dedent('''
/**
@@ -128,8 +128,8 @@ def map_args_with_last(limit):
for i in xrange(2, limit + 1):
print('#define __Y_MAP_ARGS_WITH_LAST_{}(ACTION, LAST_ACTION, x, ...) ACTION(x) Y_PASS_VA_ARGS('
'__Y_MAP_ARGS_WITH_LAST_{}(ACTION, LAST_ACTION, __VA_ARGS__))'.format(i, i - 1))
-
-
+
+
def map_args_with_last_n(limit):
print(textwrap.dedent('''
/**
@@ -197,15 +197,15 @@ def impl_dispatcher():
print('/// }@')
-def main():
- if len(sys.argv) > 2:
+def main():
+ if len(sys.argv) > 2:
sys.stderr.write('Usage: {} [limit=50]\n'.format(sys.argv[0]))
- sys.exit(1)
+ sys.exit(1)
limit = 50
- if len(sys.argv) == 2:
- limit = int(sys.argv[1])
- generate(limit)
-
-
-if __name__ == '__main__':
- main()
+ if len(sys.argv) == 2:
+ limit = int(sys.argv[1])
+ generate(limit)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/util/generic/va_args_ut.cpp b/util/generic/va_args_ut.cpp
index 79ad45980b..a9c96a0f55 100644
--- a/util/generic/va_args_ut.cpp
+++ b/util/generic/va_args_ut.cpp
@@ -1,21 +1,21 @@
-#include "va_args.h"
-
+#include "va_args.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TMacroVarargMapTest) {
Y_UNIT_TEST(TestMapArgs) {
static const char COMBINED[] = Y_MAP_ARGS(Y_STRINGIZE, 1, 2, 3);
- UNIT_ASSERT_STRINGS_EQUAL(COMBINED, "123");
- }
-
+ UNIT_ASSERT_STRINGS_EQUAL(COMBINED, "123");
+ }
+
Y_UNIT_TEST(TestMapArgsWithLast) {
-#define ADD(x) x +
-#define ID(x) x
+#define ADD(x) x +
+#define ID(x) x
static const int SUM = Y_MAP_ARGS_WITH_LAST(ADD, ID, 1, 2, 3, 4 + 5);
- UNIT_ASSERT_VALUES_EQUAL(SUM, 1 + 2 + 3 + 4 + 5);
+ UNIT_ASSERT_VALUES_EQUAL(SUM, 1 + 2 + 3 + 4 + 5);
#undef ADD
#undef ID
- }
+ }
Y_UNIT_TEST(TestMapArgsN) {
#define MAP_ARG(INDEX, X) Y_STRINGIZE(X)
@@ -40,7 +40,7 @@ Y_UNIT_TEST_SUITE(TMacroVarargMapTest) {
#undef ADD_ARG
#undef ID_ARG
}
-}
+}
Y_UNIT_TEST_SUITE(TestVaArgs) {
Y_UNIT_TEST(Count) {
diff --git a/util/stream/labeled.h b/util/stream/labeled.h
index 103c2941df..2cc539d241 100644
--- a/util/stream/labeled.h
+++ b/util/stream/labeled.h
@@ -1,7 +1,7 @@
-#pragma once
-
-#include <util/generic/va_args.h>
-
+#pragma once
+
+#include <util/generic/va_args.h>
+
/**
* Generates an output sequence for the provided expressions that is formatted
* as a labeled comma-separated list.
@@ -16,4 +16,4 @@
#define LabeledOutput(...) "" Y_PASS_VA_ARGS(Y_MAP_ARGS_WITH_LAST(__LABELED_OUTPUT_NONLAST__, __LABELED_OUTPUT_IMPL__, __VA_ARGS__))
#define __LABELED_OUTPUT_IMPL__(x) << #x " = " << (x)
-#define __LABELED_OUTPUT_NONLAST__(x) __LABELED_OUTPUT_IMPL__(x) << ", "
+#define __LABELED_OUTPUT_NONLAST__(x) __LABELED_OUTPUT_IMPL__(x) << ", "
diff --git a/util/stream/labeled_ut.cpp b/util/stream/labeled_ut.cpp
index a0f724bdca..12d0dc5004 100644
--- a/util/stream/labeled_ut.cpp
+++ b/util/stream/labeled_ut.cpp
@@ -1,12 +1,12 @@
-#include "str.h"
-
+#include "str.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
+
Y_UNIT_TEST_SUITE(TLabeledOutputTest) {
Y_UNIT_TEST(TBasicTest) {
- TStringStream out;
- int x = 3;
- out << LabeledOutput(x, 1, 2, 3 + 4);
- UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "x = 3, 1 = 1, 2 = 2, 3 + 4 = 7");
- }
-}
+ TStringStream out;
+ int x = 3;
+ out << LabeledOutput(x, 1, 2, 3 + 4);
+ UNIT_ASSERT_STRINGS_EQUAL(out.Str(), "x = 3, 1 = 1, 2 = 2, 3 + 4 = 7");
+ }
+}
diff --git a/util/stream/output.h b/util/stream/output.h
index 7b377aa0de..00eef50b95 100644
--- a/util/stream/output.h
+++ b/util/stream/output.h
@@ -1,8 +1,8 @@
#pragma once
#include "fwd.h"
-#include "labeled.h"
-
+#include "labeled.h"
+
#include <util/generic/noncopyable.h>
#include <util/generic/string.h>
#include <util/generic/strbuf.h>
diff --git a/util/ysafeptr.h b/util/ysafeptr.h
index 15c8c345f5..af7dfd4bed 100644
--- a/util/ysafeptr.h
+++ b/util/ysafeptr.h
@@ -193,7 +193,7 @@ public:
// if class needs special destructor, use CFundament
#define OBJECT_METHODS(classname) \
public: \
- virtual const char* GetClassName() const override { \
+ virtual const char* GetClassName() const override { \
return #classname; \
} \
static IObjectBase* NewSaveLoadNullItem() { \
@@ -201,7 +201,7 @@ public: \
} \
\
protected: \
- virtual void DestroyContents() override { \
+ virtual void DestroyContents() override { \
this->~classname(); \
int nHoldRefs = this->RefData, nHoldObjs = this->ObjData; \
new (this) classname(); \