Page MenuHomePhabricator

csharp: Make classes abstract and rework casting

Authored by lauromoura on Apr 3 2019, 2:40 PM.



Abstract Eo classes are now proper C# abstract classes.

As a side effect, returning Eo instances from native code was reworked
to return instances of their actual Eo classes instead of previous
behavior of returning a generic Efl.Object and using static_cast.

Instead of var window = Efl.Ui.Win.static_cast(widget.GetParent());
Use var window = widget.GetParent() as Efl.Ui.Win;

Another side effect was that efl_constructor was removed from the list
of supported Efl.Object overrides. It is invoked inside
efl_add_internal_start, before the bindings makes the association of
the newly created EoId with the C# instance that created it, making the
managed delegate meaningless. C# users then can use regular C#
constructors to initialize fields.

Also changed to set the private data of C#-inherited classes before the
call to constructing methods (aka constructor parameters) so C# classes
can override them correctly.

Fixes T7778
Fixes T7757

Diff Detail

rEFL core/efl
No Linters Available
No Unit Test Coverage
Build Status
Buildable 10767
Build 8367: arc lint + arc unit
lauromoura created this revision.Apr 3 2019, 2:40 PM
lauromoura requested review of this revision.Apr 3 2019, 2:40 PM
segfaultxavi accepted this revision.Apr 4 2019, 4:12 AM

Awesome! I cannot comment on the code, but the ui_content.cs tutorial changes from:



(vsplit.GetPart("first") as Efl.IContent).SetContent(box);

Or even:


So we remove both static_cast and the Concrete suffix. I am happy, and the users will probably be too.

This revision is now accepted and ready to land.Apr 4 2019, 4:12 AM
vitor.sousa requested changes to this revision.Apr 4 2019, 12:52 PM

Just a comment:


I think this loop is kind of redundant.

This revision now requires changes to proceed.Apr 4 2019, 12:52 PM
lauromoura updated this revision to Diff 21226.Apr 4 2019, 1:15 PM

Update removing the while loop. (It falls there only if it is a generated class. And all generated classes have the IntPtr constructor.)

lauromoura marked an inline comment as done.Apr 4 2019, 1:31 PM
vitor.sousa accepted this revision.Apr 4 2019, 1:31 PM


This revision is now accepted and ready to land.Apr 4 2019, 1:31 PM
vitor.sousa accepted this revision.Apr 5 2019, 3:42 PM
This revision was automatically updated to reflect the committed changes.