diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-17 13:13:35 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-19 15:07:45 +0000 |
commit | e347bb13921420a3d6ac62d620600f97ddcb8b3d (patch) | |
tree | 957931bd367063e107afe9eb67d2310a024c0ac0 /sources/shiboken2/tests/libsample | |
parent | d3b003f4f63a82f4cca6f4f14cd3ebb2095b1ce8 (diff) |
shiboken tests: Introduce override
Replace virtual by override where appropriate to make the code
clearer.
Change-Id: I143daf29f1c162b2de959411a5f4acdc43a2b253
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/tests/libsample')
-rw-r--r-- | sources/shiboken2/tests/libsample/derived.h | 16 | ||||
-rw-r--r-- | sources/shiboken2/tests/libsample/multiple_derived.h | 10 | ||||
-rw-r--r-- | sources/shiboken2/tests/libsample/objecttype.h | 4 | ||||
-rw-r--r-- | sources/shiboken2/tests/libsample/objecttypelayout.h | 4 | ||||
-rw-r--r-- | sources/shiboken2/tests/libsample/photon.h | 2 |
5 files changed, 18 insertions, 18 deletions
diff --git a/sources/shiboken2/tests/libsample/derived.h b/sources/shiboken2/tests/libsample/derived.h index 5c57e4691..cc8a64d9f 100644 --- a/sources/shiboken2/tests/libsample/derived.h +++ b/sources/shiboken2/tests/libsample/derived.h @@ -53,13 +53,13 @@ public: }; Derived(int id = -1); - virtual ~Derived(); - virtual void pureVirtual(); - virtual void* pureVirtualReturningVoidPtr(); - virtual void unpureVirtual(); + ~Derived() override; + void pureVirtual() override; + void* pureVirtualReturningVoidPtr() override; + void unpureVirtual() override; - virtual PrintFormat returnAnEnum() { return Short; } - virtual Type type() const { return TpDerived; } + PrintFormat returnAnEnum() override { return Short; } + Type type() const override { return TpDerived; } // factory method static Abstract* createObject(); @@ -83,10 +83,10 @@ public: static Abstract* triggerImpossibleTypeDiscovery(); static Abstract* triggerAnotherImpossibleTypeDiscovery(); - void hideFunction(HideType*) {} + void hideFunction(HideType*) override {} protected: const char* getClassName() { return className(); } - virtual const char* className() { return "Derived"; } + virtual const char* className() override { return "Derived"; } }; #endif // DERIVED_H diff --git a/sources/shiboken2/tests/libsample/multiple_derived.h b/sources/shiboken2/tests/libsample/multiple_derived.h index 5825e59b4..7a130c6b5 100644 --- a/sources/shiboken2/tests/libsample/multiple_derived.h +++ b/sources/shiboken2/tests/libsample/multiple_derived.h @@ -58,11 +58,11 @@ class LIBSAMPLE_API MDerived1 : public Base1, public Base2 { public: MDerived1(); - virtual ~MDerived1() {} + ~MDerived1() override {} - virtual int mderived1Method() { return m_value; } - virtual int base1Method() { return Base1::base1Method() * 10; } - virtual int base2Method() { return Base2::base2Method() * 10; } + int mderived1Method() { return m_value; } + int base1Method () override { return Base1::base1Method() * 10; } + int base2Method() override { return Base2::base2Method() * 10; } inline Base1* castToBase1() { return (Base1*) this; } inline Base2* castToBase2() { return (Base2*) this; } @@ -71,7 +71,7 @@ public: static MDerived1* transformFromBase2(Base2 *self); private: - virtual void publicMethod() {} + void publicMethod() override {} int m_value; }; diff --git a/sources/shiboken2/tests/libsample/objecttype.h b/sources/shiboken2/tests/libsample/objecttype.h index eae95b3b1..4d85daeff 100644 --- a/sources/shiboken2/tests/libsample/objecttype.h +++ b/sources/shiboken2/tests/libsample/objecttype.h @@ -168,8 +168,8 @@ class LIBSAMPLE_API ObjectTypeDerived: public ObjectType, public OtherBase { public: ObjectTypeDerived(): ObjectType(), OtherBase() {}; - virtual bool event(Event* event); - virtual ~ObjectTypeDerived(); + bool event(Event* event) override; + ~ObjectTypeDerived() override; }; #endif // OBJECTTYPE_H diff --git a/sources/shiboken2/tests/libsample/objecttypelayout.h b/sources/shiboken2/tests/libsample/objecttypelayout.h index 3fa8b9dbf..8524c1989 100644 --- a/sources/shiboken2/tests/libsample/objecttypelayout.h +++ b/sources/shiboken2/tests/libsample/objecttypelayout.h @@ -41,10 +41,10 @@ public: void addObject(ObjectType* obj); std::list<ObjectType*> objects() const; - virtual bool isLayoutType() { return true; } + bool isLayoutType() override { return true; } inline static ObjectTypeLayout* create() { return new ObjectTypeLayout(); } - virtual ObjectType* takeChild(const Str& name) { return ObjectType::takeChild(name); } + ObjectType* takeChild(const Str& name) override { return ObjectType::takeChild(name); } private: std::list<ObjectType*> m_objects; diff --git a/sources/shiboken2/tests/libsample/photon.h b/sources/shiboken2/tests/libsample/photon.h index d8b1be423..437ec1d9b 100644 --- a/sources/shiboken2/tests/libsample/photon.h +++ b/sources/shiboken2/tests/libsample/photon.h @@ -84,7 +84,7 @@ public: static inline TemplateBase<CLASS_TYPE>* passPointerThrough(TemplateBase<CLASS_TYPE>* obj) { return obj; } - virtual ClassType type() const { return CLASS_TYPE; } + ClassType type() const override { return CLASS_TYPE; } static const ClassType staticType = CLASS_TYPE; }; |