clang-format using ./format.sh

This commit is contained in:
Mindaugas Vinkelis
2025-09-09 17:38:23 +03:00
parent 8bda82576e
commit 7ea1da0d48
20 changed files with 55 additions and 111 deletions

View File

@@ -95,14 +95,12 @@ namespace bitsery {
// and Derived2 member fnc we need explicitly select which function to use // and Derived2 member fnc we need explicitly select which function to use
template<> template<>
struct SelectSerializeFnc<Derived2> : UseMemberFnc struct SelectSerializeFnc<Derived2> : UseMemberFnc
{ {};
};
// multiple inheritance has non-member serialize function defined // multiple inheritance has non-member serialize function defined
template<> template<>
struct SelectSerializeFnc<MultipleInheritance> : UseNonMemberFnc struct SelectSerializeFnc<MultipleInheritance> : UseNonMemberFnc
{ {};
};
} }
// some helper types // some helper types

View File

@@ -191,14 +191,12 @@ namespace ext {
template<> template<>
struct PolymorphicBaseClass<Shape> struct PolymorphicBaseClass<Shape>
: PolymorphicDerivedClasses<Circle, Rectangle> : PolymorphicDerivedClasses<Circle, Rectangle>
{ {};
};
template<> template<>
struct PolymorphicBaseClass<Rectangle> struct PolymorphicBaseClass<Rectangle>
: PolymorphicDerivedClasses<RoundedRectangle> : PolymorphicDerivedClasses<RoundedRectangle>
{ {};
};
} }
} }

View File

@@ -145,10 +145,7 @@ struct SwapImpl
return static_cast<uint16_t>((value & 0x00ff) << 8 | (value & 0xff00) >> 8); return static_cast<uint16_t>((value & 0x00ff) << 8 | (value & 0xff00) >> 8);
} }
static uint8_t exec(uint8_t value) static uint8_t exec(uint8_t value) { return value; }
{
return value;
}
}; };
template<typename TValue> template<typename TValue>

View File

@@ -62,8 +62,7 @@ struct NotDefinedType
template<typename T> template<typename T>
struct IsDefined struct IsDefined
: public std::integral_constant<bool, !std::is_same<NotDefinedType, T>::value> : public std::integral_constant<bool, !std::is_same<NotDefinedType, T>::value>
{ {};
};
} }
} }

View File

@@ -70,24 +70,19 @@ struct FtorExtValue : public Ext
template<typename Ext> template<typename Ext>
struct FtorExtValue1b : FtorExtValue<1, Ext> struct FtorExtValue1b : FtorExtValue<1, Ext>
{ {};
};
template<typename Ext> template<typename Ext>
struct FtorExtValue2b : FtorExtValue<2, Ext> struct FtorExtValue2b : FtorExtValue<2, Ext>
{ {};
};
template<typename Ext> template<typename Ext>
struct FtorExtValue4b : FtorExtValue<4, Ext> struct FtorExtValue4b : FtorExtValue<4, Ext>
{ {};
};
template<typename Ext> template<typename Ext>
struct FtorExtValue8b : FtorExtValue<8, Ext> struct FtorExtValue8b : FtorExtValue<8, Ext>
{ {};
};
template<typename Ext> template<typename Ext>
struct FtorExtValue16b : FtorExtValue<16, Ext> struct FtorExtValue16b : FtorExtValue<16, Ext>
{ {};
};
template<typename Ext> template<typename Ext>
struct FtorExtObject : public Ext struct FtorExtObject : public Ext
@@ -105,8 +100,7 @@ struct FtorExtObject : public Ext
// SelectSerializeFnc<MyDerivedClass>:UseMemberFnc {}; // SelectSerializeFnc<MyDerivedClass>:UseMemberFnc {};
template<typename T> template<typename T>
struct SelectSerializeFnc : std::integral_constant<int, 0> struct SelectSerializeFnc : std::integral_constant<int, 0>
{ {};
};
// types you need to inherit from when specializing SelectSerializeFnc class // types you need to inherit from when specializing SelectSerializeFnc class
struct UseNonMemberFnc : std::integral_constant<int, 1> struct UseNonMemberFnc : std::integral_constant<int, 1>
@@ -120,20 +114,17 @@ namespace details {
template<typename T> template<typename T>
struct IsContainerTraitsDefined struct IsContainerTraitsDefined
: public IsDefined<typename traits::ContainerTraits<T>::TValue> : public IsDefined<typename traits::ContainerTraits<T>::TValue>
{ {};
};
template<typename T> template<typename T>
struct IsTextTraitsDefined struct IsTextTraitsDefined
: public IsDefined<typename traits::TextTraits<T>::TValue> : public IsDefined<typename traits::TextTraits<T>::TValue>
{ {};
};
template<typename Ext, typename T> template<typename Ext, typename T>
struct IsExtensionTraitsDefined struct IsExtensionTraitsDefined
: public IsDefined<typename traits::ExtensionTraits<Ext, T>::TValue> : public IsDefined<typename traits::ExtensionTraits<Ext, T>::TValue>
{ {};
};
#ifdef _MSC_VER #ifdef _MSC_VER
// helper types for HasSerializeFunction // helper types for HasSerializeFunction
@@ -151,8 +142,7 @@ struct HasSerializeFunctionHelper
}; };
template<typename S, typename T> template<typename S, typename T>
struct HasSerializeFunction : HasSerializeFunctionHelper<S, T>::type struct HasSerializeFunction : HasSerializeFunctionHelper<S, T>::type
{ {};
};
// helper types for HasSerializeMethod // helper types for HasSerializeMethod
template<typename S, typename T> template<typename S, typename T>
@@ -169,8 +159,7 @@ struct HasSerializeMethodHelper
}; };
template<typename S, typename T> template<typename S, typename T>
struct HasSerializeMethod : HasSerializeMethodHelper<S, T>::type struct HasSerializeMethod : HasSerializeMethodHelper<S, T>::type
{ {};
};
// helper types for IsBriefSyntaxIncluded // helper types for IsBriefSyntaxIncluded
template<typename S, typename T> template<typename S, typename T>
@@ -188,8 +177,7 @@ struct IsBriefSyntaxIncludedHelper
template<typename S, typename T> template<typename S, typename T>
struct IsBriefSyntaxIncluded : IsBriefSyntaxIncludedHelper<S, T>::type struct IsBriefSyntaxIncluded : IsBriefSyntaxIncludedHelper<S, T>::type
{ {};
};
#else #else
// helper metafunction, that is added to c++17 // helper metafunction, that is added to c++17
template<typename... Ts> template<typename... Ts>
@@ -202,8 +190,7 @@ using void_t = typename make_void<Ts...>::type;
template<typename, typename, typename = void> template<typename, typename, typename = void>
struct HasSerializeFunction : std::false_type struct HasSerializeFunction : std::false_type
{ {};
};
template<typename S, typename T> template<typename S, typename T>
struct HasSerializeFunction< struct HasSerializeFunction<
@@ -211,13 +198,11 @@ struct HasSerializeFunction<
T, T,
void_t<decltype(serialize(std::declval<S&>(), std::declval<T&>()))>> void_t<decltype(serialize(std::declval<S&>(), std::declval<T&>()))>>
: std::true_type : std::true_type
{ {};
};
template<typename, typename, typename = void> template<typename, typename, typename = void>
struct HasSerializeMethod : std::false_type struct HasSerializeMethod : std::false_type
{ {};
};
template<typename S, typename T> template<typename S, typename T>
struct HasSerializeMethod< struct HasSerializeMethod<
@@ -225,14 +210,12 @@ struct HasSerializeMethod<
T, T,
void_t<decltype(Access::serialize(std::declval<S&>(), std::declval<T&>()))>> void_t<decltype(Access::serialize(std::declval<S&>(), std::declval<T&>()))>>
: std::true_type : std::true_type
{ {};
};
// this solution doesn't work with visual studio, but is more elegant // this solution doesn't work with visual studio, but is more elegant
template<typename, typename, typename = void> template<typename, typename, typename = void>
struct IsBriefSyntaxIncluded : std::false_type struct IsBriefSyntaxIncluded : std::false_type
{ {};
};
template<typename S, typename T> template<typename S, typename T>
struct IsBriefSyntaxIncluded< struct IsBriefSyntaxIncluded<
@@ -240,8 +223,7 @@ struct IsBriefSyntaxIncluded<
T, T,
void_t<decltype(processBriefSyntax(std::declval<S&>(), std::declval<T&&>()))>> void_t<decltype(processBriefSyntax(std::declval<S&>(), std::declval<T&&>()))>>
: std::true_type : std::true_type
{ {};
};
#endif #endif
// used for extensions when extension TValue = void // used for extensions when extension TValue = void
@@ -257,8 +239,7 @@ struct IsFundamentalType
std::is_enum<T>::value || std::is_enum<T>::value ||
std::is_floating_point<T>::value || std::is_floating_point<T>::value ||
std::is_integral<T>::value> std::is_integral<T>::value>
{ {};
};
template<typename T, typename Integral = void> template<typename T, typename Integral = void>
struct IntegralFromFundamental struct IntegralFromFundamental
@@ -372,16 +353,14 @@ struct BriefSyntaxFunction
template<int Index, typename... Conds> template<int Index, typename... Conds>
struct FindIndex : std::integral_constant<int, Index> struct FindIndex : std::integral_constant<int, Index>
{ {};
};
template<int Index, typename Cond, typename... Conds> template<int Index, typename Cond, typename... Conds>
struct FindIndex<Index, Cond, Conds...> struct FindIndex<Index, Cond, Conds...>
: std::conditional<Cond::value, : std::conditional<Cond::value,
std::integral_constant<int, Index>, std::integral_constant<int, Index>,
FindIndex<Index + 1, Conds...>>::type FindIndex<Index + 1, Conds...>>::type
{ {};
};
template<typename T, typename Tuple> template<typename T, typename Tuple>
struct GetConvertibleTypeIndexFromTuple; struct GetConvertibleTypeIndexFromTuple;
@@ -389,8 +368,7 @@ struct GetConvertibleTypeIndexFromTuple;
template<typename T, typename... Us> template<typename T, typename... Us>
struct GetConvertibleTypeIndexFromTuple<T, std::tuple<Us...>> struct GetConvertibleTypeIndexFromTuple<T, std::tuple<Us...>>
: FindIndex<0, std::is_convertible<Us&, T&>...> : FindIndex<0, std::is_convertible<Us&, T&>...>
{ {};
};
template<typename T, typename Tuple> template<typename T, typename Tuple>
struct IsExistsConvertibleTupleType; struct IsExistsConvertibleTupleType;
@@ -401,8 +379,7 @@ struct IsExistsConvertibleTupleType<T, std::tuple<Us...>>
bool, bool,
GetConvertibleTypeIndexFromTuple<T, std::tuple<Us...>>::value != GetConvertibleTypeIndexFromTuple<T, std::tuple<Us...>>::value !=
sizeof...(Us)> sizeof...(Us)>
{ {};
};
/* /*
* get context from internal or external, and check if it's convertible or not * get context from internal or external, and check if it's convertible or not
@@ -549,13 +526,11 @@ protected:
template<typename T, template<typename...> class Template> template<typename T, template<typename...> class Template>
struct IsSpecializationOf : std::false_type struct IsSpecializationOf : std::false_type
{ {};
};
template<template<typename...> class Template, typename... Args> template<template<typename...> class Template, typename... Args>
struct IsSpecializationOf<Template<Args...>, Template> : std::true_type struct IsSpecializationOf<Template<Args...>, Template> : std::true_type
{ {};
};
} }
} }

View File

@@ -329,8 +329,7 @@ public:
: std::integral_constant< : std::integral_constant<
bool, bool,
RTTI::template isPolymorphic<typename TPtrManager<T>::TElement>()> RTTI::template isPolymorphic<typename TPtrManager<T>::TElement>()>
{ {};
};
template<PointerOwnershipType Value> template<PointerOwnershipType Value>
using OwnershipType = std::integral_constant<PointerOwnershipType, Value>; using OwnershipType = std::integral_constant<PointerOwnershipType, Value>;

View File

@@ -35,8 +35,7 @@ namespace ext {
// helper type, that contains list of types // helper type, that contains list of types
template<typename...> template<typename...>
struct PolymorphicClassesList struct PolymorphicClassesList
{ {};
};
// specialize for your base class by deriving from PolymorphicDerivedClasses // specialize for your base class by deriving from PolymorphicDerivedClasses
// with list of derivatives that DIRECTLY inherits from your base class. // with list of derivatives that DIRECTLY inherits from your base class.

View File

@@ -32,14 +32,12 @@ namespace traits {
template<typename T, size_t N> template<typename T, size_t N>
struct ContainerTraits<std::array<T, N>> struct ContainerTraits<std::array<T, N>>
: public StdContainer<std::array<T, N>, false, true> : public StdContainer<std::array<T, N>, false, true>
{ {};
};
template<typename T, size_t N> template<typename T, size_t N>
struct BufferAdapterTraits<std::array<T, N>> struct BufferAdapterTraits<std::array<T, N>>
: public StdContainerForBufferAdapter<std::array<T, N>> : public StdContainerForBufferAdapter<std::array<T, N>>
{ {};
};
} }
} }

View File

@@ -33,8 +33,7 @@ namespace traits {
template<typename T, typename Allocator> template<typename T, typename Allocator>
struct ContainerTraits<std::deque<T, Allocator>> struct ContainerTraits<std::deque<T, Allocator>>
: public StdContainer<std::deque<T, Allocator>, true, false> : public StdContainer<std::deque<T, Allocator>, true, false>
{ {};
};
} }

View File

@@ -33,8 +33,7 @@ namespace traits {
template<typename T, typename Allocator> template<typename T, typename Allocator>
struct ContainerTraits<std::list<T, Allocator>> struct ContainerTraits<std::list<T, Allocator>>
: public StdContainer<std::list<T, Allocator>, true, false> : public StdContainer<std::list<T, Allocator>, true, false>
{ {};
};
} }

View File

@@ -36,8 +36,7 @@ namespace traits {
template<typename CharT, typename Traits, typename Allocator> template<typename CharT, typename Traits, typename Allocator>
struct ContainerTraits<std::basic_string<CharT, Traits, Allocator>> struct ContainerTraits<std::basic_string<CharT, Traits, Allocator>>
: public StdContainer<std::basic_string<CharT, Traits, Allocator>, true, true> : public StdContainer<std::basic_string<CharT, Traits, Allocator>, true, true>
{ {};
};
template<typename CharT, typename Traits, typename Allocator> template<typename CharT, typename Traits, typename Allocator>
struct TextTraits<std::basic_string<CharT, Traits, Allocator>> struct TextTraits<std::basic_string<CharT, Traits, Allocator>>
@@ -72,8 +71,7 @@ template<typename CharT, typename Traits, typename Allocator>
struct BufferAdapterTraits<std::basic_string<CharT, Traits, Allocator>> struct BufferAdapterTraits<std::basic_string<CharT, Traits, Allocator>>
: public StdContainerForBufferAdapter< : public StdContainerForBufferAdapter<
std::basic_string<CharT, Traits, Allocator>> std::basic_string<CharT, Traits, Allocator>>
{ {};
};
} }

View File

@@ -32,21 +32,18 @@ namespace traits {
template<typename T, typename Allocator> template<typename T, typename Allocator>
struct ContainerTraits<std::vector<T, Allocator>> struct ContainerTraits<std::vector<T, Allocator>>
: public StdContainer<std::vector<T, Allocator>, true, true> : public StdContainer<std::vector<T, Allocator>, true, true>
{ {};
};
// bool vector is not contiguous, do not copy it directly to buffer // bool vector is not contiguous, do not copy it directly to buffer
template<typename Allocator> template<typename Allocator>
struct ContainerTraits<std::vector<bool, Allocator>> struct ContainerTraits<std::vector<bool, Allocator>>
: public StdContainer<std::vector<bool, Allocator>, true, false> : public StdContainer<std::vector<bool, Allocator>, true, false>
{ {};
};
template<typename T, typename Allocator> template<typename T, typename Allocator>
struct BufferAdapterTraits<std::vector<T, Allocator>> struct BufferAdapterTraits<std::vector<T, Allocator>>
: public StdContainerForBufferAdapter<std::vector<T, Allocator>> : public StdContainerForBufferAdapter<std::vector<T, Allocator>>
{ {};
};
} }

View File

@@ -306,8 +306,7 @@ using AdapterInputTypes =
template<typename TConfig> template<typename TConfig>
class InputAll : public AdapterConfig<TConfig> class InputAll : public AdapterConfig<TConfig>
{ {};
};
TYPED_TEST_SUITE(InputAll, AdapterInputTypes, ); TYPED_TEST_SUITE(InputAll, AdapterInputTypes, );
@@ -476,8 +475,7 @@ using AdapterOutputTypes =
template<typename TConfig> template<typename TConfig>
class OutputAll : public AdapterConfig<TConfig> class OutputAll : public AdapterConfig<TConfig>
{ {};
};
TYPED_TEST_SUITE(OutputAll, AdapterOutputTypes, ); TYPED_TEST_SUITE(OutputAll, AdapterOutputTypes, );

View File

@@ -38,9 +38,9 @@
#include <bitsery/brief_syntax/unordered_set.h> #include <bitsery/brief_syntax/unordered_set.h>
#include <bitsery/brief_syntax/vector.h> #include <bitsery/brief_syntax/vector.h>
#if __cplusplus > 201402L #if __cplusplus > 201402L
#include <bitsery/brief_syntax/optional.h>
#include <bitsery/brief_syntax/tuple.h> #include <bitsery/brief_syntax/tuple.h>
#include <bitsery/brief_syntax/variant.h> #include <bitsery/brief_syntax/variant.h>
#include <bitsery/brief_syntax/optional.h>
#if __cplusplus > 202002L #if __cplusplus > 202002L
#include <bitsery/brief_syntax/bitset.h> #include <bitsery/brief_syntax/bitset.h>
#endif #endif

View File

@@ -320,8 +320,7 @@ namespace ext {
template<> template<>
struct PolymorphicBaseClass<PolymorphicNDCBase> struct PolymorphicBaseClass<PolymorphicNDCBase>
: PolymorphicDerivedClasses<PolymorphicNDC1, PolymorphicNDC2> : PolymorphicDerivedClasses<PolymorphicNDC1, PolymorphicNDC2>
{ {};
};
} }
} }

View File

@@ -214,8 +214,7 @@ TYPED_TEST(SerializeContainerFixedSizeArithmeticTypes, ArithmeticValues)
template<typename T> template<typename T>
class SerializeContainerFixedSizeCompositeTypes class SerializeContainerFixedSizeCompositeTypes
: public SerializeContainerFixedSizeArithmeticTypes<T> : public SerializeContainerFixedSizeArithmeticTypes<T>
{ {};
};
using StaticContainersWithCompositeTypes = using StaticContainersWithCompositeTypes =
::testing::Types<std::array<MyStruct1, 4>, MyStruct1[4]>; ::testing::Types<std::array<MyStruct1, 4>, MyStruct1[4]>;

View File

@@ -356,13 +356,11 @@ struct DerivedMemberSerialize : public BaseNonMemberSerialize
namespace bitsery { namespace bitsery {
template<> template<>
struct SelectSerializeFnc<DerivedPrivateBase> : UseNonMemberFnc struct SelectSerializeFnc<DerivedPrivateBase> : UseNonMemberFnc
{ {};
};
template<> template<>
struct SelectSerializeFnc<DerivedMemberSerialize> : UseMemberFnc struct SelectSerializeFnc<DerivedMemberSerialize> : UseMemberFnc
{ {};
};
} }
TEST( TEST(

View File

@@ -147,8 +147,7 @@ namespace ext {
template<> template<>
struct PolymorphicBaseClass<Base> struct PolymorphicBaseClass<Base>
: PolymorphicDerivedClasses<Derived1, Derived2> : PolymorphicDerivedClasses<Derived1, Derived2>
{ {};
};
// this is commented on purpose, to test scenario when base class is registered // this is commented on purpose, to test scenario when base class is registered
// (Base) but using instance of Derived1 which is not registered as base // (Base) but using instance of Derived1 which is not registered as base
@@ -160,8 +159,7 @@ struct PolymorphicBaseClass<Base>
template<> template<>
struct PolymorphicBaseClass<Derived2> struct PolymorphicBaseClass<Derived2>
: PolymorphicDerivedClasses<MultipleVirtualInheritance> : PolymorphicDerivedClasses<MultipleVirtualInheritance>
{ {};
};
} }
} }

View File

@@ -152,14 +152,12 @@ namespace ext {
template<> template<>
struct PolymorphicBaseClass<Base> struct PolymorphicBaseClass<Base>
: PolymorphicDerivedClasses<Derived1, Derived2> : PolymorphicDerivedClasses<Derived1, Derived2>
{ {};
};
template<> template<>
struct PolymorphicBaseClass<PolyPtrWithPolyPtrBase> struct PolymorphicBaseClass<PolyPtrWithPolyPtrBase>
: PolymorphicDerivedClasses<DerivedPolyPtrWithPolyPtr> : PolymorphicDerivedClasses<DerivedPolyPtrWithPolyPtr>
{ {};
};
} }
} }

View File

@@ -106,13 +106,11 @@ namespace ext {
template<> template<>
struct PolymorphicBaseClass<Base> : PolymorphicDerivedClasses<Derived> struct PolymorphicBaseClass<Base> : PolymorphicDerivedClasses<Derived>
{ {};
};
template<> template<>
struct PolymorphicBaseClass<Derived> : PolymorphicDerivedClasses<MoreDerived> struct PolymorphicBaseClass<Derived> : PolymorphicDerivedClasses<MoreDerived>
{ {};
};
} }
} }