summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2018-05-10 22:00:07 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2018-05-11 11:01:59 -0300
commitda6f5932f1ec0392d23d84907863271810d90567 (patch)
tree2dcf9729be38d78b2bacfa811072c7fbc5d161a1 /src/lib/eolian_cxx
parent95e3468aeee915c4b429066f14c39f2a0715f571 (diff)
efl_mono: Support type aliases.
Summary: Due to the absence of typedef from C#, we generate thin structs with implicit operators to allow reference the data from their typedef'd name from C#. The other alternatives would be always converting to the lowest base on the alias stack (losing the meaningfulness of the typedef name) or using the 'using' directive. The latter has the restriction that it makes an alias visible only in the file they are declared. Reviewers: felipealmeida, cedric, segfaultxavi Reviewed By: segfaultxavi Subscribers: zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6157
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 24969ab37a..d8b61458ce 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -414,6 +414,39 @@ inline void type_def::set(Eolian_Expression_Type eolian_exp_type)
414 } 414 }
415} 415}
416 416
417struct alias_def
418{
419 std::string eolian_name;
420 std::string cxx_name;
421 std::vector<std::string> namespaces;
422 bool is_undefined;
423 type_def base_type {};
424 documentation_def documentation;
425
426 alias_def(Eolian_Typedecl const* alias_obj, Eolian_Unit const* unit)
427 {
428 cxx_name = eolian_name = ::eolian_typedecl_short_name_get(alias_obj);
429
430 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_typedecl_namespaces_get(alias_obj))
431 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator)
432 {
433 this->namespaces.push_back((&*namespace_iterator));
434 }
435
436 Eolian_Type const* bt = ::eolian_typedecl_base_type_get(alias_obj);
437 if (eolian_type_type_get(bt) == EOLIAN_TYPE_UNDEFINED)
438 is_undefined = true;
439 else
440 {
441 base_type = type_def(::eolian_typedecl_base_type_get(alias_obj), unit, EOLIAN_C_TYPE_DEFAULT);
442 is_undefined = false;
443 }
444
445 documentation = ::eolian_typedecl_documentation_get(alias_obj);
446
447 }
448};
449
417enum class parameter_direction 450enum class parameter_direction
418{ 451{
419 unknown, in, inout, out 452 unknown, in, inout, out