From f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Tue, 29 Oct 2024 14:49:26 +0800 Subject: format * format * Minor test fixes * enable checking cpp format in ci --- source/core/slang-func-ptr.h | 47 ++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'source/core/slang-func-ptr.h') diff --git a/source/core/slang-func-ptr.h b/source/core/slang-func-ptr.h index c861bc6b8..271b51ae1 100644 --- a/source/core/slang-func-ptr.h +++ b/source/core/slang-func-ptr.h @@ -6,7 +6,8 @@ namespace Slang { -template class FuncPtr : public RefObject +template +class FuncPtr : public RefObject { public: virtual TResult operator()(Arguments...) const = 0; @@ -15,7 +16,7 @@ public: virtual ~FuncPtr() {} }; -template +template class CdeclFuncPtr : public FuncPtr { public: @@ -27,7 +28,8 @@ private: public: CdeclFuncPtr(FuncType func) : funcPtr(func) - {} + { + } virtual FuncPtr* clone() override { auto rs = new CdeclFuncPtr(funcPtr); @@ -46,7 +48,7 @@ public: } }; -template +template class MemberFuncPtr : public FuncPtr { public: @@ -58,9 +60,9 @@ private: public: MemberFuncPtr(Class* obj, FuncType func) - : funcPtr(func) - , object(obj) - {} + : funcPtr(func), object(obj) + { + } virtual FuncPtr* clone() override { auto rs = new MemberFuncPtr(object, funcPtr); @@ -81,7 +83,7 @@ public: } }; -template +template class LambdaFuncPtr : public FuncPtr { private: @@ -90,7 +92,8 @@ private: public: LambdaFuncPtr(const F& _func) : func(_func) - {} + { + } virtual TResult operator()(Arguments... params) const override { return func(params...); } virtual FuncPtr* clone() override { @@ -103,7 +106,8 @@ public: } }; -template class Func +template +class Func { private: RefPtr> funcPtr; @@ -114,12 +118,13 @@ public: { funcPtr = new CdeclFuncPtr(func); } - template + template Func(Class* object, typename MemberFuncPtr::FuncType func) { funcPtr = new MemberFuncPtr(object, func); } - template Func(const TFuncObj& func) + template + Func(const TFuncObj& func) { funcPtr = new LambdaFuncPtr(func); } @@ -128,13 +133,14 @@ public: funcPtr = new CdeclFuncPtr(func); return *this; } - template + template Func& operator=(const MemberFuncPtr& func) { funcPtr = new MemberFuncPtr(func); return *this; } - template Func& operator=(const TFuncObj& func) + template + Func& operator=(const TFuncObj& func) { funcPtr = new LambdaFuncPtr(func); return *this; @@ -147,7 +153,8 @@ public: // template // using Action = Func; -template class Action : public Func +template +class Action : public Func { private: RefPtr> funcPtr; @@ -159,12 +166,13 @@ public: { funcPtr = new CdeclFuncPtr(func); } - template + template Action(Class* object, typename MemberFuncPtr::FuncType func) { funcPtr = new MemberFuncPtr(object, func); } - template Action(const TFuncObj& func) + template + Action(const TFuncObj& func) { funcPtr = new LambdaFuncPtr(func); } @@ -173,13 +181,14 @@ public: funcPtr = new CdeclFuncPtr(func); return *this; } - template + template Action& operator=(const MemberFuncPtr& func) { funcPtr = new MemberFuncPtr(func); return *this; } - template Action& operator=(const TFuncObj& func) + template + Action& operator=(const TFuncObj& func) { funcPtr = new LambdaFuncPtr(func); return *this; -- cgit v1.2.3