summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-07-05 16:31:35 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-07-05 16:32:11 -0300
commit1c402f62a9ef61428ea236da8558b8dd8bcb76c5 (patch)
treedc883e55f3eca3de5eb6f09702c17a235e965b0a /src/lib/eolian_cxx
parent3eb322518ff8d3fab29cc39f8180a88ffdc79ecf (diff)
eolian-cxx: Fix generation for ref generic_values and Eolian classes
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/c_type.hpp2
-rw-r--r--src/lib/eolian_cxx/grammar/converting_argument.hpp5
-rw-r--r--src/lib/eolian_cxx/grammar/function_declaration.hpp2
-rw-r--r--src/lib/eolian_cxx/grammar/function_definition.hpp6
-rw-r--r--src/lib/eolian_cxx/grammar/type_impl.hpp15
5 files changed, 18 insertions, 12 deletions
diff --git a/src/lib/eolian_cxx/grammar/c_type.hpp b/src/lib/eolian_cxx/grammar/c_type.hpp
index 54b996d65a..6d814f80a4 100644
--- a/src/lib/eolian_cxx/grammar/c_type.hpp
+++ b/src/lib/eolian_cxx/grammar/c_type.hpp
@@ -19,6 +19,8 @@ struct c_type_visitor
19 , std::make_tuple(name.namespaces, name.eolian_name 19 , std::make_tuple(name.namespaces, name.eolian_name
20 , std::string{name.base_qualifier & qualifier_info::is_const ? " const" : ""}) 20 , std::string{name.base_qualifier & qualifier_info::is_const ? " const" : ""})
21 , context_null {}); 21 , context_null {});
22 if(name.base_qualifier & qualifier_info::is_ref)
23 n += '*';
22 return n; 24 return n;
23 } 25 }
24 template <typename T> 26 template <typename T>
diff --git a/src/lib/eolian_cxx/grammar/converting_argument.hpp b/src/lib/eolian_cxx/grammar/converting_argument.hpp
index 3b5cb1dcfc..cb3f750544 100644
--- a/src/lib/eolian_cxx/grammar/converting_argument.hpp
+++ b/src/lib/eolian_cxx/grammar/converting_argument.hpp
@@ -25,9 +25,10 @@ struct converting_argument_generator
25 attributes::qualifier_def qualifier = param.type.original_type.visit(attributes::get_qualifier_visitor{}); 25 attributes::qualifier_def qualifier = param.type.original_type.visit(attributes::get_qualifier_visitor{});
26 return as_generator 26 return as_generator
27 ( 27 (
28 attribute_reorder<1, -1, 2> 28 attribute_reorder<-1, -1, 2>
29 ( 29 (
30 " ::efl::eolian::convert_to_c<" << c_type << ", " << parameter_type 30 " ::efl::eolian::convert_to_c<" << c_type
31 << ", " << parameter_type
31 << (qualifier & qualifier_info::is_own 32 << (qualifier & qualifier_info::is_own
32 ? ", true" : "") 33 ? ", true" : "")
33 << ">(" << string << ")" 34 << ">(" << string << ")"
diff --git a/src/lib/eolian_cxx/grammar/function_declaration.hpp b/src/lib/eolian_cxx/grammar/function_declaration.hpp
index f01c214483..6e124dfd38 100644
--- a/src/lib/eolian_cxx/grammar/function_declaration.hpp
+++ b/src/lib/eolian_cxx/grammar/function_declaration.hpp
@@ -19,7 +19,7 @@ struct function_declaration_generator
19 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const 19 bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
20 { 20 {
21 return as_generator 21 return as_generator
22 (grammar::type(true) << " " << string << "(" << (parameter % ", ") << ") const;\n") 22 ("::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << string << "(" << (parameter % ", ") << ") const;\n")
23 .generate(sink, std::make_tuple(f.return_type, escape_keyword(f.name), f.parameters), context); 23 .generate(sink, std::make_tuple(f.return_type, escape_keyword(f.name), f.parameters), context);
24 } 24 }
25}; 25};
diff --git a/src/lib/eolian_cxx/grammar/function_definition.hpp b/src/lib/eolian_cxx/grammar/function_definition.hpp
index a2de1aaf41..714cb1fbda 100644
--- a/src/lib/eolian_cxx/grammar/function_definition.hpp
+++ b/src/lib/eolian_cxx/grammar/function_definition.hpp
@@ -54,7 +54,7 @@ struct function_definition_generator
54 return false; 54 return false;
55 55
56 if(!as_generator 56 if(!as_generator
57 ("inline " << grammar::type(true) << " " << string << "::" << string << "(" << (parameter % ", ") << ") const\n{\n") 57 ("inline ::efl::eolian::return_traits<" << grammar::type(true) << ">::type " << string << "::" << string << "(" << (parameter % ", ") << ") const\n{\n")
58 .generate(sink, std::make_tuple(f.return_type, _klass_name.eolian_name, escape_keyword(f.name), f.parameters), ctx)) 58 .generate(sink, std::make_tuple(f.return_type, _klass_name.eolian_name, escape_keyword(f.name), f.parameters), ctx))
59 return false; 59 return false;
60 60
@@ -133,8 +133,8 @@ struct function_definition_generator
133 .generate(sink, f.parameters, ctx)) return false; 133 .generate(sink, f.parameters, ctx)) return false;
134 134
135 if(f.return_type != attributes::void_ 135 if(f.return_type != attributes::void_
136 && !as_generator(scope_tab << "return ::efl::eolian::convert_to_return<" 136 && !as_generator(scope_tab << "return ::efl::eolian::convert_to_return< ::efl::eolian::return_traits<"
137 << type(true) << ">(__return_value);\n" 137 << type(true) << ">::type>(__return_value);\n"
138 ).generate(sink, f.return_type, ctx)) return false; 138 ).generate(sink, f.return_type, ctx)) return false;
139 139
140 if(!as_generator("}\n").generate(sink, attributes::unused, ctx)) 140 if(!as_generator("}\n").generate(sink, attributes::unused, ctx))
diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp
index 3e67d858ca..6e18b2bda1 100644
--- a/src/lib/eolian_cxx/grammar/type_impl.hpp
+++ b/src/lib/eolian_cxx/grammar/type_impl.hpp
@@ -102,9 +102,12 @@ struct visitor_generate
102 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 102 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
103 return replace_base_type(r, " ::efl::eina::stringshare"); 103 return replace_base_type(r, " ::efl::eina::stringshare");
104 }} 104 }}
105 , {"generic_value", nullptr, [&] 105 , {"generic_value", true, [&]
106 { return regular_type_def{" ::efl::eina::value", regular.base_qualifier, {}}; 106 { return regular_type_def{" ::efl::eina::value", regular.base_qualifier, {}};
107 }} 107 }}
108 , {"generic_value", false, [&]
109 { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier, {}};
110 }}
108 }; 111 };
109 if(regular.base_type == "void_ptr") 112 if(regular.base_type == "void_ptr")
110 { 113 {
@@ -207,11 +210,11 @@ struct visitor_generate
207 } 210 }
208 bool operator()(attributes::klass_name klass) const 211 bool operator()(attributes::klass_name klass) const
209 { 212 {
210 if(as_generator(" " << *("::" << lower_case[string]) << "::" << string) 213 return
211 .generate(sink, std::make_tuple(attributes::cpp_namespaces(klass.namespaces), klass.eolian_name), *context)) 214 as_generator(" " << *("::" << lower_case[string]) << "::" << string)
212 return true; 215 .generate(sink, std::make_tuple(attributes::cpp_namespaces(klass.namespaces), klass.eolian_name), *context)
213 else 216 && (!(klass.base_qualifier & qualifier_info::is_ref)
214 return false; 217 || as_generator("&").generate(sink, attributes::unused, *context));
215 } 218 }
216 bool operator()(attributes::complex_type_def const& complex) const 219 bool operator()(attributes::complex_type_def const& complex) const
217 { 220 {