1.. module:: shiboken 2 3.. |maya| unicode:: Maya U+2122 4 5Shiboken module 6*************** 7 8Functions 9^^^^^^^^^ 10 11.. container:: function_list 12 13 * def :meth:`isValid<shiboken.isValid>` (obj) 14 * def :meth:`wrapInstance<shiboken.wrapInstance>` (address, type) 15 * def :meth:`getCppPointer<shiboken.getCppPointer>` (obj) 16 * def :meth:`delete<shiboken.delete>` (obj) 17 * def :meth:`isOwnedByPython<shiboken.isOwnedByPython>` (obj) 18 * def :meth:`wasCreatedByPython<shiboken.wasCreatedByPython>` (obj) 19 * def :meth:`dump<shiboken.dump>` (obj) 20 21Detailed description 22^^^^^^^^^^^^^^^^^^^^ 23 24This Python module can be used to access internal information related to our 25binding technology. Access to this internal information is required to e.g.: 26integrate PySide with Qt based programs that offer Python scripting like |maya| 27or just for debug purposes. 28 29Some function description refer to "Shiboken based objects", wich means 30Python objects instances of any Python Type created using Shiboken. 31 32 33.. function:: isValid(obj) 34 35 Given a Python object, returns True if the object methods can be called 36 without an exception being thrown. A Python wrapper becomes invalid when 37 the underlying C++ object is destroyed or unreachable. 38 39.. function:: wrapInstance(address, type) 40 41 Creates a Python wrapper for a C++ object instantiated at a given memory 42 address - the returned object type will be the same given by the user. 43 44 The type must be a Shiboken type, the C++ object will not be 45 destroyed when the returned Python object reach zero references. 46 47 If the address is invalid or doesn't point to a C++ object of given type 48 the behavior is undefined. 49 50.. function:: getCppPointer(obj) 51 52 Returns a tuple of longs that contain the memory addresses of the 53 C++ instances wrapped by the given object. 54 55.. function:: delete(obj) 56 57 Deletes the C++ object wrapped by the given Python object. 58 59.. function:: isOwnedByPython(obj) 60 61 Given a Python object, returns True if Python is responsible for deleting 62 the underlying C++ object, False otherwise. 63 64 If the object was not a Shiboken based object, a TypeError is 65 thrown. 66 67.. function:: wasCreatedByPython(obj) 68 69 Returns true if the given Python object was created by Python. 70 71.. function:: dump(obj) 72 73 Returns a string with implementation-defined information about the 74 object. 75 This method should be used **only** for debug purposes by developers 76 creating their own bindings as no guarantee is provided that 77 the string format will be the same across different versions. 78 79 If the object is not a Shiboken based object, a TypeError is thrown. 80