aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-17 13:13:35 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-19 15:07:45 +0000
commite347bb13921420a3d6ac62d620600f97ddcb8b3d (patch)
tree957931bd367063e107afe9eb67d2310a024c0ac0 /sources/shiboken2/tests
parentd3b003f4f63a82f4cca6f4f14cd3ebb2095b1ce8 (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')
-rw-r--r--sources/shiboken2/tests/libother/otherderived.h12
-rw-r--r--sources/shiboken2/tests/libsample/derived.h16
-rw-r--r--sources/shiboken2/tests/libsample/multiple_derived.h10
-rw-r--r--sources/shiboken2/tests/libsample/objecttype.h4
-rw-r--r--sources/shiboken2/tests/libsample/objecttypelayout.h4
-rw-r--r--sources/shiboken2/tests/libsample/photon.h2
6 files changed, 24 insertions, 24 deletions
diff --git a/sources/shiboken2/tests/libother/otherderived.h b/sources/shiboken2/tests/libother/otherderived.h
index 792b7c408..88c711e1a 100644
--- a/sources/shiboken2/tests/libother/otherderived.h
+++ b/sources/shiboken2/tests/libother/otherderived.h
@@ -41,11 +41,11 @@ class LIBOTHER_API OtherDerived : public Abstract
{
public:
OtherDerived(int id = -1);
- virtual ~OtherDerived();
- virtual void pureVirtual();
- virtual void* pureVirtualReturningVoidPtr();
- virtual void unpureVirtual();
- virtual PrintFormat returnAnEnum() { return Short; }
+ ~OtherDerived() override;
+ void pureVirtual() override;
+ void* pureVirtualReturningVoidPtr() override;
+ void unpureVirtual() override;
+ PrintFormat returnAnEnum() override { return Short; }
inline void useObjectTypeFromOtherModule(ObjectType*) {}
inline Event useValueTypeFromOtherModule(const Event& e) { return e; }
@@ -59,7 +59,7 @@ public:
protected:
inline const char* getClassName() { return className(); }
- virtual const char* className() { return "OtherDerived"; }
+ virtual const char* className() override { return "OtherDerived"; }
};
#endif // OTHERDERIVED_H
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;
};