mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
QgsSipUtils.isPyOwned will return True if an object is owned by python, or False if ownership is held by another object or c++ class. This gives a way to test in advance if we can safely assign an object to a method which takes ownership (which always results in a crash).
51 lines
1.6 KiB
Plaintext
51 lines
1.6 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/qgssiputils.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
class QgsSipUtils
|
|
{
|
|
%Docstring(signature="appended")
|
|
Contains utilities for working with SIP Python objects.
|
|
|
|
.. versionadded:: 3.44
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgssiputils.h"
|
|
%End
|
|
public:
|
|
|
|
static bool isPyOwned( SIP_PYOBJECT /GetWrapper/ );
|
|
%Docstring
|
|
Returns ``True`` if an object is currently owned by Python.
|
|
|
|
If ``False`` is returned, then the object is currently owned by another
|
|
object (e.g. a c++ class).
|
|
%End
|
|
%MethodCode
|
|
if ( sipIsOwnedByPython( ( sipSimpleWrapper * )a0Wrapper ) )
|
|
{
|
|
sipRes = true;
|
|
}
|
|
else
|
|
{
|
|
sipRes = false;
|
|
}
|
|
%End
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/qgssiputils.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|