aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into extensibleconversionsMarcelo Lira2010-03-043-23/+36
|\ | | | | | | | | | | | | | | | | Conflicts: cppgenerator.cpp libshiboken/basewrapper.cpp Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Lauro Moura <lauro.neto@openbossa.org>
| * Merge remote branch 'hugopl/typediscovery2'Hugo Lima2010-03-033-23/+36
| |\ | | | | | | | | | | | | Conflicts: libshiboken/conversions.h
| | * Init tb_base of SbkBaseWrapperType_Type on struct declaration instead ofHugo Lima2010-03-031-3/+1
| | | | | | | | | | | | | | | | | | | | | on initShiboken function. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Reviewer: Lauro Moura <lauro.neto@openbossa.org>
| | * Use polymorphic-id-expression to discover the correct type of a C++ object.Hugo Lima2010-03-023-20/+35
| | |
* | | Adds support for extensible converters for value type classes.Marcelo Lira2010-03-021-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Value type classes without implicit conversions use the default implementation provided by ValueTypeConverter. This commit updates ValueTypeConverter to check for extended conversions, since even a class without implicit conversions in one module could get some conversion operators in another. CppGenerator now writes 'isConvertible' calls to all object and value types checks leaving the door open to extended conversions.
* | | Wrapper meta type can now point to converter extensions.Marcelo Lira2010-03-022-1/+12
|/ / | | | | | | | | | | | | The SbkBaseWrapperType structure now stores pointers to functions that extend the type Converter methods 'isConvertible' and 'toCpp'. This is used when a module is extended by another module that defines a conversion operator for a class in the first module.
* / Refactored and documented base Converters.Marcelo Lira2010-03-021-59/+68
|/ | | | | | | | | | | | To improve legibility and understanding ConverterBase<T> was renamed to ValueTypeConverter<T>, and ConverterBase<T*> specialization is now an independent base converter ObjectTypeConverter<T>. Converter_CppEnum was renamed to EnumConverter. The HeaderGenerator and custom converters for the test bindings were updated accordingly. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Lauro Moura <lauro.neto@openbossa.org>
* Rename SbkCreateWrapper to createWrapper, to follow our fuction naming ↵Hugo Lima2010-02-261-4/+4
| | | | | | conventions. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Do not get the pointer of SbkType<T> function, so the compiler doesn't needHugo Lima2010-02-262-7/+7
| | | | | | to implement this function (inlining it when needed). This safe amazings 8KiB from QtGui :-)
* Fix bug #142 by eliminating the CppCopier::copy function and adding it to a ↵Hugo Lima2010-02-262-7/+30
| | | | field in SbkBaseWrapper_Type.
* Rename init_shiboken to InitShiboken, to follow our naming convention.Hugo Lima2010-02-262-10/+8
|
* Fix Config.cmake library pathLauro Neto2010-02-251-1/+1
| | | | Reviewed by Hugo Parente <hugo.lima@openbossa.org>
* Adds a 'new' function to the SbkBaseWrapperType meta type.Marcelo Lira2010-02-241-1/+21
| | | | | | | | | | | | When a Python programmer extends a wrapped C++ class the newly created type must inherit its parent class' special information (e.g. multiple inheritance casting). The 'new' function for the wrapper meta type copies the parent information for the extended type. As it is now the meta type new works properly only with a Python class inheriting from a single wrapped C++ type. Reviewed by Hugo Parente <hugo.lima@openbossa.org>
* Remove FindShiboken.cmake file in favor of ShibokenConfig and Version .cmake ↵Hugo Lima2010-02-244-21/+31
| | | | | | | | | | | files. This is the right way to go, according to: - http://www.cmake.org/pipermail/cmake/2009-April/028504.html - http://www.cmake.org/Wiki/CMake_2.6_Notes#Packages Reviewed by Renato Araújo <renato.filho@openbossa.org>
* Remove warnings related to comparison between signed and unsigned integer ↵Hugo Lima2010-02-221-21/+41
| | | | expressions.
* Fix memory corruption due to missing parenthesis in ternary operatorAnderson Lizardo2010-02-221-1/+1
| | | | Reviewed by Hugo Parente <hugo.lima@openbossa.org>
* The C string converter now transforms a Python None in a C null pointer.Marcelo Lira2010-02-201-1/+5
| | | | | The conversion of '[const] char*' to C++ now accepts an None object and gives back a NULL pointer.
* All enums are now extensible to match the C++ casting behaviour.Marcelo Lira2010-02-202-9/+0
| | | | | | | | | | | | | | | Now the user can build new values of a particular enum type passing an integer to its constructor. Thus, the following C++ code: MyEnum val = (MyEnum) 1; is the equivalent of this Python code: val = MyEnum(1) The enum unit tests were also updated. Reviewed by Lauro Moura <lauro.neto@openbossa.org>
* Fixing array deallocation in exampleLauro Neto2010-02-191-1/+1
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Adding sequenceToIntArray helper functionLauro Neto2010-02-192-0/+45
|
* Some optimizations and code cleanup on conversion code for std containers.Hugo Lima2010-02-181-11/+7
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Converter<T> doesn't inherits ConverterBase, to avoid uneeded template ↵Hugo Lima2010-02-181-1/+1
| | | | instanciations.
* Write a verbose error messages when the function arguments don't match.Hugo Lima2010-02-182-1/+39
| | | | | | | This will increase the binding size, so there's an option to disable verbose error messages. "--disable-verbose-error-messages" Reviewed by Renato Araújo <renato.filho@openbossa.org> and Marcelo Lira <marcelo.lira@openbossa.org>
* Do not export Sbk*Type variables.Hugo Lima2010-02-122-0/+18
| | | | | | To access Sbk*Type variables from other modules, you need to use the array provided via CObjects. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Deallocator for classes with private destructor now calls reference clearing ↵Marcelo Lira2010-02-121-0/+1
| | | | | | function. Reviewed by Lauro Moura <lauro.neto@openbossa.org>
* Adds support for managing objects referred by a Python wrapper.Marcelo Lira2010-02-122-1/+56
| | | | | | | | | | | | | | | | | | | | | A mapping to referred objects has been added to the SbkBaseWrapper structure to keep track of objects used by a given Python wrapper. This differs from ownership or parenting, since the referee is not responsible for destroying the referred object. It is more akin to a model/view relationship when many views refers to one model but don't own it, and the model must be kept alive as long it is referred. Two methods were added to assist the reference keeping: * SbkBaseWrapper_keepReference Causes a referred object reference counter to be increased and any previous used object refcount is decreased. SbkBaseWrapper_clearReferences Decrements the reference counter of all referred objects. It is called when the Python wrapper referee is destroyed.
* Removed some member initializations from SbkBaseWrapper_New.Marcelo Lira2010-02-121-4/+0
| | | | | The same initializations are made in SbkBaseWrapper_TpNew which is called by SbkBaseWrapper_New.
* Adding typeresolver.h to shiboken.hLauro Neto2010-02-111-0/+1
|
* Shiboken::setParent also accepts list of children.Renato Filho2010-02-051-1/+7
| | | | Reviewed by Hugo Parente <hugo.lima@openbossa.org>
* Fix Weakreference supportLauro Neto2010-02-041-0/+3
| | | | | | | - Flag for types with private destructor - Cleaning weakrefs in normal destructor Reviewed by Hugo Parente <hugo.lima@openbossa.org>
* Fixing tuple construction and adding more makeTupleLauro Neto2010-02-041-9/+23
| | | | | | For 4 and 5-item tuples Reviewed by Hugo Parente Lima <hugo.lima@openbossa.org>
* Adding support for weakreferenceLauro Neto2010-02-032-1/+9
| | | | Reviewer: Renato Filho <renato.filho@openbossa.org>
* Fixed possible error in reparent process;Renato Filho2010-02-031-0/+5
| | | | Reviewed by Hugo Parente <hugo.lima@openbossa.org>
* char converter return string instead of intLauro Neto2010-02-021-1/+7
| | | | | | Only if not specified signed/unsigned Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
* Use Shiboken::AutoDecRef to handle python references.Hugo Lima2010-02-011-0/+2
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Adds support for void pointer conversions.Marcelo Lira2010-01-281-0/+24
| | | | | | | | | A new converter specialization was added to deal with 'void*' conversions. In the case of C++ generating a unknown void pointer a BaseWrapper is used to hold the said pointer. There is a new test for this situation. Reviewed by Renato Araújo <renato.filho@openbossa.org>
* Changed API for PySequence_to_argc_argv.Hugo Lima2010-01-282-4/+20
| | | | | | | | | | It was renamed to PySequenceToArgcArgv and a new argument was added, besides some documentation. If the sequence is empty and defaultAppName (the new argument) was provided, argc will be 1 and argv will have a copy of defaultAppName because some libraries, like Qt, need at least one element in argv (the application name), otherwise it'll crash somewhere inside Qt. Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
* Add overflow check to unsigned int, because we need it on 64bit platforms.Hugo Lima2010-01-221-21/+10
|
* Fix bug on overflow check routines under 32 bits platforms.Hugo Lima2010-01-221-33/+50
|
* Adds support for Duck Punching (aka Monkey Patching).Marcelo Lira2010-01-213-6/+40
| | | | | | | | | | | | | | | | The simplest definition of duck punching for our purposes is the ability to change the definition of a method in an instance of a class. To allow this behaviour the SbkBaseWrapper structure had to be extended with a 'ob_dict' which is a PyObject pointer to the instance dictionary. It is originally set to NULL until the user tries to access it. This dictionary could be accessed through the '__dict__' instance property. For now it is read-only. The generator was updated to handle the instance dictionary, and an extensive duck punching test was also added. Reviewed by Hugo Parente Lima <hugo.lima@openbossa.org>
* Add special conversion rules to the char type.Hugo Lima2010-01-201-3/+28
| | | | | | A type is convertible to char if it is a number or a 1-sized char. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Converter<PyInt> now follows the Converter interface.Hugo Lima2010-01-201-2/+2
| | | | | - Converter<PyInt>::isConvertible should return bool instead of int and - Converter<PyInt>::toPython must receive "const PyInt&" instead of just "PyInt".
* Adds convenience ThreadStateSaver class to libshiboken.Marcelo Lira2010-01-182-0/+64
| | | | | | | ThreadStateSaver class just wraps the Python Thread save and restore operations. Its destructor also ensures the restoration of saved thread state if the method ends abruptly, e.g. when the wrapped C++ library throws an exception.
* Adds convenience GilState class to libshiboken.Marcelo Lira2010-01-182-0/+56
| | | | | | GilState class puts some sugar over the Python GIL usage and also adds the safety of a final GIL release when the GilState destructor is called when get out of scope.
* libshiboken initialises Python threads if available.Marcelo Lira2010-01-151-0/+4
|
* Added SbkDbg stream class, used to print debug messages.Hugo Lima2010-01-143-5/+107
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Added template specialization SbkType<signed char>(), needed by someone.Hugo Lima2010-01-141-0/+1
|
* Implemented type discovery feature.Hugo Lima2010-01-146-7/+264
| | | | | | | | | | | | | | | The problem: - There are two class, A and B, B inherits from A. - You are inside a virtual method reimplemented in python with just one parameter of type A*. - But the object referenced by a variable of type A* is an instance of B and it was created by C++, not Python! - Shiboken needs to create a PyObject of type B, not A! This does not makes sense for C++, but does for Python, because python variables does not store type information, just values. To achieve this we use RTTI to get the real type name of a variable, then we create the PyObject using the TypeResolver infrastructure initially developed to help with signal slot problems. In other words, the TypeResolver class has been moved from libpyside to libshiboken.
* Removed warninig: missing braces around initializer for 'PyTypeObject' from ↵Hugo Lima2010-01-141-1/+5
| | | | basewrapper.cpp
* Fix transfer ownership on return values.Hugo Lima2010-01-131-0/+1
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>