diff options
author | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-08-31 14:27:02 +0200 |
---|---|---|
committer | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2018-11-28 16:11:36 +0000 |
commit | 0363a0986e19bfb97ed1b899fc1431a0e1b14dcb (patch) | |
tree | 9c5b67a91e61033b415f8d6b8d62c6ec86fd5dac /sources/pyside2/PySide2/glue/qtcore.cpp | |
parent | addfdfb1ff195e36d412dc7aa3dde2f2d474c0ed (diff) |
Place templates per module
There is a main template file that hosts most of the
code-templates we use in the typesystems, but there
were still several templates written in each module-typesystem
file.
The templates that are used on different typesystem
are now placed in:
sources/pyside2/PySide2/templates/core_common.xml
Additionally, the templates used only by a certain module,
are placed next to it, e.g.:
sources/pyside2/PySide2/templates/widgets_common.xml
Some simple templates were moved to the snippets files too.
Task-number: PYSIDE-799
Change-Id: I4f355cf2ae983aba9e85414e910550189cd18dcb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/pyside2/PySide2/glue/qtcore.cpp')
-rw-r--r-- | sources/pyside2/PySide2/glue/qtcore.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index f4114db3f..084004ceb 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -1008,3 +1008,29 @@ QT_END_NAMESPACE reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_4))); %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); // @snippet qt-qunregisterresourcedata + +// @snippet use-stream-for-format-security +// Uses the stream version for security reasons +// see gcc man page at -Wformat-security +%FUNCTION_NAME() << %1; +// @snippet use-stream-for-format-security + +// @snippet qresource-registerResource + auto ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1)); + %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast<const uchar*>(ptr), %2); + %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0); +// @snippet qresource-registerResource + +// @snippet qstring-return +%PYARG_0 = %CONVERTTOPYTHON[QString](%1); +// @snippet qstring-return + +// @snippet stream-write-method +(*%CPPSELF) << %1; +// @snippet stream-write-method + +// @snippet stream-read-method +%RETURN_TYPE _cpp_result; +(*%CPPSELF) >> _cpp_result; +%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](_cpp_result); +// @snippet stream-read-method |