Commit Graph

227 Commits

Author SHA1 Message Date
Jean-Philippe Andre 5901b4601e cxx: Implement support for parts
This generates methods like this:

  Part_Class part_name() const;

Which can then be used like:

  slider.indicator().format_string_set("%1.1f");
2017-12-05 10:15:40 +09:00
Jean-Philippe Andre 0f5d40e6d4 cxx: Add header guards to .impl.hh
Those are included headers after all, even if they're only included once
from Elementary.hh (or whatever Efl_Header.hh).
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre b4e3d4d8a4 cxx: Avoid pedantic warning with -Wold-style-cast
This affects the generated headers.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 03af836332 cxx: Use set for forward classes
This avoids duplication. Not very important as there are FWD_GUARD
macros anyway.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre d887c4de52 cxx: Add implicit conversion to Eo* pointer
This is part of the experimental stuff.

Allows calling C functions without using ._eo_ptr() explicitly. Probably
not super useful, assuming the interfaces are done :)
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre a787c3cc07 cxx: Only use eo_cxx:: for methods
Add an experimental (disabled) macro to only generate functions inside
the eo_cxx equivalent of a class, instead of inside both the eo_cxx and
the normal class definition.

I guess the duplicated definition had something to do with doxygen, but
I'm not sure this is quite necessary as doc will be generated with
custom scripts.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 12d50cbe19 cxx: No instantiate ctors for non-regular classes
Only regular classes can be instantiated, this should be reflected in
the C++ binding as well.
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 753304c69d cxx: Add define EFL_CXXPERIMENTAL for testing
I'll hide some controversial features behind this, until we come to an
agreement with @felipealmeida and people who actually know C++ (iow: not
just me^^).

Features protected:
 - easy wref (using -> without locking)
 - xxx_event_cb_add() functions in object classes
 - instantiate(obj) to create a new object
 - add as a synonym for instantiate (both in efl::eo)
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre 5425baa906 cxx: Add support for function pointers
This was tested on the function pointer Efl.Ui.Format_Func_Cb
2017-12-05 10:14:03 +09:00
Jean-Philippe Andre a597084db7 cxx: Add strbuf to the list of recognized builtins 2017-12-05 10:09:58 +09:00
Jean-Philippe Andre 258a214e0f cxx: Add event_cb_add functions to events
This enables a syntax like:

  button.clicked_event_cb_add([]() { std::cout << "Hello" << std::endl; });

I could not manage to pass the std::placeholders inside the template,
depending on whether the lambda has arguments or not. Not sure if
that's even possible.
2017-12-05 10:09:58 +09:00
Lauro Moura e6dd831f7e eolian_cxx: Many changes for the C# bindings
- Added helper function to get all methods of a given class (local and
  inherited methods)
- Add filename information to klass
- Added new defs: enum, value (currently only integers), struct
- Generator refactoring
- Eolian C compatibility
2017-12-04 15:47:49 -03:00
Jean-Philippe Andre c490392ee6 cxx: Fix ifdef protections in function impl
Mote: for protected we should use "protected:" if that is somehow
possible.
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre e7009b77a2 cxx: Add experimental "easy" way to use wref
I hid it behind ifdef for now as I'm very much unsure of what I'm doing.
This whole modern C++ thing is still weird to me :)

Prerequisite:
 #define EFL_CXX_WREF_EASY

This allows constructs such as:

  auto wobj = obj._get_wref();
  std::cout << wobj->text_get() << std::endl;
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre 73ec85aeff cxx: Add _get_wref() convenience to all classes
This allows constructs like:

  auto w_obj = obj._get_wref();
  auto cb = std::bind([w_obj]() {
    auto o = w_obj.lock();
    if (!o) return;
    o->call();
  });
  event_add(..., obj, cb);

Note: I don't like how those wref work. Close to c++ wref but far from
EFL wref.
2017-11-07 09:57:24 +09:00
Jean-Philippe Andre 3f64dcc521 cxx: Place beta API declarations behind ifdef
NOTE: protected APIs are placed behind ifdef as well in the
implementation file. This makes sense since the define is required for
the C code to compile, but this isn't what @protected means.
2017-11-07 09:57:24 +09:00
Felipe Magno de Almeida f05a799daa eolian-cxx: Fix multiple definitions in forward declaration 2017-10-25 18:03:09 -02:00
Daniel Kolesa 4f8a9b50f4 eolian: make inherits_get return a list of classes, not strings
Most of the time you need to retrieve the class from the string
anyway, so remove this relic of old Eolian and gain some small
performance benefits and extra convenience.

Subtly breaks API but everything should be updated.
2017-10-25 16:25:41 +02:00
Felipe Magno de Almeida 96d3af10bf eolian-cxx: Add optional parameter to lambda for unnamed proxy instantiation 2017-09-28 17:50:14 -03:00
Felipe Magno de Almeida bb887f9869 eolian-cxx: Fix compilation errors with new any_value_ptr and mstring types 2017-09-25 21:57:25 -03:00
Daniel Kolesa e4cd67c7d6 eolian cxx: rename generic_value to any_value 2017-09-22 22:52:18 +02:00
Daniel Kolesa 4bae2a7385 eolian: merge REGULAR and COMPLEX types 2017-09-22 17:46:02 +02:00
Daniel Kolesa 157e125114 eolian cxx: use new ownership check API 2017-09-15 16:35:24 +02:00
Felipe Magno de Almeida 44c0199f42 eolian-cxx: Fix instantiate constructor with lambda after disambiguation patch 2017-09-14 15:06:33 -03:00
Felipe Magno de Almeida 48b3c127f7 eo-cxx: Require instantiate keyword for constructors calling efl_add to avoid ambiguity 2017-09-08 11:47:29 +09:00
Daniel Zaoui b71612eb20 cxx: generate a constructor with a parent and a lambda function
Until now, one could not invoke functions into the constructor of a
widget possessing a parent. It is needed for widgets such as Efl.Ui.Check
where style is needed during construction.

@fix T5980
2017-09-07 01:29:57 +03:00
Felipe Magno de Almeida a7649a7897 eolian-cxx: Add workaround for function pointer types 2017-08-22 22:40:13 -03:00
Daniel Kolesa 9738a6e3d2 eolian cxx: fix the remaining type errors 2017-08-10 14:10:52 +02:00
Daniel Kolesa 22e27ab045 eolian cxx: fix build after eolian type api change 2017-08-10 13:38:38 +02:00
Felipe Magno de Almeida c40ecb6282 eolian-cxx: Add constructor with default argument
Fixes compilation error in clang. T5588
2017-06-18 20:02:10 -03:00
Felipe Magno de Almeida 0fcee227aa eolian-cxx: Fix C++ generation errors with handle opaque types 2017-06-18 11:31:43 -03:00
Felipe Magno de Almeida 6dcc8dd07f eolian-cxx: Fixed compilation error after Eolian_Unit type introduction 2017-06-02 18:27:46 -03:00
Felipe Magno de Almeida 891376f42a eolian-cxx: Add all cases in switch to remove warning 2017-01-18 23:07:46 -02:00
Felipe Magno de Almeida 679bbc5cab eolian-cxx: Do not call eolian_function_scope_get with EOLIAN_PROPERTY 2017-01-18 23:06:51 -02:00
Felipe Magno de Almeida a1f2db255b cxx: Modify how to generate C++ headers and allow cyclic dependencies
Allow cyclic dependencies in generated C++ headers by changing order
of includes and creating forward declarations.
2017-01-18 22:47:04 -02:00
Felipe Magno de Almeida e64327bacc eolian-cxx: Add std::move to member variable initialization
CID 1361231
2016-12-20 16:06:58 -03:00
Felipe Magno de Almeida b92acd5caf eolian-cxx: Make class_definition lambda's catch parameter by const-reference
CID 1361230
CID 1361234
2016-12-20 16:06:58 -03:00
Felipe Magno de Almeida 45e1ccf312 eolian-cxx: Remove EOLIAN_TYPE_POINTER enumeration 2016-11-10 15:20:36 -02:00
Felipe Magno de Almeida 137dd4864d eina-cxx: eolian-cxx: Fix correct usage of is_eolian_object traits 2016-11-03 17:59:20 -02:00
Carsten Haitzler 7d654b2065 fix build for c++ after eolian api change 2016-11-03 22:48:09 +09:00
Felipe Magno de Almeida dbed78ad3b eina-cxx: Moved variant to eina C++ 2016-09-14 00:33:22 -03:00
Felipe Magno de Almeida a63cfcafc7 eolian-cxx: Implement future template class for C++ 2016-09-11 23:44:05 -03:00
Lauro Moura 16986ffc7a eolian_cxx: Fix behavior with explicit void return
Only perform the single value/return type substitution on properties if the
void return type is implicit (i.e. NULL return from function_return_type_get),
following the eolian-C implementation as we use the generated headers.

Also update example after Eo-Efl changes.
2016-08-17 20:54:27 -03:00
Felipe Magno de Almeida f4a90dcde2 eolian-cxx: Fix compilation break from changes in Eo nomenclature
Rename of classes and function calls in generated code and C++ headers
2016-08-11 16:24:15 -03:00
Felipe Magno de Almeida 1c402f62a9 eolian-cxx: Fix generation for ref generic_values and Eolian classes 2016-07-05 16:32:11 -03:00
Felipe Magno de Almeida b09c1f8093 eolian-cxx: Added stringshare 2016-06-21 16:35:09 -03:00
Felipe Magno de Almeida b97a156ac4 eolian-cxx: Work with @inout parameter of void type 2016-06-16 21:48:07 -03:00
Felipe Magno de Almeida 9a407761bc eolian-cxx: Fix generation of non-inline function in headers 2016-06-15 17:49:56 -03:00
Felipe Magno de Almeida 136d0d684b eolian-cxx: Fix conversion to bool in clang 2016-06-15 17:49:56 -03:00
Felipe Magno de Almeida 3a7af71079 eolian-cxx: Fixed generation of implicit conversion operators 2016-06-15 15:50:04 -03:00
Felipe Magno de Almeida 8906998ef2 eolian-cxx: Add support for ref parameters and correct ownership handling 2016-06-14 22:44:02 -03:00
Jean-Philippe Andre c6dfdeb0c8 cxx: Add support for protected and beta events
The code is horrible, pardon my C++.

Note: I guess @protected should also change the scope from
public: to protected: but that's another problem. Here I'm only
trying to fix the build while still introducing @beta and
@protected flags.
2016-06-14 16:27:42 +09:00
Daniel Kolesa 33c147f6d4 eolian: remove the unnecessary subtypes API
Inner type can now be retrieved as a base type of the type.
If the type has two inner types or more, there is a new API that allows you to
get the second inner type by calling it on the first one (same would apply to
getting third via second etc.).

This API is simpler to use and doesn't require an iterator.
2016-06-10 14:28:19 +01:00
Lauro Moura 7b63ecf4f6 eolian_cxx: Fix build after scope_get changes 2016-06-09 18:53:31 -03:00
Felipe Magno de Almeida 343b88a735 eolian-cxx: Fix some C++ quirks that makes clang warn about 2016-06-08 12:55:19 -03:00
Felipe Magno de Almeida f683efd2c1 eolian-cxx: Fix generation of some primitive types
Fix translation of primitive types for C++ binding
2016-06-08 12:19:15 -03:00
Felipe Magno de Almeida 27429cf40b eolian-cxx: Fix compilation error on clang with const UDT initialization 2016-06-06 03:49:16 -03:00
Larry Jr 6680eca359 eolian-cxx: fix compilation errors an olders gcc 2016-06-06 03:30:42 -03:00
Felipe Magno de Almeida 2a3d7860db eolian-cxx: Rewrite to accomodate new features of the C++ binding 2016-06-06 02:54:36 -03:00
Felipe Magno de Almeida 66dade5604 eolian-cxx: Removed useless commented code 2016-05-26 16:46:40 -03:00
Daniel Kolesa 7782c0bcb9 eolian: add event_prefix and have classes follow that or eo_prefix by default
Previously events used to use class name as a prefix and ignored eo_prefix
when specified. This is no longer the case. Events follow eo_prefix by default
now. In order to get around this for classes where this is undesirable, a new
field event_prefix was added which takes priority over eo_prefix. If neither
is specified, class name is used like previously.

@feature
2016-05-17 17:50:43 +01:00
Stefan Schmidt e981bfc4e8 cxx: follow eoid to eo_self rename in cxx generator and bindings
Bringing efl back to a building state with cxx enabled.
2016-03-16 21:11:17 +01:00
Tom Hacohen 72c6236038 Revert "cxx: Migrate C++ binding to the new eo_add syntax"
This reverts commit 48f62ad686.
2016-03-11 12:29:03 +00:00
Vitor Sousa 48f62ad686 cxx: Migrate C++ binding to the new eo_add syntax 2016-03-09 15:46:19 -03:00
Vitor Sousa 9cbda57bf0 eolian-cxx: Fix Eolian C++ constructing methods with new eo_add
Also fix Eolian C++ examples using the new "eo_super".
2016-03-03 16:05:40 -03:00
Felipe Magno de Almeida 5c7d78d104 eolian-cxx: Partial fix for generation without eo_do 2016-03-03 16:05:40 -03:00
Felipe Magno de Almeida d40b046685 eolian-cxx: Fix C++ events with new Eo_Event_Cb signature 2016-02-29 11:01:04 -03:00
Jean-Philippe Andre 050bd0adc8 Eolian Cxx: Fix warnings related to deprecated EO_EV_DEL
Switch the generator to EO_BASE_EVENT_DEL.
2016-01-22 15:35:23 +09:00
Felipe Magno de Almeida 13606c4647 eolian-cxx: Fixed assert which was a tautology
Fixed the assert to the correct check

@fix CID 1316018
2015-10-09 13:51:20 -03:00
Felipe Magno de Almeida c2132a0666 eolian-cxx: Fix inheritance from C++ classes after Eo ABI breakage
Fixed removal of op field from Eo_Op_Description and removed
unnecessary use of internal Eo API to implement the Eo API function
for theh constructor of the inherited class.
2015-09-30 17:55:16 -05:00
Tom Hacohen 37f84b7e96 Eo: Drop doc field from ops and events.
This hasn't been used for a while. Since we are going to break Eo a bit anyway
it's a good opportunity to drop this.

This may cause a slight performance issues with legacy events, such as
smart callbacks. This shouldn't really be a problem as we've migrated away from
them. If it does, we need to migrate the remaining parts. Only relevant
for callbacks that are added before the classes are created, which
shouldn't be possible except for smart, only for old evas callbacks.
2015-09-28 15:09:16 +01:00
Vitor Sousa 22094b6a27 eolian_cxx: Fix C++ generated inheritance wrappers
Summary:
Fix a bug that happens when a Eolian C++ wrapper have no default
constructor (because it have obligatory constructing methods) and it is
being used as a return of a inheritance wrappers.
Switched to a conversion of the native type as the default return, instead
of a value initialized wrapper.

Reviewers: q66, felipealmeida

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2769
2015-06-25 15:58:43 +01:00
Vitor Sousa dae35333fd eolian_cxx: Use C++ wrappers instead of native types as parameters
Summary:
Using C++ wrapper types in the signature of methods of the generated
classes.
Now, when the type is an Eo type defined in Eolian, eolian_cxx will detect
it and use the equivalent C++ wrapper.

Types defined in Eolian no longer need to be specified in the lookup table,
so removed them from there.

Disable wrapping of non-const char*. The current wrapper (unique_ptr) is
not suited for some required operations like ownership acquisition from
C code.

Fix constructing properties that only have the "set" method.

Fix translation of non-const parameters.

Modified Makefiles to allow proper inclusion of evas_cxx headers required
by some tests and examples.

Move one auxiliary function to another reader to make it more accessible.

@feature

Reviewers: felipealmeida, q66, cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2752
2015-06-24 15:23:01 +01:00
Daniel Kolesa a1b2358527 eolian_cxx: initialize all members in a struct correctly
Fixes CID 1298133.

@fix
2015-06-08 10:48:22 +01:00
Vitor Sousa 2c48b3212a eolian_cxx: Fix @beta on generated bindings for C++ 2015-05-12 15:51:31 +01:00
Felipe Magno de Almeida 5791065d29 Fix uninitialized member by coverity CID 1294558
Initialize the scope member in the default constructor.
2015-04-23 21:24:06 -03:00
Vitor Sousa ce36f0be93 eolain_cxx: Fix C++ support for new Eolian features
Added optional constructor methods for C++ Eolian wrappers.
Changed the interface of wrappers' main constructors.
If there are optional constructor methods they should be passed as variadic
template argument at the end of the constructor.
To support variadic template arguments, the optional "parent" parameter is
now the first parameter and there is another constructor without the
"parent" parameter.

Checking for @optinal and @nullable attributes instead of @nonull.
Now @nonull is the default, and eina::optional is only used when @optional
or @nullable attribute is specified.

The names of constructor methods no longer have the class name prefixed.

Added unit tests for checking the binding of optional constructors.
Added new .eo file to be used in the test.

Changed the generated documentation of constructors.

Changed the efl::eo::inherit accordingly, to address these new features.
Now the constructor methods should be explicit called in the
efl::eo::inherit constructor, which will receive them via variadic
template arguments.

Added another constructor to efl::eo::inherit for passing the parent
object.

Updated some tests and examples to follow the new interface.

Removed some code that is no longer necessary.

Also, fix Eolian C++ support for constructing properties. fix
assertion when parsing constructing properties.

Now if a property is a constructing property eolian_cxx will generate a
constructor method that have the property name (without the "_set" suffix).
2015-04-14 01:06:57 -03:00
Vitor Sousa d530389898 eolian_cxx: Add protected methods and events to C++ wrappers and fixes
Using eina::string_view in eolian generated interfaces (instead of
std::string) to allow lightweight passing of both C strings and C++
std::string.

Also, No longer using eina::optional in generated headers for types
that already implements the concept of null state (like Eo wrappers
and eina_accessor).

Also fix allocating callback objects require by class methods
(i.e. static) in static vectors so the memory will be freed when the
programs exit.

Added a new test case for testing callbacks on class methods.

Moved method definitions and supplementary code from generated C++
wrappers to auxiliary header file (.eo.impl.hh) generated together
with the main ".eo.hh" file. Updated Makefiles to list such files in
the compilation and cleanup processes. Updated .gitignore to include
these new generated files.

Made general adjustments on the documentation of generated C++ wrappers

Added "PREDEFINED" preprocessor macro definition in the Doxyfile.in in
order to make some adjustments for better documentation in the C++
generated headers.  Excluding generation of documentation for classes
in the "eo_cxx" namespace (the namespace for "abstract" eolian C++
wrappers).  Now generating the documentation for the events too.
Hiding some auxiliary code from being documented. Some aesthetic
adjustments for generated white space. Generate documentation for the
main constructor of C++ wrappers and added auxiliary grammars to list
parameters names.
2015-04-14 01:06:57 -03:00
Vitor Sousa 9eb19f8852 eolian_cxx: Declaring all inherited events on the concrete C++ wrapper
Added declaration of all inherited events on the concrete type to
avoid unnecessary type conversion on event callbacks.

Note that when two events happens to have the same name, only the
event of the derived class is declared in the concrete class. Access to
such events should be made through the base class type specification.

Fix on forwarding callback object (changed std::move to std::forward).

Additional line break at the end of event handling methods in the
generated headers to improve readability.
2015-04-14 01:06:57 -03:00
Vitor Sousa 09be34b825 eolian_cxx: fix build error for some generated C++ wrappers
Name generation for some C++ wrapper functions were adding an illegal ":"
in the function name.
Fixed the logical error that was causing this to happens when converting
namespaces to function prefixes.

@fix
2015-04-03 16:30:46 +02:00
Vitor Sousa 0ca8f7c718 eolian_cxx: Fix wrapper constructors by updating to the new eo_add_ref interface 2015-02-23 17:04:53 -03:00
Felipe Magno de Almeida c57fa54fc8 eolian-cxx: Fixed mixed inheritance between C and C++ classes
Removed genereation for Eo.Base primitive methods which segfault'ed
on parent_set function.
2015-01-05 18:59:09 -02:00
Vitor Sousa 666b0da912 eolian_cxx: Using eina::optional to handle parameters without @nonull property 2015-01-05 15:52:27 -02:00
Vitor Sousa 4222cd3f50 eolian_cxx: Fix compilation of inheritance from Eolian generated classes
Updated the code for the "inheritance helper" functions and classes
to be in conformance with the new wrapper architecture.

Member variable "parents" of efl::eo::eo_class struct was split in two
member variables, "ancestors" and "parents", the former containing all
Eo class ancestors and the later only the direct bases.
Changed all required files accordingly.

Check to avoid using biding string when the parameter is @out now matches
any variation of "char".

Add default constructor to efl::eo::concrete in order to allow it to be
NULL initialized in the "inheritance helper" classes.

Removed conflicting parent_set member function in the efl::eo::inherit
class.

Removed the "inheritance_extension_function" generator since it is no
longer used.
2015-01-05 15:52:27 -02:00
Larry Jr 2b12114777 allow C++ user create new classes inheriting from Eolian generated Classes 2015-01-05 15:52:27 -02:00
Vitor Sousa 0685885c2a eolian_cxx: Add implicit conversion of the returned pointer of C++ wrappers
Overloaded address-of operator for C++ Eolian wrappers for implicit converting
to any ancestor pointer type when getting the object memory address.

Added new grammars to aid the creation of the pointer wrappers
responsible of doing the implicit conversions.

Added a unit test which checks the address-of overload for arbitrary classes.
Added new .eo files to be used in it.
2015-01-05 15:52:27 -02:00
Vitor Sousa 6519ae6ed9 eolian_cxx: Fix "dreaded diamond" inheritance problem for C++ wrappers
Solved diamond inheritance problem by completely removing inheritance in
the abstract class.
All ancestors are inherited directly in the concrete class.
The algorithm that list the ancestors also avoid repetition.

Now concrete classes define methods too. This helps referring the correct
method directly by the object type (when there are methods with the same
name).

Moved the declaration and definition of constructor methods to the concrete
class, since they should not be used in derived classes.

Updated example that call "color_set".
With this model, if two ancestor classes have a method with the same name,
to call one of them from a derived class you must write the scoped name of
the member function in the wrapper.
In this case, either Evas.Object and Evas.SmartObject have a property
named "color".

Added "from_global" option to the full_name grammar too.
2015-01-05 15:52:27 -02:00
Vitor Sousa ed75aa32d6 cxx: General C++ Eo wrapper generation improvement
Using a new architecture in the generated files that simplify multiple
inheritance and allows the use of interface types as parameters.

No longer using a hand-crafted C++ header for eo_base.eo.
This file was added to the generation process.

Updated all files that are dependent in the hand-crafted eo_base
C++ header.

Now there is a class that contains the essentials functions of the former
eo::base wrapper and that is used to create (through inheritance) the
"concrete" classes for all Eo generated wrappers.

No longer binding any function or property that are protected, private or
legacy for now.

eolian_type_instance is now a struct with general information for the
whole type.

Added the new header file namespace_generator.hh to hold namespace
generation grammars.

Separated declaration and definition of Eo wrappers methods.

Referring for most objects by its full name (starting at the global
namespace ::) in the generated files.

Created additional helper grammars to avoid code replication.

Removed a TODO comment referring to a doubt about inheritance of
constructor methods.
Added a TODO comment regarding memory allocation for callbacks in static
member functions.
2015-01-05 15:52:27 -02:00
Larry Jr ebebcf6438 catch exceptions in cxx wrappers and throw a eina_error 2015-01-05 15:52:27 -02:00
Vitor Sousa d5ec6c41d9 eolian_cxx: Fix: Using binding type for @out parameter instead of native type
No longer reverting to the native type when the parameter has "@out"
direction.

Added "is_out" member variable to eolian_type class.
With that, generators can keep track of the direction of the parameters.
Also added helper functions "type_is_out" and "type_is_complex".

Created "to_native" functions in eo_cxx_interop.hh to convert binding types
from C++ arguments to the actual C function arguments.
Added static assertions in these functions to enforce compatibility
between the binding and the native type (Required by @out parameters).

Reworked the overload of the "to_c" function for eo::base derivated
objects. Now there is a overload that rely in the compatibility
between the native type and the wrapper, enabling a wrapper to be used as
an output parameter.
2015-01-05 15:52:27 -02:00
Felipe Magno de Almeida 890ce1f9cf eolian-cxx: Fixed C++ conversion for lists
Signed-off-by: Vitor Sousa <vitorsousasilva@gmail.com>
2015-01-05 15:52:27 -02:00
Vitor Sousa 64dede1cf1 eolian_cxx: Fix callback handling on generated wrappers
Added callbacks to the event EO_EV_DEL for deleting heap-allocated
function objects. This will enforce that the allocated memory,
necessary for maintaining these callable objects alive, is freed at
least when the underlaying Eo object is destroyed.

Functions and constructor methods are now able to have multiple
callback types.

Removed some unused generators, since they become inconsistent now that
functions are required to handle multiple callback types.

Allocating callback objects in the constructor methods instead of
delaying it until the final constructor is called.

Created some generators to avoid code repetition.

Now the generator parameters_forward_to_c replicate the behavior of the
generator parameters_list. The generator parameters_list was, then,
removed since it have a less intuitive name.

Added a TODO comment regarding the behaviour of simple not translating
callbacks that are not followed by a user data pointer.

The generator parameter_type was moved from "parameters_generator.hh" to
"type_generator.hh" for more consistency and convenience.
2015-01-05 15:52:27 -02:00
Vitor Sousa 132abc3534 eolian_cxx: Fix Eolian C++ generated wrapper inconsistencies
In convert.cc: Reading functions instead of implements to convert the
Eolian_Class. It avoids creation of methods that do not belong to the
class, in special it avoids calling the default constructor twice in the
generated code.

No longer generating one constructor in the C++ wrapper for each eolian
class constructor, since the correct behavior demands that all constructor
should be called. Now the wrappers have "constructor methods" that
must be called when creating a new object.

Updated test cases and examples to match the new interface. Some class
constructors and some test cases have to be removed since they were based
on the wrong assumption that constructors are mutually exclusive.

Created new generators for forwarding parameters and for looping over
the relevant parameters to the C++ wrapper executing a generic lambda.

Added a TODO comment regarding the call of constructor methods of all
base classes. Currently there is no base type with constructors, so this
situation should be discussed more.

Added a TODO comment regarding the way callback parameters are being
processed.
2015-01-05 15:52:27 -02:00
Vitor Sousa ed8ce801cb eolian_cxx: Assertions to ensure C++ wrapper compatibility with Eo*
Added static assertion in the generated header to ensure that the wrapper
have the same size of Eo*, thus grating compatibility between these types.

Added static assertion in the generated header to ensure that the wrapper
have standard layout. This should ensure correct type sizes when dealing
with inheritance.

Created a test to ensure that eo::base and the eolian wrappers have the
same size of a Eo*.

Added eolian_cxx_test_wrapper.cc to the list of test source files in
Makefile_Eolian_Cxx.am.
2015-01-05 15:52:27 -02:00
Felipe Magno de Almeida 36405c6556 eolian-cxx: Fixed pointer dereferencing for Eolian types and constant propagation for C++ eina list containers
With the addition of pointer types, the eolian C++ generator now has
to dereference to get the base type which might be a complex type.
2014-10-08 22:28:51 -03:00
Savio Sena e9e2344982 eolian-cxx: Replace old eo_add with eo_add_ref.
eo_add_ref behaves like the old eo_add.
2014-09-26 18:56:41 -03:00
Savio Sena 684617cfdc eo-cxx: Get rid of eo_add_custom. 2014-09-25 16:11:03 -03:00
Savio Sena ab43773a43 eolian-cxx: Include Efl.h in generated headers. 2014-09-12 15:28:23 -03:00
Savio Sena 916ddb46b8 eolian-cxx: Fix generated code indentation. 2014-09-12 15:28:23 -03:00
Savio Sena 07c6cadee3 eolian-cxx: Renamed event_*_callback_{add,call} to callback_*_{add,call}. 2014-08-13 10:17:53 -03:00
Savio Sena 0cc5f5c94d eolian-cxx: Added generation of call_constructor for parent_type. 2014-07-25 11:32:56 -03:00
Savio Sena fb82d67ab1 eolian-cxx: Fixed inheritance operations generation rules.
The generated code was not converting the types from C to C++ correctly.
2014-07-24 19:52:23 -03:00
Savio Sena bd68d29968 eolian-cxx: Added grammar rule parameters_cxx_list.
Now with the correct semantics: list parameters converting to C++.
2014-07-24 19:52:23 -03:00
Savio Sena 90f46e36f2 eolian-cxx: Renamed parameters_cxx_list -> constructor_parameters_list 2014-07-24 19:52:23 -03:00
Savio Sena cc04dff0b9 eolian-cxx: Removed unused code.
Sanitized grammar removing old code which is not unecessary for good.
2014-07-24 19:52:23 -03:00
Savio Sena dcb75cdc1d eolian-cxx: Fixed a bug in the generator.
It was not considering the variable name correctly.
2014-07-24 19:52:23 -03:00
Felipe Magno de Almeida ad66192465 eolian-cxx: Fixed generation using abstract return-type instead of C type
The _tmp_ret variable should use the native C type and not the
abstracted C++ type.
2014-07-18 19:20:55 -03:00
Felipe Magno de Almeida c1e8918b88 eolian-cxx: Fixed inheritance feature with callbacks
The addition of callbacks was making the inheritance to fail. Fixed
generation by using the C types, instead of the abstracted callback
types for the wrapper functions.
2014-07-18 19:00:35 -03:00
Felipe Magno de Almeida 907544be7b eolian-cxx: Various and various fixes with callbacks
Mimic the callback function generation for other functions that were
being generated incorrectly and inconsistently.
2014-07-18 18:59:12 -03:00
Felipe Magno de Almeida 15d85d7dc6 eolian-cxx: Workaround for callbacks without void* data parameter 2014-07-18 18:57:14 -03:00
Felipe Magno de Almeida 7e84cc0154 eo-cxx: Added a few complex types to lookup table 2014-07-18 18:57:14 -03:00
Felipe Magno de Almeida 401cc81355 eolian-cxx: Workaround for multiple callbacks without corresponding void*data
Added workaround for generating classes with methods that have more
than one callback but doesn't have a corresponding void* data
parameter. E.g., elm_box.eo.
2014-07-18 18:57:14 -03:00
Felipe Magno de Almeida bb1e5248c4 eolian-cxx: Fixed double qualifying operator on generated code
Fixed the generation of double qualifying operators on extension
inheritance for classes defined in the global namespace.
2014-07-18 18:57:14 -03:00
Savio Sena e807421f60 eolian-cxx: Fixed complex-types. 2014-07-18 18:57:13 -03:00
Savio Sena 04d90ae131 eolian-cxx: Relevant cosmetics. 2014-07-18 18:57:13 -03:00
Felipe Magno de Almeida 377bb449ba eolian-cxx: Added empty wrapper constructor
Added empty wrapper constructor to generation from std::nullptr_t and
allowed efl::eo::base to be empty with proper copy-constructors and
assignment operators.
2014-07-18 18:57:13 -03:00
Felipe Magno de Almeida 6109d17de1 eolian-cxx: Fixed inheritance extensions not proper qualifying the base class
The generator now globally qualifies the base names, so it works
outside the efl namespace
2014-07-18 18:57:13 -03:00
Savio Sena 67e187bebc eolian-cxx: Fixed the translation of the native type. 2014-07-18 18:57:13 -03:00
Savio Sena 027fa407bd eolian-cxx: Fixed a bug in class validator. 2014-07-18 18:57:13 -03:00
Savio Sena 78e396ac19 eolian-cxx: Initial version of complex types / callbacks / events implementation. 2014-07-18 18:57:13 -03:00
Felipe Magno de Almeida 5e5b00bc90 eolian-cxx: Disabled temporarily the inheritance feature
This feature is buggy when using multi-level namespaces. I disabled it
temporarily and will fix it ASAP and re-enable it.
2014-07-18 12:28:03 -03:00
Savio Sena ce63b16f40 eolian-cxx: Make proper handling of namespaces.
Summary:
The generation of class prefixes was not taking into account the full
classname -- the namespace was not being prepended to it. Fixed that and
also re-organized the code a bit, removed some Wshadow warnings also.

This commit fixes 'make examples' and 'make check'.

Reviewers: tasn, cedric, q66

CC: felipealmeida, smohanty, cedric

Differential Revision: https://phab.enlightenment.org/D1100
2014-07-01 10:55:45 +01:00
Daniel Kolesa c05493b480 eolian-cxx: Added namespaces and more (see below)
Implemented namespaces
Added eolian_wrappers.hh with C++ code wrapping Eolain API
Changed eolian_cxx program options. Now they're eolian_gen's
Added functions to safe_str.hh (safe_lower, safe_upper, normalize_spaces, path_base)
Added a mocked version of type_lookup.hh in advance. The full
version will come as soon as complex-types are added.

Made apply again by Daniel Kolesa, original implementation by Savio Sena.
2014-06-30 19:35:06 +01:00
Savio Sena a9babe8053 eolian-cxx: remove annoying compilation warnings and messages
Summary:
- remove an automake warning caused by a variable redefinition
- remove unnecessary verbosity during debug compilation

Reviewers: cedric, smohanty

CC: felipealmeida, cedric

Differential Revision: https://phab.enlightenment.org/D844

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-10 10:15:37 +02:00
Savio Sena e4f16cb2c5 eolian_cxx: pass eo_class by reference instead of by value.
Summary: This patch gets rid of a "defect" pointed out by Coverty Scan -- as per jackdanielz request.
CID 1211985.

Reviewers: cedric, smohanty, JackDanielZ

CC: felipealmeida, cedric

Differential Revision: https://phab.enlightenment.org/D840

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-09 13:02:43 +02:00
Savio Sena e61004e30f eolian_cxx: remove warnings from bin and lib.
Reviewers: cedric, smohanty, stefan_schmidt, stefan

CC: felipealmeida, cedric

Differential Revision: https://phab.enlightenment.org/D826

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-07 00:18:43 +02:00
Savio Sena 46b6e8a563 eolian_cxx: initial version of the EFL C++ Bindings Generator.
Summary:
This patch adds 'eolian_cxx' -- a C++ bindings generator --
to the EFL tree. Eolian Cxx uses Eolian API to read .eo files and generate
.eo.hh. It relies/depends on Eo Cxx and Eina Cxx (both non-generated
bindings).

src/bin/eolian_cxx: The eolian_cxx program.
src/lib/eolian_cxx: A header-only library that implements the C++ code
generation that binds the .eo classes.

=Examples=

src/examples/eolian_cxx/eolian_cxx_simple_01.cc: The simplest example,
it just uses some "dummy" generated C++ classes.

src/examples/eolian_cxx/eolian_cxx_inherit_01.cc: Illustrates how
pure C++ classes inherit from .eo generated classes.

src/examples/evas/evas_cxx_rectangle.cc: More realistic example using
the generated bindings Evas Cxx. Still a bit shallow because we don't
have full fledged .eo descriptions yet, but will be improved.

=Important=

The generated code is not supported and not a stable API/ABI. It is
here to gather people interest and get review before we set things in
stone for release 1.11.

@feature

Reviewers: cedric, smohanty, raster, stefan_schmidt

CC: felipealmeida, JackDanielZ, cedric, stefan

Differential Revision: https://phab.enlightenment.org/D805

Signed-off-by: Cedric Bail <cedric.bail@free.fr>
2014-05-03 00:56:32 +02:00