diff options
Diffstat (limited to 'sources/pyside2/PySide2/templates/core_common.xml')
-rw-r--r-- | sources/pyside2/PySide2/templates/core_common.xml | 420 |
1 files changed, 0 insertions, 420 deletions
diff --git a/sources/pyside2/PySide2/templates/core_common.xml b/sources/pyside2/PySide2/templates/core_common.xml deleted file mode 100644 index 4b74c6b55..000000000 --- a/sources/pyside2/PySide2/templates/core_common.xml +++ /dev/null @@ -1,420 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt for Python. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** 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-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ ---> -<typesystem> - - <template name="tuple_ok_retval"> - %PYARG_0 = PyTuple_New(2); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](ok_)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); - </template> - - <template name="bool*_fix,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2); - %END_ALLOW_THREADS - <insert-template name="tuple_ok_retval"/> - </template> - - <template name="bool*_fix,arg,arg,arg,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3, %4, %5); - %END_ALLOW_THREADS - <insert-template name="tuple_ok_retval"/> - </template> - - <!-- Templates to fix bool* parameters --> - <template name="tuple_retval_ok"> - %PYARG_0 = PyTuple_New(2); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[bool](ok_)); - </template> - - <template name="fix_bool*"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_args,bool*"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &ok_); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_args,arg,bool*"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, &ok_); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_arg,bool*,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, &ok_, %3); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_bool*,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_bool*,arg,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_bool*,arg,arg,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3, %4); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_bool*,arg,arg,arg,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3, %4, %5); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &ok_, %9); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &ok_, %9, %10); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_arg,arg,arg,arg,arg,arg,bool*,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, &ok_, %8); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_arg,arg,arg,arg,arg,bool*,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &ok_, %7); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_arg,arg,arg,arg,bool*,arg,arg"> - bool ok_; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &ok_, %6, %7); - %END_ALLOW_THREADS - <insert-template name="tuple_retval_ok"/> - </template> - - <template name="fix_char*"> - char val_{}; - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&val_); - %END_ALLOW_THREADS - %PYARG_0 = PyTuple_New(2); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[char](val_)); - </template> - - <template name="tuple_abcd_same_type"> - %PYARG_0 = PyTuple_New(4); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b)); - PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c)); - PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d)); - </template> - - <template name="fix_number*,number*,number*,number*"> - $TYPE a, b, c, d; - %BEGIN_ALLOW_THREADS - %CPPSELF->::%TYPE::%FUNCTION_NAME(&a, &b, &c, &d); - %END_ALLOW_THREADS - <insert-template name="tuple_abcd_same_type"/> - </template> - - <template name="fix_number*,number*,number*,number*,args"> - $TYPE a, b, c, d; - %BEGIN_ALLOW_THREADS - %CPPSELF->::%TYPE::%FUNCTION_NAME(&a, &b, &c, &d, %ARGUMENT_NAMES); - %END_ALLOW_THREADS - <insert-template name="tuple_abcd_same_type"/> - </template> - - <template name="fix_native_return_number*,number*,number*,number*"> - PyObject* _obj = %PYARG_0.object(); - if (!PySequence_Check(_obj) - || PySequence_Fast_GET_SIZE(_obj) != 4 - || !SbkNumber_Check(PySequence_Fast_GET_ITEM(_obj, 0)) - || !SbkNumber_Check(PySequence_Fast_GET_ITEM(_obj, 1)) - || !SbkNumber_Check(PySequence_Fast_GET_ITEM(_obj, 2)) - || !SbkNumber_Check(PySequence_Fast_GET_ITEM(_obj, 3))) { - PyErr_SetString(PyExc_TypeError, "Sequence of 4 numbers expected"); - } else { - *%1 = %CONVERTTOCPP[$TYPE](PySequence_Fast_GET_ITEM(_obj, 0)); - *%2 = %CONVERTTOCPP[$TYPE](PySequence_Fast_GET_ITEM(_obj, 1)); - *%3 = %CONVERTTOCPP[$TYPE](PySequence_Fast_GET_ITEM(_obj, 2)); - *%4 = %CONVERTTOCPP[$TYPE](PySequence_Fast_GET_ITEM(_obj, 3)); - } - </template> - - <template name="fix_number*,number*,number*,number*,number*"> - $TYPE a, b, c, d, e; - %BEGIN_ALLOW_THREADS - %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d, &e); - %END_ALLOW_THREADS - %PYARG_0 = PyTuple_New(5); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b)); - PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[$TYPE](c)); - PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[$TYPE](d)); - PyTuple_SET_ITEM(%PYARG_0, 4, %CONVERTTOPYTHON[$TYPE](e)); - </template> - - <template name="fix_args,number*,number*"> - $TYPE a, b; - %BEGIN_ALLOW_THREADS - %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &a, &b); - %END_ALLOW_THREADS - %PYARG_0 = PyTuple_New(2); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b)); - </template> - - <template name="fix_arg,int*,int*"> - %RETURN_TYPE _ret; - int a, b; - %BEGIN_ALLOW_THREADS - _ret = %CPPSELF.%FUNCTION_NAME(%1, &a, &b); - %END_ALLOW_THREADS - %PYARG_0 = PyTuple_New(3); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](_ret)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](a)); - PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](b)); - </template> - - <template name="return_tuple_QValidator_QString_int"> - %BEGIN_ALLOW_THREADS - %RETURN_TYPE retval_ = %RETURN_TYPE(%CPPSELF.%FUNCTION_NAME(%1, %2)); - %END_ALLOW_THREADS - %PYARG_0 = PyTuple_New(3); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1)); - PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[%ARG2_TYPE](%2)); - </template> - - <template name="repr_code"> - QString format = QString::asprintf("%s(%REPR_FORMAT)", - Py_TYPE(%PYSELF)->tp_name, %REPR_ARGS); - %PYARG_0 = Shiboken::String::fromCString(qPrintable(format)); - </template> - - <template name="return_internal_pointer"> - %PYARG_0 = reinterpret_cast<PyObject*>(%CPPSELF.%FUNCTION_NAME()); - if (!%PYARG_0) - %PYARG_0 = Py_None; - Py_INCREF(%PYARG_0); - </template> - - <!-- Helpers for modifying "bool nativeEventFilter(QByteArray, void*, long *result)" - to return a tuple of bool,long --> - <template name="return_native_eventfilter_conversion_variables"> - long resultVar{0}; - long *%out = &resultVar; - </template> - <template name="return_native_eventfilter_conversion"> - %RETURN_TYPE %out = false; - if (PySequence_Check(%PYARG_0) && (PySequence_Size(%PYARG_0) == 2)) { - Shiboken::AutoDecRef pyItem(PySequence_GetItem(%PYARG_0, 0)); - %out = %CONVERTTOCPP[bool](pyItem); - if (result) { - Shiboken::AutoDecRef pyResultItem(PySequence_GetItem(pyResult, 1)); - *result = %CONVERTTOCPP[long](pyResultItem); - } - } - </template> - - <template name="return_native_eventfilter"> - %PYARG_0 = PyTuple_New(2); - PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0)); - PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[long](*result_out)); - </template> - - <!-- templates for __reduce__ --> - <template name="reduce_code"> - %PYARG_0 = Py_BuildValue("(N(%REDUCE_FORMAT))", PyObject_Type(%PYSELF), %REDUCE_ARGS); - </template> - - <!-- Replace '#' for the argument number you want. --> - <template name="return_argument"> - Py_INCREF(%PYARG_#); - %PYARG_0 = %PYARG_#; - </template> - - <!-- Iterator --> - <template name="__iter__"> - Py_INCREF(%PYSELF); - %PYARG_0 = %PYSELF; - </template> - - <template name="to_tuple"> - %PYARG_0 = Py_BuildValue("%TT_FORMAT", %TT_ARGS); - </template> - - <template name="cpplist_to_pylist_conversion"> - PyObject* %out = PyList_New((int) %in.size()); - %INTYPE::const_iterator it = %in.begin(); - for (int idx = 0; it != %in.end(); ++it, ++idx) { - %INTYPE_0 cppItem(*it); - PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem)); - } - return %out; - </template> - - <template name="pyseq_to_cpplist_conversion"> - for (int i = 0, size = PySequence_Size(%in); i < size; i++) { - - Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i)); - %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); - %out << cppItem; - } - </template> - - <template name="cppvector_to_pylist_conversion"> - %INTYPE::size_type vectorSize = %in.size(); - PyObject* %out = PyList_New((int) vectorSize); - for (%INTYPE::size_type idx = 0; idx < vectorSize; ++idx) { - %INTYPE_0 cppItem(%in[idx]); - PyList_SET_ITEM(%out, idx, %CONVERTTOPYTHON[%INTYPE_0](cppItem)); - } - return %out; - </template> - - <template name="pyseq_to_cppvector_conversion"> - int vectorSize = PySequence_Size(%in); - %out.reserve(vectorSize); - for (int idx = 0; idx < vectorSize; ++idx) { - Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, idx)); - %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); - %out.push_back(cppItem); - } - </template> - - <template name="checkPyCapsuleOrPyCObject_func"> - static bool checkPyCapsuleOrPyCObject(PyObject* pyObj) - { - #ifdef IS_PY3K - return PyCapsule_CheckExact(pyObj); - #else - return PyCObject_Check(pyObj); - #endif - } - </template> - - <template name="cppmap_to_pymap_conversion"> - PyObject *%out = PyDict_New(); - for (%INTYPE::const_iterator it = %in.begin(), end = %in.end(); it != end; ++it) { - %INTYPE_0 key = it.key(); - %INTYPE_1 value = it.value(); - PyObject *pyKey = %CONVERTTOPYTHON[%INTYPE_0](key); - PyObject *pyValue = %CONVERTTOPYTHON[%INTYPE_1](value); - PyDict_SetItem(%out, pyKey, pyValue); - Py_DECREF(pyKey); - Py_DECREF(pyValue); - } - return %out; - </template> - - <template name="pydict_to_cppmap_conversion"> - PyObject *key; - PyObject *value; - Py_ssize_t pos = 0; - while (PyDict_Next(%in, &pos, &key, &value)) { - %OUTTYPE_0 cppKey = %CONVERTTOCPP[%OUTTYPE_0](key); - %OUTTYPE_1 cppValue = %CONVERTTOCPP[%OUTTYPE_1](value); - %out.insert(cppKey, cppValue); - } - </template> - - <template name="pydatetime_importandcheck_function"> - #ifdef IS_PY3K - #define PySideDateTime_IMPORT PyDateTime_IMPORT - #else - #define PySideDateTime_IMPORT \ - (PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \ - (char*)"datetime_CAPI")) - #endif - static bool PyDateTime_ImportAndCheck(PyObject *pyIn) { - if (!PyDateTimeAPI) PySideDateTime_IMPORT; - return $DATETIMETYPE_Check(pyIn); - } - </template> - -</typesystem> |