aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken6/tests/libminimal/listuser.cpp31
-rw-r--r--sources/shiboken6/tests/libminimal/listuser.h3
-rw-r--r--sources/shiboken6/tests/libminimal/minbool.h4
-rw-r--r--sources/shiboken6/tests/libminimal/obj.cpp3
-rw-r--r--sources/shiboken6/tests/libother/extendsnoimplicitconversion.h3
-rw-r--r--sources/shiboken6/tests/libother/number.cpp14
-rw-r--r--sources/shiboken6/tests/libother/number.h4
-rw-r--r--sources/shiboken6/tests/libother/otherderived.cpp16
-rw-r--r--sources/shiboken6/tests/libother/otherderived.h16
-rw-r--r--sources/shiboken6/tests/libother/othermultiplederived.cpp11
-rw-r--r--sources/shiboken6/tests/libother/othermultiplederived.h4
-rw-r--r--sources/shiboken6/tests/libother/otherobjecttype.cpp5
-rw-r--r--sources/shiboken6/tests/libother/otherobjecttype.h8
-rw-r--r--sources/shiboken6/tests/libsample/abstract.cpp51
-rw-r--r--sources/shiboken6/tests/libsample/abstract.h25
-rw-r--r--sources/shiboken6/tests/libsample/blackbox.cpp61
-rw-r--r--sources/shiboken6/tests/libsample/blackbox.h21
-rw-r--r--sources/shiboken6/tests/libsample/bucket.cpp10
-rw-r--r--sources/shiboken6/tests/libsample/bucket.h6
-rw-r--r--sources/shiboken6/tests/libsample/bytearray.cpp109
-rw-r--r--sources/shiboken6/tests/libsample/bytearray.h67
-rw-r--r--sources/shiboken6/tests/libsample/collector.cpp8
-rw-r--r--sources/shiboken6/tests/libsample/collector.h21
-rw-r--r--sources/shiboken6/tests/libsample/complex.cpp11
-rw-r--r--sources/shiboken6/tests/libsample/complex.h6
-rw-r--r--sources/shiboken6/tests/libsample/cvlist.h2
-rw-r--r--sources/shiboken6/tests/libsample/derived.cpp36
-rw-r--r--sources/shiboken6/tests/libsample/derived.h18
-rw-r--r--sources/shiboken6/tests/libsample/echo.h16
-rw-r--r--sources/shiboken6/tests/libsample/expression.cpp20
-rw-r--r--sources/shiboken6/tests/libsample/expression.h22
-rw-r--r--sources/shiboken6/tests/libsample/filter.cpp12
-rw-r--r--sources/shiboken6/tests/libsample/filter.h22
-rw-r--r--sources/shiboken6/tests/libsample/functions.cpp77
-rw-r--r--sources/shiboken6/tests/libsample/functions.h21
-rw-r--r--sources/shiboken6/tests/libsample/handle.cpp4
-rw-r--r--sources/shiboken6/tests/libsample/handle.h6
-rw-r--r--sources/shiboken6/tests/libsample/implicitconv.cpp20
-rw-r--r--sources/shiboken6/tests/libsample/implicitconv.h22
-rw-r--r--sources/shiboken6/tests/libsample/injectcode.cpp31
-rw-r--r--sources/shiboken6/tests/libsample/injectcode.h22
-rw-r--r--sources/shiboken6/tests/libsample/list.h23
-rw-r--r--sources/shiboken6/tests/libsample/listuser.cpp22
-rw-r--r--sources/shiboken6/tests/libsample/listuser.h11
-rw-r--r--sources/shiboken6/tests/libsample/main.cpp7
-rw-r--r--sources/shiboken6/tests/libsample/mapuser.cpp28
-rw-r--r--sources/shiboken6/tests/libsample/mapuser.h11
-rw-r--r--sources/shiboken6/tests/libsample/modelindex.h13
-rw-r--r--sources/shiboken6/tests/libsample/modifications.cpp45
-rw-r--r--sources/shiboken6/tests/libsample/modifications.h22
-rw-r--r--sources/shiboken6/tests/libsample/modified_constructor.cpp3
-rw-r--r--sources/shiboken6/tests/libsample/modified_constructor.h4
-rw-r--r--sources/shiboken6/tests/libsample/multiple_derived.cpp33
-rw-r--r--sources/shiboken6/tests/libsample/multiple_derived.h94
-rw-r--r--sources/shiboken6/tests/libsample/noimplicitconversion.h9
-rw-r--r--sources/shiboken6/tests/libsample/nondefaultctor.h10
-rw-r--r--sources/shiboken6/tests/libsample/null.h8
-rw-r--r--sources/shiboken6/tests/libsample/objectmodel.cpp6
-rw-r--r--sources/shiboken6/tests/libsample/objectmodel.h10
-rw-r--r--sources/shiboken6/tests/libsample/objecttype.cpp85
-rw-r--r--sources/shiboken6/tests/libsample/objecttype.h84
-rw-r--r--sources/shiboken6/tests/libsample/objecttypebyvalue.h4
-rw-r--r--sources/shiboken6/tests/libsample/objecttypeholder.cpp8
-rw-r--r--sources/shiboken6/tests/libsample/objecttypeholder.h8
-rw-r--r--sources/shiboken6/tests/libsample/objecttypelayout.cpp10
-rw-r--r--sources/shiboken6/tests/libsample/objecttypelayout.h13
-rw-r--r--sources/shiboken6/tests/libsample/objecttypeoperators.cpp12
-rw-r--r--sources/shiboken6/tests/libsample/objecttypeoperators.h22
-rw-r--r--sources/shiboken6/tests/libsample/objectview.cpp11
-rw-r--r--sources/shiboken6/tests/libsample/objectview.h16
-rw-r--r--sources/shiboken6/tests/libsample/oddbool.cpp2
-rw-r--r--sources/shiboken6/tests/libsample/oddbool.h4
-rw-r--r--sources/shiboken6/tests/libsample/onlycopy.cpp13
-rw-r--r--sources/shiboken6/tests/libsample/onlycopy.h10
-rw-r--r--sources/shiboken6/tests/libsample/overload.cpp6
-rw-r--r--sources/shiboken6/tests/libsample/overload.h12
-rw-r--r--sources/shiboken6/tests/libsample/overloadsort.h11
-rw-r--r--sources/shiboken6/tests/libsample/pairuser.cpp18
-rw-r--r--sources/shiboken6/tests/libsample/pairuser.h10
-rw-r--r--sources/shiboken6/tests/libsample/pen.cpp6
-rw-r--r--sources/shiboken6/tests/libsample/pen.h5
-rw-r--r--sources/shiboken6/tests/libsample/photon.cpp14
-rw-r--r--sources/shiboken6/tests/libsample/photon.h41
-rw-r--r--sources/shiboken6/tests/libsample/point.cpp63
-rw-r--r--sources/shiboken6/tests/libsample/point.h56
-rw-r--r--sources/shiboken6/tests/libsample/pointerholder.h11
-rw-r--r--sources/shiboken6/tests/libsample/pointf.cpp51
-rw-r--r--sources/shiboken6/tests/libsample/pointf.h46
-rw-r--r--sources/shiboken6/tests/libsample/polygon.cpp14
-rw-r--r--sources/shiboken6/tests/libsample/polygon.h11
-rw-r--r--sources/shiboken6/tests/libsample/privatector.h12
-rw-r--r--sources/shiboken6/tests/libsample/privatedtor.h18
-rw-r--r--sources/shiboken6/tests/libsample/protected.h65
-rw-r--r--sources/shiboken6/tests/libsample/rect.h41
-rw-r--r--sources/shiboken6/tests/libsample/reference.cpp28
-rw-r--r--sources/shiboken6/tests/libsample/reference.h35
-rw-r--r--sources/shiboken6/tests/libsample/removednamespaces.h1
-rw-r--r--sources/shiboken6/tests/libsample/sample.cpp2
-rw-r--r--sources/shiboken6/tests/libsample/sample.h4
-rw-r--r--sources/shiboken6/tests/libsample/samplenamespace.cpp61
-rw-r--r--sources/shiboken6/tests/libsample/samplenamespace.h29
-rw-r--r--sources/shiboken6/tests/libsample/sbkdate.h3
-rw-r--r--sources/shiboken6/tests/libsample/simplefile.cpp38
-rw-r--r--sources/shiboken6/tests/libsample/simplefile.h7
-rw-r--r--sources/shiboken6/tests/libsample/size.cpp7
-rw-r--r--sources/shiboken6/tests/libsample/size.h55
-rw-r--r--sources/shiboken6/tests/libsample/sometime.cpp20
-rw-r--r--sources/shiboken6/tests/libsample/sometime.h25
-rw-r--r--sources/shiboken6/tests/libsample/str.cpp76
-rw-r--r--sources/shiboken6/tests/libsample/str.h29
-rw-r--r--sources/shiboken6/tests/libsample/strlist.cpp6
-rw-r--r--sources/shiboken6/tests/libsample/strlist.h28
-rw-r--r--sources/shiboken6/tests/libsample/templateptr.h9
-rw-r--r--sources/shiboken6/tests/libsample/transform.cpp11
-rw-r--r--sources/shiboken6/tests/libsample/transform.h12
-rw-r--r--sources/shiboken6/tests/libsample/valueandvirtual.h8
-rw-r--r--sources/shiboken6/tests/libsample/virtualmethods.cpp9
-rw-r--r--sources/shiboken6/tests/libsample/virtualmethods.h36
-rw-r--r--sources/shiboken6/tests/libsample/voidholder.h15
-rw-r--r--sources/shiboken6/tests/libsmart/smart_sharedptr.h2
120 files changed, 1174 insertions, 1423 deletions
diff --git a/sources/shiboken6/tests/libminimal/listuser.cpp b/sources/shiboken6/tests/libminimal/listuser.cpp
index 14ac1c7ee..54acc6e05 100644
--- a/sources/shiboken6/tests/libminimal/listuser.cpp
+++ b/sources/shiboken6/tests/libminimal/listuser.cpp
@@ -8,22 +8,19 @@
#include <algorithm>
#include <numeric>
-std::list<int>
-ListUser::createIntList(int num)
+std::list<int> ListUser::createIntList(int num)
{
std::list<int> retval(num);
std::iota(retval.begin(), retval.end(), 0);
return retval;
}
-int
-ListUser::sumIntList(std::list<int> intList)
+int ListUser::sumIntList(std::list<int> intList)
{
return std::accumulate(intList.begin(), intList.end(), 0);
}
-std::list<MinBool>
-ListUser::createMinBoolList(MinBool mb1, MinBool mb2)
+std::list<MinBool> ListUser::createMinBoolList(MinBool mb1, MinBool mb2)
{
std::list<MinBool> retval;
retval.push_back(mb1);
@@ -31,8 +28,7 @@ ListUser::createMinBoolList(MinBool mb1, MinBool mb2)
return retval;
}
-MinBool
-ListUser::oredMinBoolList(std::list<MinBool> minBoolList)
+MinBool ListUser::oredMinBoolList(std::list<MinBool> minBoolList)
{
MinBool result(false);
for (const auto &m : minBoolList)
@@ -40,8 +36,7 @@ ListUser::oredMinBoolList(std::list<MinBool> minBoolList)
return result;
}
-std::list<Val>
-ListUser::createValList(int num)
+std::list<Val> ListUser::createValList(int num)
{
std::list<Val> retval;
for (int i = 0; i < num; ++i)
@@ -49,17 +44,14 @@ ListUser::createValList(int num)
return retval;
}
-int
-ListUser::sumValList(std::list<Val> valList)
+int ListUser::sumValList(std::list<Val> valList)
{
int total = 0;
for (const auto &v : valList)
total += v.valId();
return total;
}
-
-std::list<Obj*>
-ListUser::createObjList(Obj* o1, Obj* o2)
+std::list<Obj*> ListUser::createObjList(Obj* o1, Obj* o2)
{
std::list<Obj*> retval;
retval.push_back(o1);
@@ -67,8 +59,7 @@ ListUser::createObjList(Obj* o1, Obj* o2)
return retval;
}
-int
-ListUser::sumObjList(std::list<Obj*> objList)
+int ListUser::sumObjList(std::list<Obj*> objList)
{
int total = 0;
for (const auto *obj : objList)
@@ -76,8 +67,7 @@ ListUser::sumObjList(std::list<Obj*> objList)
return total;
}
-std::list<std::list<int> >
-ListUser::createListOfIntLists(int num)
+std::list<std::list<int> > ListUser::createListOfIntLists(int num)
{
std::list<std::list<int> > retval;
for (int i = 0; i < num; ++i)
@@ -85,8 +75,7 @@ ListUser::createListOfIntLists(int num)
return retval;
}
-int
-ListUser::sumListOfIntLists(std::list<std::list<int> > intListList)
+int ListUser::sumListOfIntLists(std::list<std::list<int> > intListList)
{
int total = 0;
for (const auto &list : intListList)
diff --git a/sources/shiboken6/tests/libminimal/listuser.h b/sources/shiboken6/tests/libminimal/listuser.h
index 2254cb138..8d16927ea 100644
--- a/sources/shiboken6/tests/libminimal/listuser.h
+++ b/sources/shiboken6/tests/libminimal/listuser.h
@@ -4,13 +4,14 @@
#ifndef LISTUSER_H
#define LISTUSER_H
-#include <list>
#include "obj.h"
#include "val.h"
#include "minbool.h"
#include "libminimalmacros.h"
+#include <list>
+
struct LIBMINIMAL_API ListUser
{
virtual ~ListUser() {}
diff --git a/sources/shiboken6/tests/libminimal/minbool.h b/sources/shiboken6/tests/libminimal/minbool.h
index f75e458da..4473df975 100644
--- a/sources/shiboken6/tests/libminimal/minbool.h
+++ b/sources/shiboken6/tests/libminimal/minbool.h
@@ -16,6 +16,7 @@ public:
m_value = m_value | other.m_value;
return *this;
}
+
private:
bool m_value;
};
@@ -31,11 +32,12 @@ class LIBMINIMAL_API MinBoolUser
{
public:
MinBoolUser() : m_minbool(MinBool(false)) {}
- virtual ~MinBoolUser() {}
+ virtual ~MinBoolUser() = default;
inline MinBool minBool() { return m_minbool; }
inline void setMinBool(MinBool minBool) { m_minbool = minBool; }
virtual MinBool invertedMinBool() { return !m_minbool; }
inline MinBool callInvertedMinBool() { return invertedMinBool(); }
+
private:
MinBool m_minbool;
};
diff --git a/sources/shiboken6/tests/libminimal/obj.cpp b/sources/shiboken6/tests/libminimal/obj.cpp
index 0e49fee8b..f21fb5454 100644
--- a/sources/shiboken6/tests/libminimal/obj.cpp
+++ b/sources/shiboken6/tests/libminimal/obj.cpp
@@ -9,8 +9,7 @@ Obj::Obj(int objId) : m_objId(objId)
Obj::~Obj() = default;
-bool
-Obj::virtualMethod(int val)
+bool Obj::virtualMethod(int val)
{
return !bool(val%2);
}
diff --git a/sources/shiboken6/tests/libother/extendsnoimplicitconversion.h b/sources/shiboken6/tests/libother/extendsnoimplicitconversion.h
index bf6cd736c..36d503fe8 100644
--- a/sources/shiboken6/tests/libother/extendsnoimplicitconversion.h
+++ b/sources/shiboken6/tests/libother/extendsnoimplicitconversion.h
@@ -13,8 +13,9 @@ public:
explicit ExtendsNoImplicitConversion(int objId) : m_objId(objId) {};
inline int objId() const { return m_objId; }
inline operator NoImplicitConversion() const { return NoImplicitConversion(m_objId); }
+
private:
int m_objId;
};
-#endif // EXTENDSNOIMPLICITCONVERSION_H
+#endif // EXTENDSNOIMPLICITCONVERSION_H
diff --git a/sources/shiboken6/tests/libother/number.cpp b/sources/shiboken6/tests/libother/number.cpp
index 5a416bb1c..538cea01e 100644
--- a/sources/shiboken6/tests/libother/number.cpp
+++ b/sources/shiboken6/tests/libother/number.cpp
@@ -2,31 +2,27 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "number.h"
-#include <cstring>
+
#include <sstream>
-Str
-Number::toStr() const
+Str Number::toStr() const
{
std::ostringstream in;
in << m_value;
return in.str().c_str();
}
-Point
-operator*(const Point& p, const Number& n)
+Point operator*(const Point &p, const Number &n)
{
return Point(p.x() * n.value(), p.y() * n.value());
}
-Complex
-Number::toComplex() const
+Complex Number::toComplex() const
{
return Complex(m_value);
}
-Number
-Number::fromComplex(Complex cpx)
+Number Number::fromComplex(Complex cpx)
{
return Number(cpx.real());
}
diff --git a/sources/shiboken6/tests/libother/number.h b/sources/shiboken6/tests/libother/number.h
index 85f888d82..2c480e7f2 100644
--- a/sources/shiboken6/tests/libother/number.h
+++ b/sources/shiboken6/tests/libother/number.h
@@ -18,7 +18,7 @@ public:
Str toStr() const;
inline operator Str() const { return toStr(); }
- friend LIBOTHER_API Point operator*(const Point&, const Number&);
+ friend LIBOTHER_API Point operator*(const Point &, const Number &);
Complex toComplex() const;
static Number fromComplex(Complex cpx);
@@ -27,6 +27,6 @@ private:
int m_value;
};
-LIBOTHER_API Point operator*(const Point&, const Number&);
+LIBOTHER_API Point operator*(const Point &, const Number &);
#endif // NUMBER_H
diff --git a/sources/shiboken6/tests/libother/otherderived.cpp b/sources/shiboken6/tests/libother/otherderived.cpp
index 12521b73c..93a18876e 100644
--- a/sources/shiboken6/tests/libother/otherderived.cpp
+++ b/sources/shiboken6/tests/libother/otherderived.cpp
@@ -7,30 +7,24 @@ OtherDerived::OtherDerived(int id) : Abstract(id)
{
}
-OtherDerived::~OtherDerived()
-{
-}
+OtherDerived::~OtherDerived() = default;
-Abstract*
-OtherDerived::createObject()
+Abstract *OtherDerived::createObject()
{
static int id = 100;
return new OtherDerived(id++);
}
-void
-OtherDerived::pureVirtual()
+void OtherDerived::pureVirtual()
{
}
-void*
-OtherDerived::pureVirtualReturningVoidPtr()
+void *OtherDerived::pureVirtualReturningVoidPtr()
{
return nullptr;
}
-void
-OtherDerived::unpureVirtual()
+void OtherDerived::unpureVirtual()
{
}
diff --git a/sources/shiboken6/tests/libother/otherderived.h b/sources/shiboken6/tests/libother/otherderived.h
index cefb4dc11..a233c6e2f 100644
--- a/sources/shiboken6/tests/libother/otherderived.h
+++ b/sources/shiboken6/tests/libother/otherderived.h
@@ -18,26 +18,26 @@ public:
OtherDerived(int id = -1);
~OtherDerived() override;
void pureVirtual() override;
- void* pureVirtualReturningVoidPtr() override;
+ void *pureVirtualReturningVoidPtr() override;
void unpureVirtual() override;
PrintFormat returnAnEnum() override { return Short; }
- inline void useObjectTypeFromOtherModule(ObjectType*) {}
- inline Event useValueTypeFromOtherModule(const Event& e) { return e; }
- inline Complex useValueTypeFromOtherModule(const Complex& c) { return c; }
+ inline void useObjectTypeFromOtherModule(ObjectType *) {}
+ inline Event useValueTypeFromOtherModule(const Event &e) { return e; }
+ inline Complex useValueTypeFromOtherModule(const Complex &c) { return c; }
inline void useEnumTypeFromOtherModule(OverloadedFuncEnum) {}
// factory method
- static Abstract* createObject();
+ static Abstract *createObject();
void hideFunction(HideType*) override {}
protected:
- inline const char* getClassName() { return className(); }
- virtual const char* className() override { return "OtherDerived"; }
+ inline const char *getClassName() { return className(); }
+ virtual const char *className() const override { return "OtherDerived"; }
private:
void pureVirtualPrivate() override;
};
-#endif // OTHERDERIVED_H
+#endif // OTHERDERIVED_H
diff --git a/sources/shiboken6/tests/libother/othermultiplederived.cpp b/sources/shiboken6/tests/libother/othermultiplederived.cpp
index 41718fc49..cfbbfb2c2 100644
--- a/sources/shiboken6/tests/libother/othermultiplederived.cpp
+++ b/sources/shiboken6/tests/libother/othermultiplederived.cpp
@@ -8,18 +8,17 @@ VirtualMethods OtherMultipleDerived::returnUselessClass()
return VirtualMethods();
}
-Base1* OtherMultipleDerived::createObject(const std::string& objName)
+Base1 *OtherMultipleDerived::createObject(const std::string &objName)
{
if (objName == "Base1")
return new Base1;
- else if (objName == "MDerived1")
+ if (objName == "MDerived1")
return new MDerived1;
- else if (objName == "SonOfMDerived1")
+ if (objName == "SonOfMDerived1")
return new SonOfMDerived1;
- else if (objName == "MDerived3")
+ if (objName == "MDerived3")
return new MDerived3;
- else if (objName == "OtherMultipleDerived")
+ if (objName == "OtherMultipleDerived")
return new OtherMultipleDerived;
return nullptr;
}
-
diff --git a/sources/shiboken6/tests/libother/othermultiplederived.h b/sources/shiboken6/tests/libother/othermultiplederived.h
index c209c72ac..a8e265388 100644
--- a/sources/shiboken6/tests/libother/othermultiplederived.h
+++ b/sources/shiboken6/tests/libother/othermultiplederived.h
@@ -15,7 +15,7 @@ class LIBOTHER_API OtherMultipleDerived : public MDerived1
public:
// this will use CppCopier from other module (bug#142)
VirtualMethods returnUselessClass();
- static Base1* createObject(const std::string& objName);
+ static Base1 *createObject(const std::string &objName);
};
-#endif
+#endif // OTHERMULTIPLEDERIVED_H
diff --git a/sources/shiboken6/tests/libother/otherobjecttype.cpp b/sources/shiboken6/tests/libother/otherobjecttype.cpp
index fee6f5bfa..eaaa231be 100644
--- a/sources/shiboken6/tests/libother/otherobjecttype.cpp
+++ b/sources/shiboken6/tests/libother/otherobjecttype.cpp
@@ -3,10 +3,9 @@
#include "otherobjecttype.h"
-Collector&
-operator<<(Collector& collector, const OtherObjectType& obj)
+Collector &operator<<(Collector &collector, const OtherObjectType &obj)
{
- collector << obj.identifier()*2;
+ collector << obj.identifier() * 2;
return collector;
}
diff --git a/sources/shiboken6/tests/libother/otherobjecttype.h b/sources/shiboken6/tests/libother/otherobjecttype.h
index b301ce22b..844795118 100644
--- a/sources/shiboken6/tests/libother/otherobjecttype.h
+++ b/sources/shiboken6/tests/libother/otherobjecttype.h
@@ -4,16 +4,12 @@
#ifndef OTHEROBJECTTYPE_H
#define OTHEROBJECTTYPE_H
-#include <list>
-#include "str.h"
-
#include "libothermacros.h"
#include "objecttype.h"
#include "collector.h"
#include "samplenamespace.h"
#include "removednamespaces.h"
-
class LIBOTHER_API OtherObjectType : public ObjectType
{
public:
@@ -21,8 +17,6 @@ public:
static int enumAsIntForInvisibleNamespace(RemovedNamespace1::RemovedNamespace1_Enum value);
};
-
-LIBOTHER_API Collector& operator<<(Collector&, const OtherObjectType&);
+LIBOTHER_API Collector &operator<<(Collector &, const OtherObjectType &);
#endif // OTHEROBJECTTYPE_H
-
diff --git a/sources/shiboken6/tests/libsample/abstract.cpp b/sources/shiboken6/tests/libsample/abstract.cpp
index 5994e685c..89e7336ad 100644
--- a/sources/shiboken6/tests/libsample/abstract.cpp
+++ b/sources/shiboken6/tests/libsample/abstract.cpp
@@ -1,60 +1,50 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "abstract.h"
-#include "objecttype.h"
+
+#include <iostream>
const int Abstract::staticPrimitiveField = 0;
Abstract::Abstract(int id) : m_id(id)
{
- toBeRenamedField = readOnlyField = primitiveField = 123;
- valueTypeField = Point(12, 34);
- objectTypeField = nullptr;
bitField = 0;
}
-Abstract::~Abstract()
-{
-}
+Abstract::~Abstract() = default;
-void
-Abstract::unpureVirtual()
+void Abstract::unpureVirtual()
{
}
-void
-Abstract::callUnpureVirtual()
+void Abstract::callUnpureVirtual()
{
this->unpureVirtual();
}
-
-void
-Abstract::callPureVirtual()
+void Abstract::callPureVirtual()
{
this->pureVirtual();
}
-void
-Abstract::show(PrintFormat format)
+void Abstract::show(PrintFormat format) const
{
std::cout << '<';
switch(format) {
- case Short:
- std::cout << this;
- break;
- case Verbose:
- std::cout << "class " << className() << " | cptr: " << this
- << ", id: " << m_id;
- break;
- case OnlyId:
- std::cout << "id: " << m_id;
- break;
- case ClassNameAndId:
- std::cout << className() << " - id: " << m_id;
- break;
+ case Short:
+ std::cout << this;
+ break;
+ case Verbose:
+ std::cout << "class " << className() << " | cptr: " << this
+ << ", id: " << m_id;
+ break;
+ case OnlyId:
+ std::cout << "id: " << m_id;
+ break;
+ case ClassNameAndId:
+ std::cout << className() << " - id: " << m_id;
+ break;
}
std::cout << '>';
}
@@ -67,4 +57,3 @@ void Abstract::callVirtualGettingEnum(PrintFormat p)
void Abstract::virtualGettingAEnum(Abstract::PrintFormat)
{
}
-
diff --git a/sources/shiboken6/tests/libsample/abstract.h b/sources/shiboken6/tests/libsample/abstract.h
index 0e66ad0e1..bc63e3fd1 100644
--- a/sources/shiboken6/tests/libsample/abstract.h
+++ b/sources/shiboken6/tests/libsample/abstract.h
@@ -38,26 +38,26 @@ public:
};
static const int staticPrimitiveField;
- int primitiveField;
+ int primitiveField = 123;
Complex userPrimitiveField;
- Point valueTypeField;
- ObjectType* objectTypeField;
- int toBeRenamedField;
- int readOnlyField;
+ Point valueTypeField{12, 34};
+ ObjectType *objectTypeField = nullptr;
+ int toBeRenamedField = 123;
+ int readOnlyField = 123;
Abstract(int id = -1);
virtual ~Abstract();
- inline int id() { return m_id; }
+ inline int id() const { return m_id; }
// factory method
- inline static Abstract* createObject() { return nullptr; }
+ inline static Abstract *createObject() { return nullptr; }
// method that receives an Object Type
- inline static int getObjectId(Abstract* obj) { return obj->id(); }
+ inline static int getObjectId(Abstract *obj) { return obj->id(); }
virtual void pureVirtual() = 0;
- virtual void* pureVirtualReturningVoidPtr() = 0;
+ virtual void *pureVirtualReturningVoidPtr() = 0;
virtual void unpureVirtual();
virtual PrintFormat returnAnEnum() = 0;
@@ -67,13 +67,13 @@ public:
void callPureVirtual();
void callUnpureVirtual();
- void show(PrintFormat format = Verbose);
+ void show(PrintFormat format = Verbose) const;
virtual Type type() const { return TpAbstract; }
- virtual void hideFunction(HideType* arg) = 0;
+ virtual void hideFunction(HideType *arg) = 0;
protected:
- virtual const char* className() { return "Abstract"; }
+ virtual const char *className() const { return "Abstract"; }
// Protected bit-field structure member.
unsigned int bitField: 1;
@@ -82,4 +82,5 @@ private:
virtual void pureVirtualPrivate() = 0;
int m_id;
};
+
#endif // ABSTRACT_H
diff --git a/sources/shiboken6/tests/libsample/blackbox.cpp b/sources/shiboken6/tests/libsample/blackbox.cpp
index e6fc20049..b6fc28fe3 100644
--- a/sources/shiboken6/tests/libsample/blackbox.cpp
+++ b/sources/shiboken6/tests/libsample/blackbox.cpp
@@ -6,80 +6,61 @@
BlackBox::~BlackBox()
{
// Free all maps.
- while (!m_objects.empty()) {
- delete (*m_objects.begin()).second;
- m_objects.erase(m_objects.begin());
- }
- while (!m_points.empty()) {
- delete (*m_points.begin()).second;
- m_points.erase(m_points.begin());
- }
+ for (auto it = m_objects.begin(), end = m_objects.end(); it != end; ++it)
+ delete it->second;
+ for (auto it = m_points.begin(), end = m_points.end(); it != end; ++it)
+ delete it->second;
}
-int
-BlackBox::keepObjectType(ObjectType* object)
+int BlackBox::keepObjectType(ObjectType *object)
{
- m_ticket++;
- std::pair<int, ObjectType*> item(m_ticket, object);
- m_objects.insert(item);
+ ++m_ticket;
+ m_objects.insert({m_ticket, object});
object->setParent(nullptr);
return m_ticket;
}
-ObjectType*
-BlackBox::retrieveObjectType(int ticket)
+ObjectType *BlackBox::retrieveObjectType(int ticket)
{
const auto it = m_objects.find(ticket);
if (it != m_objects.end()) {
- ObjectType* second = it->second;
+ ObjectType *second = it->second;
m_objects.erase(it);
return second;
}
return nullptr;
}
-void
-BlackBox::disposeObjectType(int ticket)
+void BlackBox::disposeObjectType(int ticket)
{
- ObjectType* object = retrieveObjectType(ticket);
- if (object)
- delete object;
+ delete retrieveObjectType(ticket);
}
-int
-BlackBox::keepPoint(Point* point)
+int BlackBox::keepPoint(Point *point)
{
- m_ticket++;
- std::pair<int, Point*> item(m_ticket, point);
- m_points.insert(item);
-
+ ++m_ticket;
+ m_points.insert({m_ticket, point});
return m_ticket;
}
-Point*
-BlackBox::retrievePoint(int ticket)
+Point *BlackBox::retrievePoint(int ticket)
{
const auto it = m_points.find(ticket);
if (it != m_points.end()) {
- Point* second = it->second;
+ Point *second = it->second;
m_points.erase(it);
return second;
}
return nullptr;
}
-void
-BlackBox::disposePoint(int ticket)
+void BlackBox::disposePoint(int ticket)
{
- Point* point = retrievePoint(ticket);
- if (point)
- delete point;
+ delete retrievePoint(ticket);
}
-
-std::list<ObjectType*>
-BlackBox::objects()
+std::list<ObjectType*> BlackBox::objects()
{
std::list<ObjectType*> l;
@@ -89,8 +70,7 @@ BlackBox::objects()
return l;
}
-std::list<Point*>
-BlackBox::points()
+std::list<Point*> BlackBox::points()
{
std::list<Point*> l;
@@ -99,4 +79,3 @@ BlackBox::points()
return l;
}
-
diff --git a/sources/shiboken6/tests/libsample/blackbox.h b/sources/shiboken6/tests/libsample/blackbox.h
index bfcbd2128..2cc8c66bd 100644
--- a/sources/shiboken6/tests/libsample/blackbox.h
+++ b/sources/shiboken6/tests/libsample/blackbox.h
@@ -5,25 +5,27 @@
#define BLACKBOX_H
#include "libsamplemacros.h"
-#include <map>
#include "objecttype.h"
#include "point.h"
+#include <list>
+#include <map>
+
class LIBSAMPLE_API BlackBox
{
public:
- typedef std::map<int, ObjectType*> ObjectTypeMap;
- typedef std::map<int, Point*> PointMap;
+ using ObjectTypeMap = std::map<int, ObjectType*>;
+ using PointMap = std::map<int, Point*>;
- BlackBox() { m_ticket = -1;}
+ BlackBox() = default;
~BlackBox();
- int keepObjectType(ObjectType* object);
- ObjectType* retrieveObjectType(int ticket);
+ int keepObjectType(ObjectType *object);
+ ObjectType *retrieveObjectType(int ticket);
void disposeObjectType(int ticket);
- int keepPoint(Point* point);
- Point* retrievePoint(int ticket);
+ int keepPoint(Point *point);
+ Point *retrievePoint(int ticket);
void disposePoint(int ticket);
std::list<ObjectType*> objects();
@@ -35,8 +37,7 @@ public:
private:
ObjectTypeMap m_objects;
PointMap m_points;
- int m_ticket;
+ int m_ticket = -1;
};
#endif // BLACKBOX_H
-
diff --git a/sources/shiboken6/tests/libsample/bucket.cpp b/sources/shiboken6/tests/libsample/bucket.cpp
index 40f92d97e..277809b15 100644
--- a/sources/shiboken6/tests/libsample/bucket.cpp
+++ b/sources/shiboken6/tests/libsample/bucket.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "bucket.h"
+
#include <iostream>
#ifdef _WIN32 // _WIN32 is defined by all Windows 32 and 64 bit compilers, but not by others.
@@ -15,10 +16,6 @@
# define SLEEP(x) usleep(x)
#endif
-Bucket::Bucket() : m_locked(false)
-{
-}
-
void Bucket::push(int x)
{
m_data.push_back(x);
@@ -44,7 +41,9 @@ bool Bucket::empty()
void Bucket::lock()
{
m_locked = true;
- while (m_locked) { SLEEP(300); }
+ while (m_locked) {
+ SLEEP(300);
+ }
}
void Bucket::unlock()
@@ -58,4 +57,3 @@ bool Bucket::virtualBlockerMethod()
// The return value was added just for diversity sake.
return true;
}
-
diff --git a/sources/shiboken6/tests/libsample/bucket.h b/sources/shiboken6/tests/libsample/bucket.h
index 4a45802a4..73e8edd78 100644
--- a/sources/shiboken6/tests/libsample/bucket.h
+++ b/sources/shiboken6/tests/libsample/bucket.h
@@ -6,6 +6,7 @@
#include "libsamplemacros.h"
#include "objecttype.h"
+
#include <list>
class ObjectType;
@@ -13,7 +14,7 @@ class ObjectType;
class LIBSAMPLE_API Bucket : public ObjectType
{
public:
- Bucket();
+ Bucket() = default;
void push(int);
int pop();
bool empty();
@@ -27,8 +28,7 @@ public:
private:
std::list<int> m_data;
- volatile bool m_locked;
+ volatile bool m_locked = false;
};
#endif // BUCKET_H
-
diff --git a/sources/shiboken6/tests/libsample/bytearray.cpp b/sources/shiboken6/tests/libsample/bytearray.cpp
index 2ed80bf51..ebe40f52a 100644
--- a/sources/shiboken6/tests/libsample/bytearray.cpp
+++ b/sources/shiboken6/tests/libsample/bytearray.cpp
@@ -1,13 +1,13 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <cstring>
#include "bytearray.h"
-ByteArray::ByteArray()
+#include <algorithm>
+#include <cstring>
+
+ByteArray::ByteArray() : m_data(1, '\0')
{
- m_data = std::vector<char>(1);
- m_data[0] = '\0';
}
ByteArray::ByteArray(char c)
@@ -17,41 +17,37 @@ ByteArray::ByteArray(char c)
m_data[1] = '\0';
}
-ByteArray::ByteArray(const char* data)
+ByteArray::ByteArray(const char *data)
{
- size_t len = strlen(data);
+ size_t len = std::strlen(data);
m_data = std::vector<char>(len + 1);
memcpy(&m_data[0], data, len);
m_data[len] = '\0';
}
-ByteArray::ByteArray(const char* data, int len)
+ByteArray::ByteArray(const char *data, int len)
{
m_data = std::vector<char>(len + 1);
memcpy(&m_data[0], data, len);
m_data[len] = '\0';
}
-int
-ByteArray::size() const
+int ByteArray::size() const
{
return m_data.size() - 1;
}
-char
-ByteArray::at(int pos) const
+char ByteArray::at(int pos) const
{
return m_data[pos];
}
-const char*
-ByteArray::data() const
+const char *ByteArray::data() const
{
return &(m_data[0]);
}
-ByteArray&
-ByteArray::append(char c)
+ByteArray &ByteArray::append(char c)
{
m_data.pop_back();
m_data.push_back(c);
@@ -59,37 +55,30 @@ ByteArray::append(char c)
return *this;
}
-ByteArray&
-ByteArray::append(const char* data)
+ByteArray &ByteArray::append(const char *data)
{
m_data.pop_back();
- for (int i = 0; i < (int)strlen(data); ++i)
- m_data.push_back(data[i]);
+ std::copy(data, data + strlen(data), std::back_inserter(m_data));
m_data.push_back('\0');
return *this;
}
-ByteArray&
-ByteArray::append(const char* data, int len)
+ByteArray &ByteArray::append(const char *data, int len)
{
m_data.pop_back();
- for (int i = 0; i < len; ++i)
- m_data.push_back(data[i]);
+ std::copy(data, data + len, std::back_inserter(m_data));
m_data.push_back('\0');
return *this;
}
-ByteArray&
-ByteArray::append(const ByteArray& other)
+ByteArray &ByteArray::append(const ByteArray &other)
{
m_data.pop_back();
- for (int i = 0; i < (int)other.m_data.size(); ++i)
- m_data.push_back(other.m_data[i]);
- m_data.push_back('\0');
+ std::copy(other.m_data.begin(), other.m_data.end(), std::back_inserter(m_data));
return *this;
}
-static bool compare(const std::vector<char>& mine, const char* other)
+static bool compare(const std::vector<char> &mine, const char *other)
{
for (int i = 0; i < (int)mine.size() - 1; ++i) {
if (mine[i] != other[i])
@@ -98,85 +87,79 @@ static bool compare(const std::vector<char>& mine, const char* other)
return true;
}
-bool
-ByteArray::operator==(const ByteArray& other) const
+bool ByteArray::operator==(const ByteArray &other) const
{
- return compare(m_data, &other.m_data[0]);
+ return m_data == other.m_data;
}
-bool
-operator==(const ByteArray& ba1, const char* ba2)
+bool operator==(const ByteArray &ba1, const char *ba2)
{
return compare(ba1.m_data, ba2);
}
-bool
-operator==(const char* ba1, const ByteArray& ba2)
+
+bool operator==(const char *ba1, const ByteArray &ba2)
{
return compare(ba2.m_data, ba1);
}
-bool
-ByteArray::operator!=(const ByteArray& other) const
+bool ByteArray::operator!=(const ByteArray &other) const
{
- return !(m_data == other.m_data);
+ return m_data != other.m_data;
}
-bool
-operator!=(const ByteArray& ba1, const char* ba2)
+
+bool operator!=(const ByteArray &ba1, const char *ba2)
{
return !(ba1 == ba2);
}
-bool
-operator!=(const char* ba1, const ByteArray& ba2)
+
+bool operator!=(const char *ba1, const ByteArray &ba2)
{
return !(ba1 == ba2);
}
-ByteArray&
-ByteArray::operator+=(char c)
+ByteArray &ByteArray::operator+=(char c)
{
return append(c);
}
-ByteArray&
-ByteArray::operator+=(const char* data)
+
+ByteArray &ByteArray::operator+=(const char *data)
{
return append(data);
}
-ByteArray&
-ByteArray::operator+=(const ByteArray& other)
+
+ByteArray &ByteArray::operator+=(const ByteArray &other)
{
return append(other);
}
-ByteArray
-operator+(const ByteArray& ba1, const ByteArray& ba2)
+ByteArray operator+(const ByteArray &ba1, const ByteArray &ba2)
{
return ByteArray(ba1) += ba2;
}
-ByteArray
-operator+(const ByteArray& ba1, const char* ba2)
+
+ByteArray operator+(const ByteArray &ba1, const char *ba2)
{
return ByteArray(ba1) += ByteArray(ba2);
}
-ByteArray
-operator+(const char* ba1, const ByteArray& ba2)
+
+ByteArray operator+(const char *ba1, const ByteArray &ba2)
{
return ByteArray(ba1) += ba2;
}
-ByteArray
-operator+(const ByteArray& ba1, char ba2)
+
+ByteArray operator+(const ByteArray &ba1, char ba2)
{
return ByteArray(ba1) += ByteArray(ba2);
}
-ByteArray
-operator+(char ba1, const ByteArray& ba2)
+
+ByteArray operator+(char ba1, const ByteArray &ba2)
{
return ByteArray(ba1) += ba2;
}
-unsigned int
-ByteArray::hash(const ByteArray& byteArray)
+unsigned int ByteArray::hash(const ByteArray &byteArray)
{
unsigned int result = 0;
- for (int i = 0; i < (int)byteArray.m_data.size(); ++i)
- result = 5 * result + byteArray.m_data[i];
+ for (char c : byteArray.m_data)
+ result = 5u * result + unsigned(c);
return result;
}
diff --git a/sources/shiboken6/tests/libsample/bytearray.h b/sources/shiboken6/tests/libsample/bytearray.h
index e4504d755..35ff22367 100644
--- a/sources/shiboken6/tests/libsample/bytearray.h
+++ b/sources/shiboken6/tests/libsample/bytearray.h
@@ -6,58 +6,59 @@
#include "str.h"
#include "libsamplemacros.h"
+
#include <vector>
class LIBSAMPLE_API ByteArray
{
public:
ByteArray();
- ByteArray(char data);
- ByteArray(const char* data);
- ByteArray(const char* data, int len);
+ explicit ByteArray(char data);
+ explicit ByteArray(const char *data);
+ explicit ByteArray(const char *data, int len);
int size() const;
char at(int i) const;
char operator[](int i) const;
- const char* data() const;
+ const char *data() const;
- ByteArray& append(char c);
- ByteArray& append(const char* data);
- ByteArray& append(const char* data, int len);
- ByteArray& append(const ByteArray& other);
+ ByteArray &append(char c);
+ ByteArray &append(const char *data);
+ ByteArray &append(const char *data, int len);
+ ByteArray &append(const ByteArray &other);
- bool operator==(const ByteArray& other) const;
- bool operator!=(const ByteArray& other) const;
+ bool operator==(const ByteArray &other) const;
+ bool operator!=(const ByteArray &other) const;
- ByteArray& operator+=(char c);
- ByteArray& operator+=(const char* data);
- ByteArray& operator+=(const ByteArray& other);
+ ByteArray &operator+=(char c);
+ ByteArray &operator+=(const char *data);
+ ByteArray &operator+=(const ByteArray &other);
- static unsigned int hash(const ByteArray& byteArray);
+ static unsigned int hash(const ByteArray &byteArray);
private:
std::vector<char> m_data;
- friend LIBSAMPLE_API bool operator==(const ByteArray& ba1, const char* ba2);
- friend LIBSAMPLE_API bool operator==(const char* ba1, const ByteArray& ba2);
- friend LIBSAMPLE_API bool operator!=(const ByteArray& ba1, const char* ba2);
- friend LIBSAMPLE_API bool operator!=(const char* ba1, const ByteArray& ba2);
-
- friend LIBSAMPLE_API ByteArray operator+(const ByteArray& ba1, const ByteArray& ba2);
- friend LIBSAMPLE_API ByteArray operator+(const ByteArray& ba1, const char* ba2);
- friend LIBSAMPLE_API ByteArray operator+(const char* ba1, const ByteArray& ba2);
- friend LIBSAMPLE_API ByteArray operator+(const ByteArray& ba1, char ba2);
- friend LIBSAMPLE_API ByteArray operator+(char ba1, const ByteArray& ba2);
+ friend LIBSAMPLE_API bool operator==(const ByteArray &ba1, const char *ba2);
+ friend LIBSAMPLE_API bool operator==(const char *ba1, const ByteArray &ba2);
+ friend LIBSAMPLE_API bool operator!=(const ByteArray &ba1, const char *ba2);
+ friend LIBSAMPLE_API bool operator!=(const char *ba1, const ByteArray &ba2);
+
+ friend LIBSAMPLE_API ByteArray operator+(const ByteArray &ba1, const ByteArray &ba2);
+ friend LIBSAMPLE_API ByteArray operator+(const ByteArray &ba1, const char *ba2);
+ friend LIBSAMPLE_API ByteArray operator+(const char *ba1, const ByteArray &ba2);
+ friend LIBSAMPLE_API ByteArray operator+(const ByteArray &ba1, char ba2);
+ friend LIBSAMPLE_API ByteArray operator+(char ba1, const ByteArray &ba2);
};
-LIBSAMPLE_API bool operator==(const ByteArray& ba1, const char* ba2);
-LIBSAMPLE_API bool operator==(const char* ba1, const ByteArray& ba2);
-LIBSAMPLE_API bool operator!=(const ByteArray& ba1, const char* ba2);
-LIBSAMPLE_API bool operator!=(const char* ba1, const ByteArray& ba2);
+LIBSAMPLE_API bool operator==(const ByteArray &ba1, const char *ba2);
+LIBSAMPLE_API bool operator==(const char *ba1, const ByteArray &ba2);
+LIBSAMPLE_API bool operator!=(const ByteArray &ba1, const char *ba2);
+LIBSAMPLE_API bool operator!=(const char *ba1, const ByteArray &ba2);
-LIBSAMPLE_API ByteArray operator+(const ByteArray& ba1, const ByteArray& ba2);
-LIBSAMPLE_API ByteArray operator+(const ByteArray& ba1, const char* ba2);
-LIBSAMPLE_API ByteArray operator+(const char* ba1, const ByteArray& ba2);
-LIBSAMPLE_API ByteArray operator+(const ByteArray& ba1, char ba2);
-LIBSAMPLE_API ByteArray operator+(char ba1, const ByteArray& ba2);
+LIBSAMPLE_API ByteArray operator+(const ByteArray &ba1, const ByteArray &ba2);
+LIBSAMPLE_API ByteArray operator+(const ByteArray &ba1, const char *ba2);
+LIBSAMPLE_API ByteArray operator+(const char *ba1, const ByteArray &ba2);
+LIBSAMPLE_API ByteArray operator+(const ByteArray &ba1, char ba2);
+LIBSAMPLE_API ByteArray operator+(char ba1, const ByteArray &ba2);
#endif // BYTEARRAY_H
diff --git a/sources/shiboken6/tests/libsample/collector.cpp b/sources/shiboken6/tests/libsample/collector.cpp
index 2adff6628..579239bcb 100644
--- a/sources/shiboken6/tests/libsample/collector.cpp
+++ b/sources/shiboken6/tests/libsample/collector.cpp
@@ -8,13 +8,13 @@ void Collector::clear()
m_items.clear();
}
-Collector& Collector::operator<<(ObjectType::Identifier item)
+Collector &Collector::operator<<(ObjectType::Identifier item)
{
m_items.push_back(item);
return *this;
}
-Collector& Collector::operator<<(const ObjectType *obj)
+Collector &Collector::operator<<(const ObjectType *obj)
{
m_items.push_back(obj->identifier());
return *this;
@@ -25,9 +25,9 @@ std::list<ObjectType::Identifier> Collector::items()
return m_items;
}
-int Collector::size()
+int Collector::size() const
{
- return (int) m_items.size();
+ return int(m_items.size());
}
Collector &operator<<(Collector &s, const IntWrapper &w)
diff --git a/sources/shiboken6/tests/libsample/collector.h b/sources/shiboken6/tests/libsample/collector.h
index 1ef3281e5..1322cdeff 100644
--- a/sources/shiboken6/tests/libsample/collector.h
+++ b/sources/shiboken6/tests/libsample/collector.h
@@ -4,36 +4,35 @@
#ifndef COLLECTOR_H
#define COLLECTOR_H
-#include <list>
#include "libsamplemacros.h"
-
#include "intwrapper.h"
#include "objecttype.h"
+#include <list>
+
class LIBSAMPLE_API Collector
{
public:
- Collector() {}
- virtual ~Collector() {}
+ Collector() = default;
+ virtual ~Collector() = default;
+ Collector(const Collector &) = delete;
+ Collector &operator=(const Collector &) = delete;
void clear();
- Collector& operator<<(ObjectType::Identifier item);
+ Collector &operator<<(ObjectType::Identifier item);
- Collector& operator<<(const ObjectType *);
+ Collector &operator<<(const ObjectType *);
std::list<ObjectType::Identifier> items();
- int size();
+ int size() const;
private:
std::list<ObjectType::Identifier> m_items;
-
- Collector(const Collector&);
- Collector& operator=(const Collector&);
};
/* Helper for testing external operators */
-LIBSAMPLE_API Collector &operator<<(Collector&, const IntWrapper&);
+LIBSAMPLE_API Collector &operator<<(Collector &, const IntWrapper &);
#endif // COLLECTOR_H
diff --git a/sources/shiboken6/tests/libsample/complex.cpp b/sources/shiboken6/tests/libsample/complex.cpp
index d06b33fbf..36ac19389 100644
--- a/sources/shiboken6/tests/libsample/complex.cpp
+++ b/sources/shiboken6/tests/libsample/complex.cpp
@@ -1,16 +1,16 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "complex.h"
+#include <iostream>
+
Complex::Complex(double real, double imag)
: m_real(real), m_imag(imag)
{
}
-Complex
-Complex::operator+(Complex& other)
+Complex Complex::operator+(const Complex &other)
{
Complex result;
result.setReal(m_real + other.real());
@@ -18,10 +18,7 @@ Complex::operator+(Complex& other)
return result;
}
-void
-Complex::show()
+void Complex::show() const
{
std::cout << "(real: " << m_real << ", imag: " << m_imag << ")";
}
-
-
diff --git a/sources/shiboken6/tests/libsample/complex.h b/sources/shiboken6/tests/libsample/complex.h
index 54fb99ed1..16be1facc 100644
--- a/sources/shiboken6/tests/libsample/complex.h
+++ b/sources/shiboken6/tests/libsample/complex.h
@@ -10,16 +10,16 @@ class LIBSAMPLE_API Complex
{
public:
Complex(double real = 0.0, double imag = 0.0);
- ~Complex() {}
+ ~Complex() = default;
inline double real() const { return m_real; }
inline void setReal(double real) { m_real = real; }
inline double imag() const { return m_imag; }
inline void setImaginary(double imag) { m_imag = imag; }
- Complex operator+(Complex& other);
+ Complex operator+(const Complex &other);
- void show();
+ void show() const;
private:
double m_real;
diff --git a/sources/shiboken6/tests/libsample/cvlist.h b/sources/shiboken6/tests/libsample/cvlist.h
index eb635c83b..96eaab35e 100644
--- a/sources/shiboken6/tests/libsample/cvlist.h
+++ b/sources/shiboken6/tests/libsample/cvlist.h
@@ -22,7 +22,7 @@ class CVListUser
{
public:
static const_ptr_value_list produce() { return const_ptr_value_list(); }
- static void consume(const const_ptr_value_list& l) { (void)l; }
+ static void consume(const const_ptr_value_list &l) { (void)l; }
};
#endif // LIST_H
diff --git a/sources/shiboken6/tests/libsample/derived.cpp b/sources/shiboken6/tests/libsample/derived.cpp
index 62b64c6c4..310ae5e75 100644
--- a/sources/shiboken6/tests/libsample/derived.cpp
+++ b/sources/shiboken6/tests/libsample/derived.cpp
@@ -1,42 +1,36 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "derived.h"
+#include <iostream>
+
Derived::Derived(int id) : Abstract(id)
{
}
-Derived::~Derived()
-{
-}
+Derived::~Derived() = default;
-Abstract*
-Derived::createObject()
+Abstract *Derived::createObject()
{
static int id = 100;
return new Derived(id++);
}
-void
-Derived::pureVirtual()
+void Derived::pureVirtual()
{
}
-void*
-Derived::pureVirtualReturningVoidPtr()
+void *Derived::pureVirtualReturningVoidPtr()
{
return nullptr;
}
-void
-Derived::unpureVirtual()
+void Derived::unpureVirtual()
{
}
-bool
-Derived::singleArgument(bool b)
+bool Derived::singleArgument(bool b)
{
return !b;
}
@@ -68,15 +62,15 @@ Derived::OtherOverloadedFuncEnum Derived::otherOverloaded(int, double)
}
struct SecretClass : public Abstract {
- virtual void pureVirtual() {}
- virtual void *pureVirtualReturningVoidPtr() { return nullptr; }
- virtual PrintFormat returnAnEnum() { return Short; }
- void hideFunction(HideType*){};
+ void pureVirtual() override {}
+ void *pureVirtualReturningVoidPtr() override { return nullptr; }
+ PrintFormat returnAnEnum() override { return Short; }
+ void hideFunction(HideType*) override {};
private:
- virtual void pureVirtualPrivate() {}
+ virtual void pureVirtualPrivate() override {}
};
-Abstract* Derived::triggerImpossibleTypeDiscovery()
+Abstract *Derived::triggerImpossibleTypeDiscovery()
{
return new SecretClass;
}
@@ -84,7 +78,7 @@ Abstract* Derived::triggerImpossibleTypeDiscovery()
struct AnotherSecretClass : public Derived {
};
-Abstract* Derived::triggerAnotherImpossibleTypeDiscovery()
+Abstract *Derived::triggerAnotherImpossibleTypeDiscovery()
{
return new AnotherSecretClass;
}
diff --git a/sources/shiboken6/tests/libsample/derived.h b/sources/shiboken6/tests/libsample/derived.h
index 35673198b..2f1caf2c7 100644
--- a/sources/shiboken6/tests/libsample/derived.h
+++ b/sources/shiboken6/tests/libsample/derived.h
@@ -23,21 +23,21 @@ public:
class SomeInnerClass {
public:
void uselessMethod() {}
- SomeInnerClass operator+(const SomeInnerClass& other) { return other; }
+ SomeInnerClass operator+(const SomeInnerClass &other) { return other; }
bool operator==(const SomeInnerClass &) { return true; }
};
- Derived(int id = -1);
+ explicit Derived(int id = -1);
~Derived() override;
void pureVirtual() override;
- void* pureVirtualReturningVoidPtr() override;
+ void *pureVirtualReturningVoidPtr() override;
void unpureVirtual() override;
PrintFormat returnAnEnum() override { return Short; }
Type type() const override { return TpDerived; }
// factory method
- static Abstract* createObject();
+ static Abstract *createObject();
// single argument
bool singleArgument(bool b);
@@ -53,15 +53,15 @@ public:
OtherOverloadedFuncEnum otherOverloaded(int a, int b, bool c, double d);
OtherOverloadedFuncEnum otherOverloaded(int a, double b);
- inline SomeInnerClass returnMyParameter(const SomeInnerClass& s) { return s; }
+ inline SomeInnerClass returnMyParameter(const SomeInnerClass &s) { return s; }
- static Abstract* triggerImpossibleTypeDiscovery();
- static Abstract* triggerAnotherImpossibleTypeDiscovery();
+ static Abstract *triggerImpossibleTypeDiscovery();
+ static Abstract *triggerAnotherImpossibleTypeDiscovery();
void hideFunction(HideType*) override {}
protected:
- const char* getClassName() { return className(); }
- virtual const char* className() override { return "Derived"; }
+ const char *getClassName() { return className(); }
+ virtual const char *className() const override { return "Derived"; }
private:
void pureVirtualPrivate() override;
diff --git a/sources/shiboken6/tests/libsample/echo.h b/sources/shiboken6/tests/libsample/echo.h
index 54db3e9bd..688bdf45d 100644
--- a/sources/shiboken6/tests/libsample/echo.h
+++ b/sources/shiboken6/tests/libsample/echo.h
@@ -12,19 +12,19 @@ class ObjectType;
class Echo
{
public:
- Echo(){}
- ~Echo(){}
+ Echo() = default;
+ ~Echo() = default;
void doNothingWithConstBool(const bool hi);
- void methodWithNamedArg(const Str& string = Str(""));
+ void methodWithNamedArg(const Str &string = Str{});
- Str operator()(const Str& s, const int i) { return s + i; }
+ Str operator()(const Str &s, const int i) { return s + i; }
// These method are here just for compilation test purposes
- Echo& operator<<(unsigned int item);
- Echo& operator<<(signed int item);
- Echo& operator<<(const ObjectType *item);
- Echo& operator<<(Str str);
+ Echo &operator<<(unsigned int item);
+ Echo &operator<<(signed int item);
+ Echo &operator<<(const ObjectType *item);
+ Echo &operator<<(Str str);
};
inline void Echo::doNothingWithConstBool(const bool)
diff --git a/sources/shiboken6/tests/libsample/expression.cpp b/sources/shiboken6/tests/libsample/expression.cpp
index 21a51a288..5a6b4f4bb 100644
--- a/sources/shiboken6/tests/libsample/expression.cpp
+++ b/sources/shiboken6/tests/libsample/expression.cpp
@@ -3,17 +3,16 @@
#include "expression.h"
+
#include <sstream>
-Expression::Expression() : m_value(0), m_operation(None), m_operand1(nullptr), m_operand2(nullptr)
-{
-}
+Expression::Expression() = default;
-Expression::Expression(int number) : m_value(number), m_operation(None), m_operand1(nullptr), m_operand2(nullptr)
+Expression::Expression(int number) : m_value(number)
{
}
-Expression::Expression(const Expression& other)
+Expression::Expression(const Expression &other)
{
m_operand1 = other.m_operand1 ? new Expression(*other.m_operand1) : nullptr;
m_operand2 = other.m_operand2 ? new Expression(*other.m_operand2) : nullptr;
@@ -21,7 +20,7 @@ Expression::Expression(const Expression& other)
m_operation = other.m_operation;
}
-Expression& Expression::operator=(const Expression& other)
+Expression &Expression::operator=(const Expression &other)
{
if (&other == this)
return *this;
@@ -40,7 +39,7 @@ Expression::~Expression()
delete m_operand2;
}
-Expression Expression::operator+(const Expression& other)
+Expression Expression::operator+(const Expression &other)
{
Expression expr;
expr.m_operation = Add;
@@ -49,7 +48,7 @@ Expression Expression::operator+(const Expression& other)
return expr;
}
-Expression Expression::operator-(const Expression& other)
+Expression Expression::operator-(const Expression &other)
{
Expression expr;
expr.m_operation = Add;
@@ -58,7 +57,7 @@ Expression Expression::operator-(const Expression& other)
return expr;
}
-Expression Expression::operator<(const Expression& other)
+Expression Expression::operator<(const Expression &other)
{
Expression expr;
expr.m_operation = LessThan;
@@ -67,7 +66,7 @@ Expression Expression::operator<(const Expression& other)
return expr;
}
-Expression Expression::operator>(const Expression& other)
+Expression Expression::operator>(const Expression &other)
{
Expression expr;
expr.m_operation = GreaterThan;
@@ -111,4 +110,3 @@ std::string Expression::toString() const
result += ')';
return result;
}
-
diff --git a/sources/shiboken6/tests/libsample/expression.h b/sources/shiboken6/tests/libsample/expression.h
index cf41cb620..2082a8ad3 100644
--- a/sources/shiboken6/tests/libsample/expression.h
+++ b/sources/shiboken6/tests/libsample/expression.h
@@ -6,6 +6,7 @@
#define EXPRESSION_H
#include "libsamplemacros.h"
+
#include <string>
class LIBSAMPLE_API Expression
@@ -16,23 +17,22 @@ public:
};
Expression(int number);
- Expression(const Expression& other);
- Expression& operator=(const Expression& other);
+ Expression(const Expression &other);
+ Expression &operator=(const Expression &other);
~Expression();
- Expression operator>(const Expression& other);
- Expression operator<(const Expression& other);
- Expression operator+(const Expression& other);
- Expression operator-(const Expression& other);
+ Expression operator>(const Expression &other);
+ Expression operator<(const Expression &other);
+ Expression operator+(const Expression &other);
+ Expression operator-(const Expression &other);
std::string toString() const;
private:
- int m_value;
- Operation m_operation;
- Expression* m_operand1;
- Expression* m_operand2;
-
+ int m_value = 0;
+ Operation m_operation = None;
+ Expression *m_operand1 = nullptr;
+ Expression *m_operand2 = nullptr;
Expression();
};
diff --git a/sources/shiboken6/tests/libsample/filter.cpp b/sources/shiboken6/tests/libsample/filter.cpp
index 09c8c89ed..950847985 100644
--- a/sources/shiboken6/tests/libsample/filter.cpp
+++ b/sources/shiboken6/tests/libsample/filter.cpp
@@ -1,34 +1,34 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <string>
#include "filter.h"
+
Data::Data(Field field, std::string value)
: m_field(field), m_value(value)
{
}
-Union::Union(const Data& filter)
+Union::Union(const Data &filter)
{
m_filters.push_back(filter);
}
-Union::Union(const Intersection& filter)
+Union::Union(const Intersection &filter)
{
m_filters.push_back(filter);
}
-Intersection::Intersection(const Data& filter)
+Intersection::Intersection(const Data &filter)
{
m_filters.push_back(filter);
}
-Intersection::Intersection(const Union& filter)
+Intersection::Intersection(const Union &filter)
{
m_filters.push_back(filter);
}
-Intersection operator&(const Intersection& a, const Intersection& b)
+Intersection operator&(const Intersection &a, const Intersection &b)
{
Intersection filter;
filter.addFilter(a);
diff --git a/sources/shiboken6/tests/libsample/filter.h b/sources/shiboken6/tests/libsample/filter.h
index d778342ff..d82d38eb8 100644
--- a/sources/shiboken6/tests/libsample/filter.h
+++ b/sources/shiboken6/tests/libsample/filter.h
@@ -4,11 +4,11 @@
#ifndef FILTER_H
#define FILTER_H
+#include "libsamplemacros.h"
+
#include <string>
#include <list>
-#include "libsamplemacros.h"
-
class Intersection;
class LIBSAMPLE_API Filter
@@ -17,7 +17,6 @@ class LIBSAMPLE_API Filter
class LIBSAMPLE_API Data : public Filter
{
-
public:
enum Field {
Name,
@@ -25,7 +24,7 @@ public:
Year
};
- Data(Field field, std::string value);
+ explicit Data(Field field, std::string value);
Field field() const { return m_field; }
std::string value() const { return m_value; }
@@ -39,12 +38,12 @@ class LIBSAMPLE_API Union : public Filter
{
public:
- Union(const Data&);
- Union(const Intersection&);
+ Union(const Data &);
+ Union(const Intersection &);
Union() = default;
std::list<Filter> filters() const { return m_filters; }
- void addFilter(const Filter& data) { m_filters.push_back(data); }
+ void addFilter(const Filter &data) { m_filters.push_back(data); }
private:
std::list<Filter> m_filters;
@@ -53,19 +52,18 @@ private:
class LIBSAMPLE_API Intersection : public Filter
{
public:
-
- Intersection(const Data&);
- Intersection(const Union&);
+ Intersection(const Data &);
+ Intersection(const Union &);
Intersection() = default;
std::list<Filter> filters() const { return m_filters; }
- void addFilter(const Filter& data) { m_filters.push_back(data); }
+ void addFilter(const Filter &data) { m_filters.push_back(data); }
private:
std::list<Filter> m_filters;
};
-LIBSAMPLE_API Intersection operator&(const Intersection& a, const Intersection& b);
+LIBSAMPLE_API Intersection operator&(const Intersection &a, const Intersection &b);
#endif // FILTER_H
diff --git a/sources/shiboken6/tests/libsample/functions.cpp b/sources/shiboken6/tests/libsample/functions.cpp
index fdb179913..29c148346 100644
--- a/sources/shiboken6/tests/libsample/functions.cpp
+++ b/sources/shiboken6/tests/libsample/functions.cpp
@@ -2,35 +2,32 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "functions.h"
+
#include <cstring>
#include <algorithm>
#include <iostream>
#include <numeric>
-void
-printSomething()
+void printSomething()
{
std::cout << __FUNCTION__ << std::endl;
}
-int
-gimmeInt()
+int gimmeInt()
{
static int val = 2;
val = val * 1.3;
return val;
}
-double
-gimmeDouble()
+double gimmeDouble()
{
static double val = 7.77;
val = val * 1.3;
return val;
}
-std::list<Complex>
-gimmeComplexList()
+std::list<Complex> gimmeComplexList()
{
std::list<Complex> lst;
lst.push_back(Complex());
@@ -39,39 +36,31 @@ gimmeComplexList()
return lst;
}
-Complex
-sumComplexPair(std::pair<Complex, Complex> cpx_pair)
+Complex sumComplexPair(std::pair<Complex, Complex> cpx_pair)
{
return cpx_pair.first + cpx_pair.second;
}
-double
-multiplyPair(std::pair<double, double> pair)
+double multiplyPair(std::pair<double, double> pair)
{
return pair.first * pair.second;
}
-int
-countCharacters(const char* text)
+int countCharacters(const char *text)
{
if (!text)
return -1;
- int count;
- for(count = 0; text[count] != '\0'; count++)
- ;
- return count;
+ return std::strlen(text);
}
-char*
-makeCString()
+char *makeCString()
{
- char* string = new char[strlen(__FUNCTION__) + 1];
+ char *string = new char[strlen(__FUNCTION__) + 1];
std::strcpy(string, __FUNCTION__);
return string;
}
-const char*
-returnCString()
+const char *returnCString()
{
return __FUNCTION__;
}
@@ -86,86 +75,72 @@ GlobalOverloadFuncEnum overloadedFunc(double)
return GlobalOverloadFunc_d;
}
-char*
-returnNullPrimitivePointer()
+char *returnNullPrimitivePointer()
{
return nullptr;
}
-ObjectType*
-returnNullObjectTypePointer()
+ObjectType *returnNullObjectTypePointer()
{
return nullptr;
}
-Event*
-returnNullValueTypePointer()
+Event *returnNullValueTypePointer()
{
return nullptr;
}
-unsigned int
-doubleUnsignedInt(unsigned int value)
+unsigned int doubleUnsignedInt(unsigned int value)
{
return value * 2;
}
-long long
-doubleLongLong(long long value)
+long long doubleLongLong(long long value)
{
return value * 2;
}
-unsigned long long
-doubleUnsignedLongLong(unsigned long long value)
+unsigned long long doubleUnsignedLongLong(unsigned long long value)
{
return value * 2;
}
-short
-doubleShort(short value)
+short doubleShort(short value)
{
return value * 2;
}
-int
-acceptInt(int x)
+int acceptInt(int x)
{
return x;
}
-unsigned int
-acceptUInt(unsigned int x)
+unsigned int acceptUInt(unsigned int x)
{
return x;
}
-long
-acceptLong(long x)
+long acceptLong(long x)
{
return x;
}
-unsigned long
-acceptULong(unsigned long x)
+unsigned long acceptULong(unsigned long x)
{
return x;
}
-double
-acceptDouble(double x)
+double acceptDouble(double x)
{
return x;
}
-int
-acceptIntReference(int& x)
+int acceptIntReference(int &x)
{
return x;
}
-OddBool
-acceptOddBoolReference(OddBool& x)
+OddBool acceptOddBoolReference(OddBool &x)
{
return x;
}
diff --git a/sources/shiboken6/tests/libsample/functions.h b/sources/shiboken6/tests/libsample/functions.h
index 7492ec4c2..3eb41beaf 100644
--- a/sources/shiboken6/tests/libsample/functions.h
+++ b/sources/shiboken6/tests/libsample/functions.h
@@ -5,12 +5,13 @@
#define FUNCTIONS_H
#include "libsamplemacros.h"
-#include <list>
-#include <utility>
#include "oddbool.h"
#include "complex.h"
#include "objecttype.h"
+#include <list>
+#include <utility>
+
enum GlobalEnum {
NoThing,
FirstThing,
@@ -30,13 +31,13 @@ LIBSAMPLE_API double multiplyPair(std::pair<double, double> pair);
LIBSAMPLE_API std::list<Complex> gimmeComplexList();
LIBSAMPLE_API Complex sumComplexPair(std::pair<Complex, Complex> cpx_pair);
-LIBSAMPLE_API int countCharacters(const char* text);
-LIBSAMPLE_API char* makeCString();
-LIBSAMPLE_API const char* returnCString();
+LIBSAMPLE_API int countCharacters(const char *text);
+LIBSAMPLE_API char *makeCString();
+LIBSAMPLE_API const char *returnCString();
-LIBSAMPLE_API char* returnNullPrimitivePointer();
-LIBSAMPLE_API ObjectType* returnNullObjectTypePointer();
-LIBSAMPLE_API Event* returnNullValueTypePointer();
+LIBSAMPLE_API char *returnNullPrimitivePointer();
+LIBSAMPLE_API ObjectType *returnNullObjectTypePointer();
+LIBSAMPLE_API Event *returnNullValueTypePointer();
// Tests overloading on functions (!methods)
LIBSAMPLE_API GlobalOverloadFuncEnum overloadedFunc(int val);
@@ -53,8 +54,8 @@ LIBSAMPLE_API long acceptLong(long x);
LIBSAMPLE_API unsigned long acceptULong(unsigned long x);
LIBSAMPLE_API double acceptDouble(double x);
-LIBSAMPLE_API int acceptIntReference(int& x);
-LIBSAMPLE_API OddBool acceptOddBoolReference(OddBool& x);
+LIBSAMPLE_API int acceptIntReference(int &x);
+LIBSAMPLE_API OddBool acceptOddBoolReference(OddBool &x);
LIBSAMPLE_API int sumIntArray(int array[4]);
LIBSAMPLE_API double sumDoubleArray(double array[4]);
diff --git a/sources/shiboken6/tests/libsample/handle.cpp b/sources/shiboken6/tests/libsample/handle.cpp
index 6ed8436a7..93c2abe47 100644
--- a/sources/shiboken6/tests/libsample/handle.cpp
+++ b/sources/shiboken6/tests/libsample/handle.cpp
@@ -8,12 +8,12 @@ SAMPLE_HANDLE HandleHolder::createHandle()
return (SAMPLE_HANDLE) new OBJ;
}
-bool HandleHolder::compare(HandleHolder* other)
+bool HandleHolder::compare(HandleHolder *other)
{
return other->m_handle == m_handle;
}
-bool HandleHolder::compare2(HandleHolder* other)
+bool HandleHolder::compare2(HandleHolder *other)
{
return other->m_handle2 == m_handle2;
}
diff --git a/sources/shiboken6/tests/libsample/handle.h b/sources/shiboken6/tests/libsample/handle.h
index 4bcaa7467..7af0b3107 100644
--- a/sources/shiboken6/tests/libsample/handle.h
+++ b/sources/shiboken6/tests/libsample/handle.h
@@ -24,13 +24,13 @@ public:
explicit HandleHolder(Foo::SAMPLE_HANDLE val): m_handle2(val) {}
void set(SAMPLE_HANDLE ptr);
- inline void set(const Foo::SAMPLE_HANDLE& val) { m_handle2 = val; }
+ inline void set(const Foo::SAMPLE_HANDLE &val) { m_handle2 = val; }
inline SAMPLE_HANDLE handle() { return m_handle; }
inline Foo::SAMPLE_HANDLE handle2() { return m_handle2; }
static SAMPLE_HANDLE createHandle();
- bool compare(HandleHolder* other);
- bool compare2(HandleHolder* other);
+ bool compare(HandleHolder *other);
+ bool compare2(HandleHolder *other);
private:
SAMPLE_HANDLE m_handle;
diff --git a/sources/shiboken6/tests/libsample/implicitconv.cpp b/sources/shiboken6/tests/libsample/implicitconv.cpp
index fad17e879..887fa6b1c 100644
--- a/sources/shiboken6/tests/libsample/implicitconv.cpp
+++ b/sources/shiboken6/tests/libsample/implicitconv.cpp
@@ -8,40 +8,32 @@ ImplicitConv::ImplicitConv(const Null &) :
{
}
-ImplicitConv
-ImplicitConv::implicitConvCommon(ImplicitConv implicit)
+ImplicitConv ImplicitConv::implicitConvCommon(ImplicitConv implicit)
{
return implicit;
}
-ImplicitConv
-ImplicitConv::implicitConvDefault(ImplicitConv implicit)
+ImplicitConv ImplicitConv::implicitConvDefault(ImplicitConv implicit)
{
return implicit;
}
-ImplicitConv::ICOverloadedFuncEnum
-ImplicitConv::implicitConvOverloading(ImplicitConv, int)
+ImplicitConv::ICOverloadedFuncEnum ImplicitConv::implicitConvOverloading(ImplicitConv, int)
{
return ImplicitConv::OverFunc_Ii;
}
-ImplicitConv::ICOverloadedFuncEnum
-ImplicitConv::implicitConvOverloading(ImplicitConv, bool)
+ImplicitConv::ICOverloadedFuncEnum ImplicitConv::implicitConvOverloading(ImplicitConv, bool)
{
return ImplicitConv::OverFunc_Ib;
}
-ImplicitConv::ICOverloadedFuncEnum
-ImplicitConv::implicitConvOverloading(int)
+ImplicitConv::ICOverloadedFuncEnum ImplicitConv::implicitConvOverloading(int)
{
return ImplicitConv::OverFunc_i;
}
-ImplicitConv::ICOverloadedFuncEnum
-ImplicitConv::implicitConvOverloading(CtorEnum)
+ImplicitConv::ICOverloadedFuncEnum ImplicitConv::implicitConvOverloading(CtorEnum)
{
return ImplicitConv::OverFunc_C;
}
-
-
diff --git a/sources/shiboken6/tests/libsample/implicitconv.h b/sources/shiboken6/tests/libsample/implicitconv.h
index bd390b15c..97fe9ad4c 100644
--- a/sources/shiboken6/tests/libsample/implicitconv.h
+++ b/sources/shiboken6/tests/libsample/implicitconv.h
@@ -28,17 +28,17 @@ public:
OverFunc_C
};
- ImplicitConv() : m_ctorEnum(CtorNone), m_objId(-1), m_value(-1.0) {}
- ImplicitConv(int objId) : m_ctorEnum(CtorOne), m_objId(objId), m_value(-1.0) {}
- ImplicitConv(CtorEnum ctorEnum) : m_ctorEnum(ctorEnum), m_objId(-1), m_value(-1.0) {}
- ImplicitConv(ObjectType&) : m_ctorEnum(CtorObjectTypeReference), m_objId(-1), m_value(-1.0) {}
+ ImplicitConv() = default;
+ ImplicitConv(int objId) : m_ctorEnum(CtorOne), m_objId(objId) {}
+ ImplicitConv(CtorEnum ctorEnum) : m_ctorEnum(ctorEnum) {}
+ ImplicitConv(ObjectType&) : m_ctorEnum(CtorObjectTypeReference) {}
ImplicitConv(double value, bool=true) : m_ctorEnum(CtorNone), m_value(value) {}
ImplicitConv(const Null &null);
- ~ImplicitConv() {}
+ ~ImplicitConv() = default;
- inline CtorEnum ctorEnum() { return m_ctorEnum; }
- inline int objId() { return m_objId; }
- inline double value() { return m_value; }
+ inline CtorEnum ctorEnum() const { return m_ctorEnum; }
+ inline int objId() const { return m_objId; }
+ inline double value() const { return m_value; }
static ImplicitConv implicitConvCommon(ImplicitConv implicit);
@@ -50,9 +50,9 @@ public:
static ICOverloadedFuncEnum implicitConvOverloading(CtorEnum dummyArg);
private:
- CtorEnum m_ctorEnum;
- int m_objId;
- double m_value;
+ CtorEnum m_ctorEnum = CtorNone;
+ int m_objId = -1;
+ double m_value = -1.0;
};
#endif // IMPLICITCONV_H
diff --git a/sources/shiboken6/tests/libsample/injectcode.cpp b/sources/shiboken6/tests/libsample/injectcode.cpp
index d83d53d1a..1c723c44f 100644
--- a/sources/shiboken6/tests/libsample/injectcode.cpp
+++ b/sources/shiboken6/tests/libsample/injectcode.cpp
@@ -2,18 +2,15 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "injectcode.h"
+
#include <sstream>
-InjectCode::InjectCode()
-{
-}
+InjectCode::InjectCode() = default;
-InjectCode::~InjectCode()
-{
-}
+InjectCode::~InjectCode() = default;
template<typename T>
-const char* InjectCode::toStr(const T& value)
+const char *InjectCode::toStr(const T &value)
{
std::ostringstream s;
s << value;
@@ -21,41 +18,41 @@ const char* InjectCode::toStr(const T& value)
return m_valueHolder.c_str();
}
-const char* InjectCode::simpleMethod1(int arg0, int arg1)
+const char *InjectCode::simpleMethod1(int arg0, int arg1)
{
return toStr(arg0 + arg1);
}
-const char* InjectCode::simpleMethod2()
+const char *InjectCode::simpleMethod2()
{
return "_";
}
-const char* InjectCode::simpleMethod3(int argc, char** argv)
+const char *InjectCode::simpleMethod3(int argc, char **argv)
{
for (int i = 0; i < argc; ++i)
m_valueHolder += argv[i];
return m_valueHolder.c_str();
}
-const char* InjectCode::overloadedMethod(int arg0, bool arg1)
+const char *InjectCode::overloadedMethod(int arg0, bool arg1)
{
toStr(arg0);
m_valueHolder += arg1 ? "true" : "false";
return m_valueHolder.c_str();
}
-const char* InjectCode::overloadedMethod(int arg0, double arg1)
+const char *InjectCode::overloadedMethod(int arg0, double arg1)
{
return toStr(arg0 + arg1);
}
-const char* InjectCode::overloadedMethod(int argc, char** argv)
+const char *InjectCode::overloadedMethod(int argc, char **argv)
{
return simpleMethod3(argc, argv);
}
-const char* InjectCode::virtualMethod(int arg)
+const char *InjectCode::virtualMethod(int arg)
{
return toStr(arg);
}
@@ -68,13 +65,13 @@ int InjectCode::arrayMethod(int count, int *values) const
return ret;
}
-int InjectCode::sumArrayAndLength(int* values) const
+int InjectCode::sumArrayAndLength(int *values) const
{
int sum = 0;
- while(*values) {
+ while (*values) {
sum = sum + *values + 1;
- values++;
+ ++values;
}
return sum;
diff --git a/sources/shiboken6/tests/libsample/injectcode.h b/sources/shiboken6/tests/libsample/injectcode.h
index 43a3e8468..d079aee09 100644
--- a/sources/shiboken6/tests/libsample/injectcode.h
+++ b/sources/shiboken6/tests/libsample/injectcode.h
@@ -5,6 +5,7 @@
#define INJECTCODE_H
#include "libsamplemacros.h"
+
#include <utility>
#include <string>
@@ -14,18 +15,19 @@ public:
InjectCode();
virtual ~InjectCode();
- const char* simpleMethod1(int arg0, int arg1);
- const char* simpleMethod2();
- const char* simpleMethod3(int argc, char** argv);
+ const char *simpleMethod1(int arg0, int arg1);
+ const char *simpleMethod2();
+ const char *simpleMethod3(int argc, char **argv);
- const char* overloadedMethod(int argc, char** argv);
- const char* overloadedMethod(int arg0, double arg1);
- const char* overloadedMethod(int arg0, bool arg1);
+ const char *overloadedMethod(int argc, char **argv);
+ const char *overloadedMethod(int arg0, double arg1);
+ const char *overloadedMethod(int arg0, bool arg1);
- virtual int arrayMethod(int count, int* values) const;
+ virtual int arrayMethod(int count, int *values) const;
inline int callArrayMethod(int count, int *values) const { return arrayMethod(count, values); }
- virtual const char* virtualMethod(int arg);
- int sumArrayAndLength(int* values) const;
+ virtual const char *virtualMethod(int arg);
+ int sumArrayAndLength(int *values) const;
+
private:
// This attr is just to retain the memory pointed by all return values,
// So, the memory returned by all methods will be valid until someone call
@@ -33,7 +35,7 @@ private:
std::string m_valueHolder;
template<typename T>
- const char* toStr(const T& value);
+ const char *toStr(const T &value);
};
#endif // INJECTCODE_H
diff --git a/sources/shiboken6/tests/libsample/list.h b/sources/shiboken6/tests/libsample/list.h
index 5b0eabb02..b6e2ffde1 100644
--- a/sources/shiboken6/tests/libsample/list.h
+++ b/sources/shiboken6/tests/libsample/list.h
@@ -27,9 +27,9 @@ public:
inline IntList() : m_ctorUsed(NoParamsCtor) {}
inline explicit IntList(int val) : m_ctorUsed(IntCtor) { push_back(val); }
- inline IntList(const List<int>& lst) : List<int>(lst), m_ctorUsed(ListOfIntCtor) {}
+ inline IntList(const List<int> &lst) : List<int>(lst), m_ctorUsed(ListOfIntCtor) {}
- inline IntList(const IntList& lst) : List<int>(lst), m_ctorUsed(CopyCtor) {}
+ inline IntList(const IntList &lst) : List<int>(lst), m_ctorUsed(CopyCtor) {}
IntList(IntList &&) = default;
IntList &operator=(const IntList &) = default;
IntList &operator=(IntList &&) = default;
@@ -52,9 +52,9 @@ public:
inline PointValueList() : m_ctorUsed(NoParamsCtor) {}
inline explicit PointValueList(Point val) : m_ctorUsed(PointCtor) { push_back(val); }
- inline PointValueList(const List<Point>& lst) : List<Point>(lst), m_ctorUsed(ListOfPointValuesCtor) {}
+ inline PointValueList(const List<Point> &lst) : List<Point>(lst), m_ctorUsed(ListOfPointValuesCtor) {}
- inline PointValueList(const PointValueList& lst) : List<Point>(lst), m_ctorUsed(CopyCtor) {}
+ inline PointValueList(const PointValueList &lst) : List<Point>(lst), m_ctorUsed(CopyCtor) {}
PointValueList(PointValueList &&) = default;
PointValueList &operator=(const PointValueList &) = default;
PointValueList &operator=(PointValueList &&) = default;
@@ -75,19 +75,22 @@ public:
ListOfObjectTypePtrCtor
};
- inline ObjectTypePtrList() : m_ctorUsed(NoParamsCtor) {}
- inline explicit ObjectTypePtrList(ObjectType* val) : m_ctorUsed(ObjectTypeCtor) { push_back(val); }
- inline ObjectTypePtrList(const List<ObjectType*>& lst) : List<ObjectType*>(lst), m_ctorUsed(ListOfObjectTypePtrCtor) {}
+ inline ObjectTypePtrList() = default;
+ inline ObjectTypePtrList(const ObjectTypePtrList &lst) :
+ List<ObjectType*>(lst), m_ctorUsed(CopyCtor) {}
+ inline explicit ObjectTypePtrList(ObjectType *val) :
+ m_ctorUsed(ObjectTypeCtor) { push_back(val); }
+ inline ObjectTypePtrList(const List<ObjectType*> &lst) :
+ List<ObjectType*>(lst), m_ctorUsed(ListOfObjectTypePtrCtor) {}
- inline ObjectTypePtrList(const ObjectTypePtrList& lst) : List<ObjectType*>(lst), m_ctorUsed(CopyCtor) {}
ObjectTypePtrList(ObjectTypePtrList &&) = default;
ObjectTypePtrList &operator=(const ObjectTypePtrList &) = default;
ObjectTypePtrList &operator=(ObjectTypePtrList &&) = default;
- inline void append(ObjectType* v) { insert(end(), v); }
+ inline void append(ObjectType *v) { insert(end(), v); }
CtorEnum constructorUsed() { return m_ctorUsed; }
private:
- CtorEnum m_ctorUsed;
+ CtorEnum m_ctorUsed = NoParamsCtor;
};
#endif // LIST_H
diff --git a/sources/shiboken6/tests/libsample/listuser.cpp b/sources/shiboken6/tests/libsample/listuser.cpp
index 4260c1fb5..fd393b881 100644
--- a/sources/shiboken6/tests/libsample/listuser.cpp
+++ b/sources/shiboken6/tests/libsample/listuser.cpp
@@ -1,12 +1,12 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+#include "listuser.h"
+
#include <numeric>
#include <cstdlib>
-#include "listuser.h"
-std::list<int>
-ListUser::callCreateList()
+std::list<int> ListUser::callCreateList()
{
return createList();
}
@@ -18,8 +18,7 @@ ListUser &ListUser::operator=(const ListUser &other) = default;
ListUser &ListUser::operator=(ListUser &&other) = default;
ListUser::~ListUser() = default;
-std::list<int>
-ListUser::createList()
+std::list<int> ListUser::createList()
{
std::list<int> retval;
for (int i = 0; i < 4; i++)
@@ -27,8 +26,7 @@ ListUser::createList()
return retval;
}
-std::list<Complex>
-ListUser::createComplexList(Complex cpx0, Complex cpx1)
+std::list<Complex> ListUser::createComplexList(Complex cpx0, Complex cpx1)
{
std::list<Complex> retval;
retval.push_back(cpx0);
@@ -36,14 +34,12 @@ ListUser::createComplexList(Complex cpx0, Complex cpx1)
return retval;
}
-double
-ListUser::sumList(std::list<int> vallist)
+double ListUser::sumList(std::list<int> vallist)
{
return std::accumulate(vallist.begin(), vallist.end(), 0.0);
}
-double
-ListUser::sumList(std::list<double> vallist)
+double ListUser::sumList(std::list<double> vallist)
{
return std::accumulate(vallist.begin(), vallist.end(), 0.0);
}
@@ -58,12 +54,10 @@ ListUser::ListOfSomething ListUser::listOfPoints(const std::list<PointF> &)
return ListOfPointF;
}
-void
-ListUser::multiplyPointList(PointList& points, double multiplier)
+void ListUser::multiplyPointList(PointList &points, double multiplier)
{
for (auto *point : points) {
point->setX(point->x() * multiplier);
point->setY(point->y() * multiplier);
}
}
-
diff --git a/sources/shiboken6/tests/libsample/listuser.h b/sources/shiboken6/tests/libsample/listuser.h
index 9351ffb7a..280cfbabd 100644
--- a/sources/shiboken6/tests/libsample/listuser.h
+++ b/sources/shiboken6/tests/libsample/listuser.h
@@ -4,13 +4,14 @@
#ifndef LISTUSER_H
#define LISTUSER_H
-#include <list>
#include "complex.h"
#include "point.h"
#include "pointf.h"
#include "libsamplemacros.h"
+#include <list>
+
class LIBSAMPLE_API ListUser
{
public:
@@ -36,13 +37,13 @@ public:
double sumList(std::list<int> vallist);
double sumList(std::list<double> vallist);
- static ListOfSomething listOfPoints(const std::list<Point>& pointlist);
- static ListOfSomething listOfPoints(const std::list<PointF>& pointlist);
+ static ListOfSomething listOfPoints(const std::list<Point> &pointlist);
+ static ListOfSomething listOfPoints(const std::list<PointF> &pointlist);
- static void multiplyPointList(PointList& points, double multiplier);
+ static void multiplyPointList(PointList &points, double multiplier);
inline void setList(std::list<int> lst) { m_lst = lst; }
- inline std::list<int> getList() { return m_lst; }
+ inline std::list<int> getList() const { return m_lst; }
private:
std::list<int> m_lst;
diff --git a/sources/shiboken6/tests/libsample/main.cpp b/sources/shiboken6/tests/libsample/main.cpp
index 8791deaf2..1b44642ae 100644
--- a/sources/shiboken6/tests/libsample/main.cpp
+++ b/sources/shiboken6/tests/libsample/main.cpp
@@ -26,8 +26,7 @@ main(int argv, char **argc)
derived.callPureVirtual();
std::cout << std::endl;
- Abstract* abs;
- abs = Abstract::createObject();
+ auto *abs = Abstract::createObject();
std::cout << "Abstract::createObject(): " << abs << std::endl << std::endl;
delete abs;
@@ -48,7 +47,7 @@ main(int argv, char **argc)
std::cout << "\n-----------------------------------------\n";
KinderGarten kg;
- Derived* d[] = { 0, 0, 0 };
+ Derived *d[] = { 0, 0, 0 };
for (int i = 0; i < 3; i++) {
d[i] = new Derived(i);
@@ -70,7 +69,7 @@ main(int argv, char **argc)
std::cout << "\n* release child ";
d[1]->show();
std::cout << " -------------\n";
- Abstract* released = kg.releaseChild(d[1]);
+ Abstract *released = kg.releaseChild(d[1]);
std::cout << "released: ";
released->show();
std::cout << std::endl;
diff --git a/sources/shiboken6/tests/libsample/mapuser.cpp b/sources/shiboken6/tests/libsample/mapuser.cpp
index 56b5f6652..c793235df 100644
--- a/sources/shiboken6/tests/libsample/mapuser.cpp
+++ b/sources/shiboken6/tests/libsample/mapuser.cpp
@@ -1,38 +1,32 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "mapuser.h"
-std::map<std::string, std::pair<Complex, int> >
-MapUser::callCreateMap()
+#include <iostream>
+
+std::map<std::string, std::pair<Complex, int> > MapUser::callCreateMap()
{
return createMap();
}
-
-std::map<std::string, std::pair<Complex, int> >
-MapUser::createMap()
+std::map<std::string, std::pair<Complex, int> > MapUser::createMap()
{
std::map<std::string, std::pair<Complex, int> > retval;
- std::pair<std::string, std::pair<Complex, int> >
- item0("zero", std::pair<Complex, int>(Complex(1.2, 3.4), 2));
- retval.insert(item0);
+ std::pair<Complex, int> value{Complex(1.2, 3.4), 2};
+ retval.insert({"zero", value});
- std::pair<std::string, std::pair<Complex, int> >
- item1("one", std::pair<Complex, int>(Complex(5.6, 7.8), 3));
- retval.insert(item1);
+ value = {Complex(5.6, 7.8), 3};
+ retval.insert({"one", value});
- std::pair<std::string, std::pair<Complex, int> >
- item2("two", std::pair<Complex, int>(Complex(9.1, 2.3), 5));
- retval.insert(item2);
+ value = {Complex(9.1, 2.3), 5};
+ retval.insert({"two", value});
return retval;
}
-void
-MapUser::showMap(std::map<std::string, int> mapping)
+void MapUser::showMap(std::map<std::string, int> mapping)
{
std::cout << __FUNCTION__ << std::endl;
for (auto it = mapping.begin(), end = mapping.end(); it != end; ++it)
diff --git a/sources/shiboken6/tests/libsample/mapuser.h b/sources/shiboken6/tests/libsample/mapuser.h
index 49318743c..4783e5682 100644
--- a/sources/shiboken6/tests/libsample/mapuser.h
+++ b/sources/shiboken6/tests/libsample/mapuser.h
@@ -4,14 +4,15 @@
#ifndef MAPUSER_H
#define MAPUSER_H
+#include "libsamplemacros.h"
+
+#include "complex.h"
+#include "bytearray.h"
+
#include <map>
#include <list>
#include <utility>
#include <string>
-#include "complex.h"
-#include "bytearray.h"
-
-#include "libsamplemacros.h"
class LIBSAMPLE_API MapUser
{
@@ -31,7 +32,7 @@ public:
static void pointerToMap(std::map<std::string, std::string> *arg);
static void referenceToMap(std::map<std::string, std::string> &arg);
- inline const std::map<int, ByteArray>& passMapIntValueType(const std::map<int, ByteArray>& arg) { return arg; }
+ inline const std::map<int, ByteArray> &passMapIntValueType(const std::map<int, ByteArray>& arg) { return arg; }
std::map<int, std::list<std::list<double> > > foo() const;
diff --git a/sources/shiboken6/tests/libsample/modelindex.h b/sources/shiboken6/tests/libsample/modelindex.h
index 6ed192329..48e1b7de3 100644
--- a/sources/shiboken6/tests/libsample/modelindex.h
+++ b/sources/shiboken6/tests/libsample/modelindex.h
@@ -4,8 +4,6 @@
#ifndef MODELINDEX_H
#define MODELINDEX_H
-#include "libsamplemacros.h"
-
class ModelIndex
{
public:
@@ -13,7 +11,8 @@ public:
inline void setValue(int value) { m_value = value; }
inline int value() const { return m_value; }
- static int getValue(const ModelIndex& index) { return index.value(); }
+ static int getValue(const ModelIndex &index) { return index.value(); }
+
private:
int m_value = 0;
};
@@ -23,11 +22,12 @@ class ReferentModelIndex
public:
ReferentModelIndex() = default;
- explicit ReferentModelIndex(const ModelIndex& index) : m_index(index) {}
+ explicit ReferentModelIndex(const ModelIndex &index) : m_index(index) {}
inline void setValue(int value) { m_index.setValue(value); }
inline int value() const { return m_index.value(); }
operator const ModelIndex&() const { return m_index; }
+
private:
ModelIndex m_index;
};
@@ -37,13 +37,14 @@ class PersistentModelIndex
public:
PersistentModelIndex() = default;
- explicit PersistentModelIndex(const ModelIndex& index) : m_index(index) {}
+ explicit PersistentModelIndex(const ModelIndex &index) : m_index(index) {}
inline void setValue(int value) { m_index.setValue(value); }
inline int value() const { return m_index.value(); }
operator ModelIndex() const { return m_index; }
+
private:
ModelIndex m_index;
};
-#endif
+#endif // MODELINDEX_H
diff --git a/sources/shiboken6/tests/libsample/modifications.cpp b/sources/shiboken6/tests/libsample/modifications.cpp
index c200baa17..2e413946e 100644
--- a/sources/shiboken6/tests/libsample/modifications.cpp
+++ b/sources/shiboken6/tests/libsample/modifications.cpp
@@ -1,10 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "modifications.h"
#include "objecttype.h"
+#include <iostream>
+
Modifications::Modifications()
{
m_object = new ObjectType();
@@ -77,30 +78,26 @@ void Modifications::argRemoval5(int, bool, int, bool)
{
}
-std::pair<double, double>
-Modifications::pointToPair(Point pt, bool* ok)
+std::pair<double, double> Modifications::pointToPair(Point pt, bool *ok)
{
std::pair<double, double> retval(pt.x(), pt.y());
*ok = true;
return retval;
}
-double
-Modifications::multiplyPointCoordsPlusValue(bool* ok, Point pt, double value)
+double Modifications::multiplyPointCoordsPlusValue(bool *ok, Point pt, double value)
{
double retval = (pt.x() * pt.y()) + value;
*ok = true;
return retval;
}
-int
-Modifications::doublePlus(int value, int plus)
+int Modifications::doublePlus(int value, int plus)
{
return (2 * value) + plus;
}
-int
-Modifications::power(int base, int exponent)
+int Modifications::power(int base, int exponent)
{
if (exponent == 0)
return 1;
@@ -110,38 +107,32 @@ Modifications::power(int base, int exponent)
return retval;
}
-int
-Modifications::timesTen(int number)
+int Modifications::timesTen(int number)
{
return number * 10;
}
-int
-Modifications::increment(int number)
+int Modifications::increment(int number)
{
return ++number;
}
-void
-Modifications::exclusiveCppStuff()
+void Modifications::exclusiveCppStuff()
{
std::cout << __FUNCTION__ << std::endl;
}
-int
-Modifications::cppMultiply(int a, int b)
+int Modifications::cppMultiply(int a, int b)
{
return a * b;
}
-const char*
-Modifications::className()
+const char *Modifications::className()
{
return "Modifications";
}
-Point
-Modifications::sumPointArray(int arraySize, const Point pointArray[])
+Point Modifications::sumPointArray(int arraySize, const Point pointArray[])
{
Point point;
for (int i = 0; i < arraySize; ++i)
@@ -149,21 +140,18 @@ Modifications::sumPointArray(int arraySize, const Point pointArray[])
return point;
}
-int
-Modifications::getSize(const void* data, int size)
+int Modifications::getSize(const void *data, int size)
{
(void)data;
return size;
}
-int
-Modifications::sumPointCoordinates(const Point* point)
+int Modifications::sumPointCoordinates(const Point *point)
{
return point->x() + point->y();
}
-double
-Modifications::differenceOfPointCoordinates(const Point* pt, bool* ok)
+double Modifications::differenceOfPointCoordinates(const Point *pt, bool *ok)
{
if (!pt) {
*ok = false;
@@ -176,8 +164,7 @@ Modifications::differenceOfPointCoordinates(const Point* pt, bool* ok)
return result;
}
-bool
-Modifications::nonConversionRuleForArgumentWithDefaultValue(ObjectType** object)
+bool Modifications::nonConversionRuleForArgumentWithDefaultValue(ObjectType **object)
{
if (object)
*object = m_object;
diff --git a/sources/shiboken6/tests/libsample/modifications.h b/sources/shiboken6/tests/libsample/modifications.h
index d757d87b9..0dea163b6 100644
--- a/sources/shiboken6/tests/libsample/modifications.h
+++ b/sources/shiboken6/tests/libsample/modifications.h
@@ -5,10 +5,11 @@
#define MODIFICATIONS_H
#include "libsamplemacros.h"
-#include <utility>
#include "point.h"
#include "oddbool.h"
+#include <utility>
+
class ObjectType;
class LIBSAMPLE_API Modifications
@@ -61,10 +62,10 @@ public:
// 'ok' must be removed and the return value will be changed
// to a tuple (PyObject*) containing the expected result plus
// the 'ok' value as a Python boolean
- std::pair<double, double> pointToPair(Point pt, bool* ok);
+ std::pair<double, double> pointToPair(Point pt, bool *ok);
// same as 'pointToPair' except that this time 'ok' is the first argument
- double multiplyPointCoordsPlusValue(bool* ok, Point pt, double value);
+ double multiplyPointCoordsPlusValue(bool *ok, Point pt, double value);
// completely remove 'plus' from the Python side
int doublePlus(int value, int plus = 0);
@@ -85,24 +86,25 @@ public:
int cppMultiply(int a, int b);
// change the name of this virtual method
- virtual const char* className();
+ virtual const char *className();
Point sumPointArray(int arraySize, const Point pointArray[]);
// Replace 'const void*' by 'ByteArray&'.
- int getSize(const void* data, int size);
+ int getSize(const void *data, int size);
// Mark the argument with a <no-null-pointer/> tag;
// the test implementation must expect point never to be null.
- int sumPointCoordinates(const Point* point);
+ int sumPointCoordinates(const Point *point);
// Modify the return value of a virtual method.
- virtual double differenceOfPointCoordinates(const Point* pt, bool* ok);
- double callDifferenceOfPointCoordinates(const Point* pt, bool* ok) { return differenceOfPointCoordinates(pt, ok); }
+ virtual double differenceOfPointCoordinates(const Point *pt, bool *ok);
+ double callDifferenceOfPointCoordinates(const Point *pt, bool *ok)
+ { return differenceOfPointCoordinates(pt, ok); }
// Sets an ObjectType in the argument and returns true.
bool nonConversionRuleForArgumentWithDefaultValue(ObjectType **object = nullptr);
- ObjectType* getObject() const { return m_object; }
+ ObjectType *getObject() const { return m_object; }
// Inject code with a %CONVERTTOPYTHON that receives an user's primitive type.
static inline OddBool passOddBool(OddBool ob) { return ob; }
@@ -118,7 +120,7 @@ public:
void notifySetAttroCalled();
private:
- ObjectType* m_object;
+ ObjectType *m_object;
TestEnum m_enumValue = TestEnumValue1;
bool m_getAttroCalled = false;
bool m_setAttroCalled = false;
diff --git a/sources/shiboken6/tests/libsample/modified_constructor.cpp b/sources/shiboken6/tests/libsample/modified_constructor.cpp
index d53815243..c39c97738 100644
--- a/sources/shiboken6/tests/libsample/modified_constructor.cpp
+++ b/sources/shiboken6/tests/libsample/modified_constructor.cpp
@@ -8,8 +8,7 @@ ModifiedConstructor::ModifiedConstructor(int first_arg)
m_stored_value = first_arg;
}
-int
-ModifiedConstructor::retrieveValue()
+int ModifiedConstructor::retrieveValue() const
{
return m_stored_value;
}
diff --git a/sources/shiboken6/tests/libsample/modified_constructor.h b/sources/shiboken6/tests/libsample/modified_constructor.h
index 48cb812a6..a27899f3f 100644
--- a/sources/shiboken6/tests/libsample/modified_constructor.h
+++ b/sources/shiboken6/tests/libsample/modified_constructor.h
@@ -10,8 +10,8 @@ class LIBSAMPLE_API ModifiedConstructor
{
public:
- ModifiedConstructor(int first_arg);
- int retrieveValue();
+ explicit ModifiedConstructor(int first_arg);
+ int retrieveValue() const;
private:
int m_stored_value;
diff --git a/sources/shiboken6/tests/libsample/multiple_derived.cpp b/sources/shiboken6/tests/libsample/multiple_derived.cpp
index 9797a397b..18aa14611 100644
--- a/sources/shiboken6/tests/libsample/multiple_derived.cpp
+++ b/sources/shiboken6/tests/libsample/multiple_derived.cpp
@@ -3,37 +3,22 @@
#include "multiple_derived.h"
-MDerived1::MDerived1() : m_value(100)
-{
-}
+MDerived1::MDerived1() = default;
-MDerived2::MDerived2() : m_value(200)
-{
-}
+MDerived2::MDerived2() = default;
-MDerived3::MDerived3() : m_value(3000)
-{
-}
+MDerived3::MDerived3() = default;
-MDerived4::MDerived4()
-{
-}
+MDerived4::MDerived4() = default;
-MDerived5::MDerived5()
-{
-}
+MDerived5::MDerived5() = default;
-MDerived1*
-MDerived1::transformFromBase1(Base1* self)
+MDerived1 *MDerived1::transformFromBase1(Base1 *self)
{
- MDerived1* ptr = dynamic_cast<MDerived1*>(self);
- return ptr;
+ return dynamic_cast<MDerived1*>(self);
}
-MDerived1*
-MDerived1::transformFromBase2(Base2* self)
+MDerived1 *MDerived1::transformFromBase2(Base2 *self)
{
- MDerived1* ptr = dynamic_cast<MDerived1*>(self);
- return ptr;
+ return dynamic_cast<MDerived1*>(self);
}
-
diff --git a/sources/shiboken6/tests/libsample/multiple_derived.h b/sources/shiboken6/tests/libsample/multiple_derived.h
index b91fb34cd..243b6a21e 100644
--- a/sources/shiboken6/tests/libsample/multiple_derived.h
+++ b/sources/shiboken6/tests/libsample/multiple_derived.h
@@ -5,28 +5,32 @@
#define MDERIVED_H
#include "libsamplemacros.h"
+
#include <string>
class Base1
{
public:
- Base1() : m_value(1) {}
- virtual ~Base1() {}
+ Base1() = default;
+ virtual ~Base1() = default;
+
virtual int base1Method() { return m_value; }
virtual void publicMethod() {};
+
private:
- int m_value;
+ int m_value = 1;
};
class Base2
{
public:
- Base2() : m_value(2) {}
- virtual ~Base2() {}
+ Base2() = default;
+ virtual ~Base2() = default;
virtual int base2Method() { return m_value; }
+
private:
- int m_value;
+ int m_value = 2;
};
class LIBSAMPLE_API MDerived1 : public Base1, public Base2
@@ -39,36 +43,38 @@ public:
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; }
+ inline Base1 *castToBase1() { return (Base1*) this; }
+ inline Base2 *castToBase2() { return (Base2*) this; }
- static MDerived1* transformFromBase1(Base1 *self);
- static MDerived1* transformFromBase2(Base2 *self);
+ static MDerived1 *transformFromBase1(Base1 *self);
+ static MDerived1 *transformFromBase2(Base2 *self);
private:
void publicMethod() override {}
- int m_value;
+ int m_value = 100;
};
class SonOfMDerived1 : public MDerived1
{
public:
- SonOfMDerived1() : m_value(0) {}
- ~SonOfMDerived1() {}
+ SonOfMDerived1() = default;
+ ~SonOfMDerived1() = default;
- inline MDerived1* castToMDerived1() { return (MDerived1*) this; }
+ inline MDerived1 *castToMDerived1() { return this; }
int sonOfMDerived1Method() { return m_value; }
+
private:
- int m_value;
+ int m_value = 0;
};
class Base3
{
public:
explicit Base3(int val = 3) : m_value(val) {}
- virtual ~Base3() {}
+ virtual ~Base3() = default;
int base3Method() { return m_value; }
+
private:
int m_value;
};
@@ -76,34 +82,36 @@ private:
class Base4
{
public:
- Base4() : m_value(4) {}
- virtual ~Base4() {}
+ Base4() = default;
+ virtual ~Base4() = default;
int base4Method() { return m_value; }
+
private:
- int m_value;
+ int m_value = 4;
};
class Base5
{
public:
- Base5() : m_value(5) {}
- virtual ~Base5() {}
+ Base5() = default;
+ virtual ~Base5() = default;
virtual int base5Method() { return m_value; }
+
private:
- int m_value;
+ int m_value = 5;
};
class Base6
{
public:
- Base6() : m_value(6) {}
- virtual ~Base6() {}
+ Base6() = default;
+ virtual ~Base6() = default;
virtual int base6Method() { return m_value; }
+
private:
- int m_value;
+ int m_value = 6;
};
-
class LIBSAMPLE_API MDerived2 : public Base3, public Base4, public Base5, public Base6
{
public:
@@ -113,43 +121,44 @@ public:
inline int base4Method() { return Base3::base3Method() * 10; }
inline int mderived2Method() { return m_value; }
- inline Base3* castToBase3() { return (Base3*) this; }
- inline Base4* castToBase4() { return (Base4*) this; }
- inline Base5* castToBase5() { return (Base5*) this; }
- inline Base6* castToBase6() { return (Base6*) this; }
+ inline Base3 *castToBase3() { return this; }
+ inline Base4 *castToBase4() { return this; }
+ inline Base5 *castToBase5() { return this; }
+ inline Base6 *castToBase6() { return this; }
private:
- int m_value;
+ int m_value = 200;
};
class LIBSAMPLE_API MDerived3 : public MDerived1, public MDerived2
{
public:
MDerived3();
- virtual ~MDerived3() {}
+ virtual ~MDerived3() = default;
inline virtual int mderived3Method() { return m_value; }
- inline MDerived1* castToMDerived1() { return (MDerived1*) this; }
- inline MDerived2* castToMDerived2() { return (MDerived2*) this; }
+ inline MDerived1 *castToMDerived1() { return this; }
+ inline MDerived2 *castToMDerived2() { return this; }
- inline Base3* castToBase3() { return (Base3*) this; }
+ inline Base3 *castToBase3() { return (Base3*) this; }
private:
- int m_value;
+ int m_value = 3000;
};
class LIBSAMPLE_API MDerived4 : public Base3, public Base4
{
public:
MDerived4();
- ~MDerived4() {}
+ ~MDerived4() = default;
inline int mderived4Method() { return 0; }
inline int justDummyMethod() { return m_value; }
- inline Base3* castToBase3() { return (Base3*) this; }
- inline Base4* castToBase4() { return (Base4*) this; }
+ inline Base3 *castToBase3() { return this; }
+ inline Base4 *castToBase4() { return this; }
+
private:
int m_value;
};
@@ -158,13 +167,12 @@ class LIBSAMPLE_API MDerived5 : public Base3, public Base4
{
public:
MDerived5();
- virtual ~MDerived5() {}
+ virtual ~MDerived5() = default;
virtual int mderived5Method() { return 0; }
- inline Base3* castToBase3() { return (Base3*) this; }
- inline Base4* castToBase4() { return (Base4*) this; }
+ inline Base3 *castToBase3() { return this; }
+ inline Base4 *castToBase4() { return this; }
};
#endif // MDERIVED_H
-
diff --git a/sources/shiboken6/tests/libsample/noimplicitconversion.h b/sources/shiboken6/tests/libsample/noimplicitconversion.h
index e7d738037..a0b91380b 100644
--- a/sources/shiboken6/tests/libsample/noimplicitconversion.h
+++ b/sources/shiboken6/tests/libsample/noimplicitconversion.h
@@ -13,9 +13,12 @@ class NoImplicitConversion
public:
explicit NoImplicitConversion(int objId) : m_objId(objId) {}
inline int objId() const { return m_objId; }
- inline static int receivesNoImplicitConversionByValue(NoImplicitConversion arg) { return arg.m_objId; }
- inline static int receivesNoImplicitConversionByPointer(NoImplicitConversion* arg) { return arg->m_objId; }
- inline static int receivesNoImplicitConversionByReference(NoImplicitConversion& arg) { return arg.m_objId; }
+ inline static int receivesNoImplicitConversionByValue(NoImplicitConversion arg)
+ { return arg.m_objId; }
+ inline static int receivesNoImplicitConversionByPointer(NoImplicitConversion *arg)
+ { return arg->m_objId; }
+ inline static int receivesNoImplicitConversionByReference(NoImplicitConversion &arg)
+ { return arg.m_objId; }
private:
int m_objId;
};
diff --git a/sources/shiboken6/tests/libsample/nondefaultctor.h b/sources/shiboken6/tests/libsample/nondefaultctor.h
index c410515ad..ec682f0fb 100644
--- a/sources/shiboken6/tests/libsample/nondefaultctor.h
+++ b/sources/shiboken6/tests/libsample/nondefaultctor.h
@@ -8,13 +8,14 @@
class NonDefaultCtor
{
- int m_value;
public:
NonDefaultCtor(int value) : m_value(value)
{
}
- inline int value()
+ virtual ~NonDefaultCtor() = default;
+
+ inline int value() const
{
return m_value;
}
@@ -44,7 +45,8 @@ public:
return returnMyselfVirtual();
}
- virtual ~NonDefaultCtor() {}
+private:
+ int m_value;
};
-#endif
+#endif // NONDEFAULTCTOR_H
diff --git a/sources/shiboken6/tests/libsample/null.h b/sources/shiboken6/tests/libsample/null.h
index 9a618095c..945a89fa2 100644
--- a/sources/shiboken6/tests/libsample/null.h
+++ b/sources/shiboken6/tests/libsample/null.h
@@ -8,12 +8,12 @@ class Null
{
public:
Null(bool value) : m_isNull(value) {}
- Null() : m_isNull(false) {}
+ Null() = default;
+
void setIsNull(bool flag) { m_isNull = flag; }
private:
- bool m_isNull;
+ bool m_isNull = false;
};
-#endif // STR_H
-
+#endif // NULL_H
diff --git a/sources/shiboken6/tests/libsample/objectmodel.cpp b/sources/shiboken6/tests/libsample/objectmodel.cpp
index a211d2969..56ed86577 100644
--- a/sources/shiboken6/tests/libsample/objectmodel.cpp
+++ b/sources/shiboken6/tests/libsample/objectmodel.cpp
@@ -3,14 +3,12 @@
#include "objectmodel.h"
-void
-ObjectModel::setData(ObjectType* data)
+void ObjectModel::setData(ObjectType *data)
{
m_data = data;
}
-ObjectType*
-ObjectModel::data() const
+ObjectType *ObjectModel::data() const
{
return m_data;
}
diff --git a/sources/shiboken6/tests/libsample/objectmodel.h b/sources/shiboken6/tests/libsample/objectmodel.h
index 063404460..6d2f97aee 100644
--- a/sources/shiboken6/tests/libsample/objectmodel.h
+++ b/sources/shiboken6/tests/libsample/objectmodel.h
@@ -11,11 +11,10 @@ class LIBSAMPLE_API ObjectModel : public ObjectType
{
public:
explicit ObjectModel(ObjectType *parent = nullptr)
- : ObjectType(parent), m_data(nullptr)
- {}
+ : ObjectType(parent) {}
- void setData(ObjectType* data);
- virtual ObjectType* data() const;
+ void setData(ObjectType *data);
+ virtual ObjectType *data() const;
// The MethodCalled enum and related static methods were created to
// test bug #630 [http://bugs.openbossa.org/show_bug.cgi?id=630]
@@ -26,8 +25,7 @@ public:
private:
// The model holds only one piece of data.
// (This is just a test after all.)
- ObjectType* m_data;
+ ObjectType *m_data = nullptr;
};
#endif // OBJECTMODEL_H
-
diff --git a/sources/shiboken6/tests/libsample/objecttype.cpp b/sources/shiboken6/tests/libsample/objecttype.cpp
index 5a85dbfda..b58084821 100644
--- a/sources/shiboken6/tests/libsample/objecttype.cpp
+++ b/sources/shiboken6/tests/libsample/objecttype.cpp
@@ -3,14 +3,13 @@
#include "objecttype.h"
#include "objecttypelayout.h"
+
#include <algorithm>
#include <iostream>
#include <string>
#include <assert.h>
-#include <algorithm>
-
-ObjectType::ObjectType(ObjectType* parent) : m_parent(nullptr), m_layout(nullptr), m_call_id(-1)
+ObjectType::ObjectType(ObjectType *parent)
{
setParent(parent);
}
@@ -21,11 +20,10 @@ ObjectType::~ObjectType()
delete o;
}
-ObjectType*
-ObjectType::createWithChild()
+ObjectType *ObjectType::createWithChild()
{
- ObjectType* parent = create();
- ObjectType* child = create();
+ ObjectType *parent = create();
+ ObjectType *child = create();
child->setObjectName("child");
child->setParent(parent);
return parent;
@@ -37,8 +35,7 @@ const ObjectType *ObjectType::defaultInstance()
return &result;
}
-void
-ObjectType::removeChild(ObjectType* child)
+void ObjectType::removeChild(ObjectType *child)
{
if (!child)
return;
@@ -50,8 +47,7 @@ ObjectType::removeChild(ObjectType* child)
}
}
-ObjectType*
-ObjectType::takeChild(ObjectType* child)
+ObjectType *ObjectType::takeChild(ObjectType *child)
{
if (!child)
return nullptr;
@@ -65,8 +61,7 @@ ObjectType::takeChild(ObjectType* child)
return nullptr;
}
-ObjectType*
-ObjectType::takeChild(const Str& name)
+ObjectType *ObjectType::takeChild(const Str &name)
{
return takeChild(findChild(name));
@@ -80,15 +75,13 @@ ObjectTypeList::iterator ObjectType::findChildByName(const Str &name)
});
}
-ObjectType*
-ObjectType::findChild(const Str& name)
+ObjectType *ObjectType::findChild(const Str &name)
{
auto it = findChildByName(name);
return it != m_children.end() ? *it : nullptr;
}
-void
-ObjectType::killChild(const Str& name)
+void ObjectType::killChild(const Str &name)
{
auto it = findChildByName(name);
if (it != m_children.end()) {
@@ -98,8 +91,7 @@ ObjectType::killChild(const Str& name)
}
}
-void
-ObjectType::setParent(ObjectType* parent)
+void ObjectType::setParent(ObjectType *parent)
{
if (m_parent == parent)
return;
@@ -112,20 +104,17 @@ ObjectType::setParent(ObjectType* parent)
m_parent->m_children.push_back(this);
}
-void
-ObjectType::setObjectName(const Str& name)
+void ObjectType::setObjectName(const Str &name)
{
m_objectName = name;
}
-Str
-ObjectType::objectName() const
+Str ObjectType::objectName() const
{
return m_objectName;
}
-bool
-ObjectType::causeEvent(Event::EventType eventType)
+bool ObjectType::causeEvent(Event::EventType eventType)
{
Event e(eventType);
return event(&e);
@@ -136,8 +125,7 @@ bool ObjectType::event(Event *)
return true;
}
-int
-ObjectType::processEvent(ObjectTypeList objects, Event *event)
+int ObjectType::processEvent(ObjectTypeList objects, Event *event)
{
return std::count_if(objects.begin(), objects.end(),
[event] (ObjectType *o) {
@@ -145,8 +133,7 @@ ObjectType::processEvent(ObjectTypeList objects, Event *event)
});
}
-void
-ObjectType::callInvalidateEvent(Event* event)
+void ObjectType::callInvalidateEvent(Event *event)
{
invalidateEvent(event);
}
@@ -155,8 +142,7 @@ void ObjectType::invalidateEvent(Event *)
{
}
-void
-ObjectType::setLayout(ObjectTypeLayout* l)
+void ObjectType::setLayout(ObjectTypeLayout *l)
{
if (!l) {
std::cerr << "[WARNING] ObjectType::setLayout: Cannot set layout to 0.\n";
@@ -173,7 +159,7 @@ ObjectType::setLayout(ObjectTypeLayout* l)
return;
}
- ObjectType* oldParent = l->parent();
+ ObjectType *oldParent = l->parent();
if (oldParent && oldParent != this) {
if (oldParent->isLayoutType()) {
std::cerr << "[WARNING] ObjectType::setLayout: Attempting to set ObjectTypeLayout '"
@@ -194,9 +180,9 @@ ObjectType::setLayout(ObjectTypeLayout* l)
}
}
-ObjectTypeLayout* ObjectType::takeLayout()
+ObjectTypeLayout *ObjectType::takeLayout()
{
- ObjectTypeLayout* l = layout();
+ ObjectTypeLayout *l = layout();
if (!l)
return nullptr;
m_layout = nullptr;
@@ -204,15 +190,14 @@ ObjectTypeLayout* ObjectType::takeLayout()
return l;
}
-unsigned int
-objectTypeHash(const ObjectType* objectType)
+unsigned int objectTypeHash(const ObjectType *objectType)
{
return reinterpret_cast<std::size_t>(objectType);
}
unsigned char ObjectType::callWithEnum(const Str &, Event::EventType, unsigned char value)
{
- return value*value;
+ return value * value;
}
unsigned char ObjectType::callWithEnum(const Str &, unsigned char value)
@@ -220,23 +205,20 @@ unsigned char ObjectType::callWithEnum(const Str &, unsigned char value)
return value;
}
-void
-ObjectType::setObjectSplittedName(const char*, const Str& prefix, const Str& suffix)
+void ObjectType::setObjectSplittedName(const char *, const Str &prefix, const Str &suffix)
{
std::string result(prefix.cstring());
result += suffix.cstring();
m_objectName = result.c_str();
}
-void
-ObjectType::setObjectNameWithSize(const char*, int size, const Str& name)
+void ObjectType::setObjectNameWithSize(const char *, int size, const Str &name)
{
std::string result(name.cstring(), size);
m_objectName = result.c_str();
}
-void
-ObjectType::setObjectNameWithSize(const Str& name, int size)
+void ObjectType::setObjectNameWithSize(const Str &name, int size)
{
setObjectNameWithSize("", size, name);
}
@@ -256,34 +238,29 @@ int ObjectType::callId() const
return m_call_id;
}
-
void ObjectType::callVirtualCreateChild()
{
- ObjectType* fake_parent = new ObjectType();
- ObjectType* fake_child = createChild(fake_parent);
+ ObjectType *fake_parent = new ObjectType();
+ ObjectType *fake_child = createChild(fake_parent);
assert(fake_child->isPython());
(void)fake_child;
delete fake_parent;
}
-ObjectType* ObjectType::createChild(ObjectType* parent)
+ObjectType *ObjectType::createChild(ObjectType *parent)
{
return new ObjectType(parent);
}
std::size_t ObjectType::createObjectType()
{
- void* addr = new ObjectType();
+ void *addr = new ObjectType();
return (std::size_t) addr;
}
-OtherBase::~OtherBase()
-{
-}
+OtherBase::~OtherBase() = default;
-ObjectTypeDerived::~ObjectTypeDerived()
-{
-}
+ObjectTypeDerived::~ObjectTypeDerived() = default;
bool ObjectTypeDerived::event(Event *)
{
diff --git a/sources/shiboken6/tests/libsample/objecttype.h b/sources/shiboken6/tests/libsample/objecttype.h
index 260061995..afd8a97a4 100644
--- a/sources/shiboken6/tests/libsample/objecttype.h
+++ b/sources/shiboken6/tests/libsample/objecttype.h
@@ -4,12 +4,13 @@
#ifndef OBJECTTYPE_H
#define OBJECTTYPE_H
-#include <list>
#include "str.h"
#include "null.h"
#include "libsamplemacros.h"
+#include <list>
+
struct Event
{
enum EventType {
@@ -24,8 +25,8 @@ struct Event
Value2
};
- Event(EventType eventType) : m_eventType(eventType) {}
- EventType eventType() { return m_eventType; }
+ explicit Event(EventType eventType) : m_eventType(eventType) {}
+ EventType eventType() const { return m_eventType; }
void setEventType(EventType et) { m_eventType = et; }
void setEventTypeByConstRef(const EventType &et) { m_eventType = et; }
@@ -47,67 +48,72 @@ public:
explicit ObjectType(ObjectType *parent = nullptr);
virtual ~ObjectType();
+ ObjectType(const ObjectType &) = delete;
+ ObjectType &operator=(const ObjectType &) = delete;
// factory method
- inline static ObjectType* create() { return new ObjectType(); }
- static ObjectType* createWithChild();
+ inline static ObjectType *create() { return new ObjectType(); }
+ static ObjectType *createWithChild();
static const ObjectType *defaultInstance();
- void setParent(ObjectType* parent);
- inline ObjectType* parent() const { return m_parent; }
- inline const ObjectTypeList& children() const { return m_children; }
- void killChild(const Str& name);
- void removeChild(ObjectType* child);
- ObjectType* takeChild(ObjectType* child);
- virtual ObjectType* takeChild(const Str& name);
- ObjectType* findChild(const Str& name);
+ void setParent(ObjectType *parent);
+ inline ObjectType *parent() const { return m_parent; }
+ inline const ObjectTypeList &children() const { return m_children; }
+ void killChild(const Str &name);
+ void removeChild(ObjectType *child);
+ ObjectType *takeChild(ObjectType *child);
+ virtual ObjectType *takeChild(const Str &name);
+ ObjectType *findChild(const Str &name);
Str objectName() const;
- void setObjectName(const Str& name);
+ void setObjectName(const Str &name);
inline Identifier identifier() const { return reinterpret_cast<Identifier>(this); }
bool causeEvent(Event::EventType eventType);
// Returns true if the event is processed.
- virtual bool event(Event* event);
+ virtual bool event(Event *event);
static int processEvent(ObjectTypeList objects, Event *event);
- void callInvalidateEvent(Event* event);
+ void callInvalidateEvent(Event *event);
virtual void invalidateEvent(Event *event);
// This nonsense method emulate QWidget.setLayout method
// All layout objects will became children of this object.
- void setLayout(ObjectTypeLayout* layout);
- inline ObjectTypeLayout* layout() const { return m_layout; }
+ void setLayout(ObjectTypeLayout *layout);
+ inline ObjectTypeLayout *layout() const { return m_layout; }
// This method should be reimplemented by ObjectTypeLayout.
virtual bool isLayoutType() { return false; }
- unsigned char callWithEnum(const Str& prefix, Event::EventType type, unsigned char value=80);
- unsigned char callWithEnum(const Str& prefix, unsigned char value=0);
+ unsigned char callWithEnum(const Str &prefix, Event::EventType type,
+ unsigned char value=80);
+ unsigned char callWithEnum(const Str &prefix, unsigned char value=0);
//Functions used in test with named arguments
- void setObjectSplittedName(const char*, const Str& prefix = Str("<unk"), const Str& suffix = Str("nown>"));
- void setObjectNameWithSize(const char*, int size=9, const Str& name = Str("<unknown>"));
- void setObjectNameWithSize(const Str& name = Str("<unknown>"), int size=9);
+ void setObjectSplittedName(const char *, const Str &prefix = Str("<unk"),
+ const Str &suffix = Str("nown>"));
+ void setObjectNameWithSize(const char *, int size=9,
+ const Str &name = Str("<unknown>"));
+ void setObjectNameWithSize(const Str &name = Str("<unknown>"), int size = 9);
//Function used to confuse the generator when two values accept Null as arg
void setObject(ObjectType *);
- void setObject(const Null&);
+ void setObject(const Null &);
int callId() const;
//Function used to create a parent from C++
virtual bool isPython() { return false; }
void callVirtualCreateChild();
- virtual ObjectType* createChild(ObjectType* parent);
+ virtual ObjectType *createChild(ObjectType *parent);
static std::size_t createObjectType();
//return a parent from C++
- ObjectType* getCppParent() {
+ ObjectType *getCppParent() {
if (!m_parent) {
- ObjectType* parent = new ObjectType();
+ ObjectType *parent = new ObjectType();
setParent(parent);
}
return m_parent;
@@ -122,41 +128,35 @@ public:
// nextInFocusChain simply returns the parent to test object cycles; the parent
// may be returned by the QWidget's implementation but isn't always returned
- ObjectType* nextInFocusChain() { return m_parent; }
+ ObjectType *nextInFocusChain() { return m_parent; }
private:
- ObjectType(const ObjectType&);
- ObjectType& operator=(const ObjectType&);
-
- ObjectTypeLayout* takeLayout();
+ ObjectTypeLayout *takeLayout();
ObjectTypeList::iterator findChildByName(const Str &name);
Str m_objectName;
- ObjectType* m_parent;
+ ObjectType *m_parent = nullptr;
ObjectTypeList m_children;
- ObjectTypeLayout* m_layout;
-
-
+ ObjectTypeLayout *m_layout = nullptr;
//used on overload null test
- int m_call_id;
+ int m_call_id = -1;
};
-LIBSAMPLE_API unsigned int objectTypeHash(const ObjectType* objectType);
+LIBSAMPLE_API unsigned int objectTypeHash(const ObjectType *objectType);
class LIBSAMPLE_API OtherBase {
public:
- OtherBase() {};
+ OtherBase() = default;
virtual ~OtherBase();
};
class LIBSAMPLE_API ObjectTypeDerived: public ObjectType, public OtherBase {
public:
- ObjectTypeDerived(): ObjectType(), OtherBase() {};
+ ObjectTypeDerived() = default;
- bool event(Event* event) override;
+ bool event(Event *event) override;
~ObjectTypeDerived() override;
};
#endif // OBJECTTYPE_H
-
diff --git a/sources/shiboken6/tests/libsample/objecttypebyvalue.h b/sources/shiboken6/tests/libsample/objecttypebyvalue.h
index 0d7ac0160..c6d9aef87 100644
--- a/sources/shiboken6/tests/libsample/objecttypebyvalue.h
+++ b/sources/shiboken6/tests/libsample/objecttypebyvalue.h
@@ -3,9 +3,11 @@
#ifndef OBJECTTYPEBYVALUE_H
#define OBJECTTYPEBYVALUE_H
-#include <list>
+
#include "protected.h"
+#include <list>
+
class ObjectTypeByValue
{
public:
diff --git a/sources/shiboken6/tests/libsample/objecttypeholder.cpp b/sources/shiboken6/tests/libsample/objecttypeholder.cpp
index 076023470..dfd7c4020 100644
--- a/sources/shiboken6/tests/libsample/objecttypeholder.cpp
+++ b/sources/shiboken6/tests/libsample/objecttypeholder.cpp
@@ -3,7 +3,7 @@
#include "objecttypeholder.h"
-ObjectTypeHolder::ObjectTypeHolder(const char* objectName)
+ObjectTypeHolder::ObjectTypeHolder(const char *objectName)
{
auto object = new ObjectType();
object->setObjectName(objectName);
@@ -20,14 +20,12 @@ ObjectTypeHolder::~ObjectTypeHolder()
delete m_objectType;
}
-Str
-ObjectTypeHolder::passObjectTypeAsReference(const ObjectType& objectType)
+Str ObjectTypeHolder::passObjectTypeAsReference(const ObjectType &objectType)
{
return objectType.objectName();
}
-Str
-ObjectTypeHolder::callPassObjectTypeAsReference()
+Str ObjectTypeHolder::callPassObjectTypeAsReference()
{
return passObjectTypeAsReference(*m_objectType);
}
diff --git a/sources/shiboken6/tests/libsample/objecttypeholder.h b/sources/shiboken6/tests/libsample/objecttypeholder.h
index f0ddd97b2..e457baa26 100644
--- a/sources/shiboken6/tests/libsample/objecttypeholder.h
+++ b/sources/shiboken6/tests/libsample/objecttypeholder.h
@@ -11,17 +11,17 @@
class LIBSAMPLE_API ObjectTypeHolder
{
public:
- explicit ObjectTypeHolder(const char* objectName);
+ explicit ObjectTypeHolder(const char *objectName);
explicit ObjectTypeHolder(const ObjectType *object = ObjectType::defaultInstance());
virtual ~ObjectTypeHolder();
- const ObjectType* getObjecType() { return m_objectType; }
+ const ObjectType *getObjectType() const { return m_objectType; }
- virtual Str passObjectTypeAsReference(const ObjectType& objectType);
+ virtual Str passObjectTypeAsReference(const ObjectType &objectType);
Str callPassObjectTypeAsReference();
private:
const ObjectType *m_objectType;
};
-#endif
+#endif // OBJECTTYPEHOLDER_H
diff --git a/sources/shiboken6/tests/libsample/objecttypelayout.cpp b/sources/shiboken6/tests/libsample/objecttypelayout.cpp
index bb826df4e..3fa02917c 100644
--- a/sources/shiboken6/tests/libsample/objecttypelayout.cpp
+++ b/sources/shiboken6/tests/libsample/objecttypelayout.cpp
@@ -2,12 +2,13 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "objecttypelayout.h"
+
#include <iostream>
-void ObjectTypeLayout::addObject(ObjectType* obj)
+void ObjectTypeLayout::addObject(ObjectType *obj)
{
if (obj->isLayoutType()) {
- ObjectTypeLayout* l = reinterpret_cast<ObjectTypeLayout*>(obj);
+ auto *l = reinterpret_cast<ObjectTypeLayout*>(obj);
if (l->parent()) {
std::cerr << "[WARNING] ObjectTypeLayout::addObject: layout '"
<< l->objectName().cstring() << "' already has a parent.\n";
@@ -23,12 +24,12 @@ void ObjectTypeLayout::addObject(ObjectType* obj)
m_objects.push_back(obj);
}
-std::list< ObjectType* > ObjectTypeLayout::objects() const
+std::list<ObjectType*> ObjectTypeLayout::objects() const
{
return m_objects;
}
-void ObjectTypeLayout::reparentChildren(ObjectType* parent)
+void ObjectTypeLayout::reparentChildren(ObjectType *parent)
{
for (auto *o : m_objects) {
if (o->isLayoutType())
@@ -37,4 +38,3 @@ void ObjectTypeLayout::reparentChildren(ObjectType* parent)
o->setParent(parent);
}
}
-
diff --git a/sources/shiboken6/tests/libsample/objecttypelayout.h b/sources/shiboken6/tests/libsample/objecttypelayout.h
index 98eb30946..0aa9fad6e 100644
--- a/sources/shiboken6/tests/libsample/objecttypelayout.h
+++ b/sources/shiboken6/tests/libsample/objecttypelayout.h
@@ -6,6 +6,7 @@
#include "libsamplemacros.h"
#include "objecttype.h"
+
#include <list>
class ObjectType;
@@ -13,19 +14,19 @@ class ObjectType;
class LIBSAMPLE_API ObjectTypeLayout : public ObjectType
{
public:
- void addObject(ObjectType* obj);
+ void addObject(ObjectType *obj);
std::list<ObjectType*> objects() const;
bool isLayoutType() override { return true; }
- inline static ObjectTypeLayout* create() { return new ObjectTypeLayout(); }
+ inline static ObjectTypeLayout *create() { return new ObjectTypeLayout(); }
+
+ ObjectType *takeChild(const Str &name) override { return ObjectType::takeChild(name); }
- ObjectType* takeChild(const Str& name) override { return ObjectType::takeChild(name); }
private:
std::list<ObjectType*> m_objects;
- void reparentChildren(ObjectType* parent);
- friend LIBSAMPLE_API void ObjectType::setLayout(ObjectTypeLayout* l);
+ void reparentChildren(ObjectType *parent);
+ friend LIBSAMPLE_API void ObjectType::setLayout(ObjectTypeLayout *l);
};
#endif // OBJECTTYPELAYOUT_H
-
diff --git a/sources/shiboken6/tests/libsample/objecttypeoperators.cpp b/sources/shiboken6/tests/libsample/objecttypeoperators.cpp
index 05f229a81..c78387a3e 100644
--- a/sources/shiboken6/tests/libsample/objecttypeoperators.cpp
+++ b/sources/shiboken6/tests/libsample/objecttypeoperators.cpp
@@ -7,32 +7,32 @@ ObjectTypeOperators::ObjectTypeOperators(const std::string key) : m_key(key)
{
}
-bool ObjectTypeOperators::operator==(const ObjectTypeOperators& other) const
+bool ObjectTypeOperators::operator==(const ObjectTypeOperators &other) const
{
return m_key == other.m_key;
}
-const ObjectTypeOperators& ObjectTypeOperators::operator<(const ObjectTypeOperators& other) const
+const ObjectTypeOperators &ObjectTypeOperators::operator<(const ObjectTypeOperators &other) const
{
return m_key < other.m_key ? *this : other;
}
-bool operator==(const ObjectTypeOperators* obj, const std::string& str)
+bool operator==(const ObjectTypeOperators *obj, const std::string &str)
{
return obj->key() == str;
}
-bool operator==(const std::string& str, const ObjectTypeOperators* obj)
+bool operator==(const std::string &str, const ObjectTypeOperators *obj)
{
return str == obj->key();
}
-std::string operator+(const ObjectTypeOperators* obj, const std::string& str)
+std::string operator+(const ObjectTypeOperators *obj, const std::string &str)
{
return obj->key() + str;
}
-std::string operator+(const std::string& str, const ObjectTypeOperators* obj)
+std::string operator+(const std::string &str, const ObjectTypeOperators *obj)
{
return str + obj->key();
}
diff --git a/sources/shiboken6/tests/libsample/objecttypeoperators.h b/sources/shiboken6/tests/libsample/objecttypeoperators.h
index b768359a3..062ec9a79 100644
--- a/sources/shiboken6/tests/libsample/objecttypeoperators.h
+++ b/sources/shiboken6/tests/libsample/objecttypeoperators.h
@@ -5,32 +5,32 @@
#define OBJECTTYPEOPERATORS_H
#include "libsamplemacros.h"
+
#include <string>
class LIBSAMPLE_API ObjectTypeOperators
{
public:
explicit ObjectTypeOperators(const std::string key);
- virtual ~ObjectTypeOperators() {}
+ virtual ~ObjectTypeOperators() = default;
+ ObjectTypeOperators(ObjectTypeOperators &) = delete;
+ ObjectTypeOperators &operator=(ObjectTypeOperators &) = delete;
- bool operator==(const ObjectTypeOperators& other) const;
- const ObjectTypeOperators& operator<(const ObjectTypeOperators& other) const;
+ bool operator==(const ObjectTypeOperators &other) const;
+ const ObjectTypeOperators &operator<(const ObjectTypeOperators &other) const;
// chaos!
- virtual void operator>(const ObjectTypeOperators&) { m_key.append("operator>"); }
+ virtual void operator>(const ObjectTypeOperators &) { m_key.append("operator>"); }
std::string key() const { return m_key; }
private:
std::string m_key;
-
- ObjectTypeOperators(ObjectTypeOperators&);
- ObjectTypeOperators& operator=(ObjectTypeOperators&);
};
-LIBSAMPLE_API bool operator==(const ObjectTypeOperators* obj, const std::string& str);
-LIBSAMPLE_API bool operator==(const std::string& str, const ObjectTypeOperators* obj);
-LIBSAMPLE_API std::string operator+(const ObjectTypeOperators* obj, const std::string& str);
-LIBSAMPLE_API std::string operator+(const std::string& str, const ObjectTypeOperators* obj);
+LIBSAMPLE_API bool operator==(const ObjectTypeOperators *obj, const std::string &str);
+LIBSAMPLE_API bool operator==(const std::string &str, const ObjectTypeOperators *obj);
+LIBSAMPLE_API std::string operator+(const ObjectTypeOperators *obj, const std::string &str);
+LIBSAMPLE_API std::string operator+(const std::string &str, const ObjectTypeOperators *obj);
#endif // OBJECTTYPEOPERATORS_H
diff --git a/sources/shiboken6/tests/libsample/objectview.cpp b/sources/shiboken6/tests/libsample/objectview.cpp
index 5717053a7..d12464142 100644
--- a/sources/shiboken6/tests/libsample/objectview.cpp
+++ b/sources/shiboken6/tests/libsample/objectview.cpp
@@ -5,25 +5,20 @@
#include "objectmodel.h"
#include "str.h"
-Str
-ObjectView::displayModelData()
+Str ObjectView::displayModelData()
{
if (!m_model)
return Str("(NULL)");
return Str("Name: %VAR").arg(m_model->objectName());
}
-void
-ObjectView::modifyModelData(Str& data)
+void ObjectView::modifyModelData(Str &data)
{
if (m_model)
m_model->setObjectName(data);
}
-
-ObjectType*
-ObjectView::getRawModelData()
+ObjectType *ObjectView::getRawModelData()
{
return m_model->data();
}
-
diff --git a/sources/shiboken6/tests/libsample/objectview.h b/sources/shiboken6/tests/libsample/objectview.h
index 1de474ff2..2567deee5 100644
--- a/sources/shiboken6/tests/libsample/objectview.h
+++ b/sources/shiboken6/tests/libsample/objectview.h
@@ -13,21 +13,19 @@ class ObjectModel;
class LIBSAMPLE_API ObjectView : public ObjectType
{
public:
- ObjectView(ObjectModel *model = nullptr, ObjectType *parent = nullptr)
- : ObjectType(parent), m_model(model)
- {}
+ explicit ObjectView(ObjectModel *model = nullptr, ObjectType *parent = nullptr)
+ : ObjectType(parent), m_model(model) {}
- inline void setModel(ObjectModel* model) { m_model = model; }
- inline ObjectModel* model() const { return m_model; }
+ inline void setModel(ObjectModel *model) { m_model = model; }
+ inline ObjectModel *model() const { return m_model; }
Str displayModelData();
- void modifyModelData(Str& data);
+ void modifyModelData(Str &data);
- ObjectType* getRawModelData();
+ ObjectType *getRawModelData();
private:
- ObjectModel* m_model;
+ ObjectModel *m_model;
};
#endif // OBJECTVIEW_H
-
diff --git a/sources/shiboken6/tests/libsample/oddbool.cpp b/sources/shiboken6/tests/libsample/oddbool.cpp
index 06a61f1c2..bc1ee833f 100644
--- a/sources/shiboken6/tests/libsample/oddbool.cpp
+++ b/sources/shiboken6/tests/libsample/oddbool.cpp
@@ -7,7 +7,7 @@ ComparisonTester::ComparisonTester(int v) : m_value(v)
{
}
-ComparisonTester& ComparisonTester::operator=(int v)
+ComparisonTester &ComparisonTester::operator=(int v)
{
m_value = v;
return *this;
diff --git a/sources/shiboken6/tests/libsample/oddbool.h b/sources/shiboken6/tests/libsample/oddbool.h
index a64a05eb3..1d6524443 100644
--- a/sources/shiboken6/tests/libsample/oddbool.h
+++ b/sources/shiboken6/tests/libsample/oddbool.h
@@ -36,7 +36,7 @@ class OddBoolUser
{
public:
OddBoolUser() : m_oddbool(OddBool(false)) {}
- OddBoolUser(const OddBool& oddBool) : m_oddbool(oddBool) {}
+ OddBoolUser(const OddBool &oddBool) : m_oddbool(oddBool) {}
virtual ~OddBoolUser() {}
inline OddBool oddBool() { return m_oddbool; }
@@ -52,7 +52,7 @@ public:
return invertedOddBool();
}
- static inline OddBool getOddBool(const OddBoolUser& oddBoolUser)
+ static inline OddBool getOddBool(const OddBoolUser &oddBoolUser)
{
return oddBoolUser.m_oddbool;
}
diff --git a/sources/shiboken6/tests/libsample/onlycopy.cpp b/sources/shiboken6/tests/libsample/onlycopy.cpp
index 6fa4ad064..5ae746121 100644
--- a/sources/shiboken6/tests/libsample/onlycopy.cpp
+++ b/sources/shiboken6/tests/libsample/onlycopy.cpp
@@ -13,7 +13,6 @@ public:
OnlyCopy::OnlyCopy(int value) : d(new OnlyCopyPrivate(value))
{
-
}
OnlyCopy::OnlyCopy(OnlyCopyPrivate *dIn) : d(dIn)
@@ -25,12 +24,11 @@ OnlyCopy::~OnlyCopy()
delete d;
}
-OnlyCopy::OnlyCopy(const OnlyCopy& other) : d(new OnlyCopyPrivate(other.value()))
+OnlyCopy::OnlyCopy(const OnlyCopy &other) : d(new OnlyCopyPrivate(other.value()))
{
}
-OnlyCopy&
-OnlyCopy::operator=(const OnlyCopy& other)
+OnlyCopy &OnlyCopy::operator=(const OnlyCopy &other)
{
d->value = other.d->value;
return *this;
@@ -41,15 +39,12 @@ int OnlyCopy::value() const
return d->value;
}
-OnlyCopy
-FriendOfOnlyCopy::createOnlyCopy(int value)
+OnlyCopy FriendOfOnlyCopy::createOnlyCopy(int value)
{
-
return OnlyCopy(value);
}
-std::list<OnlyCopy>
-FriendOfOnlyCopy::createListOfOnlyCopy(int quantity)
+std::list<OnlyCopy> FriendOfOnlyCopy::createListOfOnlyCopy(int quantity)
{
std::list<OnlyCopy> list;
for (int i = 0; i < quantity; ++i)
diff --git a/sources/shiboken6/tests/libsample/onlycopy.h b/sources/shiboken6/tests/libsample/onlycopy.h
index e7c411a18..bd414ec34 100644
--- a/sources/shiboken6/tests/libsample/onlycopy.h
+++ b/sources/shiboken6/tests/libsample/onlycopy.h
@@ -5,6 +5,7 @@
#define ONLYCOPYCLASS_H
#include "libsamplemacros.h"
+
#include <list>
// These classes simulate a situation found in QWebEngineHistoryItem.
@@ -14,13 +15,14 @@ class OnlyCopyPrivate;
class LIBSAMPLE_API OnlyCopy
{
public:
- OnlyCopy(const OnlyCopy& other);
- OnlyCopy& operator=(const OnlyCopy& other);
+ OnlyCopy(const OnlyCopy &other);
+ OnlyCopy &operator=(const OnlyCopy &other);
~OnlyCopy();
int value() const;
static int getValue(OnlyCopy onlyCopy) { return onlyCopy.value(); }
- static int getValueFromReference(const OnlyCopy& onlyCopy) { return onlyCopy.value(); }
+ static int getValueFromReference(const OnlyCopy &onlyCopy) { return onlyCopy.value(); }
+
private:
OnlyCopyPrivate *d;
explicit OnlyCopy(int value);
@@ -35,4 +37,4 @@ public:
static std::list<OnlyCopy> createListOfOnlyCopy(int quantity);
};
-#endif
+#endif // ONLYCOPYCLASS_H
diff --git a/sources/shiboken6/tests/libsample/overload.cpp b/sources/shiboken6/tests/libsample/overload.cpp
index d533b4014..34da28e03 100644
--- a/sources/shiboken6/tests/libsample/overload.cpp
+++ b/sources/shiboken6/tests/libsample/overload.cpp
@@ -35,11 +35,13 @@ int Overload::differentReturnTypes(ParamEnum, int val)
int Overload::intOverloads(const Point &, double)
{
- return 1; }
+ return 1;
+}
int Overload::intOverloads(int, int)
{
- return 2; }
+ return 2;
+}
int Overload::intOverloads(int, int, double)
{
diff --git a/sources/shiboken6/tests/libsample/overload.h b/sources/shiboken6/tests/libsample/overload.h
index 91de8a963..c6f9dcc17 100644
--- a/sources/shiboken6/tests/libsample/overload.h
+++ b/sources/shiboken6/tests/libsample/overload.h
@@ -36,9 +36,9 @@ public:
virtual ~Overload() {}
FunctionEnum overloaded();
- FunctionEnum overloaded(Size* size);
- FunctionEnum overloaded(Point* point, ParamEnum param);
- FunctionEnum overloaded(const Point& point);
+ FunctionEnum overloaded(Size *size);
+ FunctionEnum overloaded(Point *point, ParamEnum param);
+ FunctionEnum overloaded(const Point &point);
void differentReturnTypes(ParamEnum param = Param0);
int differentReturnTypes(ParamEnum param, int val);
@@ -51,7 +51,7 @@ public:
FunctionEnum intDoubleOverloads(double a0, double a1) const;
void singleOverload(Point *x);
- Point* singleOverload() {return new Point();}
+ Point *singleOverload() { return new Point(); }
// Similar to QImage::trueMatrix(QMatrix,int,int) and QImage::trueMatrix(QTransform,int,int)
FunctionEnum wrapperIntIntOverloads(const Point &arg0, int arg1, int arg2);
@@ -60,7 +60,7 @@ public:
// Similar to QImage constructor
FunctionEnum strBufferOverloads(const Str &arg0, const char *arg1 = nullptr,
bool arg2 = true);
- FunctionEnum strBufferOverloads(unsigned char* arg0, int arg1);
+ FunctionEnum strBufferOverloads(unsigned char *arg0, int arg1);
FunctionEnum strBufferOverloads() { return Function2; }
// Similar to QPainter::drawText(...)
@@ -95,7 +95,7 @@ public:
FunctionEnum acceptSequence(const Str &a0, ParamEnum a1 = Param0);
FunctionEnum acceptSequence(const Size &a0);
// The type must be changed to PySequence.
- FunctionEnum acceptSequence(const char* const a0[]);
+ FunctionEnum acceptSequence(const char *const a0[]);
FunctionEnum acceptSequence(void *a0);
};
diff --git a/sources/shiboken6/tests/libsample/overloadsort.h b/sources/shiboken6/tests/libsample/overloadsort.h
index 473828da9..ee269cc21 100644
--- a/sources/shiboken6/tests/libsample/overloadsort.h
+++ b/sources/shiboken6/tests/libsample/overloadsort.h
@@ -11,13 +11,13 @@
class ImplicitTarget
{
public:
- ImplicitTarget(){}
+ ImplicitTarget() = default;
};
class ImplicitBase
{
public:
- ImplicitBase(){}
+ ImplicitBase() = default;
ImplicitBase(const ImplicitTarget &b);
};
@@ -39,9 +39,9 @@ public:
const char *overloadDeep(int x, ImplicitBase &y);
- inline const char* pyObjOverload(int, int) { return "int,int"; }
- inline const char* pyObjOverload(unsigned char*, int) { return "PyObject,int"; }
-
+ inline const char *pyObjOverload(int, int) { return "int,int"; }
+ inline const char *pyObjOverload(unsigned char *, int)
+ { return "PyObject,int"; }
};
class LIBSAMPLE_API CustomOverloadSequence
@@ -52,4 +52,3 @@ public:
};
#endif // OVERLOADSORT_H
-
diff --git a/sources/shiboken6/tests/libsample/pairuser.cpp b/sources/shiboken6/tests/libsample/pairuser.cpp
index 9d0b9864f..5b7eb4d8c 100644
--- a/sources/shiboken6/tests/libsample/pairuser.cpp
+++ b/sources/shiboken6/tests/libsample/pairuser.cpp
@@ -1,30 +1,24 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "pairuser.h"
-std::pair<int, int>
-PairUser::callCreatePair()
+std::pair<int, int> PairUser::callCreatePair()
{
return createPair();
}
-std::pair<int, int>
-PairUser::createPair()
+std::pair<int, int> PairUser::createPair()
{
- return std::pair<int, int>(10, 20);
+ return {10, 20};
}
-std::pair<Complex, Complex>
-PairUser::createComplexPair(Complex cpx0, Complex cpx1)
+std::pair<Complex, Complex> PairUser::createComplexPair(Complex cpx0, Complex cpx1)
{
- return std::pair<Complex, Complex>(cpx0, cpx1);
+ return {cpx0, cpx1};
}
-double
-PairUser::sumPair(std::pair<int, double> pair)
+double PairUser::sumPair(std::pair<int, double> pair)
{
return ((double) pair.first) + pair.second;
}
-
diff --git a/sources/shiboken6/tests/libsample/pairuser.h b/sources/shiboken6/tests/libsample/pairuser.h
index 313651c06..595b3fe7e 100644
--- a/sources/shiboken6/tests/libsample/pairuser.h
+++ b/sources/shiboken6/tests/libsample/pairuser.h
@@ -4,16 +4,16 @@
#ifndef PAIRUSER_H
#define PAIRUSER_H
-#include <utility>
+#include "libsamplemacros.h"
#include "complex.h"
-#include "libsamplemacros.h"
+#include <utility>
class LIBSAMPLE_API PairUser
{
public:
- PairUser() {}
- virtual ~PairUser() {}
+ PairUser() = default;
+ virtual ~PairUser() = default;
virtual std::pair<int, int> createPair();
std::pair<int, int> callCreatePair();
@@ -26,5 +26,5 @@ public:
private:
std::pair<int, int> m_pair;
};
-#endif // PAIRUSER_H
+#endif // PAIRUSER_H
diff --git a/sources/shiboken6/tests/libsample/pen.cpp b/sources/shiboken6/tests/libsample/pen.cpp
index 8e216323f..2d58fa54c 100644
--- a/sources/shiboken6/tests/libsample/pen.cpp
+++ b/sources/shiboken6/tests/libsample/pen.cpp
@@ -45,9 +45,7 @@ void Brush::setColor(const Color &newColor)
m_color = newColor;
}
-Pen::Pen() : m_ctor(EmptyCtor)
-{
-}
+Pen::Pen() = default;
Pen::Pen(SampleNamespace::Option) : m_ctor(EnumCtor)
{
@@ -62,7 +60,7 @@ Pen::Pen(const Pen &) : m_ctor(CopyCtor)
}
Pen::Pen(Pen &&) = default;
-Pen &Pen::operator=(const Pen& pen) = default;
+Pen &Pen::operator=(const Pen &pen) = default;
Pen &Pen::operator=(Pen &&) = default;
int Pen::ctorType()
diff --git a/sources/shiboken6/tests/libsample/pen.h b/sources/shiboken6/tests/libsample/pen.h
index 114810d25..c99dd8add 100644
--- a/sources/shiboken6/tests/libsample/pen.h
+++ b/sources/shiboken6/tests/libsample/pen.h
@@ -15,6 +15,7 @@ public:
Color(unsigned int arg);
bool isNull() const;
+
private:
bool m_null = true;
};
@@ -48,7 +49,7 @@ public:
Pen();
Pen(SampleNamespace::Option option);
- Pen(const Color& color);
+ Pen(const Color &color);
Pen(const Pen &pen);
Pen(Pen &&);
Pen &operator=(const Pen &pen);
@@ -63,7 +64,7 @@ public:
void setRenderHints(RenderHints h);
private:
- int m_ctor;
+ int m_ctor = EmptyCtor;
RenderHints m_renderHints = None;
};
diff --git a/sources/shiboken6/tests/libsample/photon.cpp b/sources/shiboken6/tests/libsample/photon.cpp
index f98a7c891..2a7f20e33 100644
--- a/sources/shiboken6/tests/libsample/photon.cpp
+++ b/sources/shiboken6/tests/libsample/photon.cpp
@@ -5,21 +5,27 @@
namespace Photon
{
+
const ClassType Base::staticType;
-int callCalculateForValueDuplicatorPointer(ValueDuplicator* value)
+
+int callCalculateForValueDuplicatorPointer(ValueDuplicator *value)
{
return value->calculate();
}
-int callCalculateForValueDuplicatorReference(ValueDuplicator& value)
+
+int callCalculateForValueDuplicatorReference(ValueDuplicator &value)
{
return value.calculate();
}
-int countValueIdentities(const std::list<ValueIdentity>& values)
+
+int countValueIdentities(const std::list<ValueIdentity> &values)
{
return values.size();
}
-int countValueDuplicators(const std::list<TemplateBase<DuplicatorType> >& values)
+
+int countValueDuplicators(const std::list<TemplateBase<DuplicatorType> > &values)
{
return values.size();
}
+
} // namespace Photon
diff --git a/sources/shiboken6/tests/libsample/photon.h b/sources/shiboken6/tests/libsample/photon.h
index 2fbf87d25..cf71a7543 100644
--- a/sources/shiboken6/tests/libsample/photon.h
+++ b/sources/shiboken6/tests/libsample/photon.h
@@ -4,9 +4,10 @@
#ifndef PHOTON_H
#define PHOTON_H
-#include <list>
#include "libsamplemacros.h"
+#include <list>
+
// This namespace and classes simulate
// situations found in Qt's phonon module.
@@ -23,7 +24,8 @@ class LIBSAMPLE_API Base
{
public:
explicit Base(int value) : m_value(value) {}
- virtual ~Base() {}
+ virtual ~Base() = default;
+
inline void setValue(int value) { m_value = value; }
inline int value() const { return m_value; }
@@ -42,12 +44,14 @@ class LIBSAMPLE_API TemplateBase : public Base
{
public:
explicit TemplateBase(int value) : Base(value) {}
- inline int multiplicator() const { return (int)CLASS_TYPE; }
- inline int calculate() const { return m_value * ((int)CLASS_TYPE); }
+ inline int multiplicator() const { return int(CLASS_TYPE); }
+ inline int calculate() const { return m_value * (int(CLASS_TYPE)); }
static inline ClassType classType() { return CLASS_TYPE; }
- inline int sumValueUsingPointer(TemplateBase<CLASS_TYPE>* other) const { return m_value + other->m_value; }
- inline int sumValueUsingReference(TemplateBase<CLASS_TYPE>& other) const { return m_value + other.m_value; }
+ inline int sumValueUsingPointer(TemplateBase<CLASS_TYPE> *other) const
+ { return m_value + other->m_value; }
+ inline int sumValueUsingReference(TemplateBase<CLASS_TYPE> &other) const
+ { return m_value + other.m_value; }
inline std::list<TemplateBase<CLASS_TYPE> > getListOfThisTemplateBase()
{
@@ -57,7 +61,8 @@ public:
return objs;
}
- static inline TemplateBase<CLASS_TYPE>* passPointerThrough(TemplateBase<CLASS_TYPE>* obj) { return obj; }
+ static inline TemplateBase<CLASS_TYPE> *passPointerThrough(TemplateBase<CLASS_TYPE> *obj)
+ { return obj; }
ClassType type() const override { return CLASS_TYPE; }
static const ClassType staticType = CLASS_TYPE;
@@ -71,10 +76,10 @@ template class LIBSAMPLE_API TemplateBase<DuplicatorType>;
using ValueIdentity = TemplateBase<IdentityType>;
using ValueDuplicator = TemplateBase<DuplicatorType>;
-LIBSAMPLE_API int callCalculateForValueDuplicatorPointer(ValueDuplicator* value);
-LIBSAMPLE_API int callCalculateForValueDuplicatorReference(ValueDuplicator& value);
-LIBSAMPLE_API int countValueIdentities(const std::list<ValueIdentity>& values);
-LIBSAMPLE_API int countValueDuplicators(const std::list<TemplateBase<DuplicatorType> >& values);
+LIBSAMPLE_API int callCalculateForValueDuplicatorPointer(ValueDuplicator *value);
+LIBSAMPLE_API int callCalculateForValueDuplicatorReference(ValueDuplicator &value);
+LIBSAMPLE_API int countValueIdentities(const std::list<ValueIdentity> &values);
+LIBSAMPLE_API int countValueDuplicators(const std::list<TemplateBase<DuplicatorType> > &values);
// This simulates an internal error (SEGV) caused by 'noexcept' in
// boost::intrusive_ptr before support for 'noexcept' was added. The ENTIRE
@@ -91,23 +96,23 @@ LIBSAMPLE_API int countValueDuplicators(const std::list<TemplateBase<DuplicatorT
class Pointer
{
public:
- Pointer() PHOTON_NOEXCEPT : px(nullptr) {}
- Pointer(int* p) : px(p) {}
+ Pointer() PHOTON_NOEXCEPT {}
+ explicit Pointer(int *p) : px(p) {}
void reset() PHOTON_NOEXCEPT { Pointer().swap(*this); }
- int* get() const PHOTON_NOEXCEPT { return px; }
- int& operator*() const { return *px; }
+ int *get() const PHOTON_NOEXCEPT { return px; }
+ int &operator*() const { return *px; }
- void swap(Pointer& rhs) PHOTON_NOEXCEPT
+ void swap(Pointer &rhs) PHOTON_NOEXCEPT
{
- int* tmp = px;
+ int *tmp = px;
px = rhs.px;
rhs.px = tmp;
}
private:
- int* px;
+ int *px = nullptr;
};
} // namespace Photon
diff --git a/sources/shiboken6/tests/libsample/point.cpp b/sources/shiboken6/tests/libsample/point.cpp
index cb15107c4..f85e4650c 100644
--- a/sources/shiboken6/tests/libsample/point.cpp
+++ b/sources/shiboken6/tests/libsample/point.cpp
@@ -1,9 +1,10 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "point.h"
+#include <iostream>
+
Point::Point(int x, int y) : m_x(x), m_y(y)
{
}
@@ -12,8 +13,7 @@ Point::Point(double x, double y) : m_x(x), m_y(y)
{
}
-void
-Point::midpoint(const Point& other, Point* midpoint) const
+void Point::midpoint(const Point &other, Point *midpoint) const
{
if (!midpoint)
return;
@@ -21,108 +21,91 @@ Point::midpoint(const Point& other, Point* midpoint) const
midpoint->setY((m_y + other.m_y) / 2.0);
}
-Point*
-Point::copy() const
+Point *Point::copy() const
{
- Point* pt = new Point();
+ Point *pt = new Point();
pt->m_x = m_x;
pt->m_y = m_y;
return pt;
}
-void
-Point::show()
+void Point::show() const
{
std::cout << "(x: " << m_x << ", y: " << m_y << ")";
}
-bool
-Point::operator==(const Point& other)
+bool Point::operator==(const Point &other)
{
return m_x == other.m_x && m_y == other.m_y;
}
-Point
-Point::operator+(const Point& other)
+Point Point::operator+(const Point &other)
{
return Point(m_x + other.m_x, m_y + other.m_y);
}
-Point
-Point::operator-(const Point& other)
+Point Point::operator-(const Point &other)
{
return Point(m_x - other.m_x, m_y - other.m_y);
}
-Point&
-Point::operator+=(Point &other)
+Point &Point::operator+=(Point &other)
{
m_x += other.m_x;
m_y += other.m_y;
return *this;
}
-Point&
-Point::operator-=(Point &other)
+Point &Point::operator-=(Point &other)
{
m_x -= other.m_x;
m_y -= other.m_y;
return *this;
}
-Point
-operator*(const Point& pt, double mult)
+Point operator*(const Point &pt, double mult)
{
return Point(pt.m_x * mult, pt.m_y * mult);
}
-Point
-operator*(const Point& pt, int mult)
+Point operator*(const Point &pt, int mult)
{
- return Point(((int) pt.m_x) * mult, ((int) pt.m_y) * mult);
+ return Point(int(pt.m_x) * mult, int(pt.m_y) * mult);
}
-Point
-operator*(double mult, const Point& pt)
+Point operator*(double mult, const Point &pt)
{
return Point(pt.m_x * mult, pt.m_y * mult);
}
-Point
-operator*(int mult, const Point& pt)
+Point operator*(int mult, const Point &pt)
{
- return Point(((int) pt.m_x) * mult, ((int) pt.m_y) * mult);
+ return Point(int(pt.m_x) * mult, int(pt.m_y) * mult);
}
-Point
-operator-(const Point& pt)
+Point operator-(const Point &pt)
{
return Point(-pt.m_x, -pt.m_y);
}
-bool
-operator!(const Point& pt)
+bool operator!(const Point &pt)
{
- return (pt.m_x == 0.0 && pt.m_y == 0.0);
+ return pt.m_x == 0.0 && pt.m_y == 0.0;
}
-Point
-Point::operator/(int operand)
+Point Point::operator/(int operand)
{
return Point(m_x/operand, m_y/operand);
}
-Complex
-transmutePointIntoComplex(const Point& point)
+Complex transmutePointIntoComplex(const Point &point)
{
Complex cpx(point.x(), point.y());
return cpx;
}
-Point
-transmuteComplexIntoPoint(const Complex& cpx)
+Point transmuteComplexIntoPoint(const Complex &cpx)
{
Point pt(cpx.real(), cpx.imag());
return pt;
}
-
diff --git a/sources/shiboken6/tests/libsample/point.h b/sources/shiboken6/tests/libsample/point.h
index 717658b09..52a9b1bf3 100644
--- a/sources/shiboken6/tests/libsample/point.h
+++ b/sources/shiboken6/tests/libsample/point.h
@@ -4,17 +4,17 @@
#ifndef POINT_H
#define POINT_H
+#include "libsamplemacros.h"
#include "complex.h"
-#include <utility>
-#include "libsamplemacros.h"
+#include <utility>
class LIBSAMPLE_API Point
{
public:
Point(int x = 0, int y = 0);
Point(double x, double y);
- ~Point() {}
+ ~Point() = default;
inline double x() const { return m_x; }
inline double y() const { return m_y; }
@@ -27,48 +27,48 @@ public:
// This method could simply return the midpoint,
// but the interesting part of the test is to set the
// result in the pointer argument.
- void midpoint(const Point& other, Point* midpoint) const;
+ void midpoint(const Point &other, Point *midpoint) const;
- Point* copy() const;
+ Point *copy() const;
- inline const Point& getConstReferenceToSelf() const { return *this; }
- inline const Point* getSelf() const { return this; }
+ inline const Point &getConstReferenceToSelf() const { return *this; }
+ inline const Point *getSelf() const { return this; }
// The != operator is not implemented for the purpose of testing
// for the absense of the __ne__ method in the Python binding.
- bool operator==(const Point& other);
+ bool operator==(const Point &other);
- Point operator+(const Point& other);
- Point operator-(const Point& other);
+ Point operator+(const Point &other);
+ Point operator-(const Point &other);
Point operator/(int operand);
- friend LIBSAMPLE_API Point operator*(const Point& pt, double mult);
- friend LIBSAMPLE_API Point operator*(const Point& pt, int mult);
- friend LIBSAMPLE_API Point operator*(double mult, const Point& pt);
- friend LIBSAMPLE_API Point operator*(int mult, const Point& pt);
- friend LIBSAMPLE_API Point operator-(const Point& pt);
- friend LIBSAMPLE_API bool operator!(const Point& pt);
+ friend LIBSAMPLE_API Point operator*(const Point &pt, double mult);
+ friend LIBSAMPLE_API Point operator*(const Point &pt, int mult);
+ friend LIBSAMPLE_API Point operator*(double mult, const Point &pt);
+ friend LIBSAMPLE_API Point operator*(int mult, const Point &pt);
+ friend LIBSAMPLE_API Point operator-(const Point &pt);
+ friend LIBSAMPLE_API bool operator!(const Point &pt);
- Point& operator+=(Point &other);
- Point& operator-=(Point &other);
+ Point &operator+=(Point &other);
+ Point &operator-=(Point &other);
- void show();
+ void show() const;
private:
double m_x;
double m_y;
};
-LIBSAMPLE_API Point operator*(const Point& pt, double mult);
-LIBSAMPLE_API Point operator*(const Point& pt, int mult);
-LIBSAMPLE_API Point operator*(double mult, const Point& pt);
-LIBSAMPLE_API Point operator*(int mult, const Point& pt);
-LIBSAMPLE_API Point operator-(const Point& pt);
-LIBSAMPLE_API bool operator!(const Point& pt);
+LIBSAMPLE_API Point operator*(const Point &pt, double mult);
+LIBSAMPLE_API Point operator*(const Point &pt, int mult);
+LIBSAMPLE_API Point operator*(double mult, const Point &pt);
+LIBSAMPLE_API Point operator*(int mult, const Point &pt);
+LIBSAMPLE_API Point operator-(const Point &pt);
+LIBSAMPLE_API bool operator!(const Point &pt);
-LIBSAMPLE_API Complex transmutePointIntoComplex(const Point& point);
-LIBSAMPLE_API Point transmuteComplexIntoPoint(const Complex& cpx);
+LIBSAMPLE_API Complex transmutePointIntoComplex(const Point &point);
+LIBSAMPLE_API Point transmuteComplexIntoPoint(const Complex &cpx);
-LIBSAMPLE_API Point operator*(const Point& pt, double multiplier);
+LIBSAMPLE_API Point operator*(const Point &pt, double multiplier);
#endif // POINT_H
diff --git a/sources/shiboken6/tests/libsample/pointerholder.h b/sources/shiboken6/tests/libsample/pointerholder.h
index 36ce32205..b777ffe7c 100644
--- a/sources/shiboken6/tests/libsample/pointerholder.h
+++ b/sources/shiboken6/tests/libsample/pointerholder.h
@@ -9,12 +9,13 @@
class PointerHolder
{
public:
- explicit PointerHolder(void* ptr) : m_pointer(ptr) {}
- ~PointerHolder() {}
- inline void* pointer() const { return m_pointer; }
+ explicit PointerHolder(void *ptr) : m_pointer(ptr) {}
+ ~PointerHolder() = default;
+
+ inline void *pointer() const { return m_pointer; }
+
private:
- void* m_pointer;
+ void *m_pointer;
};
#endif // POINTERHOLDER_H
-
diff --git a/sources/shiboken6/tests/libsample/pointf.cpp b/sources/shiboken6/tests/libsample/pointf.cpp
index 107325aa3..e51173c6d 100644
--- a/sources/shiboken6/tests/libsample/pointf.cpp
+++ b/sources/shiboken6/tests/libsample/pointf.cpp
@@ -1,10 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "pointf.h"
-PointF::PointF(const Point& point) : m_x(point.x()), m_y(point.y())
+#include <iostream>
+
+PointF::PointF(const Point &point) : m_x(point.x()), m_y(point.y())
{
}
@@ -12,8 +13,7 @@ PointF::PointF(double x, double y) : m_x(x), m_y(y)
{
}
-void
-PointF::midpoint(const PointF& other, PointF* midpoint) const
+void PointF::midpoint(const PointF &other, PointF *midpoint) const
{
if (!midpoint)
return;
@@ -21,79 +21,66 @@ PointF::midpoint(const PointF& other, PointF* midpoint) const
midpoint->setY((m_y + other.m_y) / 2.0);
}
-void
-PointF::show()
+void PointF::show() const
{
std::cout << "(x: " << m_x << ", y: " << m_y << ")";
}
-bool
-PointF::operator==(const PointF& other)
+bool PointF::operator==(const PointF &other)
{
return m_x == other.m_x && m_y == other.m_y;
}
-PointF
-PointF::operator+(const PointF& other)
+PointF PointF::operator+(const PointF &other)
{
return PointF(m_x + other.m_x, m_y + other.m_y);
}
-PointF
-PointF::operator-(const PointF& other)
+PointF PointF::operator-(const PointF &other)
{
return PointF(m_x - other.m_x, m_y - other.m_y);
}
-PointF&
-PointF::operator+=(PointF &other)
+PointF &PointF::operator+=(PointF &other)
{
m_x += other.m_x;
m_y += other.m_y;
return *this;
}
-PointF&
-PointF::operator-=(PointF &other)
+PointF &PointF::operator-=(PointF &other)
{
m_x -= other.m_x;
m_y -= other.m_y;
return *this;
}
-PointF
-operator*(const PointF& pt, double mult)
+PointF operator*(const PointF &pt, double mult)
{
return PointF(pt.m_x * mult, pt.m_y * mult);
}
-PointF
-operator*(const PointF& pt, int mult)
+PointF operator*(const PointF &pt, int mult)
{
- return PointF(((int) pt.m_x) * mult, ((int) pt.m_y) * mult);
+ return PointF(int(pt.m_x) * mult, int(pt.m_y) * mult);
}
-PointF
-operator*(double mult, const PointF& pt)
+PointF operator*(double mult, const PointF &pt)
{
return PointF(pt.m_x * mult, pt.m_y * mult);
}
-PointF
-operator*(int mult, const PointF& pt)
+PointF operator*(int mult, const PointF &pt)
{
- return PointF(((int) pt.m_x) * mult, ((int) pt.m_y) * mult);
+ return PointF(int(pt.m_x) * mult, int(pt.m_y) * mult);
}
-PointF
-operator-(const PointF& pt)
+PointF operator-(const PointF &pt)
{
return PointF(-pt.m_x, -pt.m_y);
}
-bool
-operator!(const PointF& pt)
+bool operator!(const PointF &pt)
{
- return (pt.m_x == 0.0 && pt.m_y == 0.0);
+ return pt.m_x == 0.0 && pt.m_y == 0.0;
}
-
diff --git a/sources/shiboken6/tests/libsample/pointf.h b/sources/shiboken6/tests/libsample/pointf.h
index 86c8c9d2a..0ebbda579 100644
--- a/sources/shiboken6/tests/libsample/pointf.h
+++ b/sources/shiboken6/tests/libsample/pointf.h
@@ -4,15 +4,15 @@
#ifndef POINTF_H
#define POINTF_H
+#include "libsamplemacros.h"
#include "point.h"
-#include <utility>
-#include "libsamplemacros.h"
+#include <utility>
class LIBSAMPLE_API PointF
{
public:
- PointF(const Point& point);
+ PointF(const Point &point);
PointF(double x = 0.0, double y = 0.0);
~PointF() {}
@@ -25,39 +25,39 @@ public:
// This method could simply return the midpoint,
// but the interesting part of the test is to set the
// result in the pointer argument.
- void midpoint(const PointF& other, PointF* midpoint) const;
+ void midpoint(const PointF &other, PointF *midpoint) const;
// The != operator is not implemented for the purpose of testing
// for the absence of the __ne__ method in the Python binding.
- bool operator==(const PointF& other);
+ bool operator==(const PointF &other);
- PointF operator+(const PointF& other);
- PointF operator-(const PointF& other);
+ PointF operator+(const PointF &other);
+ PointF operator-(const PointF &other);
- friend LIBSAMPLE_API PointF operator*(const PointF& pt, double mult);
- friend LIBSAMPLE_API PointF operator*(const PointF& pt, int mult);
- friend LIBSAMPLE_API PointF operator*(double mult, const PointF& pt);
- friend LIBSAMPLE_API PointF operator*(int mult, const PointF& pt);
- friend LIBSAMPLE_API PointF operator-(const PointF& pt);
- friend LIBSAMPLE_API bool operator!(const PointF& pt);
+ friend LIBSAMPLE_API PointF operator*(const PointF &pt, double mult);
+ friend LIBSAMPLE_API PointF operator*(const PointF &pt, int mult);
+ friend LIBSAMPLE_API PointF operator*(double mult, const PointF &pt);
+ friend LIBSAMPLE_API PointF operator*(int mult, const PointF &pt);
+ friend LIBSAMPLE_API PointF operator-(const PointF &pt);
+ friend LIBSAMPLE_API bool operator!(const PointF &pt);
- PointF& operator+=(PointF &other);
- PointF& operator-=(PointF &other);
+ PointF &operator+=(PointF &other);
+ PointF &operator-=(PointF &other);
- void show();
+ void show() const;
private:
double m_x;
double m_y;
};
-LIBSAMPLE_API PointF operator*(const PointF& pt, double mult);
-LIBSAMPLE_API PointF operator*(const PointF& pt, int mult);
-LIBSAMPLE_API PointF operator*(double mult, const PointF& pt);
-LIBSAMPLE_API PointF operator*(int mult, const PointF& pt);
-LIBSAMPLE_API PointF operator-(const PointF& pt);
-LIBSAMPLE_API bool operator!(const PointF& pt);
+LIBSAMPLE_API PointF operator*(const PointF &pt, double mult);
+LIBSAMPLE_API PointF operator*(const PointF &pt, int mult);
+LIBSAMPLE_API PointF operator*(double mult, const PointF &pt);
+LIBSAMPLE_API PointF operator*(int mult, const PointF &pt);
+LIBSAMPLE_API PointF operator-(const PointF &pt);
+LIBSAMPLE_API bool operator!(const PointF &pt);
-LIBSAMPLE_API PointF operator*(const PointF& pt, double multiplier);
+LIBSAMPLE_API PointF operator*(const PointF &pt, double multiplier);
#endif // POINTF_H
diff --git a/sources/shiboken6/tests/libsample/polygon.cpp b/sources/shiboken6/tests/libsample/polygon.cpp
index a13a3ef5c..789b94ac1 100644
--- a/sources/shiboken6/tests/libsample/polygon.cpp
+++ b/sources/shiboken6/tests/libsample/polygon.cpp
@@ -1,7 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "polygon.h"
Polygon::Polygon(double x, double y)
@@ -19,14 +18,12 @@ Polygon::Polygon(PointList points)
m_points = points;
}
-void
-Polygon::addPoint(Point point)
+void Polygon::addPoint(Point point)
{
m_points.push_back(point);
}
-Polygon
-Polygon::doublePolygonScale(Polygon polygon)
+Polygon Polygon::doublePolygonScale(Polygon polygon)
{
Polygon result;
for (const auto &point : polygon.points())
@@ -34,15 +31,12 @@ Polygon::doublePolygonScale(Polygon polygon)
return result;
}
-void
-Polygon::stealOwnershipFromPython(Point* point)
+void Polygon::stealOwnershipFromPython(Point *point)
{
delete point;
}
-void
-Polygon::stealOwnershipFromPython(Polygon* polygon)
+void Polygon::stealOwnershipFromPython(Polygon *polygon)
{
delete polygon;
}
-
diff --git a/sources/shiboken6/tests/libsample/polygon.h b/sources/shiboken6/tests/libsample/polygon.h
index 9a7586d24..f89a7b01c 100644
--- a/sources/shiboken6/tests/libsample/polygon.h
+++ b/sources/shiboken6/tests/libsample/polygon.h
@@ -4,10 +4,10 @@
#ifndef POLYGON_H
#define POLYGON_H
-#include <list>
+#include "libsamplemacros.h"
#include "point.h"
-#include "libsamplemacros.h"
+#include <list>
class LIBSAMPLE_API Polygon
{
@@ -22,20 +22,19 @@ public:
void addPoint(Point point);
- inline const PointList& points() const { return m_points; }
+ inline const PointList &points() const { return m_points; }
// This method intentionally receives and returns copies of a Polygon object.
static Polygon doublePolygonScale(Polygon polygon);
// This method invalidates the argument to be used for Polygon(Point) implicit conversion.
- static void stealOwnershipFromPython(Point* point);
+ static void stealOwnershipFromPython(Point *point);
// This method invalidates the argument to be used in a call to doublePolygonScale(Polygon).
- static void stealOwnershipFromPython(Polygon* polygon);
+ static void stealOwnershipFromPython(Polygon *polygon);
private:
PointList m_points;
};
#endif // POLYGON_H
-
diff --git a/sources/shiboken6/tests/libsample/privatector.h b/sources/shiboken6/tests/libsample/privatector.h
index 760fe4d13..3b38414f8 100644
--- a/sources/shiboken6/tests/libsample/privatector.h
+++ b/sources/shiboken6/tests/libsample/privatector.h
@@ -9,22 +9,22 @@
class PrivateCtor
{
public:
- inline static PrivateCtor* instance()
+ inline static PrivateCtor *instance()
{
static PrivateCtor self;
- self.m_instanciations++;
+ self.m_instantiations++;
return &self;
}
inline int instanceCalls()
{
- return m_instanciations;
+ return m_instantiations;
}
private:
- int m_instanciations;
+ int m_instantiations = 0;
- PrivateCtor() : m_instanciations(0) {}
+ PrivateCtor() = default;
};
class DeletedDefaultCtor
@@ -39,4 +39,4 @@ public:
~DeletedDefaultCtor() = default;
};
-#endif
+#endif // PRIVATECTOR_H
diff --git a/sources/shiboken6/tests/libsample/privatedtor.h b/sources/shiboken6/tests/libsample/privatedtor.h
index 84591ccb2..22881d047 100644
--- a/sources/shiboken6/tests/libsample/privatedtor.h
+++ b/sources/shiboken6/tests/libsample/privatedtor.h
@@ -9,27 +9,27 @@
class PrivateDtor
{
public:
- inline static PrivateDtor* instance()
+ inline static PrivateDtor *instance()
{
static PrivateDtor self;
- self.m_instanciations++;
+ self.m_instantiations++;
return &self;
}
inline int instanceCalls()
{
- return m_instanciations;
+ return m_instantiations;
}
protected:
- inline int protectedInstanceCalls() { return m_instanciations; }
+ inline int protectedInstanceCalls() { return m_instantiations; }
private:
- int m_instanciations;
+ int m_instantiations = 0;
- PrivateDtor() : m_instanciations(0) {}
- PrivateDtor(const PrivateDtor&) {}
- ~PrivateDtor() {}
+ PrivateDtor() = default;
+ PrivateDtor(const PrivateDtor &) = default;
+ ~PrivateDtor() = default;
};
-#endif
+#endif // PRIVATEDTOR_H
diff --git a/sources/shiboken6/tests/libsample/protected.h b/sources/shiboken6/tests/libsample/protected.h
index 5f2c788fb..9a862a668 100644
--- a/sources/shiboken6/tests/libsample/protected.h
+++ b/sources/shiboken6/tests/libsample/protected.h
@@ -7,6 +7,7 @@
#include "libsamplemacros.h"
#include "objecttype.h"
#include "point.h"
+
#include <string>
#include <list>
@@ -14,17 +15,18 @@ class LIBSAMPLE_API ProtectedNonPolymorphic
{
public:
explicit ProtectedNonPolymorphic(const char *name) : m_name(name) {}
- ~ProtectedNonPolymorphic() {}
+ ~ProtectedNonPolymorphic() = default;
- inline const char* publicName() { return m_name.c_str(); }
+ inline const char *publicName() { return m_name.c_str(); }
- inline static ProtectedNonPolymorphic* create() { return new ProtectedNonPolymorphic("created"); }
+ inline static ProtectedNonPolymorphic *create()
+ { return new ProtectedNonPolymorphic("created"); }
protected:
- inline const char* protectedName() { return m_name.c_str(); }
+ inline const char *protectedName() { return m_name.c_str(); }
inline int protectedSum(int a0, int a1) { return a0 + a1; }
inline int modifiedProtectedSum(int a0, int a1) { return a0 + a1; }
- inline static const char* protectedStatic() { return "protectedStatic"; }
+ inline static const char *protectedStatic() { return "protectedStatic"; }
const char *dataTypeName(void *data = nullptr) const;
const char *dataTypeName(int data) const;
@@ -38,12 +40,13 @@ public:
explicit ProtectedPolymorphic(const char *name) : m_name(name) {}
virtual ~ProtectedPolymorphic() {}
- inline static ProtectedPolymorphic* create() { return new ProtectedPolymorphic("created"); }
- inline const char* publicName() { return m_name.c_str(); }
- inline const char* callProtectedName() { return protectedName(); }
+ inline static ProtectedPolymorphic *create()
+ { return new ProtectedPolymorphic("created"); }
+ inline const char *publicName() { return m_name.c_str(); }
+ inline const char *callProtectedName() { return protectedName(); }
protected:
- virtual const char* protectedName() { return m_name.c_str(); }
+ virtual const char *protectedName() { return m_name.c_str(); }
private:
std::string m_name;
@@ -52,22 +55,27 @@ private:
class LIBSAMPLE_API ProtectedPolymorphicDaughter : public ProtectedPolymorphic
{
public:
- explicit ProtectedPolymorphicDaughter(const char *name) : ProtectedPolymorphic(name) {}
- inline static ProtectedPolymorphicDaughter* create() { return new ProtectedPolymorphicDaughter("created"); }
+ explicit ProtectedPolymorphicDaughter(const char *name) :
+ ProtectedPolymorphic(name) {}
+ inline static ProtectedPolymorphicDaughter *create()
+ { return new ProtectedPolymorphicDaughter("created"); }
};
class LIBSAMPLE_API ProtectedPolymorphicGrandDaughter: public ProtectedPolymorphicDaughter
{
public:
- explicit ProtectedPolymorphicGrandDaughter(const char *name) : ProtectedPolymorphicDaughter(name) {}
- inline static ProtectedPolymorphicGrandDaughter* create() { return new ProtectedPolymorphicGrandDaughter("created"); }
+ explicit ProtectedPolymorphicGrandDaughter(const char *name) :
+ ProtectedPolymorphicDaughter(name) {}
+ inline static ProtectedPolymorphicGrandDaughter *create()
+ { return new ProtectedPolymorphicGrandDaughter("created"); }
};
class LIBSAMPLE_API ProtectedVirtualDestructor
{
public:
ProtectedVirtualDestructor() {}
- inline static ProtectedVirtualDestructor* create() { return new ProtectedVirtualDestructor(); }
+ inline static ProtectedVirtualDestructor *create()
+ { return new ProtectedVirtualDestructor(); }
inline static int dtorCalled() { return dtor_called; }
inline static void resetDtorCounter() { dtor_called = 0; }
protected:
@@ -90,36 +98,33 @@ protected:
ProtectedItem0,
ProtectedItem1
};
- ProtectedEnum callProtectedEnumMethod(ProtectedEnum in) { return protectedEnumMethod(in); }
- inline PublicEnum callPublicEnumMethod(PublicEnum in) { return publicEnumMethod(in); }
+ ProtectedEnum callProtectedEnumMethod(ProtectedEnum in)
+ { return protectedEnumMethod(in); }
+ inline PublicEnum callPublicEnumMethod(PublicEnum in)
+ { return publicEnumMethod(in); }
virtual ProtectedEnum protectedEnumMethod(ProtectedEnum in) { return in; }
virtual PublicEnum publicEnumMethod(PublicEnum in) { return in; }
};
-
class LIBSAMPLE_API ProtectedProperty
{
public:
- ProtectedProperty()
- : protectedValueTypeProperty(Point(0, 0)),
- protectedProperty(0),
- protectedEnumProperty(Event::NO_EVENT),
- protectedValueTypePointerProperty(nullptr),
- protectedObjectTypeProperty(nullptr)
- {}
+ ProtectedProperty() = default;
+
protected:
// This is deliberately the first member to test wrapper registration
// for value type members sharing the same memory address.
- Point protectedValueTypeProperty;
- int protectedProperty;
+ Point protectedValueTypeProperty{0, 0};
+ int protectedProperty = 0;
std::list<int> protectedContainerProperty;
- Event::EventType protectedEnumProperty;
- Point* protectedValueTypePointerProperty;
- ObjectType* protectedObjectTypeProperty;
+ Event::EventType protectedEnumProperty = Event::NO_EVENT;
+ Point *protectedValueTypePointerProperty = nullptr;
+ ObjectType *protectedObjectTypeProperty = nullptr;
};
-LIBSAMPLE_API inline ProtectedProperty* createProtectedProperty() {
+LIBSAMPLE_API inline ProtectedProperty *createProtectedProperty()
+{
return new ProtectedProperty;
}
diff --git a/sources/shiboken6/tests/libsample/rect.h b/sources/shiboken6/tests/libsample/rect.h
index ca3b1912d..3218b78a2 100644
--- a/sources/shiboken6/tests/libsample/rect.h
+++ b/sources/shiboken6/tests/libsample/rect.h
@@ -9,53 +9,46 @@
class LIBSAMPLE_API Rect
{
public:
- Rect()
- {
- m_left = m_top = 0;
- m_right = m_bottom = -1;
- }
- Rect(int left, int top, int right, int bottom)
+ Rect() = default;
+ explicit Rect(int left, int top, int right, int bottom)
: m_left(left), m_top(top), m_right(right), m_bottom(bottom) { }
- ~Rect() {}
+ ~Rect() = default;
+
inline int left() const { return m_left; }
inline int top() const { return m_top; }
inline int right() const { return m_right; }
inline int bottom() const { return m_bottom; }
private:
- int m_left;
- int m_top;
- int m_right;
- int m_bottom;
+ int m_left = 0;
+ int m_top = 0;
+ int m_right = -1;
+ int m_bottom = -1;
};
class LIBSAMPLE_API RectF
{
public:
- RectF()
- {
- m_left = m_top = 0;
- m_right = m_bottom = -1;
- }
- RectF(int left, int top, int right, int bottom)
+ RectF() = default;
+ explicit RectF(int left, int top, int right, int bottom)
: m_left(left), m_top(top), m_right(right), m_bottom(bottom) { }
- RectF(const Rect& other)
+ RectF(const Rect &other)
{
m_left = other.left();
m_top = other.top();
m_right = other.right();
m_bottom = other.bottom();
}
- ~RectF() {}
+ ~RectF() = default;
+
inline double left() const { return m_left; }
inline double top() const { return m_top; }
inline double right() const { return m_right; }
inline double bottom() const { return m_bottom; }
private:
- double m_left;
- double m_top;
- double m_right;
- double m_bottom;
+ double m_left = 0;
+ double m_top = 0;
+ double m_right = -1;
+ double m_bottom = -1;
};
#endif // RECT_H
-
diff --git a/sources/shiboken6/tests/libsample/reference.cpp b/sources/shiboken6/tests/libsample/reference.cpp
index 8e8152905..29dcfc054 100644
--- a/sources/shiboken6/tests/libsample/reference.cpp
+++ b/sources/shiboken6/tests/libsample/reference.cpp
@@ -1,11 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "reference.h"
-void
-Reference::show() const
+#include <iostream>
+
+void Reference::show() const
{
std::cout << "Reference.objId: " << m_objId << ", address: " << this;
}
@@ -15,45 +15,37 @@ Reference &Reference::returnMySecondArg(int, Reference &ref)
return ref;
}
-int
-Reference::usesReferenceVirtual(Reference& r, int inc)
+int Reference::usesReferenceVirtual(Reference &r, int inc)
{
return r.m_objId + inc;
}
-int
-Reference::usesConstReferenceVirtual(const Reference& r, int inc)
+int Reference::usesConstReferenceVirtual(const Reference &r, int inc)
{
return r.m_objId + inc;
}
-int
-Reference::callUsesReferenceVirtual(Reference& r, int inc)
+int Reference::callUsesReferenceVirtual(Reference &r, int inc)
{
return usesReferenceVirtual(r, inc);
}
-int
-Reference::callUsesConstReferenceVirtual(const Reference& r, int inc)
+int Reference::callUsesConstReferenceVirtual(const Reference &r, int inc)
{
return usesConstReferenceVirtual(r, inc);
}
-void
-Reference::alterReferenceIdVirtual(Reference& r)
+void Reference::alterReferenceIdVirtual(Reference &r)
{
r.setObjId(r.objId() * Reference::multiplier());
}
-void
-Reference::callAlterReferenceIdVirtual(Reference& r)
+void Reference::callAlterReferenceIdVirtual(Reference &r)
{
alterReferenceIdVirtual(r);
}
-ObjTypeReference::~ObjTypeReference()
-{
-}
+ObjTypeReference::~ObjTypeReference() = default;
ObjTypeReference &ObjTypeReference::returnMySecondArg(int, ObjTypeReference &ref)
{
diff --git a/sources/shiboken6/tests/libsample/reference.h b/sources/shiboken6/tests/libsample/reference.h
index 1dc7aaf7c..e21cb02d7 100644
--- a/sources/shiboken6/tests/libsample/reference.h
+++ b/sources/shiboken6/tests/libsample/reference.h
@@ -11,32 +11,33 @@ class LIBSAMPLE_API Reference
public:
explicit Reference(int objId = -1)
: m_objId(objId) {}
- virtual ~Reference() {}
+ virtual ~Reference() = default;
- inline int objId() { return m_objId; }
+ inline int objId() const { return m_objId; }
inline void setObjId(int objId) { m_objId = objId; }
- inline static int usesReference(Reference& r) { return r.m_objId; }
- inline static int usesConstReference(const Reference& r) { return r.m_objId; }
+ inline static int usesReference(Reference &r) { return r.m_objId; }
+ inline static int usesConstReference(const Reference &r) { return r.m_objId; }
- virtual int usesReferenceVirtual(Reference& r, int inc);
- virtual int usesConstReferenceVirtual(const Reference& r, int inc);
+ virtual int usesReferenceVirtual(Reference &r, int inc);
+ virtual int usesConstReferenceVirtual(const Reference &r, int inc);
- int callUsesReferenceVirtual(Reference& r, int inc);
- int callUsesConstReferenceVirtual(const Reference& r, int inc);
+ int callUsesReferenceVirtual(Reference &r, int inc);
+ int callUsesConstReferenceVirtual(const Reference &r, int inc);
- virtual void alterReferenceIdVirtual(Reference& r);
- void callAlterReferenceIdVirtual(Reference& r);
+ virtual void alterReferenceIdVirtual(Reference &r);
+ void callAlterReferenceIdVirtual(Reference &r);
void show() const;
inline static int multiplier() { return 10; }
- virtual Reference& returnMyFirstArg(Reference& ref) { return ref; }
- virtual Reference& returnMySecondArg(int a, Reference &ref);
+ virtual Reference &returnMyFirstArg(Reference &ref) { return ref; }
+ virtual Reference &returnMySecondArg(int a, Reference &ref);
// nonsense operator to test if Shiboken is ignoring dereference operators.
int operator*() { return m_objId; }
+
private:
int m_objId;
};
@@ -44,13 +45,13 @@ private:
class LIBSAMPLE_API ObjTypeReference
{
public:
- ObjTypeReference() {}
- ObjTypeReference(const ObjTypeReference&) {}
+ ObjTypeReference() = default;
+ ObjTypeReference(const ObjTypeReference &) {}
virtual ~ObjTypeReference();
- virtual ObjTypeReference& returnMyFirstArg(ObjTypeReference& ref) { return ref; }
+
+ virtual ObjTypeReference &returnMyFirstArg(ObjTypeReference &ref) { return ref; }
virtual ObjTypeReference &returnMySecondArg(int a, ObjTypeReference &ref);
- virtual ObjTypeReference& justAPureVirtualFunc(ObjTypeReference& ref) = 0;
+ virtual ObjTypeReference &justAPureVirtualFunc(ObjTypeReference &ref) = 0;
};
#endif // REFERENCE_H
-
diff --git a/sources/shiboken6/tests/libsample/removednamespaces.h b/sources/shiboken6/tests/libsample/removednamespaces.h
index 08b28fae5..669f2ebf0 100644
--- a/sources/shiboken6/tests/libsample/removednamespaces.h
+++ b/sources/shiboken6/tests/libsample/removednamespaces.h
@@ -46,4 +46,3 @@ namespace RemovedNamespace3
} // namespace UnremovedNamespace
#endif // REMOVEDNAMESPACE_H
-
diff --git a/sources/shiboken6/tests/libsample/sample.cpp b/sources/shiboken6/tests/libsample/sample.cpp
index 7437a341b..5b5f8588b 100644
--- a/sources/shiboken6/tests/libsample/sample.cpp
+++ b/sources/shiboken6/tests/libsample/sample.cpp
@@ -15,7 +15,7 @@ int sample::value() const
return m_value;
}
-bool operator==(const sample&s1, const sample&s2)
+bool operator==(const sample &s1, const sample &s2)
{
return s1.value() == s2.value();
}
diff --git a/sources/shiboken6/tests/libsample/sample.h b/sources/shiboken6/tests/libsample/sample.h
index 756b4687e..27909571a 100644
--- a/sources/shiboken6/tests/libsample/sample.h
+++ b/sources/shiboken6/tests/libsample/sample.h
@@ -20,9 +20,9 @@ namespace sample
};
// shiboken must not generate richcompare for namespace sample
- LIBSAMPLE_API bool operator==(const sample&s1, const sample&s2);
+ LIBSAMPLE_API bool operator==(const sample &s1, const sample &s2);
const int INT_CONSTANT = 42;
}
-#endif
+#endif // SAMPLE_H
diff --git a/sources/shiboken6/tests/libsample/samplenamespace.cpp b/sources/shiboken6/tests/libsample/samplenamespace.cpp
index 119a8b673..6a0805c7e 100644
--- a/sources/shiboken6/tests/libsample/samplenamespace.cpp
+++ b/sources/shiboken6/tests/libsample/samplenamespace.cpp
@@ -1,10 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+#include "samplenamespace.h"
+
#include <iostream>
#include <cstdlib>
#include <ctime>
-#include "samplenamespace.h"
namespace SampleNamespace
{
@@ -16,45 +17,44 @@ SomeClass::PublicScopedEnum SomeClass::protectedMethodReturningPublicScopedEnum(
return PublicScopedEnum::v1;
}
-OutValue
-enumInEnumOut(InValue in)
+OutValue enumInEnumOut(InValue in)
{
OutValue retval;
switch(in) {
- case ZeroIn:
- retval = ZeroOut;
- break;
- case OneIn:
- retval = OneOut;
- break;
- case TwoIn:
- retval = TwoOut;
- break;
- default:
- retval = (OutValue) -1;
+ case ZeroIn:
+ retval = ZeroOut;
+ break;
+ case OneIn:
+ retval = OneOut;
+ break;
+ case TwoIn:
+ retval = TwoOut;
+ break;
+ default:
+ retval = OutValue(-1);
+ break;
}
return retval;
}
-Option
-enumArgumentWithDefaultValue(Option opt)
+Option enumArgumentWithDefaultValue(Option opt)
{
return opt;
}
-int
-getNumber(Option opt)
+int getNumber(Option opt)
{
int retval;
switch(opt) {
- case RandomNumber:
- retval = rand() % 100;
- break;
- case UnixTime:
- retval = (int) std::time(nullptr);
- break;
- default:
- retval = 0;
+ case RandomNumber:
+ retval = rand() % 100;
+ break;
+ case UnixTime:
+ retval = int(std::time(nullptr));
+ break;
+ default:
+ retval = 0;
+ break;
}
return retval;
}
@@ -66,8 +66,7 @@ void doSomethingWithArray(const unsigned char *, unsigned int, const char *)
// to check compilation issues, i.e. if it compiles, it's ok.
}
-int
-enumItemAsDefaultValueToIntArgument(int value)
+int enumItemAsDefaultValueToIntArgument(int value)
{
return value;
}
@@ -88,14 +87,12 @@ void forceDecisorSideB(int, const Point &, const Str &, ObjectType *)
{
}
-double
-passReferenceToValueType(const Point& point, double multiplier)
+double passReferenceToValueType(const Point &point, double multiplier)
{
return (point.x() + point.y()) * multiplier;
}
-int
-passReferenceToObjectType(const ObjectType& obj, int multiplier)
+int passReferenceToObjectType(const ObjectType &obj, int multiplier)
{
return obj.objectName().size() * multiplier;
}
diff --git a/sources/shiboken6/tests/libsample/samplenamespace.h b/sources/shiboken6/tests/libsample/samplenamespace.h
index da75ead50..431b68eb2 100644
--- a/sources/shiboken6/tests/libsample/samplenamespace.h
+++ b/sources/shiboken6/tests/libsample/samplenamespace.h
@@ -4,12 +4,13 @@
#ifndef SAMPLENAMESPACE_H
#define SAMPLENAMESPACE_H
-#include <list>
#include "libsamplemacros.h"
#include "str.h"
#include "point.h"
#include "objecttype.h"
+#include <list>
+
// Anonymous global enum
enum {
AnonymousGlobalEnum_Value0,
@@ -28,7 +29,7 @@ inline namespace InlineNamespace
ClassWithinInlineNamespace() = default;
~ClassWithinInlineNamespace() = default;
ClassWithinInlineNamespace(const ClassWithinInlineNamespace &) = default;
- ClassWithinInlineNamespace& operator=(const ClassWithinInlineNamespace &) = default;
+ ClassWithinInlineNamespace &operator=(const ClassWithinInlineNamespace &) = default;
void setValue(EnumWithinInlineNamespace v) { m_value = v; }
EnumWithinInlineNamespace value() const { return m_value; }
@@ -74,7 +75,8 @@ inline double powerOfTwo(double num) {
return num * num;
}
-LIBSAMPLE_API void doSomethingWithArray(const unsigned char *data, unsigned int size, const char *format = nullptr);
+LIBSAMPLE_API void doSomethingWithArray(const unsigned char *data, unsigned int size,
+ const char *format = nullptr);
LIBSAMPLE_API int enumItemAsDefaultValueToIntArgument(int value = ZeroIn);
@@ -98,8 +100,9 @@ public:
NiceClassValue1, NiceClassValue2
};
- inline int someMethod(SomeInnerClass*) { return 0; }
- virtual OkThisIsRecursiveEnough* someVirtualMethod(OkThisIsRecursiveEnough* arg) { return arg; }
+ inline int someMethod(SomeInnerClass *) { return 0; }
+ virtual OkThisIsRecursiveEnough *someVirtualMethod(OkThisIsRecursiveEnough *arg)
+ { return arg; }
};
protected:
enum ProtectedEnum {
@@ -119,7 +122,8 @@ protected:
PublicScopedEnum protectedMethodReturningPublicScopedEnum() const;
};
-LIBSAMPLE_API inline int enumAsInt(SomeClass::PublicScopedEnum value) { return static_cast<int>(value); }
+LIBSAMPLE_API inline int enumAsInt(SomeClass::PublicScopedEnum value)
+{ return static_cast<int>(value); }
class DerivedFromNamespace : public SomeClass::SomeInnerClass::OkThisIsRecursiveEnough
{
@@ -128,29 +132,30 @@ public:
// only to cause namespace confusion
// enum SampleNamespace {
// };
- virtual OkThisIsRecursiveEnough* someVirtualMethod(OkThisIsRecursiveEnough* arg) { return arg; }
+ virtual OkThisIsRecursiveEnough *someVirtualMethod(OkThisIsRecursiveEnough *arg) { return arg; }
inline OkThisIsRecursiveEnough *methodReturningTypeFromParentScope() { return nullptr; }
};
// The combination of the following two overloaded methods could trigger a
// problematic behaviour on the overload decisor, if it isn't working properly.
LIBSAMPLE_API void forceDecisorSideA(ObjectType *object = nullptr);
-LIBSAMPLE_API void forceDecisorSideA(const Point& pt, const Str& text, ObjectType* object = 0);
+LIBSAMPLE_API void forceDecisorSideA(const Point &pt, const Str &text,
+ ObjectType *object = nullptr);
// The combination of the following two overloaded methods could trigger a
// problematic behaviour on the overload decisor, if it isn't working properly.
// This is a variation of forceDecisorSideB.
LIBSAMPLE_API void forceDecisorSideB(int a, ObjectType *object = nullptr);
-LIBSAMPLE_API void forceDecisorSideB(int a, const Point &pt, const Str &text, ObjectType *object = nullptr);
+LIBSAMPLE_API void forceDecisorSideB(int a, const Point &pt, const Str &text,
+ ObjectType *object = nullptr);
// Add a new signature on type system with only a Point value as parameter.
-LIBSAMPLE_API double passReferenceToValueType(const Point& point, double multiplier);
+LIBSAMPLE_API double passReferenceToValueType(const Point &point, double multiplier);
// Add a new signature on type system with only a ObjectType pointer as parameter.
-LIBSAMPLE_API int passReferenceToObjectType(const ObjectType& obj, int multiplier);
+LIBSAMPLE_API int passReferenceToObjectType(const ObjectType &obj, int multiplier);
extern LIBSAMPLE_API int variableInNamespace;
} // namespace SampleNamespace
#endif // SAMPLENAMESPACE_H
-
diff --git a/sources/shiboken6/tests/libsample/sbkdate.h b/sources/shiboken6/tests/libsample/sbkdate.h
index d102f62b8..5e1dd0b84 100644
--- a/sources/shiboken6/tests/libsample/sbkdate.h
+++ b/sources/shiboken6/tests/libsample/sbkdate.h
@@ -9,7 +9,7 @@
class LIBSAMPLE_API SbkDate
{
public:
- SbkDate(int d, int m, int y);
+ explicit SbkDate(int d, int m, int y);
int day() const;
int month() const;
@@ -22,4 +22,3 @@ private:
};
#endif // SBKDATE_H
-
diff --git a/sources/shiboken6/tests/libsample/simplefile.cpp b/sources/shiboken6/tests/libsample/simplefile.cpp
index 81ef849ae..86c951044 100644
--- a/sources/shiboken6/tests/libsample/simplefile.cpp
+++ b/sources/shiboken6/tests/libsample/simplefile.cpp
@@ -1,30 +1,29 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+#include "simplefile.h"
+
#include <cstdlib>
#include <cstring>
#include <fstream>
-#include "simplefile.h"
class SimpleFile_p
{
public:
- SimpleFile_p(const char* filename) : m_descriptor(nullptr), m_size(0)
- {
- m_filename = strdup(filename);
- }
+ SimpleFile_p(const char *filename) :
+ m_filename(strdup(filename)) {}
~SimpleFile_p()
{
- free(m_filename);
+ std::free(m_filename);
}
- char* m_filename;
- FILE* m_descriptor;
- long m_size;
+ char *m_filename;
+ FILE *m_descriptor = nullptr;
+ long m_size = 0;
};
-SimpleFile::SimpleFile(const char* filename)
+SimpleFile::SimpleFile(const char *filename)
{
p = new SimpleFile_p(filename);
}
@@ -35,7 +34,7 @@ SimpleFile::~SimpleFile()
delete p;
}
-const char* SimpleFile::filename()
+const char *SimpleFile::filename()
{
return p->m_filename;
}
@@ -45,12 +44,13 @@ long SimpleFile::size()
return p->m_size;
}
-bool
-SimpleFile::open()
+bool SimpleFile::open()
{
- if ((p->m_descriptor = fopen(p->m_filename, "rb")) == nullptr)
+ auto *descriptor = fopen(p->m_filename, "rb");
+ if (descriptor == nullptr)
return false;
+ p->m_descriptor = descriptor;
std::fseek(p->m_descriptor, 0, SEEK_END);
p->m_size = ftell(p->m_descriptor);
std::rewind(p->m_descriptor);
@@ -58,8 +58,7 @@ SimpleFile::open()
return true;
}
-void
-SimpleFile::close()
+void SimpleFile::close()
{
if (p->m_descriptor) {
std::fclose(p->m_descriptor);
@@ -67,17 +66,14 @@ SimpleFile::close()
}
}
-bool
-SimpleFile::exists() const
+bool SimpleFile::exists() const
{
std::ifstream ifile(p->m_filename);
return !ifile.fail();
}
-bool
-SimpleFile::exists(const char* filename)
+bool SimpleFile::exists(const char *filename)
{
std::ifstream ifile(filename);
return !ifile.fail();
}
-
diff --git a/sources/shiboken6/tests/libsample/simplefile.h b/sources/shiboken6/tests/libsample/simplefile.h
index 6bc75b926..e551dd3e5 100644
--- a/sources/shiboken6/tests/libsample/simplefile.h
+++ b/sources/shiboken6/tests/libsample/simplefile.h
@@ -11,20 +11,19 @@ class SimpleFile_p;
class LIBSAMPLE_API SimpleFile
{
public:
- explicit SimpleFile(const char* filename);
+ explicit SimpleFile(const char *filename);
~SimpleFile();
- const char* filename();
+ const char *filename();
long size();
bool open();
void close();
bool exists() const;
- static bool exists(const char* filename);
+ static bool exists(const char *filename);
private:
SimpleFile_p *p;
};
#endif // SIMPLEFILE_H
-
diff --git a/sources/shiboken6/tests/libsample/size.cpp b/sources/shiboken6/tests/libsample/size.cpp
index e8e5ce85f..0291d6e86 100644
--- a/sources/shiboken6/tests/libsample/size.cpp
+++ b/sources/shiboken6/tests/libsample/size.cpp
@@ -1,12 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-#include <iostream>
#include "size.h"
-void
-Size::show() const
+#include <iostream>
+
+void Size::show() const
{
std::cout << "(width: " << m_width << ", height: " << m_height << ")";
}
-
diff --git a/sources/shiboken6/tests/libsample/size.h b/sources/shiboken6/tests/libsample/size.h
index ac57065af..011999d72 100644
--- a/sources/shiboken6/tests/libsample/size.h
+++ b/sources/shiboken6/tests/libsample/size.h
@@ -9,23 +9,24 @@
class LIBSAMPLE_API Size
{
public:
- Size(double width = 0.0, double height = 0.0) : m_width(width), m_height(height) {}
- ~Size() {}
+ explicit Size(double width = 0.0, double height = 0.0) :
+ m_width(width), m_height(height) {}
+ ~Size() = default;
- inline double width() { return m_width; }
+ inline double width() const { return m_width; }
inline void setWidth(double width) { m_width = width; }
- inline double height() { return m_height; }
+ inline double height() const { return m_height; }
inline void setHeight(double height) { m_height = height; }
inline double calculateArea() const { return m_width * m_height; }
// Comparison Operators
- inline bool operator<(const Size& other)
+ inline bool operator<(const Size &other)
{
return calculateArea() < other.calculateArea();
}
- inline bool operator>(const Size& other)
+ inline bool operator>(const Size &other)
{
// On some x86 hardware and compiler combinations, floating point
// comparisons may fail due to a hardware bug. One workaround is to
@@ -37,7 +38,7 @@ public:
return a > b;
}
- inline bool operator<=(const Size& other)
+ inline bool operator<=(const Size &other)
{
// See comments for operator>()
double a = calculateArea();
@@ -45,7 +46,7 @@ public:
return a <= b;
}
- inline bool operator>=(const Size& other)
+ inline bool operator>=(const Size &other)
{
return calculateArea() >= other.calculateArea();
}
@@ -56,28 +57,28 @@ public:
inline bool operator>=(double area) { return calculateArea() >= area; }
// Arithmetic Operators
- inline Size& operator+=(const Size& s)
+ inline Size &operator+=(const Size &s)
{
m_width += s.m_width;
m_height += s.m_height;
return *this;
}
- inline Size& operator-=(const Size& s)
+ inline Size &operator-=(const Size &s)
{
m_width -= s.m_width;
m_height -= s.m_height;
return *this;
}
- inline Size& operator*=(double mult)
+ inline Size &operator*=(double mult)
{
m_width *= mult;
m_height *= mult;
return *this;
}
- inline Size& operator/=(double div)
+ inline Size &operator/=(double div)
{
m_width /= div;
m_height /= div;
@@ -108,70 +109,71 @@ private:
};
// Comparison Operators
-inline bool operator!=(const Size& s1, const Size& s2)
+inline bool operator!=(const Size &s1, const Size &s2)
{
return s1.m_width != s2.m_width || s1.m_height != s2.m_height;
}
-inline bool operator==(const Size& s1, const Size& s2)
+inline bool operator==(const Size &s1, const Size &s2)
{
return s1.m_width == s2.m_width && s1.m_height == s2.m_height;
}
-inline bool operator<(double area, const Size& s)
+inline bool operator<(double area, const Size &s)
{
return area < s.calculateArea();
}
-inline bool operator>(double area, const Size& s)
+inline bool operator>(double area, const Size &s)
{
return area > s.calculateArea();
}
-inline bool operator<=(double area, const Size& s)
+inline bool operator<=(double area, const Size &s)
{
return area <= s.calculateArea();
}
-inline bool operator>=(double area, const Size& s)
+inline bool operator>=(double area, const Size &s)
{
return area >= s.calculateArea();
}
// Arithmetic Operators
-inline const Size operator+(const Size& s1, const Size& s2)
+inline const Size operator+(const Size &s1, const Size &s2)
{
return Size(s1.m_width + s2.m_width, s1.m_height + s2.m_height);
}
-inline const Size operator-(const Size& s1, const Size& s2)
+inline const Size operator-(const Size &s1, const Size &s2)
{
return Size(s1.m_width - s2.m_width, s1.m_height - s2.m_height);
}
-inline const Size operator*(const Size& s, double mult)
+inline const Size operator*(const Size &s, double mult)
{
return Size(s.m_width * mult, s.m_height * mult);
}
-inline const Size operator*(double mult, const Size& s)
+inline const Size operator*(double mult, const Size &s)
{
return Size(s.m_width * mult, s.m_height * mult);
}
-inline const Size operator/(const Size& s, double div)
+inline const Size operator/(const Size &s, double div)
{
return Size(s.m_width / div, s.m_height / div);
}
using real = double;
using ushort = unsigned short;
+
class LIBSAMPLE_API SizeF
{
public:
- SizeF(real width, real height) : m_width(width), m_height(height) {}
- real width() { return m_width; }
- real height() { return m_height; }
+ explicit SizeF(real width, real height) : m_width(width), m_height(height) {}
+ real width() const { return m_width; }
+ real height() const { return m_height; }
static inline ushort passTypedefOfUnsignedShort(ushort value) { return value; }
private:
real m_width;
@@ -179,4 +181,3 @@ private:
};
#endif // SIZE_H
-
diff --git a/sources/shiboken6/tests/libsample/sometime.cpp b/sources/shiboken6/tests/libsample/sometime.cpp
index daeae6df4..ad9a0d81c 100644
--- a/sources/shiboken6/tests/libsample/sometime.cpp
+++ b/sources/shiboken6/tests/libsample/sometime.cpp
@@ -5,8 +5,7 @@
#include <cstdio>
-void
-Time::setTime()
+void Time::setTime()
{
m_hour = 0;
m_minute = 0;
@@ -15,8 +14,7 @@ Time::setTime()
m_is_null = true;
}
-void
-Time::setTime(int h, int m, int s, int ms)
+void Time::setTime(int h, int m, int s, int ms)
{
m_hour = h;
m_minute = m;
@@ -25,9 +23,7 @@ Time::setTime(int h, int m, int s, int ms)
m_is_null = false;
}
-
-Time::NumArgs
-Time::somethingCompletelyDifferent()
+Time::NumArgs Time::somethingCompletelyDifferent()
{
return ZeroArgs;
}
@@ -41,8 +37,7 @@ Time::NumArgs Time::somethingCompletelyDifferent(int, int, ImplicitConv ic, Obje
return ThreeArgs;
}
-Str
-Time::toString() const
+Str Time::toString() const
{
if (m_is_null)
return Str();
@@ -52,8 +47,7 @@ Time::toString() const
return Str(buffer);
}
-bool
-Time::operator==(const Time& other) const
+bool Time::operator==(const Time &other) const
{
return m_hour == other.m_hour
&& m_minute == other.m_minute
@@ -62,8 +56,7 @@ Time::operator==(const Time& other) const
&& m_is_null == other.m_is_null;
}
-bool
-Time::operator!=(const Time& other) const
+bool Time::operator!=(const Time &other) const
{
return !operator==(other);
}
@@ -72,4 +65,3 @@ Time::operator Str() const
{
return Time::toString();
}
-
diff --git a/sources/shiboken6/tests/libsample/sometime.h b/sources/shiboken6/tests/libsample/sometime.h
index 0e3442db0..5014da25d 100644
--- a/sources/shiboken6/tests/libsample/sometime.h
+++ b/sources/shiboken6/tests/libsample/sometime.h
@@ -19,14 +19,12 @@ public:
FourArgs
};
- Time()
- : m_hour(0), m_minute(0), m_second(0), m_msec(0), m_is_null(true)
- {}
- Time(int h, int m, int s = 0, int ms = 0)
- : m_hour(h), m_minute(m), m_second(s), m_msec(ms), m_is_null(false)
+ Time() = default;
+ explicit Time(int h, int m, int s = 0, int ms = 0) :
+ m_hour(h), m_minute(m), m_second(s), m_msec(ms), m_is_null(false)
{}
- ~Time() {}
+ ~Time() = default;
inline bool isNull() const { return m_is_null; }
@@ -48,20 +46,19 @@ public:
ObjectType *type = nullptr);
Str toString() const;
- bool operator==(const Time& other) const;
- bool operator!=(const Time& other) const;
+ bool operator==(const Time &other) const;
+ bool operator!=(const Time &other) const;
// This cast operator must become an implicit conversion of Str.
operator Str() const;
private:
- int m_hour;
- int m_minute;
- int m_second;
- int m_msec;
+ int m_hour = 0;
+ int m_minute = 0;
+ int m_second = 0;
+ int m_msec = 0;
- bool m_is_null;
+ bool m_is_null = true;
};
#endif // SOMETIME_H
-
diff --git a/sources/shiboken6/tests/libsample/str.cpp b/sources/shiboken6/tests/libsample/str.cpp
index 773718c35..96fbba74a 100644
--- a/sources/shiboken6/tests/libsample/str.cpp
+++ b/sources/shiboken6/tests/libsample/str.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "str.h"
+
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -13,69 +14,61 @@ Str::Str(char c)
init(str);
}
-Str::Str(const char* cstr)
+Str::Str(const char *cstr)
{
init(cstr);
}
-void
-Str::init(const char* cstr)
+void Str::init(const char *cstr)
{
if (cstr)
m_str = cstr;
}
-Str
-Str::arg(const Str& s) const
+Str Str::arg(const Str &s) const
{
size_t idx = m_str.find_first_of("%VAR");
- if (idx == std::string::npos) {
+ if (idx == std::string::npos)
return *this;
- } else {
- std::string result = m_str;
- result.replace(idx, 4, s.m_str);
- return result.c_str();
- }
+
+ std::string result = m_str;
+ result.replace(idx, 4, s.m_str);
+ return result.c_str();
}
-Str&
-Str::append(const Str& s)
+Str &Str::append(const Str &s)
{
m_str += s.m_str;
return *this;
}
-Str&
-Str::prepend(const Str& s)
+Str &Str::prepend(const Str &s)
{
m_str = s.m_str + m_str;
return *this;
}
-const char*
-Str::cstring() const
+const char *Str::cstring() const
{
return m_str.c_str();
}
-int
-Str::toInt(bool* ok, int base) const
+int Str::toInt(bool *ok, int base) const
{
- bool my_ok;
int result = 0;
std::istringstream conv(m_str);
switch (base) {
- case 8:
- conv >> std::oct >> result;
- break;
- case 10:
- conv >> std::dec >> result;
- break;
- case 16:
- conv >> std::hex >> result;
- break;
+ case 8:
+ conv >> std::oct >> result;
+ break;
+ case 10:
+ conv >> std::dec >> result;
+ break;
+ case 16:
+ conv >> std::hex >> result;
+ break;
}
- my_ok = std::istringstream::eofbit & conv.rdstate();
+ const bool my_ok = std::istringstream::eofbit &conv.rdstate();
if (!my_ok)
result = 0;
if (ok)
@@ -83,20 +76,17 @@ Str::toInt(bool* ok, int base) const
return result;
}
-void
-Str::show() const
+void Str::show() const
{
- printf("%s", cstring());
+ std::printf("%s", cstring());
}
-char
-Str::get_char(int pos) const
+char Str::get_char(int pos) const
{
return m_str[pos];
}
-bool
-Str::set_char(int pos, char ch)
+bool Str::set_char(int pos, char ch)
{
m_str[pos] = ch;
return true;
@@ -109,24 +99,24 @@ Str Str::operator+(int number) const
return in.str().c_str();
}
-bool Str::operator==(const Str& other) const
+bool Str::operator==(const Str &other) const
{
return m_str == other.m_str;
}
-Str operator+(int number, const Str& str)
+Str operator+(int number, const Str &str)
{
std::ostringstream in;
in << number << str.m_str;
return in.str().c_str();
}
-bool Str::operator<(const Str& other) const
+bool Str::operator<(const Str &other) const
{
return m_str < other.m_str;
}
-unsigned int strHash(const Str& str)
+unsigned int strHash(const Str &str)
{
unsigned int result = 0;
for (char c : str.m_str)
@@ -134,12 +124,12 @@ unsigned int strHash(const Str& str)
return result;
}
-void changePStr(PStr* pstr, const char* suffix)
+void changePStr(PStr *pstr, const char *suffix)
{
pstr->append(suffix);
}
-void duplicatePStr(PStr* pstr)
+void duplicatePStr(PStr *pstr)
{
if (!pstr)
return;
diff --git a/sources/shiboken6/tests/libsample/str.h b/sources/shiboken6/tests/libsample/str.h
index a58f34bdb..e75e33085 100644
--- a/sources/shiboken6/tests/libsample/str.h
+++ b/sources/shiboken6/tests/libsample/str.h
@@ -3,22 +3,23 @@
#ifndef STR_H
#define STR_H
-#include <string>
#include "libsamplemacros.h"
+#include <string>
+
class LIBSAMPLE_API Str
{
public:
Str(char c);
- Str(const char* cstr = "");
+ Str(const char *cstr = "");
- Str arg(const Str& s) const;
+ Str arg(const Str &s) const;
- Str& append(const Str& s);
- Str& prepend(const Str& s);
+ Str &append(const Str &s);
+ Str &prepend(const Str &s);
- const char* cstring() const;
+ const char *cstring() const;
char get_char(int pos) const;
bool set_char(int pos, char ch);
@@ -30,22 +31,22 @@ public:
// nonsense operator just to test reverse operators
Str operator+(int number) const;
- bool operator==(const Str& other) const;
- bool operator<(const Str& other) const;
+ bool operator==(const Str &other) const;
+ bool operator<(const Str &other) const;
private:
- void init(const char* cstr);
+ void init(const char *cstr);
std::string m_str;
- friend LIBSAMPLE_API Str operator+(int number, const Str& str);
- friend LIBSAMPLE_API unsigned int strHash(const Str& str);
+ friend LIBSAMPLE_API Str operator+(int number, const Str &str);
+ friend LIBSAMPLE_API unsigned int strHash(const Str &str);
};
-LIBSAMPLE_API Str operator+(int number, const Str& str);
-LIBSAMPLE_API unsigned int strHash(const Str& str);
+LIBSAMPLE_API Str operator+(int number, const Str &str);
+LIBSAMPLE_API unsigned int strHash(const Str &str);
using PStr = Str;
-LIBSAMPLE_API void changePStr(PStr* pstr, const char* suffix);
+LIBSAMPLE_API void changePStr(PStr *pstr, const char *suffix);
LIBSAMPLE_API void duplicatePStr(PStr *pstr = nullptr);
#endif // STR_H
diff --git a/sources/shiboken6/tests/libsample/strlist.cpp b/sources/shiboken6/tests/libsample/strlist.cpp
index 845b83a0d..5840a0516 100644
--- a/sources/shiboken6/tests/libsample/strlist.cpp
+++ b/sources/shiboken6/tests/libsample/strlist.cpp
@@ -5,15 +5,13 @@
#include <algorithm>
-bool
-StrList::operator==(const std::list<Str>& other) const
+bool StrList::operator==(const std::list<Str> &other) const
{
return size() == other.size()
&& std::equal(begin(), end(), other.begin());
}
-Str
-StrList::join(const Str& sep) const
+Str StrList::join(const Str &sep) const
{
Str result;
const auto i1 = begin();
diff --git a/sources/shiboken6/tests/libsample/strlist.h b/sources/shiboken6/tests/libsample/strlist.h
index eb89b4c58..4c6e331f7 100644
--- a/sources/shiboken6/tests/libsample/strlist.h
+++ b/sources/shiboken6/tests/libsample/strlist.h
@@ -4,10 +4,10 @@
#ifndef STRLIST_H
#define STRLIST_H
-#include <list>
+#include "libsamplemacros.h"
#include "str.h"
-#include "libsamplemacros.h"
+#include <list>
class LIBSAMPLE_API StrList : public std::list<Str>
{
@@ -19,24 +19,28 @@ public:
ListOfStrCtor
};
- inline StrList() : m_ctorUsed(NoParamsCtor) {}
- inline explicit StrList(const Str& str) : m_ctorUsed(StrCtor) { push_back(str); }
- inline StrList(const std::list<Str>& lst) : std::list<Str>(lst), m_ctorUsed(ListOfStrCtor) {}
+ inline StrList() = default;
+ inline StrList(const std::list<Str> &lst) :
+ std::list<Str>(lst), m_ctorUsed(ListOfStrCtor) {}
+ inline explicit StrList(const Str &str) :
+ m_ctorUsed(StrCtor) { push_back(str); }
+ inline StrList(const StrList &lst) :
+ std::list<Str>(lst), m_ctorUsed(CopyCtor) {}
- inline StrList(const StrList &lst) : std::list<Str>(lst), m_ctorUsed(CopyCtor) {}
StrList(StrList &&) = default;
StrList &operator=(const StrList &) = default;
StrList &operator=(StrList &&) = default;
- inline void append(Str str) { push_back(str); }
- Str join(const Str& sep) const;
+ inline void append(const Str &str) { push_back(str); }
+ Str join(const Str &sep) const;
+
+ bool operator==(const std::list<Str> &other) const;
+ inline bool operator!=(const std::list<Str> &other) const { return !(*this == other); }
- bool operator==(const std::list<Str>& other) const;
- inline bool operator!=(const std::list<Str>& other) const { return !(*this == other); }
+ CtorEnum constructorUsed() const { return m_ctorUsed; }
- CtorEnum constructorUsed() { return m_ctorUsed; }
private:
- CtorEnum m_ctorUsed;
+ CtorEnum m_ctorUsed = NoParamsCtor;
};
using PStrList = StrList;
diff --git a/sources/shiboken6/tests/libsample/templateptr.h b/sources/shiboken6/tests/libsample/templateptr.h
index e8145b90d..bf230c363 100644
--- a/sources/shiboken6/tests/libsample/templateptr.h
+++ b/sources/shiboken6/tests/libsample/templateptr.h
@@ -4,15 +4,16 @@
#ifndef TEMPLATEPTR_H
#define TEMPLATEPTR_H
-#include <utility>
-#include <list>
#include "libsamplemacros.h"
#include "blackbox.h"
+#include <utility>
+#include <list>
+
class LIBSAMPLE_API TemplatePtr
{
public:
- void dummy(std::list<std::pair<BlackBox *, BlackBox *> > & items);
+ void dummy(std::list<std::pair<BlackBox *, BlackBox *> > &items);
};
-#endif
+#endif // TEMPLATEPTR_H
diff --git a/sources/shiboken6/tests/libsample/transform.cpp b/sources/shiboken6/tests/libsample/transform.cpp
index 33fbff9d7..ebcab630a 100644
--- a/sources/shiboken6/tests/libsample/transform.cpp
+++ b/sources/shiboken6/tests/libsample/transform.cpp
@@ -6,12 +6,11 @@
#include <cmath>
-Point applyHomogeneousTransform(
- const Point& in,
- double m11, double m12, double m13,
- double m21, double m22, double m23,
- double m31, double m32, double m33,
- bool* okay)
+Point applyHomogeneousTransform(const Point &in,
+ double m11, double m12, double m13,
+ double m21, double m22, double m23,
+ double m31, double m32, double m33,
+ bool *okay)
{
double x = m11 * in.x() + m12 * in.y() + m13;
double y = m21 * in.x() + m22 * in.y() + m23;
diff --git a/sources/shiboken6/tests/libsample/transform.h b/sources/shiboken6/tests/libsample/transform.h
index a39445c40..34ebf40d3 100644
--- a/sources/shiboken6/tests/libsample/transform.h
+++ b/sources/shiboken6/tests/libsample/transform.h
@@ -9,12 +9,10 @@
#include "libsamplemacros.h"
-LIBSAMPLE_API Point
-applyHomogeneousTransform(
- const Point& in,
- double m11, double m12, double m13,
- double m21, double m22, double m23,
- double m31, double m32, double m33,
- bool* okay);
+LIBSAMPLE_API Point applyHomogeneousTransform(const Point &in,
+ double m11, double m12, double m13,
+ double m21, double m22, double m23,
+ double m31, double m32, double m33,
+ bool *okay);
#endif // TRANSFORM_H
diff --git a/sources/shiboken6/tests/libsample/valueandvirtual.h b/sources/shiboken6/tests/libsample/valueandvirtual.h
index 25391cc0c..7bdc504e2 100644
--- a/sources/shiboken6/tests/libsample/valueandvirtual.h
+++ b/sources/shiboken6/tests/libsample/valueandvirtual.h
@@ -7,15 +7,15 @@
class ValueAndVirtual
{
public:
- ValueAndVirtual(int id) : m_id(id) {}
+ explicit ValueAndVirtual(int id) : m_id(id) {}
+ virtual ~ValueAndVirtual() = default;
bool operator()(int id, int id2) { return id == id2; }
- inline int id() { return m_id; }
- virtual ~ValueAndVirtual() {};
+ inline int id() const { return m_id; }
+
private:
int m_id;
};
#endif // VALUEANDVIRTUAL_H
-
diff --git a/sources/shiboken6/tests/libsample/virtualmethods.cpp b/sources/shiboken6/tests/libsample/virtualmethods.cpp
index fa2247a69..515564664 100644
--- a/sources/shiboken6/tests/libsample/virtualmethods.cpp
+++ b/sources/shiboken6/tests/libsample/virtualmethods.cpp
@@ -5,14 +5,12 @@
int VirtualDtor::dtor_called = 0;
-double
-VirtualMethods::virtualMethod0(Point pt, int val, Complex cpx, bool b)
+double VirtualMethods::virtualMethod0(Point pt, int val, Complex cpx, bool b)
{
return (pt.x() * pt.y() * val) + cpx.imag() + ((int) b);
}
-bool
-VirtualMethods::createStr(const char* text, Str*& ret)
+bool VirtualMethods::createStr(const char *text, Str *&ret)
{
if (!text) {
ret = nullptr;
@@ -23,8 +21,7 @@ VirtualMethods::createStr(const char* text, Str*& ret)
return true;
}
-void
-VirtualMethods::getMargins(int* left, int* top, int* right, int* bottom) const
+void VirtualMethods::getMargins(int *left, int *top, int *right, int *bottom) const
{
*left = m_left;
*top = m_top;
diff --git a/sources/shiboken6/tests/libsample/virtualmethods.h b/sources/shiboken6/tests/libsample/virtualmethods.h
index 5a1438a4a..e8f25552c 100644
--- a/sources/shiboken6/tests/libsample/virtualmethods.h
+++ b/sources/shiboken6/tests/libsample/virtualmethods.h
@@ -17,11 +17,8 @@
class LIBSAMPLE_API VirtualMethods
{
public:
- VirtualMethods(Str name = "VirtualMethods") : m_name(name)
- {
- m_left = m_top = m_right = m_bottom = 0;
- }
- virtual ~VirtualMethods() {}
+ explicit VirtualMethods(Str name = "VirtualMethods") : m_name(name) {}
+ virtual ~VirtualMethods() = default;
virtual double virtualMethod0(Point pt, int val, Complex cpx, bool b);
double callVirtualMethod0(Point pt, int val, Complex cpx, bool b)
@@ -61,12 +58,14 @@ public:
void callCallMe() { callMe(); }
// Passing reference to pointers.
- virtual bool createStr(const char* text, Str*& ret);
- bool callCreateStr(const char* text, Str*& ret) { return createStr(text, ret); }
+ virtual bool createStr(const char *text, Str *&ret);
+ bool callCreateStr(const char *text, Str *&ret) { return createStr(text, ret); }
// Return a non-binded method
- std::list<Str> callStrListToStdList(const StrList& strList) { return strListToStdList(strList); }
- virtual std::list<Str> strListToStdList(const StrList& strList ) { return strList; }
+ std::list<Str> callStrListToStdList(const StrList &strList)
+ { return strListToStdList(strList); }
+ virtual std::list<Str> strListToStdList(const StrList &strList )
+ { return strList; }
void setMargins(int left, int top, int right, int bottom)
{
@@ -75,8 +74,8 @@ public:
m_right = right;
m_bottom = bottom;
}
- virtual void getMargins(int* left, int* top, int* right, int* bottom) const;
- void callGetMargins(int* left, int* top, int* right, int* bottom) const
+ virtual void getMargins(int *left, int *top, int *right, int *bottom) const;
+ void callGetMargins(int *left, int *top, int *right, int *bottom) const
{
getMargins(left, top, right, bottom);
}
@@ -84,7 +83,7 @@ public:
virtual int recursionOnModifiedVirtual(Str arg) const;
int callRecursionOnModifiedVirtual(Str arg) const { return recursionOnModifiedVirtual(arg); }
- virtual const Str & returnConstRef() const;
+ virtual const Str &returnConstRef() const;
virtual int stringViewLength(std::string_view in) const;
@@ -94,10 +93,10 @@ protected:
private:
Str m_name;
- int m_left;
- int m_top;
- int m_right;
- int m_bottom;
+ int m_left = 0;
+ int m_top = 0;
+ int m_right = 0;
+ int m_bottom = 0;
};
class LIBSAMPLE_API VirtualDaughter : public VirtualMethods
@@ -128,10 +127,10 @@ public:
class LIBSAMPLE_API VirtualDtor
{
public:
- VirtualDtor() {}
+ VirtualDtor() = default;
virtual ~VirtualDtor() { dtor_called++; }
- static VirtualDtor* create() { return new VirtualDtor(); }
+ static VirtualDtor *create() { return new VirtualDtor(); }
static int dtorCalled() { return dtor_called; }
static void resetDtorCounter() { dtor_called = 0; }
@@ -140,4 +139,3 @@ private:
};
#endif // VIRTUALMETHODS_H
-
diff --git a/sources/shiboken6/tests/libsample/voidholder.h b/sources/shiboken6/tests/libsample/voidholder.h
index b5e59ba3d..7dddbfdea 100644
--- a/sources/shiboken6/tests/libsample/voidholder.h
+++ b/sources/shiboken6/tests/libsample/voidholder.h
@@ -4,26 +4,25 @@
#ifndef VOIDHOLDER_H
#define VOIDHOLDER_H
-#include "libsamplemacros.h"
-
class VoidHolder
{
public:
explicit VoidHolder(void *ptr = nullptr) : m_ptr(ptr) {}
- ~VoidHolder() {}
- inline void* voidPointer() { return m_ptr; }
- inline static void* gimmeMeSomeVoidPointer()
+ ~VoidHolder() = default;
+
+ inline void *voidPointer() { return m_ptr; }
+ inline static void *gimmeMeSomeVoidPointer()
{
- static void* pointerToSomething = new VoidHolder();
+ static void *pointerToSomething = new VoidHolder();
return pointerToSomething;
}
void *takeVoidPointer(void *item)
{
return item;
}
+
private:
- void* m_ptr;
+ void *m_ptr;
};
#endif // VOIDHOLDER_H
-
diff --git a/sources/shiboken6/tests/libsmart/smart_sharedptr.h b/sources/shiboken6/tests/libsmart/smart_sharedptr.h
index 7d0365dd0..279e199dc 100644
--- a/sources/shiboken6/tests/libsmart/smart_sharedptr.h
+++ b/sources/shiboken6/tests/libsmart/smart_sharedptr.h
@@ -38,7 +38,7 @@ public:
logCopyConstructor(typeid(T).name(), this, data());
}
- SharedPtr& operator=(const SharedPtr& other)
+ SharedPtr &operator=(const SharedPtr &other)
{
mPtr = other.mPtr;
return *this;