diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2017-12-06 21:03:55 -0300 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertisesolutions.com.br> | 2017-12-20 19:57:17 -0200 |
commit | 46b202b86ce1912653bfcae2db2dac045af9bb2b (patch) | |
tree | 37e0256e4d3046bb24c555b472791f81b4f6d28f /src/lib/eolian_cxx | |
parent | 0609c68e34940e40e0caae1bb9dfc48d4eaa306e (diff) |
eolian-mono: Add documentation generation support
This commit adds the "documentation" generator, which gets the
documentation_def attribute of the given item and generates xml comments
to be exported by MCS.
For items requiring some customization of the generated comments (e.g.
functions and its parameters), the helpers to generate the preamble
(summary), body (paragraphs) and epilogue (currently just the @since
tag) were added.
Currently we do not support converting Eolian references into xmldoc
references.
As we explicitly generate Get/Set methods for properties, for now the
generator tries to get the get/set specific documentation first. If it
is not present, fallback to the common docs.
Later this could be changed to generate the common one as paragraphs of
the Get/Set.
Also some generated code like the wrappers for calling C# methods
from C can be private. This will cleanup the introspection results
and warnings when generating documentation.
Due to this visibility change, the binbuf tests had to be changed
to add redirect calls to the native methods instead of directly
calling the DllImport'd methods.
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r-- | src/lib/eolian_cxx/Eolian_Cxx.hh | 18 | ||||
-rw-r--r-- | src/lib/eolian_cxx/grammar/function_definition.hpp | 2 | ||||
-rw-r--r-- | src/lib/eolian_cxx/grammar/html_escaped_string.hpp | 51 | ||||
-rw-r--r-- | src/lib/eolian_cxx/grammar/klass_def.hpp | 151 | ||||
-rw-r--r-- | src/lib/eolian_cxx/grammar/string.hpp | 6 |
5 files changed, 211 insertions, 17 deletions
diff --git a/src/lib/eolian_cxx/Eolian_Cxx.hh b/src/lib/eolian_cxx/Eolian_Cxx.hh index 5a8ea813c7..ec5062fee3 100644 --- a/src/lib/eolian_cxx/Eolian_Cxx.hh +++ b/src/lib/eolian_cxx/Eolian_Cxx.hh | |||
@@ -24,6 +24,24 @@ struct eolian_init | |||
24 | } | 24 | } |
25 | }; | 25 | }; |
26 | 26 | ||
27 | struct eolian_state | ||
28 | { | ||
29 | Eolian *value; | ||
30 | eolian_state() | ||
31 | { | ||
32 | value = ::eolian_new(); | ||
33 | } | ||
34 | ~eolian_state() | ||
35 | { | ||
36 | ::eolian_free(value); | ||
37 | } | ||
38 | |||
39 | inline Eolian_Unit const* as_unit() const | ||
40 | { | ||
41 | return (Eolian_Unit const*)value; | ||
42 | } | ||
43 | }; | ||
44 | |||
27 | } } | 45 | } } |
28 | 46 | ||
29 | #endif // EOLIAN_CXX_LIB_HH | 47 | #endif // EOLIAN_CXX_LIB_HH |
diff --git a/src/lib/eolian_cxx/grammar/function_definition.hpp b/src/lib/eolian_cxx/grammar/function_definition.hpp index 3c2eab5c74..9b646efc9c 100644 --- a/src/lib/eolian_cxx/grammar/function_definition.hpp +++ b/src/lib/eolian_cxx/grammar/function_definition.hpp | |||
@@ -113,7 +113,7 @@ struct function_definition_generator | |||
113 | if(!as_generator(scope_tab).generate(sink, attributes::unused, ctx)) return false; | 113 | if(!as_generator(scope_tab).generate(sink, attributes::unused, ctx)) return false; |
114 | 114 | ||
115 | if(f.return_type != attributes::void_ | 115 | if(f.return_type != attributes::void_ |
116 | && !as_generator(attributes::c_type({attributes::parameter_direction::in, f.return_type, "", f.unit}) | 116 | && !as_generator(attributes::c_type({attributes::parameter_direction::in, f.return_type, "", attributes::documentation_def{}, f.unit}) |
117 | << " __return_value = " | 117 | << " __return_value = " |
118 | ).generate(sink, attributes::unused, ctx)) return false; | 118 | ).generate(sink, attributes::unused, ctx)) return false; |
119 | 119 | ||
diff --git a/src/lib/eolian_cxx/grammar/html_escaped_string.hpp b/src/lib/eolian_cxx/grammar/html_escaped_string.hpp new file mode 100644 index 0000000000..9a6eef1f7c --- /dev/null +++ b/src/lib/eolian_cxx/grammar/html_escaped_string.hpp | |||
@@ -0,0 +1,51 @@ | |||
1 | #ifndef EOLIAN_CXX_HTML_ESCAPED_STRING_HH | ||
2 | #define EOLIAN_CXX_HTML_ESCAPED_STRING_HH | ||
3 | |||
4 | #include <cstdlib> | ||
5 | #include <cstring> | ||
6 | |||
7 | #include "grammar/generator.hpp" | ||
8 | #include "grammar/attributes.hpp" | ||
9 | #include "grammar/string.hpp" | ||
10 | |||
11 | namespace efl { namespace eolian { namespace grammar { | ||
12 | |||
13 | struct html_escaped_string_generator | ||
14 | { | ||
15 | template<typename OutputIterator, typename Context> | ||
16 | bool generate(OutputIterator sink, std::string const& input, Context const& context) const | ||
17 | { | ||
18 | std::string out; | ||
19 | out.reserve(input.size()); | ||
20 | for (size_t pos = 0; pos != input.size(); ++pos) | ||
21 | { | ||
22 | switch(input[pos]) | ||
23 | { | ||
24 | case '&': out.append("&"); break; | ||
25 | case '\"': out.append("""); break; | ||
26 | case '\'': out.append("'"); break; | ||
27 | case '<': out.append("<"); break; | ||
28 | case '>': out.append(">"); break; | ||
29 | default: out.append(&input[pos], 1); break; | ||
30 | } | ||
31 | } | ||
32 | |||
33 | return as_generator(string).generate(sink, out, context); | ||
34 | } | ||
35 | }; | ||
36 | |||
37 | struct html_escaped_string_generator const html_escaped_string = {}; | ||
38 | |||
39 | template <> | ||
40 | struct is_eager_generator<html_escaped_string_generator> : std::true_type {}; | ||
41 | template <> | ||
42 | struct is_generator<html_escaped_string_generator> : std::true_type {}; | ||
43 | |||
44 | namespace type_traits { | ||
45 | template <> | ||
46 | struct attributes_needed<html_escaped_string_generator> : std::integral_constant<int, 1> {}; | ||
47 | } | ||
48 | } } } | ||
49 | |||
50 | #endif | ||
51 | |||
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index f95b765cee..16d15b6f24 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp | |||
@@ -167,6 +167,49 @@ inline bool operator<(klass_name const& lhs, klass_name const& rhs) | |||
167 | , rhs.type)); | 167 | , rhs.type)); |
168 | } | 168 | } |
169 | 169 | ||
170 | struct documentation_def | ||
171 | { | ||
172 | std::string summary; | ||
173 | std::string description; | ||
174 | std::string since; | ||
175 | std::vector<std::string> desc_paragraphs; | ||
176 | |||
177 | documentation_def() {} | ||
178 | documentation_def(std::string summary, std::string description, std::string since) | ||
179 | : summary(summary), description(description), since(since) | ||
180 | {} | ||
181 | documentation_def(Eolian_Documentation const* eolian_doc) | ||
182 | { | ||
183 | const char *str; | ||
184 | |||
185 | if (!eolian_doc) | ||
186 | return; | ||
187 | |||
188 | str = eolian_documentation_summary_get(eolian_doc); | ||
189 | if (str) | ||
190 | summary = str; | ||
191 | |||
192 | str = eolian_documentation_description_get(eolian_doc); | ||
193 | if (str) | ||
194 | description = str; | ||
195 | |||
196 | str = eolian_documentation_since_get(eolian_doc); | ||
197 | if (str) | ||
198 | since = str; | ||
199 | |||
200 | efl::eina::ptr_list<const char> l(eolian_documentation_string_split(description.c_str())); | ||
201 | for (auto&& i : l) | ||
202 | desc_paragraphs.push_back({&i}); | ||
203 | } | ||
204 | |||
205 | friend inline bool operator==(documentation_def const& lhs, documentation_def const& rhs) | ||
206 | { | ||
207 | return lhs.summary == rhs.summary | ||
208 | && lhs.description == rhs.description | ||
209 | && lhs.since == rhs.since; | ||
210 | } | ||
211 | }; | ||
212 | |||
170 | template <> | 213 | template <> |
171 | struct tuple_element<0ul, klass_name> | 214 | struct tuple_element<0ul, klass_name> |
172 | { | 215 | { |
@@ -394,21 +437,24 @@ struct parameter_def | |||
394 | parameter_direction direction; | 437 | parameter_direction direction; |
395 | type_def type; | 438 | type_def type; |
396 | std::string param_name; | 439 | std::string param_name; |
440 | documentation_def documentation; | ||
397 | Eolian_Unit const* unit; | 441 | Eolian_Unit const* unit; |
398 | 442 | ||
399 | friend inline bool operator==(parameter_def const& lhs, parameter_def const& rhs) | 443 | friend inline bool operator==(parameter_def const& lhs, parameter_def const& rhs) |
400 | { | 444 | { |
401 | return lhs.direction == rhs.direction | 445 | return lhs.direction == rhs.direction |
402 | && lhs.type == rhs.type | 446 | && lhs.type == rhs.type |
403 | && lhs.param_name == rhs.param_name; | 447 | && lhs.param_name == rhs.param_name |
448 | && lhs.documentation == rhs.documentation; | ||
404 | } | 449 | } |
405 | friend inline bool operator!=(parameter_def const& lhs, parameter_def const& rhs) | 450 | friend inline bool operator!=(parameter_def const& lhs, parameter_def const& rhs) |
406 | { | 451 | { |
407 | return !(lhs == rhs); | 452 | return !(lhs == rhs); |
408 | } | 453 | } |
409 | 454 | ||
410 | parameter_def(parameter_direction direction, type_def type, std::string param_name, Eolian_Unit const* unit) | 455 | parameter_def(parameter_direction direction, type_def type, std::string param_name, |
411 | : direction(std::move(direction)), type(std::move(type)), param_name(std::move(param_name)), unit(unit) {} | 456 | documentation_def documentation, Eolian_Unit const* unit) |
457 | : direction(std::move(direction)), type(std::move(type)), param_name(std::move(param_name)), documentation(documentation), unit(unit) {} | ||
412 | parameter_def(Eolian_Function_Parameter const* param, Eolian_Unit const* unit) | 458 | parameter_def(Eolian_Function_Parameter const* param, Eolian_Unit const* unit) |
413 | : type( ::eolian_parameter_type_get(param), unit, EOLIAN_C_TYPE_PARAM) | 459 | : type( ::eolian_parameter_type_get(param), unit, EOLIAN_C_TYPE_PARAM) |
414 | , param_name( ::eolian_parameter_name_get(param)), unit(unit) | 460 | , param_name( ::eolian_parameter_name_get(param)), unit(unit) |
@@ -429,6 +475,8 @@ struct parameter_def | |||
429 | } | 475 | } |
430 | if( ::eolian_parameter_is_optional(param)) | 476 | if( ::eolian_parameter_is_optional(param)) |
431 | type.original_type.visit(detail::add_optional_qualifier_visitor{}); | 477 | type.original_type.visit(detail::add_optional_qualifier_visitor{}); |
478 | |||
479 | documentation = eolian_parameter_documentation_get(param); | ||
432 | } | 480 | } |
433 | }; | 481 | }; |
434 | 482 | ||
@@ -467,6 +515,16 @@ template <int I> | |||
467 | typename tuple_element<I, parameter_def>::type& get(parameter_def& p) | 515 | typename tuple_element<I, parameter_def>::type& get(parameter_def& p) |
468 | { return tuple_element<I, parameter_def>::get(p); } | 516 | { return tuple_element<I, parameter_def>::get(p); } |
469 | 517 | ||
518 | enum class function_type | ||
519 | { | ||
520 | unresolved, | ||
521 | property, | ||
522 | prop_set, | ||
523 | prop_get, | ||
524 | method, | ||
525 | function_pointer | ||
526 | }; | ||
527 | |||
470 | struct function_def | 528 | struct function_def |
471 | { | 529 | { |
472 | type_def return_type; | 530 | type_def return_type; |
@@ -474,9 +532,12 @@ struct function_def | |||
474 | std::vector<parameter_def> parameters; | 532 | std::vector<parameter_def> parameters; |
475 | std::string c_name; | 533 | std::string c_name; |
476 | std::string filename; | 534 | std::string filename; |
535 | documentation_def documentation; | ||
536 | documentation_def return_documentation; | ||
537 | documentation_def property_documentation; | ||
538 | function_type type; | ||
477 | bool is_beta; | 539 | bool is_beta; |
478 | bool is_protected; | 540 | bool is_protected; |
479 | bool is_function_pointer; | ||
480 | bool is_static; | 541 | bool is_static; |
481 | Eolian_Unit const* unit; | 542 | Eolian_Unit const* unit; |
482 | 543 | ||
@@ -487,9 +548,12 @@ struct function_def | |||
487 | && lhs.parameters == rhs.parameters | 548 | && lhs.parameters == rhs.parameters |
488 | && lhs.c_name == rhs.c_name | 549 | && lhs.c_name == rhs.c_name |
489 | && lhs.filename == rhs.filename | 550 | && lhs.filename == rhs.filename |
551 | && lhs.documentation == rhs.documentation | ||
552 | && lhs.return_documentation == rhs.return_documentation | ||
553 | && lhs.property_documentation == rhs.property_documentation | ||
554 | && lhs.type == rhs.type | ||
490 | && lhs.is_beta == rhs.is_beta | 555 | && lhs.is_beta == rhs.is_beta |
491 | && lhs.is_protected == rhs.is_protected | 556 | && lhs.is_protected == rhs.is_protected |
492 | && lhs.is_function_pointer == rhs.is_function_pointer | ||
493 | && lhs.is_static == rhs.is_static; | 557 | && lhs.is_static == rhs.is_static; |
494 | } | 558 | } |
495 | friend inline bool operator!=(function_def const& lhs, function_def const& rhs) | 559 | friend inline bool operator!=(function_def const& lhs, function_def const& rhs) |
@@ -501,13 +565,20 @@ struct function_def | |||
501 | std::vector<parameter_def> const& _parameters, | 565 | std::vector<parameter_def> const& _parameters, |
502 | std::string const& _c_name, | 566 | std::string const& _c_name, |
503 | std::string _filename, | 567 | std::string _filename, |
568 | documentation_def _documentation, | ||
569 | documentation_def _return_documentation, | ||
570 | documentation_def _property_documentation, | ||
571 | function_type _type, | ||
504 | bool _is_beta = false, | 572 | bool _is_beta = false, |
505 | bool _is_protected = false, | 573 | bool _is_protected = false, |
506 | bool _is_function_pointer = false, | ||
507 | Eolian_Unit const* unit = nullptr) | 574 | Eolian_Unit const* unit = nullptr) |
508 | : return_type(_return_type), name(_name), parameters(_parameters), | 575 | : return_type(_return_type), name(_name), parameters(_parameters), |
509 | c_name(_c_name), filename(_filename), is_beta(_is_beta), is_protected(_is_protected), | 576 | c_name(_c_name), filename(_filename), documentation(_documentation), |
510 | is_function_pointer(_is_function_pointer), unit(unit) {} | 577 | return_documentation(_return_documentation), |
578 | property_documentation(_property_documentation), | ||
579 | type(_type), | ||
580 | is_beta(_is_beta), is_protected(_is_protected), | ||
581 | unit(unit) {} | ||
511 | 582 | ||
512 | function_def( ::Eolian_Function const* function, Eolian_Function_Type type, Eolian_Unit const* unit) | 583 | function_def( ::Eolian_Function const* function, Eolian_Function_Type type, Eolian_Unit const* unit) |
513 | : return_type(void_), unit(unit) | 584 | : return_type(void_), unit(unit) |
@@ -572,6 +643,40 @@ struct function_def | |||
572 | is_beta = eolian_function_is_beta(function); | 643 | is_beta = eolian_function_is_beta(function); |
573 | is_protected = eolian_function_scope_get(function, type) == EOLIAN_SCOPE_PROTECTED; | 644 | is_protected = eolian_function_scope_get(function, type) == EOLIAN_SCOPE_PROTECTED; |
574 | is_static = eolian_function_is_class(function); | 645 | is_static = eolian_function_is_class(function); |
646 | |||
647 | return_documentation = eolian_function_return_documentation_get(function, type); | ||
648 | |||
649 | Eolian_Implement const* implement = eolian_function_implement_get(function); | ||
650 | if (!implement) | ||
651 | return; | ||
652 | |||
653 | documentation = eolian_implement_documentation_get(implement, type); | ||
654 | |||
655 | |||
656 | if (type == EOLIAN_PROP_GET || type == EOLIAN_PROP_SET) | ||
657 | property_documentation = eolian_implement_documentation_get(implement, EOLIAN_PROPERTY); | ||
658 | |||
659 | switch (type) | ||
660 | { | ||
661 | case EOLIAN_UNRESOLVED: | ||
662 | this->type = function_type::unresolved; | ||
663 | break; | ||
664 | case EOLIAN_PROPERTY: | ||
665 | this->type = function_type::property; | ||
666 | break; | ||
667 | case EOLIAN_PROP_GET: | ||
668 | this->type = function_type::prop_get; | ||
669 | break; | ||
670 | case EOLIAN_PROP_SET: | ||
671 | this->type = function_type::prop_set; | ||
672 | break; | ||
673 | case EOLIAN_METHOD: | ||
674 | this->type = function_type::method; | ||
675 | break; | ||
676 | case EOLIAN_FUNCTION_POINTER: | ||
677 | this->type = function_type::function_pointer; | ||
678 | break; | ||
679 | } | ||
575 | } | 680 | } |
576 | 681 | ||
577 | std::string template_statement() const | 682 | std::string template_statement() const |
@@ -677,6 +782,7 @@ struct event_def | |||
677 | eina::optional<type_def> type; | 782 | eina::optional<type_def> type; |
678 | std::string name, c_name; | 783 | std::string name, c_name; |
679 | bool beta, protect; | 784 | bool beta, protect; |
785 | documentation_def documentation; | ||
680 | 786 | ||
681 | friend inline bool operator==(event_def const& lhs, event_def const& rhs) | 787 | friend inline bool operator==(event_def const& lhs, event_def const& rhs) |
682 | { | 788 | { |
@@ -684,21 +790,25 @@ struct event_def | |||
684 | && lhs.name == rhs.name | 790 | && lhs.name == rhs.name |
685 | && lhs.c_name == rhs.c_name | 791 | && lhs.c_name == rhs.c_name |
686 | && lhs.beta == rhs.beta | 792 | && lhs.beta == rhs.beta |
687 | && lhs.protect == rhs.protect; | 793 | && lhs.protect == rhs.protect |
794 | && lhs.documentation == rhs.documentation; | ||
688 | } | 795 | } |
689 | friend inline bool operator!=(event_def const& lhs, event_def const& rhs) | 796 | friend inline bool operator!=(event_def const& lhs, event_def const& rhs) |
690 | { | 797 | { |
691 | return !(lhs == rhs); | 798 | return !(lhs == rhs); |
692 | } | 799 | } |
693 | 800 | ||
694 | event_def(type_def type, std::string name, std::string c_name, bool beta, bool protect) | 801 | event_def(type_def type, std::string name, std::string c_name, bool beta, bool protect, |
695 | : type(type), name(name), c_name(c_name), beta(beta), protect(protect) {} | 802 | documentation_def documentation) |
803 | : type(type), name(name), c_name(c_name), beta(beta), protect(protect) | ||
804 | , documentation(documentation) {} | ||
696 | event_def(Eolian_Event const* event, Eolian_Unit const* unit) | 805 | event_def(Eolian_Event const* event, Eolian_Unit const* unit) |
697 | : type( ::eolian_event_type_get(event) ? eina::optional<type_def>{{::eolian_event_type_get(event), unit, EOLIAN_C_TYPE_DEFAULT}} : eina::optional<type_def>{}) | 806 | : type( ::eolian_event_type_get(event) ? eina::optional<type_def>{{::eolian_event_type_get(event), unit, EOLIAN_C_TYPE_DEFAULT}} : eina::optional<type_def>{}) |
698 | , name( ::eolian_event_name_get(event)) | 807 | , name( ::eolian_event_name_get(event)) |
699 | , c_name( ::eolian_event_c_name_get(event)) | 808 | , c_name( ::eolian_event_c_name_get(event)) |
700 | , beta( ::eolian_event_is_beta(event)) | 809 | , beta( ::eolian_event_is_beta(event)) |
701 | , protect( ::eolian_event_scope_get(event) == EOLIAN_SCOPE_PROTECTED){} | 810 | , protect( ::eolian_event_scope_get(event) == EOLIAN_SCOPE_PROTECTED) |
811 | , documentation( ::eolian_event_documentation_get(event)) {} | ||
702 | }; | 812 | }; |
703 | 813 | ||
704 | template <> | 814 | template <> |
@@ -768,6 +878,7 @@ struct klass_def | |||
768 | std::string eolian_name; | 878 | std::string eolian_name; |
769 | std::string cxx_name; | 879 | std::string cxx_name; |
770 | std::string filename; | 880 | std::string filename; |
881 | documentation_def documentation; | ||
771 | std::vector<std::string> namespaces; | 882 | std::vector<std::string> namespaces; |
772 | std::vector<function_def> functions; | 883 | std::vector<function_def> functions; |
773 | std::set<klass_name, compare_klass_name_by_name> inherits; | 884 | std::set<klass_name, compare_klass_name_by_name> inherits; |
@@ -802,12 +913,14 @@ struct klass_def | |||
802 | } | 913 | } |
803 | 914 | ||
804 | klass_def(std::string eolian_name, std::string cxx_name, std::string filename | 915 | klass_def(std::string eolian_name, std::string cxx_name, std::string filename |
916 | , documentation_def documentation | ||
805 | , std::vector<std::string> namespaces | 917 | , std::vector<std::string> namespaces |
806 | , std::vector<function_def> functions | 918 | , std::vector<function_def> functions |
807 | , std::set<klass_name, compare_klass_name_by_name> inherits | 919 | , std::set<klass_name, compare_klass_name_by_name> inherits |
808 | , class_type type | 920 | , class_type type |
809 | , std::set<klass_name, compare_klass_name_by_name> immediate_inherits) | 921 | , std::set<klass_name, compare_klass_name_by_name> immediate_inherits) |
810 | : eolian_name(eolian_name), cxx_name(cxx_name), filename(filename) | 922 | : eolian_name(eolian_name), cxx_name(cxx_name), filename(filename) |
923 | , documentation(documentation) | ||
811 | , namespaces(namespaces) | 924 | , namespaces(namespaces) |
812 | , functions(functions), inherits(inherits), type(type) | 925 | , functions(functions), inherits(inherits), type(type) |
813 | , immediate_inherits(immediate_inherits) | 926 | , immediate_inherits(immediate_inherits) |
@@ -915,6 +1028,8 @@ struct klass_def | |||
915 | events.push_back({&*event_iterator, unit}); | 1028 | events.push_back({&*event_iterator, unit}); |
916 | } catch(std::exception const&) {} | 1029 | } catch(std::exception const&) {} |
917 | } | 1030 | } |
1031 | |||
1032 | documentation = eolian_class_documentation_get(klass); | ||
918 | } | 1033 | } |
919 | 1034 | ||
920 | // TODO memoize the return? | 1035 | // TODO memoize the return? |
@@ -956,6 +1071,7 @@ struct enum_value_def | |||
956 | value_def value; | 1071 | value_def value; |
957 | std::string name; | 1072 | std::string name; |
958 | std::string c_name; | 1073 | std::string c_name; |
1074 | documentation_def documentation; | ||
959 | 1075 | ||
960 | enum_value_def(Eolian_Enum_Type_Field const* enum_field, Eolian_Unit const* unit) | 1076 | enum_value_def(Eolian_Enum_Type_Field const* enum_field, Eolian_Unit const* unit) |
961 | { | 1077 | { |
@@ -963,6 +1079,7 @@ struct enum_value_def | |||
963 | c_name = eolian_typedecl_enum_field_c_name_get(enum_field); | 1079 | c_name = eolian_typedecl_enum_field_c_name_get(enum_field); |
964 | auto exp = eolian_typedecl_enum_field_value_get(enum_field, EINA_TRUE); | 1080 | auto exp = eolian_typedecl_enum_field_value_get(enum_field, EINA_TRUE); |
965 | value = eolian_expression_eval(unit, exp, EOLIAN_MASK_INT); // FIXME hardcoded int | 1081 | value = eolian_expression_eval(unit, exp, EOLIAN_MASK_INT); // FIXME hardcoded int |
1082 | documentation = eolian_typedecl_enum_field_documentation_get(enum_field); | ||
966 | } | 1083 | } |
967 | }; | 1084 | }; |
968 | 1085 | ||
@@ -972,6 +1089,7 @@ struct enum_def | |||
972 | std::string cxx_name; | 1089 | std::string cxx_name; |
973 | std::vector<std::string> namespaces; | 1090 | std::vector<std::string> namespaces; |
974 | std::vector<enum_value_def> fields; | 1091 | std::vector<enum_value_def> fields; |
1092 | documentation_def documentation; | ||
975 | 1093 | ||
976 | enum_def(Eolian_Typedecl const* enum_obj, Eolian_Unit const* unit) | 1094 | enum_def(Eolian_Typedecl const* enum_obj, Eolian_Unit const* unit) |
977 | { | 1095 | { |
@@ -989,6 +1107,8 @@ struct enum_def | |||
989 | enum_value_def field_def(&*field_iterator, unit); | 1107 | enum_value_def field_def(&*field_iterator, unit); |
990 | this->fields.push_back(field_def); | 1108 | this->fields.push_back(field_def); |
991 | } | 1109 | } |
1110 | |||
1111 | documentation = ::eolian_typedecl_documentation_get(enum_obj); | ||
992 | } | 1112 | } |
993 | }; | 1113 | }; |
994 | 1114 | ||
@@ -996,6 +1116,7 @@ struct struct_field_def | |||
996 | { | 1116 | { |
997 | type_def type; | 1117 | type_def type; |
998 | std::string name; | 1118 | std::string name; |
1119 | documentation_def documentation; | ||
999 | 1120 | ||
1000 | struct_field_def(Eolian_Struct_Type_Field const* struct_field, Eolian_Unit const* unit) | 1121 | struct_field_def(Eolian_Struct_Type_Field const* struct_field, Eolian_Unit const* unit) |
1001 | { | 1122 | { |
@@ -1003,6 +1124,7 @@ struct struct_field_def | |||
1003 | try { | 1124 | try { |
1004 | type.set(eolian_typedecl_struct_field_type_get(struct_field), unit, EOLIAN_C_TYPE_DEFAULT); | 1125 | type.set(eolian_typedecl_struct_field_type_get(struct_field), unit, EOLIAN_C_TYPE_DEFAULT); |
1005 | } catch(std::runtime_error const&) { /* Silently skip pointer fields*/ } | 1126 | } catch(std::runtime_error const&) { /* Silently skip pointer fields*/ } |
1127 | documentation = ::eolian_typedecl_struct_field_documentation_get(struct_field); | ||
1006 | } | 1128 | } |
1007 | 1129 | ||
1008 | }; | 1130 | }; |
@@ -1013,6 +1135,7 @@ struct struct_def | |||
1013 | std::string cxx_name; | 1135 | std::string cxx_name; |
1014 | std::vector<std::string> namespaces; | 1136 | std::vector<std::string> namespaces; |
1015 | std::vector<struct_field_def> fields; | 1137 | std::vector<struct_field_def> fields; |
1138 | documentation_def documentation; | ||
1016 | 1139 | ||
1017 | struct_def(Eolian_Typedecl const* struct_obj, Eolian_Unit const* unit) | 1140 | struct_def(Eolian_Typedecl const* struct_obj, Eolian_Unit const* unit) |
1018 | { | 1141 | { |
@@ -1029,6 +1152,8 @@ struct struct_def | |||
1029 | struct_field_def field_def(&*field_iterator, unit); | 1152 | struct_field_def field_def(&*field_iterator, unit); |
1030 | this->fields.push_back(field_def); | 1153 | this->fields.push_back(field_def); |
1031 | } | 1154 | } |
1155 | |||
1156 | documentation = ::eolian_typedecl_documentation_get(struct_obj); | ||
1032 | } | 1157 | } |
1033 | }; | 1158 | }; |
1034 | 1159 | ||
@@ -1137,7 +1262,7 @@ template <> | |||
1137 | struct is_tuple<attributes::parameter_def> : std::true_type {}; | 1262 | struct is_tuple<attributes::parameter_def> : std::true_type {}; |
1138 | template <> | 1263 | template <> |
1139 | struct is_tuple<attributes::event_def> : std::true_type {}; | 1264 | struct is_tuple<attributes::event_def> : std::true_type {}; |
1140 | 1265 | ||
1141 | } | 1266 | } |
1142 | 1267 | ||
1143 | } } } | 1268 | } } } |
diff --git a/src/lib/eolian_cxx/grammar/string.hpp b/src/lib/eolian_cxx/grammar/string.hpp index df4ae8f2cb..06cce17823 100644 --- a/src/lib/eolian_cxx/grammar/string.hpp +++ b/src/lib/eolian_cxx/grammar/string.hpp | |||
@@ -26,7 +26,7 @@ struct literal_generator | |||
26 | const char* string; | 26 | const char* string; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | literal_generator as_generator(char const* literal) { return literal; } | 29 | inline literal_generator as_generator(char const* literal) { return literal; } |
30 | 30 | ||
31 | struct { | 31 | struct { |
32 | literal_generator operator()(const char* literal) const | 32 | literal_generator operator()(const char* literal) const |
@@ -164,7 +164,7 @@ struct is_generator<string_generator_terminal> : std::true_type {}; | |||
164 | template <> | 164 | template <> |
165 | struct is_generator<std::string> : std::true_type {}; | 165 | struct is_generator<std::string> : std::true_type {}; |
166 | 166 | ||
167 | string_generator as_generator(string_generator_terminal) | 167 | inline string_generator as_generator(string_generator_terminal) |
168 | { | 168 | { |
169 | return string_generator{}; | 169 | return string_generator{}; |
170 | } | 170 | } |
@@ -181,7 +181,7 @@ struct attributes_needed<string_replace_generator> : std::integral_constant<int, | |||
181 | 181 | ||
182 | namespace std { | 182 | namespace std { |
183 | 183 | ||
184 | ::efl::eolian::grammar::specific_string_generator as_generator(std::string string) | 184 | inline ::efl::eolian::grammar::specific_string_generator as_generator(std::string string) |
185 | { | 185 | { |
186 | return ::efl::eolian::grammar::specific_string_generator{string}; | 186 | return ::efl::eolian::grammar::specific_string_generator{string}; |
187 | } | 187 | } |