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
template<>
struct SelectSerializeFnc<Derived2> : UseMemberFnc
{
};
{};
// multiple inheritance has non-member serialize function defined
template<>
struct SelectSerializeFnc<MultipleInheritance> : UseNonMemberFnc
{
};
{};
}
// some helper types

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -35,8 +35,7 @@ namespace ext {
// helper type, that contains list of types
template<typename...>
struct PolymorphicClassesList
{
};
{};
// specialize for your base class by deriving from PolymorphicDerivedClasses
// 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>
struct ContainerTraits<std::array<T, N>>
: public StdContainer<std::array<T, N>, false, true>
{
};
{};
template<typename T, size_t N>
struct BufferAdapterTraits<std::array<T, N>>
: public StdContainerForBufferAdapter<std::array<T, N>>
{
};
{};
}
}

View File

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

View File

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

View File

@@ -36,8 +36,7 @@ namespace traits {
template<typename CharT, typename Traits, typename Allocator>
struct ContainerTraits<std::basic_string<CharT, Traits, Allocator>>
: public StdContainer<std::basic_string<CharT, Traits, Allocator>, true, true>
{
};
{};
template<typename CharT, typename Traits, typename 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>>
: public StdContainerForBufferAdapter<
std::basic_string<CharT, Traits, Allocator>>
{
};
{};
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -147,8 +147,7 @@ namespace ext {
template<>
struct PolymorphicBaseClass<Base>
: PolymorphicDerivedClasses<Derived1, Derived2>
{
};
{};
// 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
@@ -160,8 +159,7 @@ struct PolymorphicBaseClass<Base>
template<>
struct PolymorphicBaseClass<Derived2>
: PolymorphicDerivedClasses<MultipleVirtualInheritance>
{
};
{};
}
}

View File

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

View File

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