| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
function.
Reviewed by Lauro Moura <lauro.neto@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The same initializations are made in SbkBaseWrapper_TpNew
which is called by SbkBaseWrapper_New.
|
| |
|
|
|
|
| |
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
|
|
|
|
|
|
|
| |
- Flag for types with private destructor
- Cleaning weakrefs in normal destructor
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
|
|
|
|
|
|
| |
For 4 and 5-item tuples
Reviewed by Hugo Parente Lima <hugo.lima@openbossa.org>
|
|
|
|
| |
Reviewer: Renato Filho <renato.filho@openbossa.org>
|
|
|
|
| |
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
|
|
|
|
|
|
| |
Only if not specified signed/unsigned
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
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>::isConvertible should return bool instead of int and
- Converter<PyInt>::toPython must receive "const PyInt&" instead of just "PyInt".
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
basewrapper.cpp
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
| |
The C++ object instanciation was made in tp_init function instead of tp_new function. Now tp_new just
create a useless python object which will be filled in the tp_init function.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
|
| |
tuples
from C++ objects.
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
template struct
In addition to the mere use of SbkCopyCppObject to copy C++ objects,
it is needed to know if a C++ type has a C++ wrapped produced by the
generator. To solve this SbkCopyCppObject was transformed in the template
struct CppObjectCopier with the methods copy and the constant member
isCppWrapper.
The Converter[Base]<>::createWrapper methods were replaced by template
function SbkCreateWrapper.
Also some refactoring was made on the Converters code to improve legibility.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
|
|
|
|
| |
in some parameters.
|
|
|
|
|
|
|
| |
Short methods in Converter and ConverterBase variations received the
"inline" keyword.
A convenience "toPython" signature receiving "void*" as parameter was
also added to the converter classes.
|
| |
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
| |
out of scope.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added a test for simple implicit numerical conversions involving
doubles, signed and unsigned ints and longs.
Some fixes to the converters were also made, mostly related to
adding manual checks for boundaries with doubles for negative values
Also put the overflow check in a single template
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SbkBaseWrapperType.
The wrapped classes are described with a SbkBaseWrapperType structure which
extends the PyTypeObject with information about multiple inheritance and
parenting ownership. This works well for the classes produced by the generator
but inheriting classes written in Python continues using the PyTypeObject to
describe themselves. To fix this the SbkBaseWrapperType is now a metatype for
all the wrapped classes and anyone inheriting from them.
In addition all the wrapped classes now inherit from SbkBaseWrapper, since
Python's PyType_Ready method need that multiple inheriting classes have a
common base class with the same size of the classes involved in the multiple
inheritance, which disqualifies Python's base "object" class.
The metatype and the base wrapper type are initialized by calling the new
Shiboken::init_shiboken() function. This is done by all the imported binding
modules, but it is really run only in the first call.
Another noteworthy change is the replacement of PyTypeObject as a basis for
SbkBaseWrapperType by the PyHeapTypeObject, since the latter is the proper
choice for types created on the heap, e.g. user defined classes extending
the generated wrapper classes.
Reviewed by Hugo Lima <hugo.lima@openbossa.org>
|
|
|
|
| |
with SbkBaseWrapper.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added the template function
T* SbkCopyCppObject(const T& cppobj);
whose task is simply to copy a C++ object. If the binding has a C++ class
wrapper for it, the function is specialized to use the copy constructor
of the C++ wrapper class. This replaces the Converter<T>::copyCppObject
method.
Also moved implementation of Converter<T>::toPython from the generator to
ConverterBase<T> in the conversions header, for it makes use of the
SbkCopyCppObject.
Reviewed by Lauro Neto <lauro.neto@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To avoid confusion of Python stuff with Shiboken generated stuff.
For example: a C++ class called "String" would have the PyString_Type
wrapper generated for it, mixing with the proper Python PyString_Type;
now the generate code will have things like SbkString_Type, SbkString_New,
SbkString_someMethod, and so on.
PyBaseWrapper and its variants were renamed to SbkBaseWrapper.
PyType<T>() is now SbkType<T>()
PyEnumObject was renamed to SbkEnumObject.
|
|
|
|
|
|
|
| |
The implementation of converters for pair, list and map containers was
moved from libsample test binding to libshiboken/conversions.h. The
implementation must be used with types similar to the C++ STL containers
of the same name.
|
|
|
|
|
|
|
|
|
|
|
| |
The Shiboken_TypeCheck calls Python's PyObject_TypeCheck using the
type pointer stored in PyType<T> for the type being checked.
Conversion<T*>::toCpp(pyobj) converter tries first to convert pyobj
to the Python wrapper for type T and only second to any of the
convertible types. If pyobj is neither of those, 0 is returned as
the C++ object. This works fine for Py_None and invalid values are
not expected to be passed because the generated code checked the
types first.
|
|
|
|
|
|
|
| |
auto generated by the compiler using the function PyType<T> to get
PyTypeObject of a type T.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
| |
Unit tests were added also.
Reviewed by Hugo Lima <hugo.lima@openbossa.org>
|
|
|
|
| |
Reviewed by Hugo Lima <hugo.lima@openbossa.org>
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
|
|
| |
Using the CLASS->tp_mro, which contains the list of method resolution for
a Python class, to find an override for a wrapped C++ virtual method is
more correct than relying in the ShiboTypeObject's baseWrapperType value.
Also baseWrapperType was removed from ShiboTypeObject structure.
Reviewed by Hugo Lima <hugo.lima@openbossa.org>
|