| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Also fixes another bugs found in our QFlags implementation.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Renato Araújo <renato.filho@openbossa.org>
|
|
|
|
|
| |
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
|
|
|
|
|
| |
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
|
|
|
|
|
| |
Reviewer: Renato Araújo <renato.filho@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
| |
Only C++ arguments with default values will be turned into Python
named arguments.
|
|
|
|
|
|
| |
The CppGenerator::pythonFunctionWrapperUsesListOfArguments(OverloadData)
method returns true if the Python wrapper for the received OverloadData
should handle with a single or multiple Python arguments.
|
|
|
|
|
|
|
|
| |
This makes the generated code more clear and eases future improvements
as named argument support. There is room for performance improvements.
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Reviewed by Renato Araújo <renato.filho@openbossa.org>
|
|
|
|
|
| |
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>,
Luciano Wolf <luciano.wolf@openbossa.org>
|
| |
|
|
|
|
|
| |
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>,
Luciano Wolf <luciano.wolf@openbossa.org>
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
cppgenerator.cpp
libshiboken/basewrapper.cpp
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Lauro Moura <lauro.neto@openbossa.org>
|
| | |
|
|/
|
|
|
| |
Adds the functions responsible for writing code for functions that
supports extensible conversions.
|
|
|
|
| |
field in SbkBaseWrapper_Type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enums and flags are now treated as immutable types, so
using a inplace operator will create a new flag object
and attribute it to the name which the operator is called.
flags = Qt.Window
flags |= Qt.Dialog # This will create a new object and attribute
# to flags
This was done in order to prevent changing the original objects as
the the inplace operator in line2 would modify the object pointed by
Qt.Window.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
symbols.
|
|
|
|
| |
Reviewed by Renato Araújo <renato.filho@openbossa.org>
|
|
|
|
|
| |
The method returns a textual representation of the argument index
for the given method.
|
|
|
|
|
|
| |
Whenever a class has AbstractMetaField objects, which represent
class member's of the likes of variables, the generator produces
get/set functions for the Python class wrapper.
|
|
|
|
|
|
| |
The new writeTypeCheck method receives an AbstractMetaType instead
of an OverloadData. The core functionality was moved to the new
method that is called by the old one after it had its own stuff done.
|
|
|
|
|
|
|
| |
- Decref references returned by the python implemantation.
- Print error, if it happen on python code of an virtual function called from C++.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
| |
If the method returns a pointer and there are no policies for the return type, the returned value is
considered child of the current object (self).
Reviewed by Renato Araújo <renato.filho@openbossa.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a class contains one or more overloads with static and non-static
signatures Python must accept both usages, but for this to work some
steps must be taken:
* The overload method is defined with its own PyMethodDef structure,
instead of being parte of an array of definitions.
* The overload method is marked as static in the PyMethodDef.
* This method definition is inserted in the PyMethodDef array for the
class.
* A tp_getattro function is generated and registered for the Python
wrapper. It is used to intercept instance calls to methods with
static versions to add the 'self' to the PyMethod.
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
| |
The code to write the definition of cppSelf was in two places and
contained an #ifdef clause, now it is a writer method.
Also added the ShibokenGenerator::cppSelfVariableName() method
to be used instead of directly writing the "cppSelf" string.
Updated custom code on test binding to remove warning.
Reviewed by Hugo Parente Lima <hugo.lima@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.
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
the flag enable-pyside-extensions is on.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
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.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
| |
to the Python method wrapper return variable, after a call to a C++
function that returns void, but only when any of its other overloads
has a return type different from void.
Also documented the CppGenerator::writeOverloadedMethodDecisor method.
|
|
|
|
|
| |
method, since it is used in more than one place. Also clearified the
error message.
|
|
|
|
| |
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
|
|
|
|
|
|
|
| |
method; it was used only by the boostpythongenerator from where
Shiboken code forked
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
|
|
|
|
|
|
|
| |
the converter implementations now are written in the proper wrapper
class .cpp files instead of in the global module header
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
|
|
|
|
|
|
|
| |
moment): the enum/flags numeric operators are shorter and only flags allow
new instances to be created and the libshiboken
Reviewd by Luciano Wolf <luciano.wolf@openbossa.org>
|
|
|
|
|
|
| |
on Python method wrappers that should convert from Python arguments
to C++ arguments; if implicit conversions are needed code to
deallocate any created object is also written.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* %SELF, replaced by the variable name for the Python instance
of a class method
* %CPPOBJ, replaced by the pointer to the C++ object for the
Python instance associated with the method where it appears
the 'cpythonWrapperCPtr(const AbstractMetaClass*, QString)' method
was moved from CppGenerator to ShibokenGenerator to be available
for the type system variable replacement method;
the test bindings for the libsample's SimpleFile class was updated
to use the new type system variables
|
| |
|
| |
|
| |
|