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.
|
|
|
|
*/
|
2017-11-23 16:50:16 -08:00
|
|
|
#ifndef EOLIAN_MONO_NAME_HELPERS_HH
|
|
|
|
#define EOLIAN_MONO_NAME_HELPERS_HH
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <cctype>
|
|
|
|
#include <iterator>
|
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2019-11-22 07:01:59 -08:00
|
|
|
#include <map>
|
2018-04-16 08:36:51 -07:00
|
|
|
#include "utils.hh"
|
2017-11-23 16:50:16 -08:00
|
|
|
|
2018-04-16 17:44:27 -07:00
|
|
|
#include "grammar/integral.hpp"
|
|
|
|
#include "grammar/generator.hpp"
|
2018-04-16 12:26:13 -07:00
|
|
|
#include "grammar/klass_def.hpp"
|
2018-04-27 14:08:25 -07:00
|
|
|
#include "grammar/list.hpp"
|
|
|
|
#include "grammar/string.hpp"
|
|
|
|
#include "grammar/integral.hpp"
|
|
|
|
|
|
|
|
using efl::eolian::grammar::as_generator;
|
|
|
|
using efl::eolian::grammar::string;
|
|
|
|
using efl::eolian::grammar::lit;
|
|
|
|
using efl::eolian::grammar::operator*;
|
2018-04-16 12:26:13 -07:00
|
|
|
|
2017-11-23 16:50:16 -08:00
|
|
|
namespace eolian_mono {
|
|
|
|
|
2018-04-16 08:36:51 -07:00
|
|
|
/* Utility functions for naming things. Compared to the utils.hh, this header has higher level
|
|
|
|
* functions, dealing with the knowledge of how to convert the items to the C# style we are using, for
|
|
|
|
* example, while being too short to be implemented as full-fledged generators.
|
|
|
|
*/
|
2017-11-23 16:50:16 -08:00
|
|
|
namespace name_helpers {
|
|
|
|
|
2018-04-16 12:26:13 -07:00
|
|
|
namespace attributes = efl::eolian::grammar::attributes;
|
|
|
|
|
2018-04-16 17:44:27 -07:00
|
|
|
namespace detail {
|
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
|
|
|
inline bool is_equal(std::string const& lhs, std::string const& rhs)
|
|
|
|
{
|
|
|
|
return lhs == rhs;
|
|
|
|
}
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
|
2019-04-15 11:58:30 -07:00
|
|
|
// Forward declarations
|
|
|
|
template<typename T>
|
|
|
|
inline std::string klass_concrete_or_interface_name(T const& klass);
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string identity(std::string const& str)
|
|
|
|
{
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
2018-04-16 17:44:27 -07:00
|
|
|
inline std::string escape_keyword(std::string const& 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
|
|
|
using detail::is_equal;
|
|
|
|
if(is_equal(name, "delete")
|
|
|
|
|| is_equal(name, "do")
|
|
|
|
|| is_equal(name, "lock")
|
|
|
|
|| is_equal(name, "event")
|
|
|
|
|| is_equal(name, "in")
|
|
|
|
|| is_equal(name, "object")
|
|
|
|
|| is_equal(name, "interface")
|
|
|
|
|| is_equal(name, "string")
|
|
|
|
|| is_equal(name, "internal")
|
|
|
|
|| is_equal(name, "fixed")
|
2019-08-23 10:00:26 -07:00
|
|
|
|| is_equal(name, "var")
|
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
|
|
|
|| is_equal(name, "base"))
|
2018-04-16 17:44:27 -07:00
|
|
|
return "kw_" + 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 (is_equal(name, "Finalize"))
|
2018-04-16 17:44:27 -07:00
|
|
|
return name + "Add"; // Eo's Finalize is actually the end of efl_add.
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
typedef std::function<std::string(std::string const&)> string_transform_func;
|
2018-04-16 17:44:27 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string join_namespaces(std::vector<std::string> const& namespaces, char separator,
|
|
|
|
string_transform_func func=identity)
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
|
|
|
std::stringstream s;
|
|
|
|
for (auto&& n : namespaces)
|
|
|
|
s << func(n) << separator;
|
|
|
|
|
|
|
|
return s.str();
|
|
|
|
}
|
|
|
|
|
2017-11-23 16:50:16 -08:00
|
|
|
static const std::vector<std::string> verbs =
|
|
|
|
{
|
|
|
|
"add",
|
|
|
|
"get",
|
|
|
|
"is",
|
|
|
|
"del",
|
|
|
|
"thaw",
|
|
|
|
"freeze",
|
|
|
|
"save",
|
|
|
|
"wait",
|
|
|
|
"eject",
|
|
|
|
"raise",
|
|
|
|
"lower",
|
|
|
|
"load",
|
|
|
|
"dup",
|
|
|
|
"reset",
|
|
|
|
"unload",
|
|
|
|
"close",
|
|
|
|
"set",
|
|
|
|
"interpolate",
|
|
|
|
"has",
|
|
|
|
"grab",
|
|
|
|
"check",
|
|
|
|
"find",
|
|
|
|
"ungrab",
|
|
|
|
"unset",
|
|
|
|
"clear",
|
|
|
|
"pop",
|
|
|
|
"new",
|
|
|
|
"peek",
|
|
|
|
"push",
|
|
|
|
"update",
|
|
|
|
"show",
|
|
|
|
"move",
|
|
|
|
"hide",
|
|
|
|
"calculate",
|
|
|
|
"resize",
|
|
|
|
"attach",
|
|
|
|
"pack",
|
|
|
|
"unpack",
|
|
|
|
"emit",
|
|
|
|
"call",
|
2019-09-20 15:14:02 -07:00
|
|
|
"append",
|
|
|
|
"apply",
|
|
|
|
"bind",
|
|
|
|
"cancel",
|
|
|
|
"copy",
|
|
|
|
"create",
|
|
|
|
"cut",
|
|
|
|
"delete",
|
|
|
|
"deselect",
|
|
|
|
"detach",
|
|
|
|
"do",
|
|
|
|
"gen",
|
|
|
|
"insert",
|
|
|
|
"iterate",
|
|
|
|
"join",
|
|
|
|
"leave",
|
|
|
|
"limit",
|
|
|
|
"paste",
|
|
|
|
"parse",
|
|
|
|
"prepend",
|
|
|
|
"process",
|
|
|
|
"query",
|
|
|
|
"refresh",
|
|
|
|
"remove",
|
|
|
|
"register",
|
|
|
|
"reject",
|
|
|
|
"release",
|
|
|
|
"reply",
|
|
|
|
"send",
|
|
|
|
"select",
|
|
|
|
"serialize",
|
|
|
|
"steal",
|
|
|
|
"sync",
|
|
|
|
"toggle",
|
|
|
|
"unbind",
|
2019-12-22 23:21:10 -08:00
|
|
|
"unregister",
|
|
|
|
"unselect"
|
2017-11-23 16:50:16 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
const std::vector<std::string> not_verbs =
|
|
|
|
{
|
|
|
|
"below",
|
|
|
|
"above",
|
|
|
|
"name",
|
|
|
|
"unfreezable",
|
|
|
|
"value",
|
|
|
|
"r",
|
|
|
|
"g",
|
|
|
|
"b",
|
|
|
|
"a",
|
|
|
|
"finalize",
|
|
|
|
"destructor",
|
|
|
|
"to",
|
|
|
|
"circle",
|
|
|
|
"rect",
|
|
|
|
"path",
|
|
|
|
"commands",
|
|
|
|
"type",
|
|
|
|
"colorspace"
|
|
|
|
"op",
|
|
|
|
"type",
|
|
|
|
"properties",
|
|
|
|
"status",
|
|
|
|
"status",
|
|
|
|
"relative",
|
|
|
|
"ptr",
|
|
|
|
"pair",
|
|
|
|
"pos",
|
|
|
|
"end"
|
|
|
|
};
|
|
|
|
|
|
|
|
void reorder_verb(std::vector<std::string> &names)
|
|
|
|
{
|
|
|
|
if (names.size() <= 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::string verb = names.back();
|
|
|
|
|
|
|
|
if (std::find(verbs.begin(), verbs.end(), verb) != verbs.end())
|
|
|
|
{
|
|
|
|
names.pop_back();
|
|
|
|
names.insert(names.begin(), verb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string managed_namespace(std::string const& ns)
|
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
|
|
|
return escape_keyword(utils::remove_all(ns, '_'));
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
|
2019-04-23 03:19:09 -07:00
|
|
|
inline std::string managed_method_name(attributes::function_def const& f)
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
2019-04-23 03:19:09 -07:00
|
|
|
std::vector<std::string> names = utils::split(f.name, '_');
|
2018-04-16 17:44:27 -07:00
|
|
|
|
|
|
|
name_helpers::reorder_verb(names);
|
|
|
|
|
2018-05-02 15:49:37 -07:00
|
|
|
std::string candidate = escape_keyword(utils::to_pascal_case(names));
|
|
|
|
|
|
|
|
// Some eolian methods have the same name as their parent class
|
2019-04-23 03:19:09 -07:00
|
|
|
if (candidate == klass_concrete_or_interface_name(f.klass))
|
2018-05-02 15:49:37 -07:00
|
|
|
candidate = "Do" + candidate;
|
|
|
|
|
2019-04-15 11:58:30 -07:00
|
|
|
// Avoid clashing with System.Object.GetType
|
|
|
|
if (candidate == "GetType" || candidate == "SetType")
|
|
|
|
{
|
2019-04-23 03:19:09 -07:00
|
|
|
candidate.insert(3, f.klass.eolian_name);
|
2019-04-15 11:58:30 -07:00
|
|
|
}
|
|
|
|
|
2018-05-02 15:49:37 -07:00
|
|
|
return candidate;
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
|
2019-02-01 11:03:02 -08:00
|
|
|
inline std::string managed_name(std::string const& name, char separator='_')
|
|
|
|
{
|
|
|
|
auto tokens = utils::split(name, separator);
|
|
|
|
return utils::to_pascal_case(tokens);
|
|
|
|
}
|
|
|
|
|
2019-09-20 07:05:01 -07:00
|
|
|
inline std::string full_managed_name(std::string const& name)
|
|
|
|
{
|
|
|
|
std::stringstream ss;
|
|
|
|
|
|
|
|
auto words = utils::split(name, '.');
|
|
|
|
std::transform(words.begin(), words.end(), words.begin(), [](std::string const& word) {
|
|
|
|
return managed_name(word);
|
|
|
|
});
|
|
|
|
|
|
|
|
auto b = std::begin(words), e = std::end(words);
|
|
|
|
|
|
|
|
if (b != e)
|
|
|
|
{
|
|
|
|
std::copy(b, std::prev(e), std::ostream_iterator<std::string>(ss, "."));
|
|
|
|
b = std::prev(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Avoid trailing separator
|
|
|
|
if (b != e)
|
|
|
|
ss << *b;
|
|
|
|
|
|
|
|
return ss.str();
|
|
|
|
}
|
|
|
|
|
2018-05-10 18:00:07 -07:00
|
|
|
inline std::string alias_full_eolian_name(attributes::alias_def const& alias)
|
|
|
|
{
|
2019-01-13 22:21:21 -08:00
|
|
|
|
|
|
|
std::string eolian_name = utils::remove_all(alias.eolian_name, '_');
|
|
|
|
return join_namespaces(alias.namespaces, '.') + eolian_name;
|
2018-05-10 18:00:07 -07:00
|
|
|
}
|
|
|
|
|
2018-05-07 15:22:59 -07:00
|
|
|
inline std::string managed_async_method_name(attributes::function_def const& f)
|
|
|
|
{
|
|
|
|
return managed_method_name(f) + "Async";
|
|
|
|
}
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string function_ptr_full_eolian_name(attributes::function_def const& func)
|
2017-11-23 16:50:16 -08:00
|
|
|
{
|
2018-04-27 14:08:25 -07:00
|
|
|
return join_namespaces(func.namespaces, '.') + func.name;
|
2017-11-23 16:50:16 -08:00
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string type_full_eolian_name(attributes::regular_type_def const& type)
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
2018-04-27 14:08:25 -07:00
|
|
|
return join_namespaces(type.namespaces, '.') + type.base_type;
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string type_full_managed_name(attributes::regular_type_def const& type)
|
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
|
|
|
return join_namespaces(type.namespaces, '.', managed_namespace) + utils::remove_all(type.base_type, '_');
|
2018-04-16 17:44:27 -07:00
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string struct_full_eolian_name(attributes::struct_def const& struct_)
|
2018-04-16 17:44:27 -07:00
|
|
|
{
|
2018-04-27 14:08:25 -07:00
|
|
|
return join_namespaces(struct_.namespaces, '.') + struct_.cxx_name;
|
|
|
|
}
|
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
|
|
|
template<typename T>
|
|
|
|
inline std::string typedecl_managed_name(T const& item)
|
|
|
|
{
|
|
|
|
return utils::remove_all(item.cxx_name, '_');
|
|
|
|
}
|
|
|
|
|
|
|
|
inline std::string typedecl_managed_name(attributes::function_def const& func)
|
2018-05-02 15:49:37 -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
|
|
|
return utils::remove_all(func.name, '_');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline std::string enum_field_managed_name(std::string name)
|
|
|
|
{
|
|
|
|
std::vector<std::string> names = utils::split(name, '_');
|
|
|
|
return utils::to_pascal_case(names);
|
2018-05-02 15:49:37 -07:00
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string to_field_name(std::string const& in)
|
|
|
|
{
|
|
|
|
return utils::capitalize(in);
|
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
|
|
|
inline std::string managed_part_name(attributes::part_def const& part)
|
2018-04-16 12:26:13 -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
|
|
|
std::vector<std::string> names = utils::split(part.name, '_');
|
2019-05-07 04:44:23 -07:00
|
|
|
return utils::to_pascal_case(names) + "Part";
|
2018-04-16 12:26:13 -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
|
|
|
// Class name translation (interface/concrete/inherit/etc)
|
|
|
|
struct klass_interface_name_generator
|
2018-04-16 12:26:13 -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
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
std::string operator()(T const& klass) const
|
|
|
|
{
|
2019-09-06 07:03:23 -07:00
|
|
|
return ((klass.type == attributes::class_type::mixin
|
|
|
|
|| klass.type == attributes::class_type::interface_) ? "I" : "")
|
|
|
|
+ utils::remove_all(klass.eolian_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
|
|
|
}
|
2018-12-14 09:06:12 -08: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
|
|
|
template <typename OutputIterator, typename Attr, typename Context>
|
|
|
|
bool generate(OutputIterator sink, Attr const& attribute, Context const& context) const
|
|
|
|
{
|
|
|
|
return as_generator((*this).operator()<Attr>(attribute)).generate(sink, attributes::unused, context);
|
|
|
|
}
|
2018-12-14 09:06:12 -08:00
|
|
|
} const klass_interface_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
|
|
|
struct klass_full_interface_name_generator
|
|
|
|
{
|
|
|
|
template <typename T>
|
|
|
|
std::string operator()(T const& klass) const
|
|
|
|
{
|
|
|
|
return join_namespaces(klass.namespaces, '.', managed_namespace) + klass_interface_name(klass);
|
|
|
|
}
|
2018-12-14 09:06:12 -08: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
|
|
|
template <typename OutputIterator, typename Attr, typename Context>
|
|
|
|
bool generate(OutputIterator sink, Attr const& attribute, Context const& context) const
|
|
|
|
{
|
|
|
|
return as_generator((*this).operator()<Attr>(attribute)).generate(sink, attributes::unused, context);
|
|
|
|
}
|
2018-12-14 09:06:12 -08:00
|
|
|
} const klass_full_interface_name;
|
2018-04-16 12:26:13 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
template<typename T>
|
|
|
|
inline std::string klass_concrete_name(T const& klass)
|
2018-04-16 12:26:13 -07:00
|
|
|
{
|
2019-09-06 07:03:23 -07:00
|
|
|
return utils::remove_all(klass.eolian_name, '_') + ((klass.type == attributes::class_type::mixin
|
|
|
|
|| klass.type == attributes::class_type::interface_)
|
|
|
|
? "Concrete" : "");
|
2019-03-21 10:38:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
inline std::string klass_concrete_or_interface_name(T const& klass)
|
|
|
|
{
|
|
|
|
switch(klass.type)
|
|
|
|
{
|
|
|
|
case attributes::class_type::abstract_:
|
|
|
|
case attributes::class_type::regular:
|
|
|
|
return klass_concrete_name(klass);
|
|
|
|
default:
|
|
|
|
return klass_interface_name(klass);
|
|
|
|
}
|
2018-04-16 12:26:13 -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
|
|
|
struct klass_full_concrete_name_generator
|
2018-04-16 12:26:13 -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
|
|
|
template <typename T>
|
|
|
|
std::string operator()(T const& klass) const
|
|
|
|
{
|
|
|
|
return join_namespaces(klass.namespaces, '.', managed_namespace) + klass_concrete_name(klass);
|
|
|
|
}
|
2018-12-14 09:06:12 -08: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
|
|
|
template <typename OutputIterator, typename Attr, typename Context>
|
|
|
|
bool generate(OutputIterator sink, Attr const& attribute, Context const& context) const
|
|
|
|
{
|
|
|
|
return as_generator((*this).operator()<Attr>(attribute)).generate(sink, attributes::unused, context);
|
|
|
|
}
|
2018-12-14 09:06:12 -08:00
|
|
|
} const klass_full_concrete_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
|
|
|
|
|
|
|
struct klass_full_concrete_or_interface_name_generator
|
|
|
|
{
|
|
|
|
template <typename T>
|
|
|
|
std::string operator()(T const& klass) const
|
|
|
|
{
|
|
|
|
switch(klass.type)
|
|
|
|
{
|
|
|
|
case attributes::class_type::abstract_:
|
|
|
|
case attributes::class_type::regular:
|
|
|
|
return klass_full_concrete_name(klass);
|
2018-12-21 07:04:43 -08:00
|
|
|
default:
|
|
|
|
return klass_full_interface_name(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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename OutputIterator, typename Context>
|
|
|
|
bool generate(OutputIterator, attributes::unused_type, Context const&) const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename OutputIterator, typename Attr, typename Context>
|
|
|
|
bool generate(OutputIterator sink, Attr const& attribute, Context const& context) const
|
|
|
|
{
|
|
|
|
return as_generator((*this).operator()<Attr>(attribute)).generate(sink, attributes::unused, context);
|
|
|
|
}
|
2018-12-14 09:06:12 -08:00
|
|
|
} const klass_full_concrete_or_interface_name;
|
2018-04-16 12:26:13 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
template<typename T>
|
|
|
|
inline std::string klass_inherit_name(T 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
|
|
|
return klass_concrete_name(klass);
|
2018-04-27 14:08:25 -07:00
|
|
|
}
|
2018-04-16 12:26:13 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
template<typename T>
|
2019-04-23 02:48:03 -07:00
|
|
|
inline std::string klass_native_inherit_name(EINA_UNUSED T const& klass)
|
2018-04-27 14:08:25 -07:00
|
|
|
{
|
2019-04-23 02:48:03 -07:00
|
|
|
return "NativeMethods";
|
2018-04-27 14:08:25 -07:00
|
|
|
}
|
|
|
|
|
2018-12-14 14:39:09 -08:00
|
|
|
template<typename T>
|
|
|
|
inline std::string klass_full_native_inherit_name(T const& klass)
|
|
|
|
{
|
2019-04-23 02:48:03 -07:00
|
|
|
return klass_full_concrete_name(klass) + "." + klass_native_inherit_name(klass);
|
2018-12-14 14:39:09 -08:00
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
template<typename T>
|
|
|
|
inline std::string klass_get_name(T const& clsname)
|
|
|
|
{
|
2019-01-10 03:36:39 -08:00
|
|
|
return clsname.klass_get_name;
|
2018-04-27 14:08:25 -07:00
|
|
|
}
|
2018-04-16 12:26:13 -07:00
|
|
|
|
2018-12-14 09:06:12 -08:00
|
|
|
template<typename T>
|
|
|
|
inline std::string klass_get_full_name(T const& clsname)
|
2018-04-27 14:08:25 -07:00
|
|
|
{
|
|
|
|
return klass_full_concrete_name(clsname) + "." + klass_get_name(clsname);
|
2018-04-16 12:26:13 -07:00
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
// Events
|
|
|
|
inline std::string managed_event_name(std::string const& name)
|
2018-04-16 12:26:13 -07:00
|
|
|
{
|
eolian-mono: Renaming suffix for event and event args
Summary: suffix _Args to Args, Evt to Event
Reviewers: lauromoura, felipealmeida
Reviewed By: lauromoura
Subscribers: Jaehyun_Cho, woohyun, segfaultxavi, cedric, felipealmeida, #reviewers, lauromoura, #committers
Tags: #refactoring, PHID-PROJ-uhnmnvlvunw6jgoqdnd4, #efl_language_bindings
Maniphest Tasks: T8164, T8163
Differential Revision: https://phab.enlightenment.org/D9692
2019-09-06 06:45:18 -07:00
|
|
|
return utils::to_pascal_case(utils::split(name, "_,"), "") + "Event";
|
2018-04-27 14:08:25 -07:00
|
|
|
}
|
2018-04-16 12:26:13 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string managed_event_args_short_name(attributes::event_def const& evt)
|
|
|
|
{
|
2019-09-06 07:03:23 -07:00
|
|
|
return utils::remove_all(evt.klass.eolian_name, '_') + name_helpers::managed_event_name(evt.name) + "Args";
|
2018-04-27 14:08:25 -07:00
|
|
|
}
|
2018-04-16 12:26:13 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string managed_event_args_name(attributes::event_def 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
|
|
|
return join_namespaces(evt.klass.namespaces, '.', managed_namespace) +
|
|
|
|
managed_event_args_short_name(evt);
|
2018-04-27 14:08:25 -07:00
|
|
|
}
|
2018-04-16 12:26:13 -07:00
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
inline std::string translate_inherited_event_name(const attributes::event_def &evt, const attributes::klass_def &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
|
|
|
return join_namespaces(klass.namespaces, '_') + klass_interface_name(klass) + "_" + managed_event_name(evt.name);
|
2018-04-16 12:26:13 -07:00
|
|
|
}
|
|
|
|
|
2019-12-19 17:35:23 -08:00
|
|
|
// Properties
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
inline std::string property_managed_name(T const& klass, std::string const& name)
|
|
|
|
{
|
|
|
|
auto names = utils::split(name, '_');
|
|
|
|
// No need to escape keyword here as it will be capitalized and already
|
|
|
|
// namespaced inside the owner class.
|
|
|
|
auto managed_name = utils::to_pascal_case(names);
|
|
|
|
auto managed_klass_name = klass_concrete_or_interface_name(klass);
|
|
|
|
|
|
|
|
if (managed_name == "Type")
|
|
|
|
managed_name = managed_klass_name + managed_name;
|
|
|
|
|
|
|
|
return managed_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline std::string property_managed_name(attributes::property_def const& property)
|
|
|
|
{
|
|
|
|
return property_managed_name(property.klass, property.name);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline std::string property_concrete_indexer_name(attributes::property_def const& property)
|
|
|
|
{
|
|
|
|
return property_managed_name(property) + "Indexer";
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
inline std::string property_interface_indexer_name(attributes::property_def const& property, T const& current_klass)
|
|
|
|
{
|
|
|
|
return name_helpers::klass_full_interface_name(current_klass) + property_concrete_indexer_name(property);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
inline std::string property_interface_indexer_short_name(attributes::property_def const& property, T const& current_klass)
|
|
|
|
{
|
|
|
|
return name_helpers::klass_interface_name(current_klass) + property_concrete_indexer_name(property);
|
|
|
|
}
|
|
|
|
|
2018-04-27 14:08:25 -07:00
|
|
|
// Open/close namespaces
|
|
|
|
template<typename OutputIterator, typename Context>
|
2019-03-22 14:37:50 -07:00
|
|
|
bool open_namespaces(OutputIterator sink, std::vector<std::string> namespaces, Context const& context)
|
2018-04-27 14:08:25 -07:00
|
|
|
{
|
|
|
|
std::transform(namespaces.begin(), namespaces.end(), namespaces.begin(), managed_namespace);
|
|
|
|
|
2019-10-17 10:32:29 -07:00
|
|
|
std::string joined_namespace = join_namespaces(namespaces, '.');
|
|
|
|
if (joined_namespace.empty()) return true;
|
|
|
|
joined_namespace.pop_back();
|
|
|
|
|
|
|
|
return as_generator("namespace " << string << " {\n").generate(sink, joined_namespace, context);
|
2018-04-27 14:08:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename OutputIterator, typename Context>
|
2019-03-22 14:37:50 -07:00
|
|
|
bool close_namespaces(OutputIterator sink, std::vector<std::string> const& namespaces, Context const& context)
|
2018-04-27 14:08:25 -07:00
|
|
|
{
|
2019-10-17 10:32:29 -07:00
|
|
|
if (namespaces.empty()) return true;
|
|
|
|
return as_generator("}\n\n").generate(sink, attributes::unused, context);
|
2018-04-27 14:08:25 -07:00
|
|
|
}
|
|
|
|
|
2019-02-01 11:03:02 -08:00
|
|
|
std::string constructor_managed_name(std::string full_name)
|
|
|
|
{
|
|
|
|
auto tokens = utils::split(full_name, '.');
|
2018-04-16 17:44:27 -07:00
|
|
|
|
2019-02-01 11:03:02 -08:00
|
|
|
return managed_name(tokens.at(tokens.size()-1));
|
|
|
|
}
|
2018-04-16 17:44:27 -07:00
|
|
|
|
2019-11-13 05:05:19 -08:00
|
|
|
std::string translate_value_type(std::string const& name)
|
|
|
|
{
|
|
|
|
static std::map<std::string, std::string> table = {
|
|
|
|
{"sbyte", "SByte"},
|
|
|
|
{"byte","Byte"},
|
|
|
|
{"short","Int16"},
|
|
|
|
{"ushort","UInt16"},
|
|
|
|
{"int", "Int32"},
|
|
|
|
{"uint","UInt32"},
|
|
|
|
{"long","Int64"},
|
|
|
|
{"ulong","UInt64"},
|
|
|
|
{"char","Char"},
|
|
|
|
{"float","Single"},
|
|
|
|
{"double","Double"},
|
|
|
|
{"bool","Boolean"},
|
|
|
|
{"decimal","Decimal"},
|
|
|
|
};
|
|
|
|
|
|
|
|
auto found = table.find(name);
|
|
|
|
|
|
|
|
if (found != table.end())
|
|
|
|
return found->second;
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2019-11-18 20:48:01 -08:00
|
|
|
|
|
|
|
// Field names //
|
|
|
|
struct struct_field_name_generator
|
|
|
|
{
|
|
|
|
template <typename OutputIterator, typename Context>
|
|
|
|
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
|
|
|
|
{
|
|
|
|
return as_generator(string).generate(sink, name_helpers::to_field_name(field.name), context);
|
|
|
|
}
|
|
|
|
} const struct_field_name {};
|
|
|
|
|
2017-11-23 16:50:16 -08:00
|
|
|
} // namespace name_helpers
|
|
|
|
|
|
|
|
} // namespace eolian_mono
|
|
|
|
|
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
|
|
|
|
|
|
|
namespace efl { namespace eolian { namespace grammar {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct is_eager_generator<eolian_mono::name_helpers::klass_interface_name_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator<eolian_mono::name_helpers::klass_interface_name_generator> : std::true_type {};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct is_eager_generator<eolian_mono::name_helpers::klass_full_interface_name_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator<eolian_mono::name_helpers::klass_full_interface_name_generator> : std::true_type {};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct is_eager_generator<eolian_mono::name_helpers::klass_full_concrete_or_interface_name_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator<eolian_mono::name_helpers::klass_full_concrete_or_interface_name_generator> : std::true_type {};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct is_eager_generator<eolian_mono::name_helpers::klass_full_concrete_name_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator<eolian_mono::name_helpers::klass_full_concrete_name_generator> : std::true_type {};
|
|
|
|
|
2019-11-18 20:48:01 -08:00
|
|
|
template <>
|
|
|
|
struct is_eager_generator<eolian_mono::name_helpers::struct_field_name_generator> : std::true_type {};
|
|
|
|
template <>
|
|
|
|
struct is_generator< ::eolian_mono::name_helpers::struct_field_name_generator> : std::true_type {};
|
|
|
|
|
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
|
|
|
namespace type_traits {
|
|
|
|
template <>
|
|
|
|
struct attributes_needed<struct ::eolian_mono::name_helpers::klass_full_concrete_or_interface_name_generator> : std::integral_constant<int, 1> {};
|
2019-11-18 20:48:01 -08:00
|
|
|
|
|
|
|
template <>
|
|
|
|
struct attributes_needed< ::eolian_mono::name_helpers::struct_field_name_generator> : std::integral_constant<int, 1> {};
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
} } }
|
|
|
|
|
2017-11-23 16:50:16 -08:00
|
|
|
#endif
|