aboutsummaryrefslogtreecommitdiffstats
path: root/cppgenerator.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug#320 - "OR'ing Qt alignments doesn't work; adding them does"Hugo Parente Lima2010-09-031-2/+1
| | | | | | | Also fixes another bugs found in our QFlags implementation. Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
* Impleted auto code for classes derived from list container.Renato Filho2010-08-301-0/+3
| | | | | Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
* Implemented support to properties.Renato Filho2010-07-081-0/+1
| | | | | Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
* Fix overload decisor written on constructors.Hugo Parente Lima2010-06-251-1/+1
| | | | | Reviewer: Renato Araújo <renato.filho@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
* Adds support for named arguments in function calls.Marcelo Lira2010-06-171-0/+2
| | | | | Only C++ arguments with default values will be turned into Python named arguments.
* Adds a method to tell if multiple Python arguments must be used in the code.Marcelo Lira2010-06-171-1/+5
| | | | | | The CppGenerator::pythonFunctionWrapperUsesListOfArguments(OverloadData) method returns true if the Python wrapper for the received OverloadData should handle with a single or multiple Python arguments.
* Overload decisor code modified to separate the decision and caller parts.Marcelo Lira2010-06-151-10/+21
| | | | | | | | 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>
* Export signals to the generated cpp files.Luciano Wolf2010-05-171-0/+2
| | | | | Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
* Removes random pasted code?Hugo Parente Lima2010-04-291-2/+0
|
* Fixed argument policy propagate.Renato Filho2010-04-221-1/+2
| | | | | Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
* Merge branch 'master' into extensibleconversionsMarcelo Lira2010-03-041-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: cppgenerator.cpp libshiboken/basewrapper.cpp Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Lauro Moura <lauro.neto@openbossa.org>
| * Use polymorphic-id-expression to discover the correct type of a C++ object.Hugo Lima2010-03-021-1/+1
| |
* | Adds extended conversions writer functions.Marcelo Lira2010-03-021-0/+4
|/ | | | | Adds the functions responsible for writing code for functions that supports extensible conversions.
* Fix bug #142 by eliminating the CppCopier::copy function and adding it to a ↵Hugo Lima2010-02-261-3/+2
| | | | field in SbkBaseWrapper_Type.
* Remove inplace operators of flagsLauro Neto2010-02-231-2/+0
| | | | | | | | | | | | | | | | 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>
* Write hash function for types with hash function specified in typesystem.Hugo Lima2010-02-231-0/+1
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* All enums are now extensible to match the C++ casting behaviour.Marcelo Lira2010-02-201-0/+1
| | | | | | | | | | | | | | | 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>
* Write all converters on global header to avoid the module from exporting any ↵Hugo Lima2010-02-181-1/+0
| | | | symbols.
* Fixes problem with CppGenerator::writeTypeCheck due to a bad rebasing.Marcelo Lira2010-02-111-1/+1
| | | | Reviewed by Renato Araújo <renato.filho@openbossa.org>
* Adds CppGenerator::argumentNameFromIndex method.Marcelo Lira2010-02-101-0/+2
| | | | | The method returns a textual representation of the argument index for the given method.
* Shiboken now generates code for public class variable members.Marcelo Lira2010-02-101-0/+7
| | | | | | 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.
* Adds a new overload to CppGenerator::writeTypeCheck.Marcelo Lira2010-02-101-0/+1
| | | | | | 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.
* - Write return value policy on reimplementations of virtual functions.Hugo Lima2010-02-021-1/+1
| | | | | | | - 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>
* Implement return value heuristic.Hugo Lima2010-02-021-0/+1
| | | | | | | 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>
* Use qualified C++ names on variables inside richComparison functions.Hugo Lima2010-01-261-0/+2
|
* Generator now supports overloads with both static and non-static methods.Marcelo Lira2010-01-191-0/+3
| | | | | | | | | | | | | | | | | 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>
* Adds CppGenerator::writeCppSelfDefinition method.Marcelo Lira2010-01-151-0/+1
| | | | | | | | | | 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>
* Implemented type discovery feature.Hugo Lima2010-01-141-0/+1
| | | | | | | | | | | | | | | 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.
* Fix object initialization.Hugo Lima2010-01-131-0/+1
| | | | | | | 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>
* Add metaObject() method to every class derived from QObject whenHugo Lima2009-12-161-0/+1
| | | | the flag enable-pyside-extensions is on.
* Converter<T>::copyCppObject method was replaced by a template function.Marcelo Lira2009-12-101-0/+2
| | | | | | | | | | | | | | | | | 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>
* Multiple inheritance works as desired for 99.9% of all known use cases!Hugo Lima2009-12-051-0/+2
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Implemented primitives to solve the parent/children problem.Hugo Lima2009-11-271-0/+1
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* Python arguments are now checked for Python wrapper validity.Marcelo Lira2009-11-261-2/+7
| | | | | | | | | | 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-261-1/+1
| | | | | | 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.
* Merged with multipleinheritance branchMarcelo Lira2009-11-251-0/+14
|\
| * Added the getAncestorMultipleInheritance method to CppGenerator,Marcelo Lira2009-11-181-0/+3
| | | | | | | | | | | | | | 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.
| * Shiboken retrieves a Python wrapper object from its correspondingMarcelo Lira2009-11-181-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Added the writeNoneReturn method to CppGenerator to attribute Py_NoneMarcelo Lira2009-11-201-0/+17
|/ | | | | | | 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.
* Moved the validity check for wrapped C++ objects to a CppGeneratorMarcelo Lira2009-11-181-0/+2
| | | | | method, since it is used in more than one place. Also clearified the error message.
* Add variables CONVERTTOPYTHO[###] and PYARG_# to code snips.Hugo Lima2009-11-161-1/+0
| | | | Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
* removed unused CppGenerator::writeNonVirtualModifiedFunctionNativeMarcelo Lira2009-11-161-1/+0
| | | | | | | method; it was used only by the boostpythongenerator from where Shiboken code forked Reviewed by Hugo Parente <hugo.lima@openbossa.org>
* moved HeaderGenerator::writeConverterImpl to CppGenerator, i.e.Marcelo Lira2009-11-101-0/+2
| | | | | | | 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>
* updated Python representation of C++ enums and flags (only QFlags at theMarcelo Lira2009-11-051-1/+1
| | | | | | | 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>
* added the CppGenerator::writeArgumentConversion method to be usedMarcelo Lira2009-11-041-0/+22
| | | | | | 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.
* Add initial support for python sequence protocol.Hugo Lima2009-11-031-0/+11
|
* added two new variables for the type system template system:Marcelo Lira2009-10-211-2/+0
| | | | | | | | | | | | | | * %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
* Rich comparison is back!Hugo Lima2009-09-281-1/+1
|
* added suport to flag-like enums (aka QFlags)Marcelo Lira2009-09-161-0/+11
|
* Removed rich comparison support until it stops generating bad C++ code.Hugo Lima2009-09-151-1/+1
|