From 173563550e1d26c8550c44545a9cb94adcd04e70 Mon Sep 17 00:00:00 2001 From: Franck W Date: Fri, 18 Nov 2022 17:16:25 +0100 Subject: [PATCH] Changed case of all ALL_CAPS non macro names to PascalCase and added FAKEIT_ prefix for macros. --- config/standalone/StandaloneFakeit.hpp | 4 +-- config/tpunit/TpUnitFakeit.hpp | 4 +-- include/fakeit/ActualInvocationsSource.hpp | 4 +-- include/fakeit/DomainObjects.hpp | 2 +- include/fakeit/Invocation.hpp | 2 +- include/fakeit/MethodMockingContext.hpp | 2 +- include/fakeit/Mock.hpp | 6 ++-- include/fakeit/MockImpl.hpp | 8 ++--- include/fakeit/RecordedMethodBody.hpp | 2 +- include/fakeit/Sequence.hpp | 2 +- .../SequenceVerificationExpectation.hpp | 2 +- .../fakeit/SequenceVerificationProgress.hpp | 2 +- include/fakeit/StubbingImpl.hpp | 4 +-- include/fakeit/StubbingProgress.hpp | 4 +-- ...NoOtherInvocationsVerificationProgress.hpp | 4 +-- include/fakeit/WhenFunctor.hpp | 2 +- include/mockutils/DynamicProxy.hpp | 36 +++++++++---------- include/mockutils/Macros.hpp | 8 ++--- include/mockutils/MethodProxyCreator.hpp | 4 +-- .../gcc/is_simple_inheritance_layout.hpp | 12 +++---- include/mockutils/mscpp/VirtualTable.hpp | 12 +++---- include/mockutils/smart_ptr.hpp | 2 +- include/mockutils/type_utils.hpp | 8 ++--- include/mockutils/union_cast.hpp | 10 +++--- 24 files changed, 73 insertions(+), 73 deletions(-) diff --git a/config/standalone/StandaloneFakeit.hpp b/config/standalone/StandaloneFakeit.hpp index 6e259b57..47a5c588 100644 --- a/config/standalone/StandaloneFakeit.hpp +++ b/config/standalone/StandaloneFakeit.hpp @@ -6,7 +6,7 @@ namespace fakeit { struct VerificationException : public std::exception { - virtual ~VerificationException() NO_THROWS{}; + virtual ~VerificationException() FAKEIT_NO_THROWS{}; VerificationException(std::string format) : // _format(format) { // @@ -33,7 +33,7 @@ namespace fakeit { return _callingMethod; } - const char* what() const NO_THROWS override{ + const char* what() const FAKEIT_NO_THROWS override{ return _format.c_str(); } private: diff --git a/config/tpunit/TpUnitFakeit.hpp b/config/tpunit/TpUnitFakeit.hpp index a6bb0dde..8e81f36b 100644 --- a/config/tpunit/TpUnitFakeit.hpp +++ b/config/tpunit/TpUnitFakeit.hpp @@ -27,11 +27,11 @@ class TpUnitAdapter: public EventHandler { : _msg(msg) { } - const char* what() const NO_THROWS override{ + const char* what() const FAKEIT_NO_THROWS override{ return _msg.c_str(); } - virtual ~AssertionException() NO_THROWS {} + virtual ~AssertionException() FAKEIT_NO_THROWS {} }; virtual ~TpUnitAdapter() = default; diff --git a/include/fakeit/ActualInvocationsSource.hpp b/include/fakeit/ActualInvocationsSource.hpp index 1162b41b..67397ac0 100644 --- a/include/fakeit/ActualInvocationsSource.hpp +++ b/include/fakeit/ActualInvocationsSource.hpp @@ -10,13 +10,13 @@ namespace fakeit { struct ActualInvocationsContainer { virtual void clear() = 0; - virtual ~ActualInvocationsContainer() NO_THROWS { } + virtual ~ActualInvocationsContainer() FAKEIT_NO_THROWS { } }; struct ActualInvocationsSource { virtual void getActualInvocations(std::unordered_set &into) const = 0; - virtual ~ActualInvocationsSource() NO_THROWS { } + virtual ~ActualInvocationsSource() FAKEIT_NO_THROWS { } }; struct InvocationsSourceProxy : public ActualInvocationsSource { diff --git a/include/fakeit/DomainObjects.hpp b/include/fakeit/DomainObjects.hpp index 9f175fed..07a50e38 100644 --- a/include/fakeit/DomainObjects.hpp +++ b/include/fakeit/DomainObjects.hpp @@ -15,7 +15,7 @@ namespace fakeit { template struct MockObject { - virtual ~MockObject() THROWS { }; + virtual ~MockObject() FAKEIT_THROWS { }; virtual C &get() = 0; diff --git a/include/fakeit/Invocation.hpp b/include/fakeit/Invocation.hpp index 3b03be50..d6a15c46 100644 --- a/include/fakeit/Invocation.hpp +++ b/include/fakeit/Invocation.hpp @@ -27,7 +27,7 @@ namespace fakeit { struct Matcher { - virtual ~Matcher() THROWS { + virtual ~Matcher() FAKEIT_THROWS { } virtual bool matches(Invocation &invocation) = 0; diff --git a/include/fakeit/MethodMockingContext.hpp b/include/fakeit/MethodMockingContext.hpp index f701bd7d..46704dce 100644 --- a/include/fakeit/MethodMockingContext.hpp +++ b/include/fakeit/MethodMockingContext.hpp @@ -182,7 +182,7 @@ namespace fakeit { : _impl(std::move(other._impl)) { } - virtual ~MethodMockingContext() NO_THROWS { } + virtual ~MethodMockingContext() FAKEIT_NO_THROWS { } std::string format() const override { return _impl->format(); diff --git a/include/fakeit/Mock.hpp b/include/fakeit/Mock.hpp index 30821951..6b634859 100644 --- a/include/fakeit/Mock.hpp +++ b/include/fakeit/Mock.hpp @@ -51,9 +51,9 @@ namespace fakeit { impl.clear(); } - template::value>::type> - DataMemberStubbingRoot Stub(DATA_TYPE C::* member, const arglist &... ctorargs) { + template::value>::type> + DataMemberStubbingRoot Stub(DataType C::* member, const arglist &... ctorargs) { return impl.stubDataMember(member, ctorargs...); } diff --git a/include/fakeit/MockImpl.hpp b/include/fakeit/MockImpl.hpp index 2b8b63a2..950acb4c 100644 --- a/include/fakeit/MockImpl.hpp +++ b/include/fakeit/MockImpl.hpp @@ -37,7 +37,7 @@ namespace fakeit { fake->getVirtualTable().setCookie(1, this); } - virtual ~MockImpl() NO_THROWS { + virtual ~MockImpl() FAKEIT_NO_THROWS { _proxy.detach(); } @@ -83,10 +83,10 @@ namespace fakeit { return _fakeit; } - template::value>::type> - DataMemberStubbingRoot stubDataMember(DATA_TYPE T::*member, const arglist &... ctorargs) { + template::value>::type> + DataMemberStubbingRoot stubDataMember(DataType T::*member, const arglist &... ctorargs) { _proxy.stubDataMember(member, ctorargs...); - return DataMemberStubbingRoot(); + return DataMemberStubbingRoot(); } template::value>::type> diff --git a/include/fakeit/RecordedMethodBody.hpp b/include/fakeit/RecordedMethodBody.hpp index 7500f3bc..201000c7 100644 --- a/include/fakeit/RecordedMethodBody.hpp +++ b/include/fakeit/RecordedMethodBody.hpp @@ -95,7 +95,7 @@ namespace fakeit { RecordedMethodBody(FakeitContext &fakeit, std::string name) : _fakeit(fakeit), _method{MethodInfo::nextMethodOrdinal(), name} { } - virtual ~RecordedMethodBody() NO_THROWS { + virtual ~RecordedMethodBody() FAKEIT_NO_THROWS { } MethodInfo &getMethod() { diff --git a/include/fakeit/Sequence.hpp b/include/fakeit/Sequence.hpp index a9769382..7ce862cd 100644 --- a/include/fakeit/Sequence.hpp +++ b/include/fakeit/Sequence.hpp @@ -25,7 +25,7 @@ namespace fakeit { Sequence() { } - virtual ~Sequence() THROWS { + virtual ~Sequence() FAKEIT_THROWS { } public: diff --git a/include/fakeit/SequenceVerificationExpectation.hpp b/include/fakeit/SequenceVerificationExpectation.hpp index 0ee20f06..1b7abc21 100644 --- a/include/fakeit/SequenceVerificationExpectation.hpp +++ b/include/fakeit/SequenceVerificationExpectation.hpp @@ -12,7 +12,7 @@ namespace fakeit { friend class SequenceVerificationProgress; - ~SequenceVerificationExpectation() THROWS { + ~SequenceVerificationExpectation() FAKEIT_THROWS { if (UncaughtException()) { return; } diff --git a/include/fakeit/SequenceVerificationProgress.hpp b/include/fakeit/SequenceVerificationProgress.hpp index 21fdd4b3..0c12d3a4 100644 --- a/include/fakeit/SequenceVerificationProgress.hpp +++ b/include/fakeit/SequenceVerificationProgress.hpp @@ -62,7 +62,7 @@ namespace fakeit { public: - ~SequenceVerificationProgress() THROWS { }; + ~SequenceVerificationProgress() FAKEIT_THROWS { }; operator bool() const { return Terminator(_expectationPtr); diff --git a/include/fakeit/StubbingImpl.hpp b/include/fakeit/StubbingImpl.hpp index 401f8c15..1359576b 100644 --- a/include/fakeit/StubbingImpl.hpp +++ b/include/fakeit/StubbingImpl.hpp @@ -21,7 +21,7 @@ namespace fakeit { - template + template class DataMemberStubbingRoot { private: //DataMemberStubbingRoot & operator= (const DataMemberStubbingRoot & other) = delete; @@ -30,7 +30,7 @@ namespace fakeit { DataMemberStubbingRoot() = default; - void operator=(const DATA_TYPE&) { + void operator=(const DataType&) { } }; diff --git a/include/fakeit/StubbingProgress.hpp b/include/fakeit/StubbingProgress.hpp index a38de66f..0ca8439d 100644 --- a/include/fakeit/StubbingProgress.hpp +++ b/include/fakeit/StubbingProgress.hpp @@ -44,7 +44,7 @@ namespace fakeit { template struct MethodStubbingProgress { - virtual ~MethodStubbingProgress() THROWS { + virtual ~MethodStubbingProgress() FAKEIT_THROWS { } template @@ -229,7 +229,7 @@ namespace fakeit { template struct MethodStubbingProgress { - virtual ~MethodStubbingProgress() THROWS { + virtual ~MethodStubbingProgress() FAKEIT_THROWS { } MethodStubbingProgress &Return() { diff --git a/include/fakeit/VerifyNoOtherInvocationsVerificationProgress.hpp b/include/fakeit/VerifyNoOtherInvocationsVerificationProgress.hpp index 2c1642c7..69642fb4 100644 --- a/include/fakeit/VerifyNoOtherInvocationsVerificationProgress.hpp +++ b/include/fakeit/VerifyNoOtherInvocationsVerificationProgress.hpp @@ -22,7 +22,7 @@ namespace fakeit { friend class VerifyNoOtherInvocationsVerificationProgress; - ~VerifyNoOtherInvocationsExpectation() THROWS { + ~VerifyNoOtherInvocationsExpectation() FAKEIT_THROWS { if (UncaughtException()) { return; } @@ -109,7 +109,7 @@ namespace fakeit { public: - ~VerifyNoOtherInvocationsVerificationProgress() THROWS { + ~VerifyNoOtherInvocationsVerificationProgress() FAKEIT_THROWS { }; VerifyNoOtherInvocationsVerificationProgress setFileInfo(const char * file, int line, diff --git a/include/fakeit/WhenFunctor.hpp b/include/fakeit/WhenFunctor.hpp index ea80f40d..d92ab969 100644 --- a/include/fakeit/WhenFunctor.hpp +++ b/include/fakeit/WhenFunctor.hpp @@ -24,7 +24,7 @@ namespace fakeit { friend class WhenFunctor; - virtual ~StubbingChange() THROWS { + virtual ~StubbingChange() FAKEIT_THROWS { if (UncaughtException()) { return; diff --git a/include/mockutils/DynamicProxy.hpp b/include/mockutils/DynamicProxy.hpp index f1f62844..b3a735fb 100644 --- a/include/mockutils/DynamicProxy.hpp +++ b/include/mockutils/DynamicProxy.hpp @@ -71,7 +71,7 @@ namespace fakeit { _offsets(VTUtils::getVTSize()), _invocationHandlers(_methodMocks, _offsets) { _cloneVt.copyFrom(originalVtHandle.restore()); - _cloneVt.setCookie(InvocationHandlerCollection::VT_COOKIE_INDEX, &_invocationHandlers); + _cloneVt.setCookie(InvocationHandlerCollection::VtCookieIndex, &_invocationHandlers); getFake().setVirtualTable(_cloneVt); } @@ -137,21 +137,21 @@ namespace fakeit { return ptr.get(); } - template - void stubDataMember(DATA_TYPE C::*member, const arglist &... initargs) { - DATA_TYPE C::*theMember = (DATA_TYPE C::*) member; + template + void stubDataMember(DataType C::*member, const arglist &... initargs) { + DataType C::*theMember = (DataType C::*) member; C &mock = get(); - DATA_TYPE *memberPtr = &(mock.*theMember); + DataType *memberPtr = &(mock.*theMember); _members.push_back( - std::shared_ptr > - {new DataMemeberWrapper < DATA_TYPE, arglist...>(memberPtr, + std::shared_ptr > + {new DataMemeberWrapper < DataType, arglist...>(memberPtr, initargs...)}); } - template - void getMethodMocks(std::vector &into) const { + template + void getMethodMocks(std::vector &into) const { for (std::shared_ptr ptr : _methodMocks) { - DATA_TYPE p = dynamic_cast(ptr.get()); + DataType p = dynamic_cast(ptr.get()); if (p) { into.push_back(p); } @@ -165,19 +165,19 @@ namespace fakeit { private: - template + template class DataMemeberWrapper : public Destructible { private: - DATA_TYPE *dataMember; + DataType *dataMember; public: - DataMemeberWrapper(DATA_TYPE *dataMem, const arglist &... initargs) : + DataMemeberWrapper(DataType *dataMem, const arglist &... initargs) : dataMember(dataMem) { - new(dataMember) DATA_TYPE{initargs ...}; + new(dataMember) DataType{initargs ...}; } ~DataMemeberWrapper() override { - dataMember->~DATA_TYPE(); + dataMember->~DataType(); } }; @@ -208,10 +208,10 @@ namespace fakeit { _offsets[methodProxy.getOffset()] = methodProxy.getId(); } - template - DATA_TYPE getMethodMock(unsigned int offset) { + template + DataType getMethodMock(unsigned int offset) { std::shared_ptr ptr = _methodMocks[offset]; - return dynamic_cast(ptr.get()); + return dynamic_cast(ptr.get()); } template diff --git a/include/mockutils/Macros.hpp b/include/mockutils/Macros.hpp index 7e89778a..1ad56868 100644 --- a/include/mockutils/Macros.hpp +++ b/include/mockutils/Macros.hpp @@ -8,9 +8,9 @@ #pragma once #if defined (__GNUG__) || _MSC_VER >= 1900 -#define THROWS noexcept(false) -#define NO_THROWS noexcept(true) +#define FAKEIT_THROWS noexcept(false) +#define FAKEIT_NO_THROWS noexcept(true) #elif defined (_MSC_VER) -#define THROWS throw(...) -#define NO_THROWS +#define FAKEIT_THROWS throw(...) +#define FAKEIT_NO_THROWS #endif diff --git a/include/mockutils/MethodProxyCreator.hpp b/include/mockutils/MethodProxyCreator.hpp index 4ae0dfe5..b37c645e 100644 --- a/include/mockutils/MethodProxyCreator.hpp +++ b/include/mockutils/MethodProxyCreator.hpp @@ -9,14 +9,14 @@ namespace fakeit { struct InvocationHandlerCollection { - static const unsigned int VT_COOKIE_INDEX = 0; + static const unsigned int VtCookieIndex = 0; virtual Destructible *getInvocatoinHandlerPtrById(unsigned int index) = 0; static InvocationHandlerCollection *getInvocationHandlerCollection(void *instance) { VirtualTableBase &vt = VirtualTableBase::getVTable(instance); InvocationHandlerCollection *invocationHandlerCollection = (InvocationHandlerCollection *) vt.getCookie( - InvocationHandlerCollection::VT_COOKIE_INDEX); + InvocationHandlerCollection::VtCookieIndex); return invocationHandlerCollection; } }; diff --git a/include/mockutils/gcc/is_simple_inheritance_layout.hpp b/include/mockutils/gcc/is_simple_inheritance_layout.hpp index 57980444..7a97303a 100644 --- a/include/mockutils/gcc/is_simple_inheritance_layout.hpp +++ b/include/mockutils/gcc/is_simple_inheritance_layout.hpp @@ -11,17 +11,17 @@ #include namespace fakeit { - template + template class has_one_base { }; - template - class has_one_base> : public std::false_type { + template + class has_one_base> : public std::false_type { }; - template - class has_one_base> - : public has_one_base::type> { + template + class has_one_base> + : public has_one_base::type> { }; template<> diff --git a/include/mockutils/mscpp/VirtualTable.hpp b/include/mockutils/mscpp/VirtualTable.hpp index c2fbb38c..0b3c7ac5 100644 --- a/include/mockutils/mscpp/VirtualTable.hpp +++ b/include/mockutils/mscpp/VirtualTable.hpp @@ -26,7 +26,7 @@ namespace fakeit { char name[8]; }; - struct PMD { + struct PmdInfo { /************************************************************************/ /* member displacement. @@ -39,7 +39,7 @@ namespace fakeit { int pdisp; // vtable displacement int vdisp; //displacement inside vtable - PMD() : + PmdInfo() : mdisp(0), pdisp(-1), vdisp(0) { } }; @@ -51,7 +51,7 @@ namespace fakeit { const std::type_info *pTypeDescriptor; //type descriptor of the class dword_ numContainedBases; //number of nested classes following in the Base Class Array - struct PMD where; //pointer-to-member displacement info + struct PmdInfo where; //pointer-to-member displacement info dword_ attributes; //flags, usually 0 }; @@ -91,11 +91,11 @@ namespace fakeit { numBaseClasses++; } - template + template void addBaseClass() { - static_assert(std::is_base_of::value, "invalid inheritance list"); + static_assert(std::is_base_of::value, "invalid inheritance list"); addBaseClass(); - addBaseClass(); + addBaseClass(); } }; diff --git a/include/mockutils/smart_ptr.hpp b/include/mockutils/smart_ptr.hpp index 55ec8555..d0686f9d 100644 --- a/include/mockutils/smart_ptr.hpp +++ b/include/mockutils/smart_ptr.hpp @@ -48,7 +48,7 @@ namespace fakeit { reference->AddRef(); } - ~smart_ptr() THROWS { + ~smart_ptr() FAKEIT_THROWS { if (reference->Release() == 0) { delete reference; delete pData; diff --git a/include/mockutils/type_utils.hpp b/include/mockutils/type_utils.hpp index c792146a..9de15541 100644 --- a/include/mockutils/type_utils.hpp +++ b/include/mockutils/type_utils.hpp @@ -48,11 +48,11 @@ namespace fakeit { class is_ostreamable { struct no {}; #if defined(_MSC_VER) && _MSC_VER < 1900 - template - static decltype(operator<<(std::declval(), std::declval())) test(std::ostream &s, const T1 &t); + template + static decltype(operator<<(std::declval(), std::declval())) test(std::ostream &s, const Type1 &t); #else - template - static auto test(std::ostream &s, const T1 &t) -> decltype(s << t); + template + static auto test(std::ostream &s, const Type1 &t) -> decltype(s << t); #endif static no test(...); public: diff --git a/include/mockutils/union_cast.hpp b/include/mockutils/union_cast.hpp index c0430fed..bb392c6d 100644 --- a/include/mockutils/union_cast.hpp +++ b/include/mockutils/union_cast.hpp @@ -15,13 +15,13 @@ namespace fakeit { - template + template FAKEIT_NO_DEVIRTUALIZE_ATTR - TARGET union_cast(SOURCE source) { - //static_assert(sizeof(TARGET) == sizeof(SOURCE), "can't convert"); + TargetType union_cast(SourceType source) { + //static_assert(sizeof(TargetType) == sizeof(SourceType), "can't convert"); union { - SOURCE source; - TARGET target; + SourceType source; + TargetType target; } u; u.source = source; return u.target;