summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Implement 'child return' examples and support.Luciano Wolf2009-11-304-0/+131
|
* Added tests for something like QLayout.Hugo Lima2009-11-309-1/+191
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Support parent rules for return values.Hugo Lima2009-11-301-2/+4
|
* Add the generator flag "enable-parent-ctor-heuristic".Hugo Lima2009-11-305-11/+40
| | | | | When enabled, this heuristic will check every constructor for an argument named "parent", if the argument is a pointer, then it'll be the parent of this object.
* Added method to take care of the details of ownership transfer to C++.Marcelo Lira2009-11-305-16/+91
| | | | | | | | | | | | | | | | | | | Simple ownership transference, i.e. without parenting, is now performed by the new BindingManager::transferOwnershipToCpp method. It remove the parent of the transfered object and proceeds transfer or invalidation if needed. The generated code for simple ownership transfer from Python to C++ now reflects this change. Fixed the method BlackBox::keepObjectType that steals an ObjectType ownership to C++ to remove it from its parent also. The BlackBox class does not take care of the stolen object as a proper parent would, but its destructor deletes the object, so the "unparenting" is needed to avoid freeing the same memory twice. Created an unit test that adds children to a parent ObjectType and then steal the children to C++ with BlackBox.keepObjectType. Reviewed by Hugo Lima <hugo.lima@openbossa.org>
* Fixed some typos in tests' comments.Marcelo Lira2009-11-302-2/+2
|
* Wrapper invalidation method recursively updates children objects status.Marcelo Lira2009-11-304-11/+39
| | | | | | | | | | | BindingManager::invalidateWrapper checks if the object to be invalidated carries any children objects and recursively invalidates them. Shiboken::destroyParentInfo function was refactored to call the new recursive wrapper invalidator and then call a helper function that only destroy the parent information. The invalidate parent test was updated.
* Some fixing and refactoring for the ObjectType test class.Marcelo Lira2009-11-302-32/+35
|
* Fix objects/points methods to return a list + fix example using them.Luciano Wolf2009-11-273-9/+34
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Use map instead of list inside BlackBox class.Luciano Wolf2009-11-273-43/+52
| | | | | | Now keepObjectType/keepPoint and retrieveObjectType/retrievePoint uses a ticket to get the object from a map. It's a way better than lists.
* Fix identation of generated code for C++ wrapper destructor.Marcelo Lira2009-11-272-1/+2
| | | | Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
* Add test for delete child in pythonLauro Neto2009-11-272-0/+51
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Adding test for deleting parentLauro Neto2009-11-271-3/+7
|
* Add invalidate parent testLauro Neto2009-11-271-0/+49
| | | | Using BlackBox to invalidate the parent
* Add test for deleting child in cppLauro Neto2009-11-271-0/+49
|
* Add removeChild and killChild to ObjectType testLauro Neto2009-11-272-7/+27
|
* Implemented primitives to solve the parent/children problem.Hugo Lima2009-11-274-42/+184
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Add parent tags for ObjectType class.Hugo Lima2009-11-271-0/+10
|
* Small fixes for parent/child unit testsHugo Lima2009-11-271-9/+3
|
* Adding test for deleting parentLauro Neto2009-11-271-0/+79
|
* Test ownership transfer from Python to C++Luciano Wolf2009-11-274-3/+10
| | | | | | | | | There are 3 tests to be implemented in order to check the correctness. - 1. Correct the assert function inside kindergarten example to raise an exception [done]; - 2. Use "create" method to return a C++ created instance and use it to test ownership [done]; - 3. Use e.g.: "Point" class as a value-type to test "invalidate non-polymorphic". Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Improving ownership transference tests.Luciano Wolf2009-11-272-16/+87
|
* Renaming -> KinderGarten to BlackBoxLuciano Wolf2009-11-276-31/+86
|
* Added convenience method BindingManager::invalidateWrapper(const void*).Marcelo Lira2009-11-263-0/+10
| | | | | | | | This new invalidateWrapper finds the Python wrapper for a C++ pointer and then invalidates it. Virtual destructors for C++ wrappers call the invalidateWrapper on the "this" pointer.
* Added tests for the validity of Python wrappers used as method arguments.Marcelo Lira2009-11-267-2/+229
| | | | Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
* Updated method call writer to use the new PyBaseWrapper.containsCppWrapper.Marcelo Lira2009-11-261-16/+35
| | | | | | | | | | | | | | CppGenerator::writeMethodCall now generates code that uses containsCppWrapper when moving ownership from Python to C++. It deals with these cases: 1. The wrapped object has no virtual destructor: just calls invalidate 2. The wrapped object has a virtual destructor: checks if it was created by Python (containsCppWrapper is true), if so just transfer the ownership to C++, otherwise invalidate the Python wrapper immediately. It also writes an #error clause if the ownership transfer described in the type system was meant to be performed in a non-wrapped type (e.g.: a PyInt can not have its ownership transfered to C++, since it is converted).
* Added the "containsCppWrapper" flag to the PyBaseWrapper.Marcelo Lira2009-11-263-6/+34
| | | | | | | | | | | | | | The containsCppWrapper flag says if the C++ pointer held by the Python wrapper has a binding generated C++ wrapper and was created by Python. This means that the C++ object has a virtual destructor that will invalidate the Python wrapper if it is destroyed when its ownership is with C++. PyBaseWrapper_New function was expanded with the "containsCppWrapper" parameter, and CppGenerator::writeConstructorWrapper was updated to use it. The PyBaseWrapper structure was documented with comments.
* Wrapped C++ object validity checks now consider implicit conversions.Marcelo Lira2009-11-261-2/+14
| | | | | | When CppGenerator::writeInvalidCppObjectCheck if called for a function parameter and said parameter has implicit conversions that use other wrapped C++ classes the validity check is written for them too.
* BindingManager::invalidateWrapper also removes ownership of the object from ↵Marcelo Lira2009-11-261-0/+1
| | | | Python.
* Fixed OverloadData::numberOfRemovedArguments(func, int finalArgPos).Marcelo Lira2009-11-261-5/+10
| | | | | | The parameter "finalArgPos" refers to a position in the modified function, when it is provided the removed argument counter must consider the removed arguments before the final position.
* Added convenience method OverloadData::isSingleArgument(overloads).Marcelo Lira2009-11-262-0/+14
|
* Python arguments are now checked for Python wrapper validity.Marcelo Lira2009-11-264-25/+87
| | | | | | | | | | If the expected argument type has implicit conversions the type of the Python object is also checked. The invalidate-after-use test was moved from the ObjectType test to its own test file. Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
* Renamed Shiboken's function cppObjectIsValid to cppObjectIsInvalid.Marcelo Lira2009-11-264-13/+17
| | | | | | CppGenerator::writeInvalidCppObjectCheck receives the name of the PyObject to be checked and do not set the exception message anymore, since it is done by Shiboken::cppObjectIsInvalid.
* Added the invalidateWrapper method to BindingManager.Marcelo Lira2009-11-254-15/+25
| | | | | | | | | | | | It sets the wrapper as invalid and removes the relation of C++ objects to the Python wrapper from the mappings. Moved BindingManager::releaseWrapper(void*) to BindingManagerPrivate, since it should only be used by releaseWrapper(PyObject*). Modified includes on conversions.h to use quotes instead of < and >. Reviewed by Hugo Lima <hugo.lima@openbossa.org>
* Fixed visibility for multiple derived test classes.Marcelo Lira2009-11-251-9/+9
| | | | Reviewed by Hugo Lima <hugo.lima@openbossa.org>
* Merged with multipleinheritance branchMarcelo Lira2009-11-2513-138/+493
|\
| * Added new cases to multiple inheritance tests.Marcelo Lira2009-11-182-12/+90
| |
| * Modified the multiple inheritance initializer function to considerMarcelo Lira2009-11-181-7/+29
| | | | | | | | | | | | | | cases where the pointer is casted to void* and then casted to a parent pointer, and after that to a grandparent pointer. The multiple inheritance initializer is now using a STL set object to avoid registering the same offset multiple times.
| * Added the method ShibokenGenerator::hasMultipleInheritanceInAncestry(metaClass)Marcelo Lira2009-11-183-1/+14
| | | | | | | | | | which returns a boolean indicating if there are cases of multiple inheritance in any of its ancestors.
| * Updated the %PYTHONTYPEOBJECT type system variable to use the newMarcelo Lira2009-11-181-3/+2
| | | | | | | | ShiboTypeObject structure.
| * Binding manager releaseWrapper(PyObject*) method fixed to releaseMarcelo Lira2009-11-181-1/+10
| | | | | | | | | | the multiple inheritance pointers registered for a class with this trait.
| * In multiple inheritance cases the binding manager only assigns aMarcelo Lira2009-11-181-1/+2
| | | | | | | | | | wrapper to a base pointer plus offset if the latter is greater than 0 to avoid duplicated associations with the base pointer.
| * Added the getAncestorMultipleInheritance method to CppGenerator,Marcelo Lira2009-11-182-3/+16
| | | | | | | | | | | | | | it returns a QStringList with the names of all classes that are multiple parents for the current class or any of its ancestors. The purpose is to get a list of all possible casts that could change the memory address of the base pointer of a class.
| * modified the unused method ShibokenGenerator::getBaseClasses toMarcelo Lira2009-11-183-25/+9
| | | | | | | | | | return an AbstractMetaClassList (AbstractMetaClass does not provide such a method)
| * Classes that have multiple inheritance in some point of its ancestryMarcelo Lira2009-11-183-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | now receive the multiple inheritance information, the initialization function will be that of the first ancestor that have multiple inheritance. Example: class MDerived : public Base1, public Base2 clas SonOfMDerived : public MDerived MDerived defines the function PyMDerived_mi_init to register the multiple inheritance information, and SonOfMDerived just uses the ancestor function.
| * Shiboken retrieves a Python wrapper object from its correspondingMarcelo Lira2009-11-186-26/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++ object using the memory address of the former to retrieve the latter. When multiple inheritance is involved, a C++ object passed to C++ could be caught back downcasted to one of its parents with a different memory address, following the memory layout for multiple inheritance used by the compiler. This poses a problem to keep the Python identity of a C++ object. The solution was to extend the traditional PyTypeObject with a number array with all the possible displacements to be added to an object pointer to produce the memory addresses for the valid pointers that could appear from all the possible type casts involving the object parents. All the possible pointers are registered (and unregistered) by the binding wrapper manager. To store the multiple inheritance information the ShiboTypeObject structure was created, expanding the original PyTypeObject with two fields: mi_offsets an integer array containing the possible displacements from the object base pointer. The array has the value -1 at its end. mi_init the function that will initialize the mi_offsets array it is called at the first instaciation of a multiple inheriting object.
| * improved multiple inheritance tests with a myriad of new casesMarcelo Lira2009-11-185-81/+220
| |
* | Add overload dependency on PyObjectLauro Neto2009-11-253-1/+27
| | | | | | | | | | | | PyObject_Check should be the last one in the overload type check Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* | Improve overload sortingLauro Neto2009-11-251-3/+24
| | | | | | | | | | | | | | | | | | | | Now adding a new dependency: If the overload type is a container or template and the contained type is also in the overload list, the contained type is checked first. Added due to QList<String> and QString. WARNING: Not sure yet if this is the best fix :)
* | Adding test case for sorting overload dataLauro Neto2009-11-257-0/+189
| |