summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-05-31 16:32:20 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-06-02 18:27:46 -0300
commit6dcc8dd07faddba6de77fe75428a3724df964f47 (patch)
tree4277b18b671f7969d16ef8627109f02079cbc906 /src/lib/eolian_cxx
parentcc708064979314a94971fa00668ae14e6d1cab43 (diff)
eolian-cxx: Fixed compilation error after Eolian_Unit type introduction
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/implementation_include_directive.hpp2
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp48
2 files changed, 25 insertions, 25 deletions
diff --git a/src/lib/eolian_cxx/grammar/implementation_include_directive.hpp b/src/lib/eolian_cxx/grammar/implementation_include_directive.hpp
index 6c2631ab80..f82d84b9ea 100644
--- a/src/lib/eolian_cxx/grammar/implementation_include_directive.hpp
+++ b/src/lib/eolian_cxx/grammar/implementation_include_directive.hpp
@@ -20,7 +20,7 @@ struct implementation_include_directive_generator
20 bool generate(OutputIterator sink, attributes::klass_def const& cls, Context const& ctx) const 20 bool generate(OutputIterator sink, attributes::klass_def const& cls, Context const& ctx) const
21 { 21 {
22 return as_generator("#include \"" << string << ".impl.hh\"\n") 22 return as_generator("#include \"" << string << ".impl.hh\"\n")
23 .generate(sink, std::string(eolian_class_file_get(get_klass(get_klass_name(cls)))), add_lower_case_context(ctx)); 23 .generate(sink, std::string(eolian_class_file_get(get_klass(get_klass_name(cls, unit_from_context(ctx))))), add_lower_case_context(ctx));
24 } 24 }
25 template <typename OutputIterator, typename Context> 25 template <typename OutputIterator, typename Context>
26 bool generate(OutputIterator sink, std::string const& cls, Context const& ctx) const 26 bool generate(OutputIterator sink, std::string const& cls, Context const& ctx) const
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 17254e64ca..9629c70715 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -210,11 +210,11 @@ struct type_def
210 type_def(variant_type original_type, std::string c_type) 210 type_def(variant_type original_type, std::string c_type)
211 : original_type(original_type), c_type(c_type) {} 211 : original_type(original_type), c_type(c_type) {}
212 212
213 type_def(Eolian_Type const* eolian_type) 213 type_def(Eolian_Type const* eolian_type, Eolian_Unit const* unit)
214 { 214 {
215 set(eolian_type); 215 set(eolian_type, unit);
216 } 216 }
217 void set(Eolian_Type const* eolian_type); 217 void set(Eolian_Type const* eolian_type, Eolian_Unit const* unit);
218}; 218};
219 219
220struct get_qualifier_visitor 220struct get_qualifier_visitor
@@ -242,7 +242,7 @@ inline bool operator!=(type_def const& lhs, type_def const& rhs)
242 242
243type_def const void_ {attributes::regular_type_def{"void", {qualifier_info::is_none, {}}, {}}, "void"}; 243type_def const void_ {attributes::regular_type_def{"void", {qualifier_info::is_none, {}}, {}}, "void"};
244 244
245inline void type_def::set(Eolian_Type const* eolian_type) 245inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* unit)
246{ 246{
247 c_type = ::eolian_type_c_type_get(eolian_type); 247 c_type = ::eolian_type_c_type_get(eolian_type);
248 // ::eina_stringshare_del(stringshare); // this crashes 248 // ::eina_stringshare_del(stringshare); // this crashes
@@ -264,7 +264,7 @@ inline void type_def::set(Eolian_Type const* eolian_type)
264 break; 264 break;
265 case EOLIAN_TYPE_CLASS: 265 case EOLIAN_TYPE_CLASS:
266 { 266 {
267 Eolian_Class const* klass = eolian_type_class_get(eolian_type); 267 Eolian_Class const* klass = eolian_type_class_get(unit, eolian_type);
268 original_type = klass_name(klass, {qualifiers(eolian_type), {}}); 268 original_type = klass_name(klass, {qualifiers(eolian_type), {}});
269 } 269 }
270 break; 270 break;
@@ -275,7 +275,7 @@ inline void type_def::set(Eolian_Type const* eolian_type)
275 Eolian_Type const* stp = eolian_type_base_type_get(eolian_type); 275 Eolian_Type const* stp = eolian_type_base_type_get(eolian_type);
276 while (stp) 276 while (stp)
277 { 277 {
278 complex.subtypes.push_back({stp}); 278 complex.subtypes.push_back({stp, unit});
279 stp = eolian_type_next_type_get(stp); 279 stp = eolian_type_next_type_get(stp);
280 } 280 }
281 original_type = complex; 281 original_type = complex;
@@ -329,8 +329,8 @@ struct parameter_def
329 329
330 parameter_def(parameter_direction direction, type_def type, std::string param_name, std::string c_type) 330 parameter_def(parameter_direction direction, type_def type, std::string param_name, std::string c_type)
331 : direction(std::move(direction)), type(std::move(type)), param_name(std::move(param_name)), c_type(std::move(c_type)) {} 331 : direction(std::move(direction)), type(std::move(type)), param_name(std::move(param_name)), c_type(std::move(c_type)) {}
332 parameter_def(Eolian_Function_Parameter const* param) 332 parameter_def(Eolian_Function_Parameter const* param, Eolian_Unit const* unit)
333 : type( ::eolian_parameter_type_get(param)) 333 : type( ::eolian_parameter_type_get(param), unit)
334 , param_name( ::eolian_parameter_name_get(param)) 334 , param_name( ::eolian_parameter_name_get(param))
335 , c_type( ::eolian_type_c_type_get(::eolian_parameter_type_get(param))) 335 , c_type( ::eolian_type_c_type_get(::eolian_parameter_type_get(param)))
336 { 336 {
@@ -415,19 +415,19 @@ struct function_def
415 , std::string c_name, bool is_beta) 415 , std::string c_name, bool is_beta)
416 : return_type(return_type), name(name), parameters(parameters), c_name(c_name), is_beta(is_beta) {} 416 : return_type(return_type), name(name), parameters(parameters), c_name(c_name), is_beta(is_beta) {}
417 function_def() = default; 417 function_def() = default;
418 function_def( ::Eolian_Function const* function, Eolian_Function_Type type) 418 function_def( ::Eolian_Function const* function, Eolian_Function_Type type, Eolian_Unit const* unit)
419 : return_type(void_) 419 : return_type(void_)
420 { 420 {
421 Eolian_Type const* r_type = ::eolian_function_return_type_get(function, type); 421 Eolian_Type const* r_type = ::eolian_function_return_type_get(function, type);
422 name = ::eolian_function_name_get(function); 422 name = ::eolian_function_name_get(function);
423 if(r_type) 423 if(r_type)
424 return_type.set(r_type); 424 return_type.set(r_type, unit);
425 if(type == EOLIAN_METHOD) 425 if(type == EOLIAN_METHOD)
426 { 426 {
427 for(efl::eina::iterator<Eolian_Function_Parameter> param_iterator ( ::eolian_function_parameters_get(function)) 427 for(efl::eina::iterator<Eolian_Function_Parameter> param_iterator ( ::eolian_function_parameters_get(function))
428 , param_last; param_iterator != param_last; ++param_iterator) 428 , param_last; param_iterator != param_last; ++param_iterator)
429 { 429 {
430 parameters.push_back(&*param_iterator); 430 parameters.push_back({&*param_iterator, unit});
431 } 431 }
432 } 432 }
433 else if(type == EOLIAN_PROP_GET || type == EOLIAN_PROP_SET) 433 else if(type == EOLIAN_PROP_GET || type == EOLIAN_PROP_SET)
@@ -440,14 +440,14 @@ struct function_def
440 ( ::eolian_property_keys_get(function, type)) 440 ( ::eolian_property_keys_get(function, type))
441 , param_last; param_iterator != param_last; ++param_iterator) 441 , param_last; param_iterator != param_last; ++param_iterator)
442 { 442 {
443 parameters.push_back(&*param_iterator); 443 parameters.push_back({&*param_iterator, unit});
444 } 444 }
445 std::vector<parameter_def> values; 445 std::vector<parameter_def> values;
446 for(efl::eina::iterator<Eolian_Function_Parameter> param_iterator 446 for(efl::eina::iterator<Eolian_Function_Parameter> param_iterator
447 ( ::eolian_property_values_get(function, type)) 447 ( ::eolian_property_values_get(function, type))
448 , param_last; param_iterator != param_last; ++param_iterator) 448 , param_last; param_iterator != param_last; ++param_iterator)
449 { 449 {
450 values.push_back(&*param_iterator); 450 values.push_back({&*param_iterator, unit});
451 } 451 }
452 452
453 if(!r_type && type == EOLIAN_PROP_GET && values.size() == 1) 453 if(!r_type && type == EOLIAN_PROP_GET && values.size() == 1)
@@ -546,8 +546,8 @@ struct event_def
546 546
547 event_def(type_def type, std::string name, std::string c_name, bool beta, bool protect) 547 event_def(type_def type, std::string name, std::string c_name, bool beta, bool protect)
548 : type(type), name(name), c_name(c_name), beta(beta), protect(protect) {} 548 : type(type), name(name), c_name(c_name), beta(beta), protect(protect) {}
549 event_def(Eolian_Event const* event) 549 event_def(Eolian_Event const* event, Eolian_Unit const* unit)
550 : type( ::eolian_event_type_get(event) ? ::eolian_event_type_get(event) : eina::optional<type_def>{}) 550 : type( ::eolian_event_type_get(event) ? eina::optional<type_def>{{::eolian_event_type_get(event), unit}} : eina::optional<type_def>{})
551 , name( ::eolian_event_name_get(event)) 551 , name( ::eolian_event_name_get(event))
552 , c_name( ::eolian_event_c_name_get(event)) 552 , c_name( ::eolian_event_c_name_get(event))
553 , beta( ::eolian_event_is_beta(event)) 553 , beta( ::eolian_event_is_beta(event))
@@ -622,7 +622,7 @@ struct klass_def
622 , namespaces(namespaces) 622 , namespaces(namespaces)
623 , functions(functions), inherits(inherits), type(type) 623 , functions(functions), inherits(inherits), type(type)
624 {} 624 {}
625 klass_def(Eolian_Class const* klass) 625 klass_def(Eolian_Class const* klass, Eolian_Unit const* unit)
626 { 626 {
627 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_class_namespaces_get(klass)) 627 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_class_namespaces_get(klass))
628 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator) 628 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator)
@@ -640,19 +640,19 @@ struct klass_def
640 try { 640 try {
641 if(! ::eolian_function_is_legacy_only(function, EOLIAN_PROP_GET) 641 if(! ::eolian_function_is_legacy_only(function, EOLIAN_PROP_GET)
642 && ::eolian_function_scope_get(function, EOLIAN_PROP_GET) != EOLIAN_SCOPE_PRIVATE) 642 && ::eolian_function_scope_get(function, EOLIAN_PROP_GET) != EOLIAN_SCOPE_PRIVATE)
643 functions.push_back({function, EOLIAN_PROP_GET}); 643 functions.push_back({function, EOLIAN_PROP_GET, unit});
644 } catch(std::exception const&) {} 644 } catch(std::exception const&) {}
645 try { 645 try {
646 if(! ::eolian_function_is_legacy_only(function, EOLIAN_PROP_SET) 646 if(! ::eolian_function_is_legacy_only(function, EOLIAN_PROP_SET)
647 && ::eolian_function_scope_get(function, EOLIAN_PROP_SET) != EOLIAN_SCOPE_PRIVATE) 647 && ::eolian_function_scope_get(function, EOLIAN_PROP_SET) != EOLIAN_SCOPE_PRIVATE)
648 functions.push_back({function, EOLIAN_PROP_SET}); 648 functions.push_back({function, EOLIAN_PROP_SET, unit});
649 } catch(std::exception const&) {} 649 } catch(std::exception const&) {}
650 } 650 }
651 else 651 else
652 try { 652 try {
653 if(! ::eolian_function_is_legacy_only(function, type) 653 if(! ::eolian_function_is_legacy_only(function, type)
654 && ::eolian_function_scope_get(function, type) != EOLIAN_SCOPE_PRIVATE) 654 && ::eolian_function_scope_get(function, type) != EOLIAN_SCOPE_PRIVATE)
655 functions.push_back({function, type}); 655 functions.push_back({function, type, unit});
656 } catch(std::exception const&) {} 656 } catch(std::exception const&) {}
657 } 657 }
658 for(efl::eina::iterator<Eolian_Function const> eolian_functions ( ::eolian_class_functions_get(klass, EOLIAN_METHOD)) 658 for(efl::eina::iterator<Eolian_Function const> eolian_functions ( ::eolian_class_functions_get(klass, EOLIAN_METHOD))
@@ -663,7 +663,7 @@ struct klass_def
663 Eolian_Function_Type type = eolian_function_type_get(function); 663 Eolian_Function_Type type = eolian_function_type_get(function);
664 if(! ::eolian_function_is_legacy_only(function, EOLIAN_METHOD) 664 if(! ::eolian_function_is_legacy_only(function, EOLIAN_METHOD)
665 && ::eolian_function_scope_get(function, type) != EOLIAN_SCOPE_PRIVATE) 665 && ::eolian_function_scope_get(function, type) != EOLIAN_SCOPE_PRIVATE)
666 functions.push_back({function, EOLIAN_METHOD}); 666 functions.push_back({function, EOLIAN_METHOD, unit});
667 } catch(std::exception const&) {} 667 } catch(std::exception const&) {}
668 } 668 }
669 std::function<void(Eolian_Class const*)> inherit_algo = 669 std::function<void(Eolian_Class const*)> inherit_algo =
@@ -672,7 +672,7 @@ struct klass_def
672 for(efl::eina::iterator<const char> inherit_iterator ( ::eolian_class_inherits_get(klass)) 672 for(efl::eina::iterator<const char> inherit_iterator ( ::eolian_class_inherits_get(klass))
673 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator) 673 , inherit_last; inherit_iterator != inherit_last; ++inherit_iterator)
674 { 674 {
675 Eolian_Class const* inherit = ::eolian_class_get_by_name(&*inherit_iterator); 675 Eolian_Class const* inherit = ::eolian_class_get_by_name(unit, &*inherit_iterator);
676 inherits.insert({inherit, {}}); 676 inherits.insert({inherit, {}});
677 inherit_algo(inherit); 677 inherit_algo(inherit);
678 } 678 }
@@ -699,7 +699,7 @@ struct klass_def
699 , event_last; event_iterator != event_last; ++event_iterator) 699 , event_last; event_iterator != event_last; ++event_iterator)
700 { 700 {
701 try { 701 try {
702 events.push_back(&*event_iterator); 702 events.push_back({&*event_iterator, unit});
703 } catch(std::exception const&) {} 703 } catch(std::exception const&) {}
704 } 704 }
705 } 705 }
@@ -711,7 +711,7 @@ inline klass_name get_klass_name(klass_def const& klass)
711 return {klass.namespaces, klass.eolian_name, {qualifier_info::is_none, {}}, klass.type}; 711 return {klass.namespaces, klass.eolian_name, {qualifier_info::is_none, {}}, klass.type};
712} 712}
713 713
714inline Eolian_Class const* get_klass(klass_name const& klass_name_) 714inline Eolian_Class const* get_klass(klass_name const& klass_name_, Eolian_Unit const* unit)
715{ 715{
716 std::string klass_name; 716 std::string klass_name;
717 if(!as_generator(*(string << ".") << string) 717 if(!as_generator(*(string << ".") << string)
@@ -720,7 +720,7 @@ inline Eolian_Class const* get_klass(klass_name const& klass_name_)
720 , context_null{})) 720 , context_null{}))
721 return nullptr; 721 return nullptr;
722 else 722 else
723 return ::eolian_class_get_by_name(klass_name.c_str()); 723 return ::eolian_class_get_by_name(unit, klass_name.c_str());
724} 724}
725 725
726inline std::vector<std::string> cpp_namespaces(std::vector<std::string> namespaces) 726inline std::vector<std::string> cpp_namespaces(std::vector<std::string> namespaces)