aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libother
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/tests/libother')
-rw-r--r--sources/shiboken6/tests/libother/CMakeLists.txt17
-rw-r--r--sources/shiboken6/tests/libother/extendsnoimplicitconversion.h3
-rw-r--r--sources/shiboken6/tests/libother/number.cpp20
-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.h6
-rw-r--r--sources/shiboken6/tests/libother/otherobjecttype.cpp5
-rw-r--r--sources/shiboken6/tests/libother/otherobjecttype.h8
-rw-r--r--sources/shiboken6/tests/libother/smartptrtester.cpp2
11 files changed, 47 insertions, 61 deletions
diff --git a/sources/shiboken6/tests/libother/CMakeLists.txt b/sources/shiboken6/tests/libother/CMakeLists.txt
index c078d3546..0379d740b 100644
--- a/sources/shiboken6/tests/libother/CMakeLists.txt
+++ b/sources/shiboken6/tests/libother/CMakeLists.txt
@@ -1,12 +1,17 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
project(libother)
set(libother_SRC
-number.cpp
-otherderived.cpp
-otherobjecttype.cpp
-othermultiplederived.cpp
-smartptrtester.cpp
-othertypesystypedef.cpp
+extendsnoimplicitconversion.h
+libothermacros.h
+number.cpp number.h
+otherderived.cpp otherderived.h
+othermultiplederived.cpp othermultiplederived.h
+otherobjecttype.cpp otherobjecttype.h
+othertypesystypedef.cpp othertypesystypedef.h
+smartptrtester.cpp smartptrtester.h
)
add_library(libother SHARED ${libother_SRC})
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 c21c7c086..fbf50dc4a 100644
--- a/sources/shiboken6/tests/libother/number.cpp
+++ b/sources/shiboken6/tests/libother/number.cpp
@@ -2,33 +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>
-using namespace std;
+#include <sstream>
-Str
-Number::toStr() const
+Str Number::toStr() const
{
- ostringstream in;
+ 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());
+ return {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..d6bde8808 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(); }
+ 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..cd9910687 100644
--- a/sources/shiboken6/tests/libother/othermultiplederived.h
+++ b/sources/shiboken6/tests/libother/othermultiplederived.h
@@ -10,12 +10,12 @@
class ObjectType;
-class LIBOTHER_API OtherMultipleDerived : public MDerived1
+class LIBOTHER_API OtherMultipleDerived : public OtherBase, 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/libother/smartptrtester.cpp b/sources/shiboken6/tests/libother/smartptrtester.cpp
index 25b6a406e..1c6496b1a 100644
--- a/sources/shiboken6/tests/libother/smartptrtester.cpp
+++ b/sources/shiboken6/tests/libother/smartptrtester.cpp
@@ -5,7 +5,7 @@
SharedPtr<Str> SmartPtrTester::createSharedPtrStr(const char *what)
{
- return SharedPtr<Str>(new Str(what));
+ return {new Str(what)};
}
std::string SmartPtrTester::valueOfSharedPtrStr(const SharedPtr<Str> &str)