diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2018-04-27 18:08:25 -0300 |
---|---|---|
committer | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2018-05-03 18:04:41 -0300 |
commit | c9dd86579f1e4b585e5dadbc9f69df0abd263917 (patch) | |
tree | ba8b38e3600b15dec828e170dbe070dfd2bcb654 /src/lib/eolian_cxx | |
parent | f39baf1e82d7571225ac6429f7486e60abcf604f (diff) |
efl_mono: More uniformization of the handling of names
Summary:
Uses a common helper to open and close namespaces, to get the managed
and unmanaged name of things, the interface, concrete and inherit class
names, etc.
eolian_cxx: Add namespace information to func_def, as it'll avoid
eolian-cxx clients dealing with the eolian C api directly when trying
to access a function pointer namespace.
Depends on D6048
Reviewers: felipealmeida, vitor.sousa
Reviewed By: vitor.sousa
Subscribers: cedric
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6049
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r-- | src/lib/eolian_cxx/grammar/klass_def.hpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index 9c3681da1e..24969ab37a 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp | |||
@@ -530,12 +530,13 @@ enum class function_type | |||
530 | 530 | ||
531 | struct function_def | 531 | struct function_def |
532 | { | 532 | { |
533 | klass_name klass; | 533 | klass_name klass; // Klass information for function_def as method |
534 | type_def return_type; | 534 | type_def return_type; |
535 | std::string name; | 535 | std::string name; |
536 | std::vector<parameter_def> parameters; | 536 | std::vector<parameter_def> parameters; |
537 | std::string c_name; | 537 | std::string c_name; |
538 | std::string filename; | 538 | std::string filename; |
539 | std::vector<std::string> namespaces; // Namespaces for top-level function pointers | ||
539 | documentation_def documentation; | 540 | documentation_def documentation; |
540 | documentation_def return_documentation; | 541 | documentation_def return_documentation; |
541 | documentation_def property_documentation; | 542 | documentation_def property_documentation; |
@@ -553,6 +554,7 @@ struct function_def | |||
553 | && lhs.parameters == rhs.parameters | 554 | && lhs.parameters == rhs.parameters |
554 | && lhs.c_name == rhs.c_name | 555 | && lhs.c_name == rhs.c_name |
555 | && lhs.filename == rhs.filename | 556 | && lhs.filename == rhs.filename |
557 | && lhs.namespaces == rhs.namespaces | ||
556 | && lhs.documentation == rhs.documentation | 558 | && lhs.documentation == rhs.documentation |
557 | && lhs.return_documentation == rhs.return_documentation | 559 | && lhs.return_documentation == rhs.return_documentation |
558 | && lhs.property_documentation == rhs.property_documentation | 560 | && lhs.property_documentation == rhs.property_documentation |
@@ -571,6 +573,7 @@ struct function_def | |||
571 | std::vector<parameter_def> const& _parameters, | 573 | std::vector<parameter_def> const& _parameters, |
572 | std::string const& _c_name, | 574 | std::string const& _c_name, |
573 | std::string _filename, | 575 | std::string _filename, |
576 | std::vector<std::string> const& _namespaces, | ||
574 | documentation_def _documentation, | 577 | documentation_def _documentation, |
575 | documentation_def _return_documentation, | 578 | documentation_def _return_documentation, |
576 | documentation_def _property_documentation, | 579 | documentation_def _property_documentation, |
@@ -580,6 +583,7 @@ struct function_def | |||
580 | Eolian_Unit const* unit = nullptr) | 583 | Eolian_Unit const* unit = nullptr) |
581 | : klass(_klass), return_type(_return_type), name(_name), | 584 | : klass(_klass), return_type(_return_type), name(_name), |
582 | parameters(_parameters), c_name(_c_name), filename(_filename), | 585 | parameters(_parameters), c_name(_c_name), filename(_filename), |
586 | namespaces(_namespaces), | ||
583 | documentation(_documentation), | 587 | documentation(_documentation), |
584 | return_documentation(_return_documentation), | 588 | return_documentation(_return_documentation), |
585 | property_documentation(_property_documentation), | 589 | property_documentation(_property_documentation), |
@@ -587,7 +591,7 @@ struct function_def | |||
587 | is_beta(_is_beta), is_protected(_is_protected), | 591 | is_beta(_is_beta), is_protected(_is_protected), |
588 | unit(unit) {} | 592 | unit(unit) {} |
589 | 593 | ||
590 | function_def( ::Eolian_Function const* function, Eolian_Function_Type type, Eolian_Unit const* unit) | 594 | function_def( ::Eolian_Function const* function, Eolian_Function_Type type, Eolian_Typedecl const* tp, Eolian_Unit const* unit) |
591 | : return_type(void_), unit(unit) | 595 | : return_type(void_), unit(unit) |
592 | { | 596 | { |
593 | Eolian_Type const* r_type = ::eolian_function_return_type_get(function, type); | 597 | Eolian_Type const* r_type = ::eolian_function_return_type_get(function, type); |
@@ -648,6 +652,14 @@ struct function_def | |||
648 | else | 652 | else |
649 | { | 653 | { |
650 | filename = ""; | 654 | filename = ""; |
655 | |||
656 | if (tp) | ||
657 | { | ||
658 | for (efl::eina::iterator<const char> ns_iterator(::eolian_typedecl_namespaces_get(tp)), ns_last; | ||
659 | ns_iterator != ns_last; | ||
660 | ns_iterator++) | ||
661 | namespaces.push_back(&*ns_iterator); | ||
662 | } | ||
651 | } | 663 | } |
652 | is_beta = eolian_function_is_beta(function); | 664 | is_beta = eolian_function_is_beta(function); |
653 | is_protected = eolian_function_scope_get(function, type) == EOLIAN_SCOPE_PROTECTED; | 665 | is_protected = eolian_function_scope_get(function, type) == EOLIAN_SCOPE_PROTECTED; |
@@ -967,19 +979,19 @@ struct klass_def | |||
967 | try { | 979 | try { |
968 | if(! ::eolian_function_is_legacy_only(function, EOLIAN_PROP_GET) | 980 | if(! ::eolian_function_is_legacy_only(function, EOLIAN_PROP_GET) |
969 | && ::eolian_function_scope_get(function, EOLIAN_PROP_GET) != EOLIAN_SCOPE_PRIVATE) | 981 | && ::eolian_function_scope_get(function, EOLIAN_PROP_GET) != EOLIAN_SCOPE_PRIVATE) |
970 | functions.push_back({function, EOLIAN_PROP_GET, unit}); | 982 | functions.push_back({function, EOLIAN_PROP_GET, NULL, unit}); |
971 | } catch(std::exception const&) {} | 983 | } catch(std::exception const&) {} |
972 | try { | 984 | try { |
973 | if(! ::eolian_function_is_legacy_only(function, EOLIAN_PROP_SET) | 985 | if(! ::eolian_function_is_legacy_only(function, EOLIAN_PROP_SET) |
974 | && ::eolian_function_scope_get(function, EOLIAN_PROP_SET) != EOLIAN_SCOPE_PRIVATE) | 986 | && ::eolian_function_scope_get(function, EOLIAN_PROP_SET) != EOLIAN_SCOPE_PRIVATE) |
975 | functions.push_back({function, EOLIAN_PROP_SET, unit}); | 987 | functions.push_back({function, EOLIAN_PROP_SET, NULL, unit}); |
976 | } catch(std::exception const&) {} | 988 | } catch(std::exception const&) {} |
977 | } | 989 | } |
978 | else | 990 | else |
979 | try { | 991 | try { |
980 | if(! ::eolian_function_is_legacy_only(function, func_type) | 992 | if(! ::eolian_function_is_legacy_only(function, func_type) |
981 | && ::eolian_function_scope_get(function, func_type) != EOLIAN_SCOPE_PRIVATE) | 993 | && ::eolian_function_scope_get(function, func_type) != EOLIAN_SCOPE_PRIVATE) |
982 | functions.push_back({function, func_type, unit}); | 994 | functions.push_back({function, func_type, NULL, unit}); |
983 | } catch(std::exception const&) {} | 995 | } catch(std::exception const&) {} |
984 | } | 996 | } |
985 | for(efl::eina::iterator<Eolian_Function const> eolian_functions ( ::eolian_class_functions_get(klass, EOLIAN_METHOD)) | 997 | for(efl::eina::iterator<Eolian_Function const> eolian_functions ( ::eolian_class_functions_get(klass, EOLIAN_METHOD)) |
@@ -990,7 +1002,7 @@ struct klass_def | |||
990 | Eolian_Function_Type func_type = eolian_function_type_get(function); | 1002 | Eolian_Function_Type func_type = eolian_function_type_get(function); |
991 | if(! ::eolian_function_is_legacy_only(function, EOLIAN_METHOD) | 1003 | if(! ::eolian_function_is_legacy_only(function, EOLIAN_METHOD) |
992 | && ::eolian_function_scope_get(function, func_type) != EOLIAN_SCOPE_PRIVATE) | 1004 | && ::eolian_function_scope_get(function, func_type) != EOLIAN_SCOPE_PRIVATE) |
993 | functions.push_back({function, EOLIAN_METHOD, unit}); | 1005 | functions.push_back({function, EOLIAN_METHOD, NULL, unit}); |
994 | } catch(std::exception const&) {} | 1006 | } catch(std::exception const&) {} |
995 | } | 1007 | } |
996 | for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_inherits_get(klass)) | 1008 | for(efl::eina::iterator<Eolian_Class const> inherit_iterator ( ::eolian_class_inherits_get(klass)) |