Browse Source

Restoring authorship annotation for <evelkin@yandex-team.ru>. Commit 2 of 2.

evelkin 3 years ago
parent
commit
7510cec151

+ 25 - 25
library/cpp/enumbitset/enumbitset.h

@@ -2,7 +2,7 @@
 
 #include <util/ysaveload.h>
 #include <util/generic/bitmap.h>
-#include <util/generic/serialized_enum.h> 
+#include <util/generic/serialized_enum.h>
 #include <util/generic/yexception.h>
 #include <util/string/cast.h>
 #include <util/string/printf.h>
@@ -216,14 +216,14 @@ public:
         return TThis::operator^(TThis(c));
     }
 
-    auto operator[] (TEnum e) { 
-        return TParent::operator[](this->Pos(e)); 
-    } 
- 
-    auto operator[] (TEnum e) const { 
-        return TParent::operator[](this->Pos(e)); 
-    } 
- 
+    auto operator[] (TEnum e) {
+        return TParent::operator[](this->Pos(e));
+    }
+
+    auto operator[] (TEnum e) const {
+        return TParent::operator[](this->Pos(e));
+    }
+
     using TParent::Count;
     using TParent::Empty;
 
@@ -485,22 +485,22 @@ public:
         return ebs;
     }
 };
- 
-/* For Enums with GENERATE_ENUM_SERIALIZATION_WITH_HEADER */ 
-template <typename TEnum> 
-class TGeneratedEnumBitSet : public TEnumBitSet<TEnum, 0, GetEnumItemsCount<TEnum>()> { 
-public: 
-    using TParent = TEnumBitSet<TEnum, 0, GetEnumItemsCount<TEnum>()>; 
- 
-    TGeneratedEnumBitSet() 
-        : TParent() 
-    { 
-    } 
- 
+
+/* For Enums with GENERATE_ENUM_SERIALIZATION_WITH_HEADER */
+template <typename TEnum>
+class TGeneratedEnumBitSet : public TEnumBitSet<TEnum, 0, GetEnumItemsCount<TEnum>()> {
+public:
+    using TParent = TEnumBitSet<TEnum, 0, GetEnumItemsCount<TEnum>()>;
+
+    TGeneratedEnumBitSet()
+        : TParent()
+    {
+    }
+
     explicit TGeneratedEnumBitSet(const TParent& p)
-        : TParent(p) 
-    { 
-    } 
+        : TParent(p)
+    {
+    }
 
     explicit TGeneratedEnumBitSet(TEnum c1)
         : TParent(c1)
@@ -512,4 +512,4 @@ public:
         : TParent(c1, c2, r...)
     {
     }
-}; 
+};

+ 17 - 17
library/cpp/object_factory/object_factory.h

@@ -54,20 +54,20 @@ namespace NObjectFactory {
 
     public:
         template <class TDerivedProduct>
-        void Register(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) { 
+        void Register(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) {
             if (!creator)
-                ythrow yexception() << "Please specify non-null creator for " << key; 
+                ythrow yexception() << "Please specify non-null creator for " << key;
 
             TWriteGuard guard(CreatorsLock);
             if (!Creators.insert(typename ICreators::value_type(key, creator)).second)
                 ythrow yexception() << "Product with key " << key << " already registered";
         }
 
-        template <class TDerivedProduct> 
-        void Register(const TKey& key) { 
-            Register<TDerivedProduct>(key, new TFactoryObjectCreator<TProduct, TDerivedProduct, TArgs...>); 
-        } 
- 
+        template <class TDerivedProduct>
+        void Register(const TKey& key) {
+            Register<TDerivedProduct>(key, new TFactoryObjectCreator<TProduct, TDerivedProduct, TArgs...>);
+        }
+
         void GetKeys(TSet<TKey>& keys) const {
             TReadGuard guard(CreatorsLock);
             keys.clear();
@@ -165,14 +165,14 @@ namespace NObjectFactory {
         template <class Product>
         class TRegistrator {
         public:
-            TRegistrator(const TKey& key, IFactoryObjectCreator<TProduct, void>* creator) { 
+            TRegistrator(const TKey& key, IFactoryObjectCreator<TProduct, void>* creator) {
                 Singleton<TObjectFactory<TProduct, TKey>>()->template Register<Product>(key, creator);
             }
 
-            TRegistrator(const TKey& key) { 
-                Singleton<TObjectFactory<TProduct, TKey>>()->template Register<Product>(key); 
-            } 
- 
+            TRegistrator(const TKey& key) {
+                Singleton<TObjectFactory<TProduct, TKey>>()->template Register<Product>(key);
+            }
+
             TRegistrator()
                 : TRegistrator(Product::GetTypeName())
             {
@@ -221,14 +221,14 @@ namespace NObjectFactory {
         template <class Product>
         class TRegistrator {
         public:
-            TRegistrator(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) { 
+            TRegistrator(const TKey& key, IFactoryObjectCreator<TProduct, TArgs...>* creator) {
                 Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->template Register<Product>(key, creator);
             }
 
-            TRegistrator(const TKey& key) { 
-                Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->template Register<Product>(key); 
-            } 
- 
+            TRegistrator(const TKey& key) {
+                Singleton<TParametrizedObjectFactory<TProduct, TKey, TArgs...>>()->template Register<Product>(key);
+            }
+
             TRegistrator()
                 : TRegistrator(Product::GetTypeName())
             {

+ 28 - 28
library/cpp/object_factory/object_factory_ut.cpp

@@ -123,25 +123,25 @@ using TMoveableOnly2Factory = TParametrizedObjectFactory<IMoveableOnlyInterface,
 
 static TMoveableOnly2Factory::TRegistrator<TMoveableOnly2> MoveableOnly2Reg("move2");
 
-class TDirectOrderDifferentSignature : public TDirectOrder { 
-public: 
-    TDirectOrderDifferentSignature(const TString& provider, TArgument& argument) : 
-        TDirectOrder(provider, 0.01f, argument) 
-    { 
-    } 
-
-}; 
-
-struct TDirectOrderDSCreator: public IFactoryObjectCreator<ICommonInterface, const TString&, float, TArgument&> { 
-    ICommonInterface* Create(const TString& provider, float factor, TArgument& argument) const override { 
-        Y_UNUSED(factor); 
-        return new TDirectOrderDifferentSignature(provider, argument); 
-    } 
-}; 
- 
- 
-static TTestFactory::TRegistrator<TDirectOrderDifferentSignature> DirectDs("direct_ds", new TDirectOrderDSCreator); 
- 
+class TDirectOrderDifferentSignature : public TDirectOrder {
+public:
+    TDirectOrderDifferentSignature(const TString& provider, TArgument& argument) :
+        TDirectOrder(provider, 0.01f, argument)
+    {
+    }
+
+};
+
+struct TDirectOrderDSCreator: public IFactoryObjectCreator<ICommonInterface, const TString&, float, TArgument&> {
+    ICommonInterface* Create(const TString& provider, float factor, TArgument& argument) const override {
+        Y_UNUSED(factor);
+        return new TDirectOrderDifferentSignature(provider, argument);
+    }
+};
+
+
+static TTestFactory::TRegistrator<TDirectOrderDifferentSignature> DirectDs("direct_ds", new TDirectOrderDSCreator);
+
 Y_UNIT_TEST_SUITE(TestObjectFactory) {
     Y_UNIT_TEST(TestParametrized) {
         TArgument directArg{"Name", nullptr};
@@ -177,13 +177,13 @@ Y_UNIT_TEST_SUITE(TestObjectFactory) {
 
         UNIT_ASSERT(moveableOnly2->GetValue() == "value2");
     }
- 
-    Y_UNIT_TEST(TestDifferentSignature) { 
-        TArgument directArg{"Name", nullptr}; 
-        THolder<ICommonInterface> directDs(TTestFactory::Construct("direct_ds", "prov", 0.42, directArg)); 
- 
-        UNIT_ASSERT(!!directDs); 
- 
-        UNIT_ASSERT_EQUAL(directDs->GetValue(), "prov0.01Name"); 
-    } 
+
+    Y_UNIT_TEST(TestDifferentSignature) {
+        TArgument directArg{"Name", nullptr};
+        THolder<ICommonInterface> directDs(TTestFactory::Construct("direct_ds", "prov", 0.42, directArg));
+
+        UNIT_ASSERT(!!directDs);
+
+        UNIT_ASSERT_EQUAL(directDs->GetValue(), "prov0.01Name");
+    }
 }

+ 14 - 14
library/cpp/protobuf/json/proto2json_printer.cpp

@@ -442,8 +442,8 @@ namespace NProtobufJson {
                                         const FieldDescriptor& field,
                                         IJsonOutput& json,
                                         const TStringBuf key) {
- 
- 
+
+
         if (field.is_repeated())
             PrintRepeatedField(proto, field, json, key);
         else
@@ -456,21 +456,21 @@ namespace NProtobufJson {
 
         json.BeginObject();
 
-        // Iterate over all non-extension fields 
+        // Iterate over all non-extension fields
         for (int f = 0, endF = descriptor->field_count(); f < endF; ++f) {
             const FieldDescriptor* field = descriptor->field(f);
             Y_ASSERT(field);
             PrintField(proto, *field, json);
         }
 
-        // Check extensions via ListFields 
-        std::vector<const FieldDescriptor*> fields; 
-        auto* ref = proto.GetReflection(); 
-        ref->ListFields(proto, &fields); 
- 
-        for (const FieldDescriptor* field : fields) { 
-            Y_ASSERT(field); 
-            if (field->is_extension()) { 
+        // Check extensions via ListFields
+        std::vector<const FieldDescriptor*> fields;
+        auto* ref = proto.GetReflection();
+        ref->ListFields(proto, &fields);
+
+        for (const FieldDescriptor* field : fields) {
+            Y_ASSERT(field);
+            if (field->is_extension()) {
                 switch (GetConfig().ExtensionFieldNameMode) {
                     case TProto2JsonConfig::ExtFldNameFull:
                         PrintField(proto, *field, json, field->full_name());
@@ -479,9 +479,9 @@ namespace NProtobufJson {
                         PrintField(proto, *field, json);
                         break;
                 }
-            } 
-        } 
- 
+            }
+        }
+
         if (closeMap) {
             json.EndObject();
         }

+ 8 - 8
library/cpp/protobuf/json/ut/proto2json_ut.cpp

@@ -1006,17 +1006,17 @@ Y_UNIT_TEST(TestStringifyLongNumbers) {
 #undef TEST_SINGLE
 } // TestStringifyLongNumbers
 
-Y_UNIT_TEST(TestExtension) { 
-    TExtensionField proto; 
-    proto.SetExtension(bar, 1); 
- 
-    Y_ASSERT(proto.HasExtension(bar)); 
-    UNIT_ASSERT_EQUAL(Proto2Json(proto, TProto2JsonConfig()), "{\"NProtobufJsonTest.bar\":1}"); 
+Y_UNIT_TEST(TestExtension) {
+    TExtensionField proto;
+    proto.SetExtension(bar, 1);
+
+    Y_ASSERT(proto.HasExtension(bar));
+    UNIT_ASSERT_EQUAL(Proto2Json(proto, TProto2JsonConfig()), "{\"NProtobufJsonTest.bar\":1}");
 
 
     TProto2JsonConfig cfg;
     cfg.SetExtensionFieldNameMode(TProto2JsonConfig::ExtFldNameShort);
     UNIT_ASSERT_EQUAL(Proto2Json(proto, cfg), "{\"bar\":1}");
-} // TestExtension 
- 
+} // TestExtension
+
 } // TProto2JsonTest

+ 8 - 8
library/cpp/protobuf/json/ut/test.proto

@@ -193,11 +193,11 @@ message TSingleRepeatedString {
 message TSingleRepeatedInt {
     repeated int32 RepeatedInt = 1;
 }
- 
-message TExtensionField { 
-	extensions 100 to 199; 
-} 
- 
-extend TExtensionField { 
-  optional int32 bar = 123; 
-} 
+
+message TExtensionField {
+	extensions 100 to 199;
+}
+
+extend TExtensionField {
+  optional int32 bar = 123;
+}

+ 16 - 16
util/generic/function.h

@@ -82,22 +82,22 @@ struct TFunctionArgImpl {
 
 template <typename C, size_t N>
 using TFunctionArg = typename TFunctionArgImpl<C, N>::TResult;
- 
-// temporary before std::apply appearance 
- 
-template <typename F, typename Tuple, size_t... I> 
-auto ApplyImpl(F&& f, Tuple&& t, std::index_sequence<I...>) { 
-    return f(std::get<I>(std::forward<Tuple>(t))...); 
-} 
- 
-// change to std::apply after c++ 17 
-template <typename F, typename Tuple> 
+
+// temporary before std::apply appearance
+
+template <typename F, typename Tuple, size_t... I>
+auto ApplyImpl(F&& f, Tuple&& t, std::index_sequence<I...>) {
+    return f(std::get<I>(std::forward<Tuple>(t))...);
+}
+
+// change to std::apply after c++ 17
+template <typename F, typename Tuple>
 auto Apply(F&& f, Tuple&& t) {
     return ApplyImpl(f, t, std::make_index_sequence<std::tuple_size<std::decay_t<Tuple>>::value>{});
-} 
- 
-// change to std::apply after c++ 17 
-template <typename F> 
+}
+
+// change to std::apply after c++ 17
+template <typename F>
 auto Apply(F&& f, std::tuple<>) {
-    return f(); 
-} 
+    return f();
+}

+ 6 - 6
util/generic/typetraits.h

@@ -238,27 +238,27 @@ struct TPodTraits<std::pair<T1, T2>> {
 template <class T>
 struct TIsPointerToConstMemberFunction: std::false_type {
 };
- 
+
 template <class R, class T, class... Args>
 struct TIsPointerToConstMemberFunction<R (T::*)(Args...) const>: std::true_type {
 };
- 
+
 template <class R, class T, class... Args>
 struct TIsPointerToConstMemberFunction<R (T::*)(Args...) const&>: std::true_type {
 };
- 
+
 template <class R, class T, class... Args>
 struct TIsPointerToConstMemberFunction<R (T::*)(Args...) const&&>: std::true_type {
 };
- 
+
 template <class R, class T, class... Args>
 struct TIsPointerToConstMemberFunction<R (T::*)(Args..., ...) const>: std::true_type {
 };
- 
+
 template <class R, class T, class... Args>
 struct TIsPointerToConstMemberFunction<R (T::*)(Args..., ...) const&>: std::true_type {
 };
- 
+
 template <class R, class T, class... Args>
 struct TIsPointerToConstMemberFunction<R (T::*)(Args..., ...) const&&>: std::true_type {
 };