diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-22 17:50:30 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-22 18:20:59 +0200 |
commit | 9c333ade1a1b694fc6ce22e483f5de3e952c17ad (patch) | |
tree | d3a2e41de3501f91ebfdc8ec81a80156597c2585 /sources/shiboken2/tests/libother | |
parent | 8f3761d8eac7780393382ab54dbdb487eb4df027 (diff) |
move everying into sources/shiboken2 (5.9 edition)
in preparation for a subtree merge.
this should not be necessary to do in a separate commit, but git is a
tad stupid about following history correctly without it.
Diffstat (limited to 'sources/shiboken2/tests/libother')
-rw-r--r-- | sources/shiboken2/tests/libother/CMakeLists.txt | 18 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/extendsnoimplicitconversion.h | 45 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/libothermacros.h | 46 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/number.cpp | 59 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/number.h | 57 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/otherderived.cpp | 61 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/otherderived.h | 65 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/othermultiplederived.cpp | 50 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/othermultiplederived.h | 46 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/otherobjecttype.cpp | 36 | ||||
-rw-r--r-- | sources/shiboken2/tests/libother/otherobjecttype.h | 49 |
11 files changed, 532 insertions, 0 deletions
diff --git a/sources/shiboken2/tests/libother/CMakeLists.txt b/sources/shiboken2/tests/libother/CMakeLists.txt new file mode 100644 index 000000000..9b3cf5552 --- /dev/null +++ b/sources/shiboken2/tests/libother/CMakeLists.txt @@ -0,0 +1,18 @@ +project(libother) + +set(libother_SRC +number.cpp +otherderived.cpp +otherobjecttype.cpp +othermultiplederived.cpp +) + +add_definitions("-DLIBOTHER_BUILD") +add_library(libother SHARED ${libother_SRC}) +set_property(TARGET libother PROPERTY PREFIX "") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR} + ${libsample_SOURCE_DIR} + ${libsample_SOURCE_DIR}/..) +target_link_libraries(libother libsample) + diff --git a/sources/shiboken2/tests/libother/extendsnoimplicitconversion.h b/sources/shiboken2/tests/libother/extendsnoimplicitconversion.h new file mode 100644 index 000000000..744bfdc0d --- /dev/null +++ b/sources/shiboken2/tests/libother/extendsnoimplicitconversion.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EXTENDSNOIMPLICITCONVERSION_H +#define EXTENDSNOIMPLICITCONVERSION_H + +#include "libothermacros.h" +#include "noimplicitconversion.h" + +class ExtendsNoImplicitConversion +{ +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 + diff --git a/sources/shiboken2/tests/libother/libothermacros.h b/sources/shiboken2/tests/libother/libothermacros.h new file mode 100644 index 000000000..41a4fb13e --- /dev/null +++ b/sources/shiboken2/tests/libother/libothermacros.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LIBOTHERMACROS_H +#define LIBOTHERMACROS_H + +#if defined _WIN32 || defined __CYGWIN__ + #if LIBOTHER_BUILD + #define LIBOTHER_API __declspec(dllexport) + #else + #define LIBOTHER_API __declspec(dllimport) + #endif +#else +#if __GNUC__ >= 4 + #define LIBOTHER_API __attribute__ ((visibility("default"))) +#else + #define LIBOTHER_API +#endif +#endif + +#endif diff --git a/sources/shiboken2/tests/libother/number.cpp b/sources/shiboken2/tests/libother/number.cpp new file mode 100644 index 000000000..4da254286 --- /dev/null +++ b/sources/shiboken2/tests/libother/number.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "number.h" +#include <cstring> +#include <sstream> + +using namespace std; + +Str +Number::toStr() const +{ + ostringstream in; + in << m_value; + return in.str().c_str(); +} + +Point +operator*(const Point& p, const Number& n) +{ + return Point(p.x() * n.value(), p.y() * n.value()); +} + +Complex +Number::toComplex() const +{ + return Complex(m_value); +} + +Number +Number::fromComplex(Complex cpx) +{ + return Number(cpx.real()); +} diff --git a/sources/shiboken2/tests/libother/number.h b/sources/shiboken2/tests/libother/number.h new file mode 100644 index 000000000..4286068d5 --- /dev/null +++ b/sources/shiboken2/tests/libother/number.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef NUMBER_H +#define NUMBER_H + +#include "libothermacros.h" +#include "str.h" +#include "point.h" +#include "complex.h" + +class LIBOTHER_API Number +{ +public: + explicit Number(int value) : m_value(value) {}; + inline int value() const { return m_value; } + + Str toStr() const; + inline operator Str() const { return toStr(); } + + friend LIBOTHER_API Point operator*(const Point&, const Number&); + + Complex toComplex() const; + static Number fromComplex(Complex cpx); + +private: + int m_value; +}; + +LIBOTHER_API Point operator*(const Point&, const Number&); + +#endif // NUMBER_H diff --git a/sources/shiboken2/tests/libother/otherderived.cpp b/sources/shiboken2/tests/libother/otherderived.cpp new file mode 100644 index 000000000..4128d73ff --- /dev/null +++ b/sources/shiboken2/tests/libother/otherderived.cpp @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "otherderived.h" + +OtherDerived::OtherDerived(int id) : Abstract(id) +{ +} + +OtherDerived::~OtherDerived() +{ +} + +Abstract* +OtherDerived::createObject() +{ + static int id = 100; + return new OtherDerived(id++); +} + +void +OtherDerived::pureVirtual() +{ +} + +void* +OtherDerived::pureVirtualReturningVoidPtr() +{ + return 0; +} + +void +OtherDerived::unpureVirtual() +{ +} + diff --git a/sources/shiboken2/tests/libother/otherderived.h b/sources/shiboken2/tests/libother/otherderived.h new file mode 100644 index 000000000..792b7c408 --- /dev/null +++ b/sources/shiboken2/tests/libother/otherderived.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OTHERDERIVED_H +#define OTHERDERIVED_H + +#include "libothermacros.h" +#include "abstract.h" +#include "derived.h" +#include "objecttype.h" +#include "complex.h" + +class ObjectType; + +class LIBOTHER_API OtherDerived : public Abstract +{ +public: + OtherDerived(int id = -1); + virtual ~OtherDerived(); + virtual void pureVirtual(); + virtual void* pureVirtualReturningVoidPtr(); + virtual void unpureVirtual(); + virtual PrintFormat returnAnEnum() { return Short; } + + 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(); + + void hideFunction(HideType*) {} + +protected: + inline const char* getClassName() { return className(); } + virtual const char* className() { return "OtherDerived"; } +}; +#endif // OTHERDERIVED_H + diff --git a/sources/shiboken2/tests/libother/othermultiplederived.cpp b/sources/shiboken2/tests/libother/othermultiplederived.cpp new file mode 100644 index 000000000..77fa44b83 --- /dev/null +++ b/sources/shiboken2/tests/libother/othermultiplederived.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "othermultiplederived.h" + +VirtualMethods OtherMultipleDerived::returnUselessClass() +{ + return VirtualMethods(); +} + +Base1* OtherMultipleDerived::createObject(const std::string& objName) +{ + if (objName == "Base1") + return new Base1; + else if (objName == "MDerived1") + return new MDerived1; + else if (objName == "SonOfMDerived1") + return new SonOfMDerived1; + else if (objName == "MDerived3") + return new MDerived3; + else if (objName == "OtherMultipleDerived") + return new OtherMultipleDerived; + return 0; +} + diff --git a/sources/shiboken2/tests/libother/othermultiplederived.h b/sources/shiboken2/tests/libother/othermultiplederived.h new file mode 100644 index 000000000..e75504320 --- /dev/null +++ b/sources/shiboken2/tests/libother/othermultiplederived.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OTHERMULTIPLEDERIVED_H +#define OTHERMULTIPLEDERIVED_H + +#include "libothermacros.h" +#include "multiple_derived.h" +#include "virtualmethods.h" + +class ObjectType; + +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); +}; + +#endif diff --git a/sources/shiboken2/tests/libother/otherobjecttype.cpp b/sources/shiboken2/tests/libother/otherobjecttype.cpp new file mode 100644 index 000000000..266b2583e --- /dev/null +++ b/sources/shiboken2/tests/libother/otherobjecttype.cpp @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "otherobjecttype.h" + +Collector& +operator<<(Collector& collector, const OtherObjectType& obj) +{ + collector << obj.identifier()*2; + return collector; +} diff --git a/sources/shiboken2/tests/libother/otherobjecttype.h b/sources/shiboken2/tests/libother/otherobjecttype.h new file mode 100644 index 000000000..2bba912b6 --- /dev/null +++ b/sources/shiboken2/tests/libother/otherobjecttype.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of PySide2. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OTHEROBJECTTYPE_H +#define OTHEROBJECTTYPE_H + +#include <list> +#include "str.h" + +#include "libothermacros.h" +#include "objecttype.h" +#include "collector.h" + +class OtherObjectType : public ObjectType +{ +public: + +}; + + +LIBOTHER_API Collector& operator<<(Collector&, const OtherObjectType&); + +#endif // OTHEROBJECTTYPE_H + |