aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken/basewrapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/libshiboken/basewrapper.h')
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.h154
1 files changed, 77 insertions, 77 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.h b/sources/shiboken2/libshiboken/basewrapper.h
index 55445b026..7faf223bd 100644
--- a/sources/shiboken2/libshiboken/basewrapper.h
+++ b/sources/shiboken2/libshiboken/basewrapper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -57,41 +57,41 @@ struct LIBSHIBOKEN_API SbkObject
{
PyObject_HEAD
/// Instance dictionary.
- PyObject* ob_dict;
+ PyObject *ob_dict;
/// List of weak references
- PyObject* weakreflist;
- SbkObjectPrivate* d;
+ PyObject *weakreflist;
+ SbkObjectPrivate *d;
};
/// Dealloc the python object \p pyObj and the C++ object represented by it.
-LIBSHIBOKEN_API void SbkDeallocWrapper(PyObject* pyObj);
-LIBSHIBOKEN_API void SbkDeallocQAppWrapper(PyObject* pyObj);
-LIBSHIBOKEN_API void SbkDeallocWrapperWithPrivateDtor(PyObject* self);
+LIBSHIBOKEN_API void SbkDeallocWrapper(PyObject *pyObj);
+LIBSHIBOKEN_API void SbkDeallocQAppWrapper(PyObject *pyObj);
+LIBSHIBOKEN_API void SbkDeallocWrapperWithPrivateDtor(PyObject *self);
struct SbkObjectType;
/// Function signature for the multiple inheritance information initializers that should be provided by classes with multiple inheritance.
-typedef int* (*MultipleInheritanceInitFunction)(const void*);
+typedef int *(*MultipleInheritanceInitFunction)(const void *);
/**
* Special cast function is used to correctly cast an object when it's
* part of a multiple inheritance hierarchy.
* The implementation of this function is auto generated by the generator and you don't need to care about it.
*/
-typedef void* (*SpecialCastFunction)(void*, SbkObjectType*);
-typedef SbkObjectType* (*TypeDiscoveryFunc)(void*, SbkObjectType*);
-typedef void* (*TypeDiscoveryFuncV2)(void*, SbkObjectType*);
+typedef void *(*SpecialCastFunction)(void *, SbkObjectType *);
+typedef SbkObjectType *(*TypeDiscoveryFunc)(void *, SbkObjectType *);
+typedef void *(*TypeDiscoveryFuncV2)(void *, SbkObjectType *);
-typedef void* (*ExtendedToCppFunc)(PyObject*); // DEPRECATED.
-typedef bool (*ExtendedIsConvertibleFunc)(PyObject*); // DEPRECATED.
+typedef void *(*ExtendedToCppFunc)(PyObject *); // DEPRECATED.
+typedef bool (*ExtendedIsConvertibleFunc)(PyObject *); // DEPRECATED.
// Used in userdata dealloc function
-typedef void (*DeleteUserDataFunc)(void*);
+typedef void (*DeleteUserDataFunc)(void *);
-typedef void (*ObjectDestructor)(void*);
+typedef void (*ObjectDestructor)(void *);
-typedef void (*SubTypeInitHook)(SbkObjectType*, PyObject*, PyObject*);
+typedef void (*SubTypeInitHook)(SbkObjectType *, PyObject *, PyObject *);
extern LIBSHIBOKEN_API PyTypeObject *SbkObjectType_TypeF(void);
extern LIBSHIBOKEN_API SbkObjectType *SbkObject_TypeF(void);
@@ -104,9 +104,9 @@ struct LIBSHIBOKEN_API SbkObjectType
PyTypeObject type;
};
-LIBSHIBOKEN_API PyObject* SbkObjectTpNew(PyTypeObject* subtype, PyObject*, PyObject*);
+LIBSHIBOKEN_API PyObject *SbkObjectTpNew(PyTypeObject *subtype, PyObject *, PyObject *);
// the special case of a switchable singleton
-LIBSHIBOKEN_API PyObject* SbkQAppTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
+LIBSHIBOKEN_API PyObject *SbkQAppTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
/**
* PYSIDE-832: Use object_dealloc instead of nullptr.
@@ -132,36 +132,36 @@ LIBSHIBOKEN_API void init();
/// Delete the class T allocated on \p cptr.
template<typename T>
-void callCppDestructor(void* cptr)
+void callCppDestructor(void *cptr)
{
- delete reinterpret_cast<T*>(cptr);
+ delete reinterpret_cast<T *>(cptr);
}
/**
* Shiboken::importModule is DEPRECATED. Use Shiboken::Module::import() instead.
*/
-SBK_DEPRECATED(LIBSHIBOKEN_API bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr));
+SBK_DEPRECATED(LIBSHIBOKEN_API bool importModule(const char *moduleName, PyTypeObject *** cppApiPtr));
// setErrorAboutWrongArguments now gets overload info from the signature module.
-LIBSHIBOKEN_API void setErrorAboutWrongArguments(PyObject* args, const char* funcName);
+LIBSHIBOKEN_API void setErrorAboutWrongArguments(PyObject *args, const char *funcName);
namespace ObjectType {
/**
* Returns true if the object is an instance of a type created by the Shiboken generator.
*/
-LIBSHIBOKEN_API bool checkType(PyTypeObject* pyObj);
+LIBSHIBOKEN_API bool checkType(PyTypeObject *pyObj);
/**
* Returns true if this object is an instance of an user defined type derived from an Shiboken type.
*/
-LIBSHIBOKEN_API bool isUserType(PyTypeObject* pyObj);
+LIBSHIBOKEN_API bool isUserType(PyTypeObject *pyObj);
/**
* Returns true if the constructor of \p ctorType can be called for a instance of type \p myType.
* \note This function set a python error when returning false.
*/
-LIBSHIBOKEN_API bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctorType);
+LIBSHIBOKEN_API bool canCallConstructor(PyTypeObject *myType, PyTypeObject *ctorType);
/**
* Tells if the \p type represents an object of a class with multiple inheritance in C++.
@@ -170,27 +170,27 @@ LIBSHIBOKEN_API bool canCallConstructor(PyTypeObject* myType, PyTypeObjec
* \returns true if a call to ObjectType::cast() is needed to obtain the correct
* C++ pointer for Python objects of type \p type.
*/
-LIBSHIBOKEN_API bool hasCast(SbkObjectType* type);
+LIBSHIBOKEN_API bool hasCast(SbkObjectType *type);
/**
* Cast the C++ pointer held by a Python object \p obj of type \p sourceType,
* to a C++ pointer of a C++ class indicated by type \p targetType.
* \returns The cast C++ pointer.
*/
-LIBSHIBOKEN_API void* cast(SbkObjectType* sourceType, SbkObject* obj, PyTypeObject* targetType);
+LIBSHIBOKEN_API void *cast(SbkObjectType *sourceType, SbkObject *obj, PyTypeObject *targetType);
/// Set the C++ cast function for \p type.
-LIBSHIBOKEN_API void setCastFunction(SbkObjectType* type, SpecialCastFunction func);
+LIBSHIBOKEN_API void setCastFunction(SbkObjectType *type, SpecialCastFunction func);
-LIBSHIBOKEN_API void setOriginalName(SbkObjectType* self, const char* name);
-LIBSHIBOKEN_API const char* getOriginalName(SbkObjectType* self);
+LIBSHIBOKEN_API void setOriginalName(SbkObjectType *self, const char *name);
+LIBSHIBOKEN_API const char *getOriginalName(SbkObjectType *self);
-LIBSHIBOKEN_API void setTypeDiscoveryFunctionV2(SbkObjectType* self, TypeDiscoveryFuncV2 func);
-LIBSHIBOKEN_API void copyMultipleInheritance(SbkObjectType *self, SbkObjectType *other);
-LIBSHIBOKEN_API void setMultipleInheritanceFunction(SbkObjectType* self, MultipleInheritanceInitFunction func);
+LIBSHIBOKEN_API void setTypeDiscoveryFunctionV2(SbkObjectType *self, TypeDiscoveryFuncV2 func);
+LIBSHIBOKEN_API void copyMultipleInheritance(SbkObjectType *self, SbkObjectType *other);
+LIBSHIBOKEN_API void setMultipleInheritanceFunction(SbkObjectType *self, MultipleInheritanceInitFunction func);
LIBSHIBOKEN_API MultipleInheritanceInitFunction getMultipleInheritanceFunction(SbkObjectType *self);
-LIBSHIBOKEN_API void setDestructorFunction(SbkObjectType* self, ObjectDestructor func);
+LIBSHIBOKEN_API void setDestructorFunction(SbkObjectType *self, ObjectDestructor func);
-LIBSHIBOKEN_API void initPrivateData(SbkObjectType* self);
+LIBSHIBOKEN_API void initPrivateData(SbkObjectType *self);
enum WrapperFlags
{
@@ -232,13 +232,13 @@ LIBSHIBOKEN_API SbkObjectType *introduceWrapperType(PyObject *enclosingObject,
* The hook gets 3 params, they are: The new type being created, args and kwds. The last two are the very
* same got from tp_new.
*/
-LIBSHIBOKEN_API void setSubTypeInitHook(SbkObjectType* self, SubTypeInitHook func);
+LIBSHIBOKEN_API void setSubTypeInitHook(SbkObjectType *self, SubTypeInitHook func);
/**
* Get the user data previously set by Shiboken::Object::setTypeUserData
*/
-LIBSHIBOKEN_API void* getTypeUserData(SbkObjectType* self);
-LIBSHIBOKEN_API void setTypeUserData(SbkObjectType* self, void* userData, DeleteUserDataFunc d_func);
+LIBSHIBOKEN_API void *getTypeUserData(SbkObjectType *self);
+LIBSHIBOKEN_API void setTypeUserData(SbkObjectType *self, void *userData, DeleteUserDataFunc d_func);
/**
* Return an instance of SbkObjectType for a C++ type name as determined by
@@ -261,23 +261,23 @@ namespace Object {
/**
* Returns a string with information about the internal state of the instance object, useful for debug purposes.
*/
-LIBSHIBOKEN_API std::string info(SbkObject* self);
+LIBSHIBOKEN_API std::string info(SbkObject *self);
/**
* Returns true if the object is an instance of a type created by the Shiboken generator.
*/
-LIBSHIBOKEN_API bool checkType(PyObject* pyObj);
+LIBSHIBOKEN_API bool checkType(PyObject *pyObj);
/**
* Returns true if this object type is an instance of an user defined type derived from an Shiboken type.
* \see Shiboken::ObjectType::isUserType
*/
-LIBSHIBOKEN_API bool isUserType(PyObject* pyObj);
+LIBSHIBOKEN_API bool isUserType(PyObject *pyObj);
/**
* Generic function used to make ObjectType hashable, the C++ pointer is used as hash value.
*/
-LIBSHIBOKEN_API Py_hash_t hash(PyObject* pyObj);
+LIBSHIBOKEN_API Py_hash_t hash(PyObject *pyObj);
/**
* Find a child of given wrapper having same address having the specified type.
@@ -294,101 +294,101 @@ LIBSHIBOKEN_API SbkObject *findColocatedChild(SbkObject *wrapper,
* and as fallback.
* \param typeName If non-null, this will be used as helper to find the correct Python type for this object.
*/
-LIBSHIBOKEN_API PyObject* newObject(SbkObjectType* instanceType,
- void* cptr,
- bool hasOwnership = true,
- bool isExactType = false,
- const char* typeName = 0);
+LIBSHIBOKEN_API PyObject *newObject(SbkObjectType *instanceType,
+ void *cptr,
+ bool hasOwnership = true,
+ bool isExactType = false,
+ const char *typeName = nullptr);
/**
* Changes the valid flag of a PyObject, invalid objects will raise an exception when someone tries to access it.
*/
-LIBSHIBOKEN_API void setValidCpp(SbkObject* pyObj, bool value);
+LIBSHIBOKEN_API void setValidCpp(SbkObject *pyObj, bool value);
/**
* Tells shiboken the Python object \p pyObj has a C++ wrapper used to intercept virtual method calls.
*/
-LIBSHIBOKEN_API void setHasCppWrapper(SbkObject* pyObj, bool value);
+LIBSHIBOKEN_API void setHasCppWrapper(SbkObject *pyObj, bool value);
/**
* Return true if the Python object \p pyObj has a C++ wrapper used to intercept virtual method calls.
*/
-LIBSHIBOKEN_API bool hasCppWrapper(SbkObject* pyObj);
+LIBSHIBOKEN_API bool hasCppWrapper(SbkObject *pyObj);
/**
* Return true if the Python object was created by Python, false otherwise.
* \note This function was added to libshiboken only to be used by shiboken.wasCreatedByPython()
*/
-LIBSHIBOKEN_API bool wasCreatedByPython(SbkObject* pyObj);
+LIBSHIBOKEN_API bool wasCreatedByPython(SbkObject *pyObj);
/**
* Call the C++ object destructor and invalidates the Python object.
* \note This function was added to libshiboken only to be used by shiboken.delete()
*/
-LIBSHIBOKEN_API void callCppDestructors(SbkObject* pyObj);
+LIBSHIBOKEN_API void callCppDestructors(SbkObject *pyObj);
/**
* Return true if the Python is responsible for deleting the underlying C++ object.
*/
-LIBSHIBOKEN_API bool hasOwnership(SbkObject* pyObj);
+LIBSHIBOKEN_API bool hasOwnership(SbkObject *pyObj);
/**
* Sets python as responsible to delete the underlying C++ object.
* \note You this overload only when the PyObject can be a sequence and you want to
* call this function for every item in the sequence.
- * \see getOwnership(SbkObject*)
+ * \see getOwnership(SbkObject *)
*/
-LIBSHIBOKEN_API void getOwnership(PyObject* pyObj);
+LIBSHIBOKEN_API void getOwnership(PyObject *pyObj);
/**
* Sets python as responsible to delete the underlying C++ object.
*/
-LIBSHIBOKEN_API void getOwnership(SbkObject* pyObj);
+LIBSHIBOKEN_API void getOwnership(SbkObject *pyObj);
/**
* Release the ownership, so Python will not delete the underlying C++ object.
* \note You this overload only when the PyObject can be a sequence and you want to
* call this function for every item in the sequence.
- * \see releaseOwnership(SbkObject*)
+ * \see releaseOwnership(SbkObject *)
*/
-LIBSHIBOKEN_API void releaseOwnership(PyObject* pyObj);
+LIBSHIBOKEN_API void releaseOwnership(PyObject *pyObj);
/**
* Release the ownership, so Python will not delete the underlying C++ object.
*/
-LIBSHIBOKEN_API void releaseOwnership(SbkObject* pyObj);
+LIBSHIBOKEN_API void releaseOwnership(SbkObject *pyObj);
/**
* Get the C++ pointer of type \p desiredType from a Python object.
*/
-LIBSHIBOKEN_API void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType);
+LIBSHIBOKEN_API void *cppPointer(SbkObject *pyObj, PyTypeObject *desiredType);
/**
* Return a list with all C++ pointers held from a Python object.
* \note This function was added to libshiboken only to be used by shiboken.getCppPointer()
*/
-LIBSHIBOKEN_API std::vector<void*> cppPointers(SbkObject* pyObj);
+LIBSHIBOKEN_API std::vector<void *>cppPointers(SbkObject *pyObj);
/**
* Set the C++ pointer of type \p desiredType of a Python object.
*/
-LIBSHIBOKEN_API bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr);
+LIBSHIBOKEN_API bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr);
/**
* Returns false and sets a Python RuntimeError if the Python wrapper is not marked as valid.
*/
-LIBSHIBOKEN_API bool isValid(PyObject* pyObj);
+LIBSHIBOKEN_API bool isValid(PyObject *pyObj);
/**
* Returns false if the Python wrapper is not marked as valid.
* \param pyObj the object.
* \param throwPyError sets a Python RuntimeError when the object isn't valid.
*/
-LIBSHIBOKEN_API bool isValid(SbkObject* pyObj, bool throwPyError = true);
+LIBSHIBOKEN_API bool isValid(SbkObject *pyObj, bool throwPyError = true);
/**
* Returns false if the Python wrapper is not marked as valid.
* \param pyObj the object.
* \param throwPyError sets a Python RuntimeError when the object isn't valid.
*/
-LIBSHIBOKEN_API bool isValid(PyObject* pyObj, bool throwPyError);
+LIBSHIBOKEN_API bool isValid(PyObject *pyObj, bool throwPyError);
/**
* Set the parent of \p child to \p parent.
@@ -396,36 +396,36 @@ LIBSHIBOKEN_API bool isValid(PyObject* pyObj, bool throwPyError);
* \param parent the parent object, if null, the child will have no parents.
* \param child the child.
*/
-LIBSHIBOKEN_API void setParent(PyObject* parent, PyObject* child);
+LIBSHIBOKEN_API void setParent(PyObject *parent, PyObject *child);
/**
* Remove this child from their parent, if any.
* \param child the child.
*/
-LIBSHIBOKEN_API void removeParent(SbkObject* child, bool giveOwnershipBack = true, bool keepReferenc = false);
+LIBSHIBOKEN_API void removeParent(SbkObject *child, bool giveOwnershipBack = true, bool keepReferenc = false);
/**
* Mark the object as invalid
*/
-LIBSHIBOKEN_API void invalidate(SbkObject* self);
+LIBSHIBOKEN_API void invalidate(SbkObject *self);
/**
* Help function can be used to invalidate a sequence of object
**/
-LIBSHIBOKEN_API void invalidate(PyObject* pyobj);
+LIBSHIBOKEN_API void invalidate(PyObject *pyobj);
/**
* Make the object valid again
*/
-LIBSHIBOKEN_API void makeValid(SbkObject* self);
+LIBSHIBOKEN_API void makeValid(SbkObject *self);
-/// \deprecated Use destroy(SbkObject*, void*)
-SBK_DEPRECATED(LIBSHIBOKEN_API void destroy(SbkObject* self));
+/// \deprecated Use destroy(SbkObject *, void *)
+SBK_DEPRECATED(LIBSHIBOKEN_API void destroy(SbkObject *self));
/**
* Destroy any data in Shiboken structure and c++ pointer if the pyboject has the ownership
*/
-LIBSHIBOKEN_API void destroy(SbkObject* self, void* cppData);
+LIBSHIBOKEN_API void destroy(SbkObject *self, void *cppData);
/**
* Set user data on type of \p wrapper.
@@ -433,11 +433,11 @@ LIBSHIBOKEN_API void destroy(SbkObject* self, void* cppData);
* \param userData the user data
* \param d_func a function used to delete the user data
*/
-LIBSHIBOKEN_API void setTypeUserData(SbkObject* wrapper, void* userData, DeleteUserDataFunc d_func);
+LIBSHIBOKEN_API void setTypeUserData(SbkObject *wrapper, void *userData, DeleteUserDataFunc d_func);
/**
* Get the user data previously set by Shiboken::Object::setTypeUserData
*/
-LIBSHIBOKEN_API void* getTypeUserData(SbkObject* wrapper);
+LIBSHIBOKEN_API void *getTypeUserData(SbkObject *wrapper);
/**
* Increments the reference count of the referred Python object.
@@ -451,7 +451,7 @@ LIBSHIBOKEN_API void* getTypeUserData(SbkObject* wrapper);
* \param key a key that identifies the C++ method signature and argument where the referred Object came from.
* \param referredObject the object whose reference is used by the self object.
*/
-LIBSHIBOKEN_API void keepReference(SbkObject* self, const char* key, PyObject* referredObject, bool append = false);
+LIBSHIBOKEN_API void keepReference(SbkObject *self, const char *key, PyObject *referredObject, bool append = false);
/**
* Removes any reference previously added by keepReference function
@@ -459,7 +459,7 @@ LIBSHIBOKEN_API void keepReference(SbkObject* self, const char* key, PyOb
* \param key a key that identifies the C++ method signature and argument from where the referred Object came.
* \param referredObject the object whose reference is used by the self object.
*/
-LIBSHIBOKEN_API void removeReference(SbkObject* self, const char* key, PyObject* referredObject);
+LIBSHIBOKEN_API void removeReference(SbkObject *self, const char *key, PyObject *referredObject);
} // namespace Object