2019-10-24 06:01:50 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2019 by its authors. See AUTHORS.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2018-04-16 17:44:27 -07:00
|
|
|
#ifndef EOLIAN_MONO_EVENTS_HH
|
2019-07-12 06:07:27 -07:00
|
|
|
#define EOLIAN_MONO_EVENTS_HH
|
2018-04-16 17:44:27 -07:00
|
|
|
|
2018-04-18 19:07:22 -07:00
|
|
|
#include <iterator>
|
|
|
|
|
2019-12-10 09:01:26 -08:00
|
|
|
#include <Eina.hh>
|
|
|
|
|
2018-04-16 17:44:27 -07:00
|
|
|
#include "grammar/generator.hpp"
|
|
|
|
#include "grammar/klass_def.hpp"
|
2019-12-10 09:01:26 -08:00
|
|
|
#include "type_match.hh"
|
2018-04-16 17:44:27 -07:00
|
|
|
#include "name_helpers.hh"
|
|
|
|
#include "using_decl.hh"
|
|
|
|
|
|
|
|
namespace eolian_mono {
|
|
|
|
|
2019-12-10 09:01:26 -08:00
|
|
|
namespace eina = efl::eina;
|
|
|
|
|
2018-04-18 19:07:22 -07:00
|
|
|
template<typename OutputIterator, typename Context>
|
|
|
|
struct unpack_event_args_visitor
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
2018-04-18 19:07:22 -07:00
|
|
|
mutable OutputIterator sink;
|
|
|
|
Context const* context;
|
|
|
|
attributes::type_def const& type;
|
2018-04-16 17:44:27 -07:00
|
|
|
|
2018-04-18 19:07:22 -07:00
|
|
|
typedef unpack_event_args_visitor<OutputIterator, Context> visitor_type;
|
|
|
|
typedef bool result_type;
|
|
|
|
bool operator()(grammar::attributes::regular_type_def const& regular) const
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
2019-11-11 06:33:03 -08:00
|
|
|
std::string const& arg = "info";
|
2018-04-27 14:08:25 -07:00
|
|
|
std::string arg_type = name_helpers::type_full_managed_name(regular);
|
2018-04-18 19:07:22 -07:00
|
|
|
|
2018-12-20 19:15:17 -08:00
|
|
|
if (regular.is_struct())
|
|
|
|
{
|
|
|
|
// Structs are usually passed by pointer to events, like having a ptr<> modifier
|
|
|
|
// Uses implicit conversion from IntPtr
|
|
|
|
return as_generator(
|
2019-11-11 06:33:03 -08:00
|
|
|
" info"
|
2018-12-20 19:15:17 -08:00
|
|
|
).generate(sink, attributes::unused, *context);
|
|
|
|
}
|
|
|
|
else if (type.is_ptr)
|
|
|
|
{
|
|
|
|
return as_generator("(" + arg_type + ")Marshal.PtrToStructure(" + arg + ", typeof(" + arg_type + "))")
|
2018-04-18 19:07:22 -07:00
|
|
|
.generate(sink, attributes::unused, *context);
|
2018-12-20 19:15:17 -08:00
|
|
|
}
|
2018-04-18 19:07:22 -07:00
|
|
|
|
|
|
|
using attributes::regular_type_def;
|
|
|
|
struct match
|
|
|
|
{
|
|
|
|
eina::optional<std::string> name;
|
|
|
|
std::function<std::string()> function;
|
|
|
|
}
|
2019-05-13 23:38:50 -07:00
|
|
|
/// Sizes taken from https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/sizeof
|
2018-04-18 19:07:22 -07:00
|
|
|
const match_table [] =
|
|
|
|
{
|
2019-05-13 23:38:50 -07:00
|
|
|
{"bool", [&arg] { return "Marshal.ReadByte(" + arg + ") != 0"; }}
|
|
|
|
|
|
|
|
, {"ubyte", [&arg] { return "Marshal.ReadByte(" + arg + ")"; }}
|
|
|
|
, {"byte", [&arg] { return "(sbyte) Marshal.ReadByte(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"char", [&arg] { return "(char) Marshal.ReadByte(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"short", [&arg] { return "Marshal.ReadInt16(" + arg + ")"; }}
|
|
|
|
, {"ushort", [&arg] { return "(ushort) Marshal.ReadInt16(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"int", [&arg] { return "Marshal.ReadInt32(" + arg + ")"; }}
|
|
|
|
, {"uint", [&arg] { return "(uint) Marshal.ReadInt32(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"long", [&arg] { return "Marshal.ReadInt64(" + arg + ")"; }}
|
|
|
|
, {"ulong", [&arg] { return "(ulong) Marshal.ReadInt64(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"llong", [&arg] { return "(long) Marshal.ReadInt64(" + arg + ")"; }}
|
|
|
|
, {"ullong", [&arg] { return "(ulong) Marshal.ReadInt64(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"int8", [&arg] { return "(sbyte)Marshal.ReadByte(" + arg + ")"; }}
|
|
|
|
, {"uint8", [&arg] { return "Marshal.ReadByte(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"int16", [&arg] { return "Marshal.ReadInt16(" + arg + ")"; }}
|
|
|
|
, {"uint16", [&arg] { return "(ushort)Marshal.ReadInt16(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"int32", [&arg] { return "Marshal.ReadInt32(" + arg + ")"; }}
|
|
|
|
, {"uint32", [&arg] { return "(uint) Marshal.ReadInt32(" + arg + ")"; }}
|
|
|
|
|
|
|
|
// We don't support int128 as csharp has no similar datatype.
|
|
|
|
, {"int64", [&arg] { return "Marshal.ReadInt64(" + arg + ")"; }}
|
|
|
|
, {"uint64", [&arg] { return "(ulong) Marshal.ReadInt64(" + arg + ")"; }}
|
|
|
|
|
|
|
|
, {"float", [&arg] { return "Eina.PrimitiveConversion.PointerToManaged<float>(" + arg + ")"; }}
|
|
|
|
, {"double", [&arg] { return "Eina.PrimitiveConversion.PointerToManaged<double>(" + arg + ")"; }}
|
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
, {"string", [&arg] { return "Eina.StringConversion.NativeUtf8ToManagedString(" + arg + ")"; }}
|
2019-03-08 08:06:55 -08:00
|
|
|
, {"stringshare", [&arg] { return "Eina.StringConversion.NativeUtf8ToManagedString(" + arg + ")"; }}
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
, {"Eina.Error", [&arg] { return "(Eina.Error)Marshal.PtrToStructure(" + arg + ", typeof(Eina.Error))"; }}
|
2018-04-18 19:07:22 -07:00
|
|
|
};
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
std::string full_type_name = name_helpers::type_full_eolian_name(regular);
|
2018-04-18 19:07:22 -07:00
|
|
|
auto filter_func = [®ular, &full_type_name] (match const& m)
|
|
|
|
{
|
|
|
|
return (!m.name || *m.name == regular.base_type || *m.name == full_type_name);
|
|
|
|
};
|
|
|
|
|
|
|
|
auto accept_func = [&](std::string const& conversion)
|
|
|
|
{
|
|
|
|
return as_generator(conversion).generate(sink, attributes::unused, *context);
|
|
|
|
};
|
|
|
|
|
2019-12-10 09:01:26 -08:00
|
|
|
if (eina::optional<bool> b = type_match::get_match(match_table, filter_func, accept_func))
|
2018-04-18 19:07:22 -07:00
|
|
|
return *b;
|
|
|
|
else
|
eolian_mono: fix to support event info which is a type defined in eo
Summary:
Previously, if event info was not structure and it was a type defined in
eo, then the type value was not passed to the event info correctly.
e.g. if event info was Efl.Ui.AlertPopupButton enum type, then
default(Efl.Ui.AlertPopupButton) was always passed to event info.
Now, the given type value is passed to the event info correctly.
Reviewers: felipealmeida, lauromoura, vitor.sousa, bu5hm4n
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, herb, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9159
2019-06-27 10:29:13 -07:00
|
|
|
{
|
|
|
|
// Type defined in Eo is passed here. (e.g. enum type defined in Eo)
|
|
|
|
// Uses conversion from IntPtr with type casting to the given type.
|
|
|
|
return as_generator(
|
2019-11-11 06:33:03 -08:00
|
|
|
" (" << arg_type << ")info"
|
eolian_mono: fix to support event info which is a type defined in eo
Summary:
Previously, if event info was not structure and it was a type defined in
eo, then the type value was not passed to the event info correctly.
e.g. if event info was Efl.Ui.AlertPopupButton enum type, then
default(Efl.Ui.AlertPopupButton) was always passed to event info.
Now, the given type value is passed to the event info correctly.
Reviewers: felipealmeida, lauromoura, vitor.sousa, bu5hm4n
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, herb, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9159
2019-06-27 10:29:13 -07:00
|
|
|
).generate(sink, attributes::unused, *context);
|
|
|
|
}
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
2018-04-27 14:08:25 -07:00
|
|
|
bool operator()(grammar::attributes::klass_name const& cls) const
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
2020-01-22 14:30:13 -08:00
|
|
|
return as_generator("(Efl.Eo.Globals.CreateWrapperFor(info) as " + name_helpers::klass_full_interface_name(cls) + ")").generate(sink, attributes::unused, *context);
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
2019-12-17 06:34:30 -08:00
|
|
|
bool operator()(attributes::complex_type_def const& types) const
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
2019-12-17 06:34:30 -08:00
|
|
|
if (types.outer.base_type == "iterator")
|
|
|
|
return as_generator("Efl.Eo.Globals.IteratorTo" << eolian_mono::type << "(info)").generate(sink, type, *context);
|
|
|
|
else if (types.outer.base_type == "accessor")
|
|
|
|
return as_generator("Efl.Eo.Globals.AccessorTo" << eolian_mono::type << "(info)").generate(sink, type, *context);
|
2020-01-14 00:17:04 -08:00
|
|
|
else if (types.outer.base_type == "array")
|
|
|
|
return as_generator("Efl.Eo.Globals.NativeArrayTo" << eolian_mono::type << "(info)").generate(sink, type, *context);
|
|
|
|
else if (types.outer.base_type == "list")
|
|
|
|
return as_generator("Efl.Eo.Globals.NativeListTo" << eolian_mono::type << "(info)").generate(sink, type, *context);
|
2019-12-17 06:34:30 -08:00
|
|
|
else
|
|
|
|
return as_generator("new " << eolian_mono::type << "(info, false, false)").generate(sink, type, *context);
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-04-05 15:59:34 -07:00
|
|
|
template<typename OutputIterator, typename Context>
|
|
|
|
struct pack_event_info_and_call_visitor
|
|
|
|
{
|
|
|
|
mutable OutputIterator sink;
|
|
|
|
Context const* context;
|
|
|
|
attributes::type_def const& type;
|
2019-12-09 08:45:56 -08:00
|
|
|
std::string library_name;
|
|
|
|
std::string evt_c_name;
|
2019-04-05 15:59:34 -07:00
|
|
|
|
|
|
|
typedef pack_event_info_and_call_visitor<OutputIterator, Context> visitor_type;
|
|
|
|
typedef bool result_type;
|
|
|
|
|
|
|
|
bool operator()(grammar::attributes::regular_type_def const& regular) const
|
|
|
|
{
|
|
|
|
std::string arg_type = name_helpers::type_full_managed_name(regular);
|
|
|
|
|
|
|
|
auto const& indent = current_indentation(*context);
|
|
|
|
|
|
|
|
if (regular.is_struct())
|
|
|
|
{
|
|
|
|
return as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
|
|
|
|
<< indent.inc() << "IntPtr info = Marshal.AllocHGlobal(Marshal.SizeOf(e.arg));\n"
|
|
|
|
<< indent.inc() << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Marshal.FreeHGlobal(p));\n"
|
2019-04-05 15:59:34 -07:00
|
|
|
).generate(sink, attributes::unused, *context);
|
|
|
|
}
|
|
|
|
|
|
|
|
using attributes::regular_type_def;
|
|
|
|
struct match
|
|
|
|
{
|
|
|
|
eina::optional<std::string> name;
|
|
|
|
std::function<std::string()> function;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::string full_type_name = name_helpers::type_full_eolian_name(regular);
|
|
|
|
auto filter_func = [®ular, &full_type_name] (match const& m)
|
|
|
|
{
|
|
|
|
return (!m.name || *m.name == regular.base_type || *m.name == full_type_name);
|
|
|
|
};
|
|
|
|
|
|
|
|
match const str_table[] =
|
|
|
|
{
|
|
|
|
{"string", [] { return "e.arg"; }}
|
|
|
|
, {"stringshare", [] { return "e.arg"; }}
|
|
|
|
};
|
|
|
|
|
|
|
|
auto str_accept_func = [&](std::string const& conversion)
|
|
|
|
{
|
|
|
|
return as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
|
|
|
|
<< indent.inc() << "IntPtr info = Eina.StringConversion.ManagedStringToNativeUtf8Alloc(" << conversion << ");\n"
|
|
|
|
<< indent.inc() << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Eina.MemoryNative.Free(p));\n"
|
2019-12-09 08:45:56 -08:00
|
|
|
).generate(sink, attributes::unused, *context);
|
2019-04-05 15:59:34 -07:00
|
|
|
};
|
|
|
|
|
2019-12-10 09:01:26 -08:00
|
|
|
if (eina::optional<bool> b = type_match::get_match(str_table, filter_func, str_accept_func))
|
2019-04-05 15:59:34 -07:00
|
|
|
return *b;
|
|
|
|
|
|
|
|
match const value_table [] =
|
|
|
|
{
|
|
|
|
{"bool", [] { return "e.arg ? (byte) 1 : (byte) 0"; }}
|
|
|
|
, {"Eina.Error", [] { return "(int)e.arg"; }}
|
|
|
|
, {nullptr, [] { return "e.arg"; }}
|
|
|
|
};
|
|
|
|
|
|
|
|
auto value_accept_func = [&](std::string const& conversion)
|
|
|
|
{
|
|
|
|
return as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
|
|
|
|
<< indent.inc() << "IntPtr info = Eina.PrimitiveConversion.ManagedToPointerAlloc(" << conversion << ");\n"
|
|
|
|
<< indent.inc() << "CallNativeEventCallback(" + library_name + ", \"_" + evt_c_name + "\", info, " << "(p) => Marshal.FreeHGlobal(p));\n"
|
2019-12-09 08:45:56 -08:00
|
|
|
).generate(sink, attributes::unused, *context);
|
2019-04-05 15:59:34 -07:00
|
|
|
};
|
|
|
|
|
2019-12-10 09:01:26 -08:00
|
|
|
if (eina::optional<bool> b = type_match::get_match(value_table, filter_func, value_accept_func))
|
2019-04-05 15:59:34 -07:00
|
|
|
return *b;
|
|
|
|
|
|
|
|
return value_accept_func("e.args");
|
|
|
|
}
|
|
|
|
bool operator()(grammar::attributes::klass_name const&) const
|
|
|
|
{
|
|
|
|
auto const& indent = current_indentation(*context);
|
2020-01-02 14:27:25 -08:00
|
|
|
return as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
|
|
|
|
<< indent.inc() << "IntPtr info = e.arg.NativeHandle;\n"
|
2020-01-14 00:17:04 -08:00
|
|
|
<< indent.inc() << "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", info, null);\n"
|
2019-12-09 08:45:56 -08:00
|
|
|
).generate(sink, attributes::unused, *context);
|
2019-04-05 15:59:34 -07:00
|
|
|
}
|
2019-12-17 06:34:30 -08:00
|
|
|
bool operator()(attributes::complex_type_def const& type) const
|
2019-04-05 15:59:34 -07:00
|
|
|
{
|
|
|
|
auto const& indent = current_indentation(*context);
|
2020-01-14 00:17:04 -08:00
|
|
|
bool is_own = type.outer.base_qualifier & attributes::qualifier_info::is_own;
|
|
|
|
std::string info_variable;
|
|
|
|
|
|
|
|
if (type.outer.base_type == "iterator")
|
|
|
|
info_variable = std::string("IntPtr info = Efl.Eo.Globals.IEnumerableToIterator(e.arg, ") + (is_own ? "true" : "false") + ");\n";
|
|
|
|
else if (type.outer.base_type == "accessor")
|
|
|
|
info_variable = std::string("IntPtr info = Efl.Eo.Globals.IEnumerableToAccessor(e.arg, ") + (is_own ? "true" : "false") + ");\n";
|
|
|
|
else if (type.outer.base_type == "array")
|
|
|
|
info_variable = std::string("IntPtr info = Efl.Eo.Globals.IListToNativeArray(e.arg, ") + (is_own ? "true" : "false") + ");\n";
|
|
|
|
else if (type.outer.base_type == "list")
|
|
|
|
info_variable = std::string("IntPtr info = Efl.Eo.Globals.IListToNativeList(e.arg, ") + (is_own ? "true" : "false") + ");\n";
|
|
|
|
else
|
|
|
|
info_variable = "IntPtr info = e.arg.Handle;\n";
|
|
|
|
return as_generator(indent.inc() << "Contract.Requires(e != null, nameof(e));\n"
|
|
|
|
<< indent.inc() << info_variable
|
|
|
|
<< indent.inc() << "CallNativeEventCallback(" << library_name << ", \"_" << evt_c_name << "\", info, null);\n"
|
2019-12-09 08:45:56 -08:00
|
|
|
).generate(sink, attributes::unused, *context);
|
2019-04-05 15:59:34 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
/*
|
|
|
|
* Generates a struct wrapping the argument of a given event.
|
|
|
|
*/
|
2018-04-16 17:44:27 -07:00
|
|
|
struct event_argument_wrapper_generator
|
|
|
|
{
|
|
|
|
template<typename OutputIterator, typename Context>
|
|
|
|
bool generate(OutputIterator sink, attributes::event_def const& evt, Context const& context) const
|
|
|
|
{
|
|
|
|
efl::eina::optional<grammar::attributes::type_def> etype = evt.type;
|
|
|
|
if (!etype.is_engaged())
|
|
|
|
return true;
|
|
|
|
|
efl-csharp: Respect beta for classes and other stuff.
Summary:
In order to work around an issue with Efl.App, which is stable but
inherits from Efl.Core.Command_Line, @beta interfaces/mixins in the
inheritance chain are simply skipped.
Also changed the class used int test for inheritance from C#
Efl.Loop is stable but internally it uses a @beta class as argument to
its Register() method in the constructor. When instantiating a
user-defined C# subclass, the binding calls the C# override in the
NativeInherit class and the marshalling fails as no code is generated
for the beta class.
Also moved Efl.Part test to a beta class. Efl.Part is still beta.
Regarding parts, they are skipped if its class is @beta too.
Also rejected all elm_* files in elm public eo files. They should get
back in as they are converted to Efl.Ui.* api. An exception is
elm_interface_scrollable.eo, as efl_ui_panel depends on it.
Fixes T7730
Test Plan: Run tests
Reviewers: vitor.sousa, segfaultxavi, felipealmeida, cedric, bu5hm4n, zmike
Reviewed By: vitor.sousa
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7730
Differential Revision: https://phab.enlightenment.org/D8268
2019-03-11 11:46:12 -07:00
|
|
|
if (blacklist::is_event_blacklisted(evt, context))
|
|
|
|
return true;
|
|
|
|
|
2018-04-16 17:44:27 -07:00
|
|
|
std::string evt_name = name_helpers::managed_event_name(evt.name);
|
|
|
|
|
2020-01-12 16:45:16 -08:00
|
|
|
if (!as_generator(scope_tab << "/// <summary>Event argument wrapper for event <see cref=\""
|
2019-10-11 14:45:41 -07:00
|
|
|
<< join_namespaces(evt.klass.namespaces, '.', managed_namespace)
|
|
|
|
<< klass_interface_name(evt.klass) << "." << evt_name << "\"/>.\n"
|
|
|
|
).generate(sink, nullptr, context))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
std::string since;
|
|
|
|
|
|
|
|
if (!evt.is_beta)
|
|
|
|
{
|
|
|
|
since = evt.documentation.since;
|
|
|
|
|
|
|
|
if (since.empty())
|
|
|
|
{
|
|
|
|
auto unit = (const Eolian_Unit*) context_find_tag<eolian_state_context>(context).state;
|
|
|
|
attributes::klass_def klass(get_klass(evt.klass, unit), unit);
|
|
|
|
since = klass.documentation.since;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!since.empty())
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab << lit("/// <para>Since EFL ") << evt.documentation.since << ".</para>\n"
|
2019-10-11 14:45:41 -07:00
|
|
|
).generate(sink, nullptr, context))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EINA_CXX_DOM_LOG_ERR(eolian_mono::domain) << "Event " << evt.name << " of class " << evt.klass.eolian_name
|
|
|
|
<< " is stable but has no 'Since' information.";
|
|
|
|
// We do not bail out here because there are some cases of this happening upstream.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-12 16:45:16 -08:00
|
|
|
if (!as_generator(scope_tab << lit("/// </summary>\n")
|
|
|
|
<< scope_tab << "[Efl.Eo.BindingEntity]\n"
|
|
|
|
<< scope_tab << "public class " << name_helpers::managed_event_args_short_name(evt) << " : EventArgs {\n"
|
|
|
|
<< scope_tab(2) << "/// <summary>Actual event payload.\n"
|
2019-10-11 14:45:41 -07:00
|
|
|
).generate(sink, nullptr, context))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (since != "")
|
|
|
|
{
|
2020-01-12 16:45:16 -08:00
|
|
|
if (!as_generator(scope_tab(2) << "/// <para>Since EFL " << since << ".</para>\n").generate(sink, nullptr, context))
|
2019-10-11 14:45:41 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-01-12 16:45:16 -08:00
|
|
|
if (!as_generator(scope_tab(2) << "/// </summary>\n"
|
|
|
|
<< scope_tab(2) << "/// <value>" << documentation_string << "</value>\n"
|
|
|
|
<< scope_tab(2) << "public " << type << " arg { get; set; }\n"
|
|
|
|
<< scope_tab << "}\n\n"
|
2019-10-11 14:45:41 -07:00
|
|
|
).generate(sink, std::make_tuple(evt.documentation.summary, *etype), context))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
} const event_argument_wrapper {};
|
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
/*
|
|
|
|
* Generates an event declaration as a C# Interface member.
|
|
|
|
* In regular/abstract classes they are declared directly in their
|
|
|
|
* implementation in event_definition_generator.
|
|
|
|
*/
|
2018-04-16 17:44:27 -07:00
|
|
|
struct event_declaration_generator
|
|
|
|
{
|
|
|
|
template<typename OutputIterator, typename Context>
|
|
|
|
bool generate(OutputIterator sink, attributes::event_def const& evt, Context const& context) const
|
|
|
|
{
|
|
|
|
std::string wrapper_args_type;
|
|
|
|
std::string evt_name = name_helpers::managed_event_name(evt.name);
|
|
|
|
|
efl-csharp: Respect beta for classes and other stuff.
Summary:
In order to work around an issue with Efl.App, which is stable but
inherits from Efl.Core.Command_Line, @beta interfaces/mixins in the
inheritance chain are simply skipped.
Also changed the class used int test for inheritance from C#
Efl.Loop is stable but internally it uses a @beta class as argument to
its Register() method in the constructor. When instantiating a
user-defined C# subclass, the binding calls the C# override in the
NativeInherit class and the marshalling fails as no code is generated
for the beta class.
Also moved Efl.Part test to a beta class. Efl.Part is still beta.
Regarding parts, they are skipped if its class is @beta too.
Also rejected all elm_* files in elm public eo files. They should get
back in as they are converted to Efl.Ui.* api. An exception is
elm_interface_scrollable.eo, as efl_ui_panel depends on it.
Fixes T7730
Test Plan: Run tests
Reviewers: vitor.sousa, segfaultxavi, felipealmeida, cedric, bu5hm4n, zmike
Reviewed By: vitor.sousa
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7730
Differential Revision: https://phab.enlightenment.org/D8268
2019-03-11 11:46:12 -07:00
|
|
|
if (blacklist::is_event_blacklisted(evt, context))
|
|
|
|
return true;
|
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
if (evt.type.is_engaged())
|
|
|
|
wrapper_args_type = "<" + name_helpers::managed_event_args_name(evt) + ">";
|
2018-04-16 17:44:27 -07:00
|
|
|
|
2020-01-12 16:45:16 -08:00
|
|
|
if (!as_generator(documentation(2))
|
2019-09-23 16:50:27 -07:00
|
|
|
.generate(sink, evt, context)) return false;
|
2019-08-02 04:49:20 -07:00
|
|
|
if (evt.type.is_engaged())
|
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << "/// <value><see cref=\"" << name_helpers::managed_event_args_name(evt) << "\"/></value>\n"
|
2019-08-02 04:49:20 -07:00
|
|
|
).generate(sink, evt, context)) return false;
|
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << "event EventHandler" << wrapper_args_type << " " << evt_name << ";\n"
|
2019-08-02 04:49:20 -07:00
|
|
|
).generate(sink, evt, context))
|
2018-04-16 17:44:27 -07:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} const event_declaration {};
|
|
|
|
|
|
|
|
struct event_definition_generator
|
|
|
|
{
|
|
|
|
attributes::klass_def const& klass;
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
attributes::klass_def const& leaf_klass;
|
2018-04-16 17:44:27 -07:00
|
|
|
bool is_inherited_event;
|
|
|
|
|
|
|
|
template<typename OutputIterator, typename Context>
|
2019-03-22 14:37:50 -07:00
|
|
|
bool generate(OutputIterator sink, attributes::event_def const& evt, Context const& context) const
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
efl-csharp: Respect beta for classes and other stuff.
Summary:
In order to work around an issue with Efl.App, which is stable but
inherits from Efl.Core.Command_Line, @beta interfaces/mixins in the
inheritance chain are simply skipped.
Also changed the class used int test for inheritance from C#
Efl.Loop is stable but internally it uses a @beta class as argument to
its Register() method in the constructor. When instantiating a
user-defined C# subclass, the binding calls the C# override in the
NativeInherit class and the marshalling fails as no code is generated
for the beta class.
Also moved Efl.Part test to a beta class. Efl.Part is still beta.
Regarding parts, they are skipped if its class is @beta too.
Also rejected all elm_* files in elm public eo files. They should get
back in as they are converted to Efl.Ui.* api. An exception is
elm_interface_scrollable.eo, as efl_ui_panel depends on it.
Fixes T7730
Test Plan: Run tests
Reviewers: vitor.sousa, segfaultxavi, felipealmeida, cedric, bu5hm4n, zmike
Reviewed By: vitor.sousa
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7730
Differential Revision: https://phab.enlightenment.org/D8268
2019-03-11 11:46:12 -07:00
|
|
|
if (blacklist::is_event_blacklisted(evt, context))
|
|
|
|
return true;
|
|
|
|
|
2019-12-09 08:45:56 -08:00
|
|
|
auto library_name = context_find_tag<library_context>(context).actual_library_name(klass.filename);
|
2018-04-16 17:44:27 -07:00
|
|
|
std::string managed_evt_name = name_helpers::managed_event_name(evt.name);
|
2019-04-05 15:59:34 -07:00
|
|
|
auto const& indent = current_indentation(context);
|
2018-04-16 17:44:27 -07:00
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
bool is_unique = helpers::is_unique_event(evt, leaf_klass);
|
|
|
|
bool use_explicit_impl = is_inherited_event && !is_unique;
|
|
|
|
|
|
|
|
// The name of the public event that goes in the public API.
|
2018-04-16 17:44:27 -07:00
|
|
|
std::string wrapper_evt_name;
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
if (use_explicit_impl)
|
2018-04-16 17:44:27 -07:00
|
|
|
wrapper_evt_name = name_helpers::translate_inherited_event_name(evt, klass);
|
|
|
|
else
|
|
|
|
wrapper_evt_name = managed_evt_name;
|
|
|
|
|
|
|
|
std::string klass_name;
|
|
|
|
if (is_inherited_event)
|
2018-04-27 14:08:25 -07:00
|
|
|
klass_name = name_helpers::klass_full_interface_name(klass);
|
2018-04-16 17:44:27 -07:00
|
|
|
else
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
klass_name = name_helpers::klass_concrete_name(klass);
|
2018-04-16 17:44:27 -07:00
|
|
|
|
|
|
|
std::string wrapper_args_type = "EventArgs";
|
|
|
|
std::string wrapper_args_template = "";
|
|
|
|
std::string event_args = "EventArgs args = EventArgs.Empty;\n";
|
2019-04-05 15:59:34 -07:00
|
|
|
std::string event_native_call;
|
2018-04-16 17:44:27 -07:00
|
|
|
|
|
|
|
efl::eina::optional<grammar::attributes::type_def> etype = evt.type;
|
|
|
|
|
2019-04-05 15:59:34 -07:00
|
|
|
if (!etype.is_engaged())
|
|
|
|
{
|
|
|
|
auto event_call_site_sink = std::back_inserter(event_native_call);
|
2020-01-12 16:45:16 -08:00
|
|
|
if (!as_generator(indent.inc().inc().inc() << "CallNativeEventCallback(" << library_name << ", \"_" << utils::to_uppercase(evt.c_name) << "\", IntPtr.Zero, null);\n")
|
2019-04-05 15:59:34 -07:00
|
|
|
.generate(event_call_site_sink, attributes::unused, context))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
|
|
|
wrapper_args_type = name_helpers::managed_event_args_name(evt);
|
|
|
|
wrapper_args_template = "<" + wrapper_args_type + ">";
|
2019-04-05 15:59:34 -07:00
|
|
|
std::string arg_initializer;
|
2018-04-18 19:07:22 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
auto arg_initializer_sink = std::back_inserter(arg_initializer);
|
2019-04-05 15:59:34 -07:00
|
|
|
auto event_call_site_sink = std::back_inserter(event_native_call);
|
|
|
|
|
|
|
|
auto sub_context = change_indentation(indent.inc().inc(), context);
|
2018-04-18 19:07:22 -07:00
|
|
|
|
2019-11-11 06:33:03 -08:00
|
|
|
if (!as_generator(", info => new " << wrapper_args_type << "{ "
|
|
|
|
<< "arg = ").generate(arg_initializer_sink, attributes::unused, context))
|
2019-04-05 15:59:34 -07:00
|
|
|
return false;
|
|
|
|
if (!(*etype).original_type.visit(unpack_event_args_visitor<decltype(arg_initializer_sink), decltype(sub_context)>{arg_initializer_sink, &sub_context, *etype}))
|
|
|
|
return false;
|
|
|
|
|
2019-12-09 08:45:56 -08:00
|
|
|
if (!(*etype).original_type.visit(pack_event_info_and_call_visitor<decltype(event_call_site_sink), decltype(sub_context)>{event_call_site_sink, &sub_context, *etype, library_name, utils::to_uppercase(evt.c_name)}))
|
2018-04-18 19:07:22 -07:00
|
|
|
return false;
|
|
|
|
|
2019-11-11 06:33:03 -08:00
|
|
|
arg_initializer += " }";
|
2018-04-16 17:44:27 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
event_args = arg_initializer;
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
|
2020-01-12 16:45:16 -08:00
|
|
|
if(!as_generator(documentation(2)).generate(sink, evt, context))
|
2018-04-16 17:44:27 -07:00
|
|
|
return false;
|
2019-08-02 08:29:27 -07:00
|
|
|
if (etype.is_engaged())
|
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << "/// <value><see cref=\"" << wrapper_args_type << "\"/></value>\n"
|
2019-08-02 08:29:27 -07:00
|
|
|
).generate(sink, evt, context)) return false;
|
2018-04-16 17:44:27 -07:00
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
// Visible event declaration. Either a regular class member or an explicit interface implementation.
|
|
|
|
if (klass.type == attributes::class_type::interface_ || klass.type == attributes::class_type::mixin)
|
|
|
|
{
|
|
|
|
// Public event implementation.
|
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << (!use_explicit_impl ? "public " : " ") << "event EventHandler" << wrapper_args_template << " " << (use_explicit_impl ? (klass_name + ".") : "") << managed_evt_name << "\n"
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
).generate(sink, attributes::unused, context))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else // For inheritable classes event handling.
|
|
|
|
{
|
|
|
|
// We may have inherited an event with the same name as this concrete event, thus
|
|
|
|
// the concrete event would "hide" the interface one, requiring the new keyword.
|
|
|
|
std::string visibility = "public ";
|
|
|
|
if (!is_unique)
|
|
|
|
visibility += "new ";
|
|
|
|
|
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << visibility << "event EventHandler" << wrapper_args_template << " " << wrapper_evt_name << "\n"
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
).generate(sink, attributes::unused, context))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-04-05 15:59:34 -07:00
|
|
|
if (!generate_event_add_remove(sink, evt, event_args, context))
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return false;
|
|
|
|
|
2019-04-05 15:59:34 -07:00
|
|
|
if (!generate_event_trigger(sink, evt, wrapper_evt_name, wrapper_args_type, event_native_call, context))
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return false;
|
2018-04-16 17:44:27 -07:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
|
|
|
|
template<typename OutputIterator, typename Context>
|
|
|
|
bool generate_event_trigger(OutputIterator sink
|
2019-04-05 15:59:34 -07:00
|
|
|
, attributes::event_def const &evt
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
, std::string const& event_name
|
|
|
|
, std::string const& event_args_type
|
2019-04-05 15:59:34 -07:00
|
|
|
, std::string const& event_native_call
|
2019-03-22 14:37:50 -07:00
|
|
|
, Context const& context) const
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
{
|
2019-04-05 15:59:34 -07:00
|
|
|
auto library_name = context_find_tag<library_context>(context).actual_library_name(klass.filename);
|
|
|
|
std::string upper_c_name = utils::to_uppercase(evt.c_name);
|
2019-11-12 22:58:39 -08:00
|
|
|
bool is_concrete = context_find_tag<class_context>(context).current_wrapper_kind == class_context::concrete;
|
2019-10-11 14:45:41 -07:00
|
|
|
|
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << "/// <summary>Method to raise event "<< event_name << ".\n"
|
2019-10-11 14:45:41 -07:00
|
|
|
).generate(sink, nullptr, context))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (!evt.is_beta)
|
|
|
|
{
|
|
|
|
std::string since = evt.documentation.since;
|
|
|
|
|
|
|
|
if (since.empty())
|
|
|
|
{
|
|
|
|
auto unit = (const Eolian_Unit*) context_find_tag<eolian_state_context>(context).state;
|
|
|
|
attributes::klass_def klass(get_klass(evt.klass, unit), unit);
|
|
|
|
since = klass.documentation.since;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!since.empty())
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << "/// <para>Since EFL " << evt.documentation.since << ".</para>\n"
|
2019-10-11 14:45:41 -07:00
|
|
|
).generate(sink, nullptr, context))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EINA_CXX_DOM_LOG_ERR(eolian_mono::domain) << "Event " << evt.name << " of class " << evt.klass.eolian_name
|
|
|
|
<< " is stable but has no 'Since' information.";
|
|
|
|
// We do not bail out here because there are some cases of this happening upstream.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-09 07:59:19 -08:00
|
|
|
// Close summary
|
2020-01-12 16:45:16 -08:00
|
|
|
if (!as_generator(scope_tab(2) << "/// </summary>\n").generate(sink, nullptr, context))
|
2019-12-09 07:59:19 -08:00
|
|
|
return false;
|
|
|
|
|
|
|
|
if (evt.type.is_engaged())
|
|
|
|
{
|
2020-01-12 16:45:16 -08:00
|
|
|
if (!as_generator(scope_tab(2) << "/// <param name=\"e\">Event to raise.</param>\n"
|
2019-12-09 07:59:19 -08:00
|
|
|
).generate(sink, nullptr, context))
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
if (!as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << (is_concrete ? "public" : "protected virtual") << " void On" << event_name << "(" << (!evt.type.is_engaged() ? "" : event_args_type + " e") << ")\n"
|
|
|
|
<< scope_tab(2) << "{\n"
|
2019-04-05 15:59:34 -07:00
|
|
|
<< event_native_call
|
2020-01-12 16:45:16 -08:00
|
|
|
<< scope_tab(2) << "}\n\n"
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
).generate(sink, nullptr, context))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename OutputIterator, typename Context>
|
2019-04-05 15:59:34 -07:00
|
|
|
bool generate_event_add_remove(OutputIterator sink
|
|
|
|
, attributes::event_def const &evt
|
|
|
|
, std::string const& event_args
|
|
|
|
, Context const& context) const
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
{
|
|
|
|
std::string upper_c_name = utils::to_uppercase(evt.c_name);
|
2019-01-15 23:29:56 -08:00
|
|
|
auto unit = (const Eolian_Unit*) context_find_tag<eolian_state_context>(context).state;
|
|
|
|
attributes::klass_def klass(get_klass(evt.klass, unit), unit);
|
|
|
|
auto library_name = context_find_tag<library_context>(context).actual_library_name(klass.filename);
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
return as_generator(
|
2020-01-12 16:45:16 -08:00
|
|
|
scope_tab(2) << "{\n"
|
|
|
|
<< scope_tab(2) << scope_tab << "add\n"
|
|
|
|
<< scope_tab(2) << scope_tab << "{\n"//evt.type.is_engaged()
|
|
|
|
<< scope_tab(2) << scope_tab << scope_tab << "Efl.EventCb callerCb = GetInternalEventCallback(value"
|
2019-11-11 06:33:03 -08:00
|
|
|
<< (evt.type.is_engaged() ? event_args : "") << ");\n"
|
2020-01-12 16:45:16 -08:00
|
|
|
<< scope_tab(2) << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
|
|
|
|
<< scope_tab(2) << scope_tab << scope_tab << "AddNativeEventHandler(" << library_name << ", key, callerCb, value);\n"
|
|
|
|
<< scope_tab(2) << scope_tab << "}\n\n"
|
|
|
|
<< scope_tab(2) << scope_tab << "remove\n"
|
|
|
|
<< scope_tab(2) << scope_tab << "{\n"
|
|
|
|
<< scope_tab(2) << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
|
|
|
|
<< scope_tab(2) << scope_tab << scope_tab << "RemoveNativeEventHandler(" << library_name << ", key, value);\n"
|
|
|
|
<< scope_tab(2) << scope_tab << "}\n"
|
|
|
|
<< scope_tab(2) << "}\n\n"
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
).generate(sink, attributes::unused, context);
|
|
|
|
}
|
2018-04-16 17:44:27 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct event_definition_parameterized
|
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
event_definition_generator operator()(attributes::klass_def const& klass, attributes::klass_def const& leaf_klass) const
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
csharp: Change to new class API.
Summary:
As discussed in T7204:
- Eo Interfaces/mixins -> C# Interfaces with concrete class
implementations
- Eo Regular/Abstracts -> Proper C# classes
- Added some new generators and helper methods.
- Refactored the class generator, splitting into helper methods
Eo handles now are stored only in the "root" class in any given
inheritance tree (generally, Efl.Object), and accessible to each child.
Methods also are defined in a single place instead of repeatedly
generated in everyfile, reducing the size of the generated .dll from
30MB to around 4.5MB.
Mixins are generated as C# interfaces but any regular class it inherits
from is lost, as we can't have interfaces inheriting from regular
classes. This will be dealt with in a later commit.
Summary of API Changes:
- Merged Inherit/Concrete classes. (These suffixes disappear from
regular classes).
- Interface still have implementations with 'Concrete' suffix for when
they are returned from methods.
- Removed 'I' from interface names.
- Removed interfaces for regular/abstract Eo classes.
- Concrete classes for interfaces/mixins hold the event argument struct.
- Removed '_' from classes, enums, structs, etc, as indicated in C#
naming conventions.
- Namespaces are now Camel.Cased.
- Renamed IWrapper's raw_handle/raw_klass to NativeHandle/NativeClass
Also renamed the test classes as after the namespace change, the
test namespace Test can conflict with the helper Test namespace.
(And use more meaningful names than Test.Testing...)
Also Fixes T7336 by removing a deprecated example and adding
efl_loop_timer_example to build system.
Fixes T7451 by hiding the class_get DllImports and renaming the IWrapper
fields. The native handlers are used in the manual binding.
Still need to work:
- As there are still some events names clashing (e.g. Efl.Ui.Bg with "resize"
from Efl.Gfx.Entity and Efl.Gfx.Image), Events are currently declared on
the interface and implemented "namespaced" in the classes,
requiring the cast to the interface to access the event.
- The Mixin Conundrum. Mixin inheritance will be dealt in a future
commit.
Depends on D7260
Reviewers: segfaultxavi, vitor.sousa, felipealmeida, Jaehyun_Cho
Reviewed By: vitor.sousa
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7451, T7336
Differential Revision: https://phab.enlightenment.org/D7262
2018-11-29 15:04:37 -08:00
|
|
|
bool is_inherited_event = klass != leaf_klass;
|
|
|
|
return {klass, leaf_klass, is_inherited_event};
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
} const event_definition;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace efl { namespace eolian { namespace grammar {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct is_eager_generator<struct ::eolian_mono::event_argument_wrapper_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator<struct ::eolian_mono::event_argument_wrapper_generator> : std::true_type {};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct is_eager_generator<struct ::eolian_mono::event_declaration_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator<struct ::eolian_mono::event_declaration_generator> : std::true_type {};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct is_eager_generator<struct ::eolian_mono::event_definition_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator<struct ::eolian_mono::event_definition_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator<struct ::eolian_mono::event_definition_parameterized> : std::true_type {};
|
|
|
|
|
|
|
|
namespace type_traits {
|
|
|
|
template <>
|
|
|
|
struct attributes_needed<struct ::eolian_mono::event_argument_wrapper_generator> : std::integral_constant<int, 1> {};
|
|
|
|
template <>
|
|
|
|
struct attributes_needed<struct ::eolian_mono::event_declaration_generator> : std::integral_constant<int, 1> {};
|
|
|
|
template <>
|
|
|
|
struct attributes_needed<struct ::eolian_mono::event_definition_generator> : std::integral_constant<int, 1> {};
|
|
|
|
template <>
|
|
|
|
struct attributes_needed<struct ::eolian_mono::event_definition_parameterized> : std::integral_constant<int, 1> {};
|
|
|
|
}
|
|
|
|
} } }
|
|
|
|
|
|
|
|
#endif
|