summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-09-25 21:57:25 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-09-25 21:57:25 -0300
commitbb887f9869c3dd9eca72c8e65f335d148f9dbdd3 (patch)
tree7b4e33f6e249d59963cd58a81f9c78b82f653c7f
parent39318789a88cf5e3930c9ed6e9d437aa374ce7ad (diff)
eolian-cxx: Fix compilation errors with new any_value_ptr and mstring types
-rw-r--r--src/bindings/cxx/eo_cxx/eo_cxx_interop.hh6
-rw-r--r--src/lib/eolian_cxx/grammar/type_impl.hpp25
-rw-r--r--src/tests/eolian_cxx/name1_name2_type_generation.c4
3 files changed, 32 insertions, 3 deletions
diff --git a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
index d5f31d351c..2f9b6382b3 100644
--- a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
+++ b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
@@ -394,7 +394,11 @@ inline char* convert_to_c_impl( ::efl::eina::string_view v, tag<char*, ::efl::ei
394 std::strcpy(string, v.c_str()); 394 std::strcpy(string, v.c_str());
395 return string; 395 return string;
396} 396}
397inline char** convert_to_c_impl(efl::eina::string_view* /*view*/, tag<char **, efl::eina::string_view*>) 397inline char** convert_to_c_impl(efl::eina::string_view& /*view*/, tag<char **, efl::eina::string_view, true>)
398{
399 std::abort();
400}
401inline const char** convert_to_c_impl(efl::eina::string_view& /*view*/, tag<const char **, efl::eina::string_view, true>)
398{ 402{
399 std::abort(); 403 std::abort();
400} 404}
diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp
index bb61980dd9..fb78c1e51b 100644
--- a/src/lib/eolian_cxx/grammar/type_impl.hpp
+++ b/src/lib/eolian_cxx/grammar/type_impl.hpp
@@ -110,6 +110,24 @@ struct visitor_generate
110 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 110 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
111 return replace_base_type(r, " ::efl::eina::string_view"); 111 return replace_base_type(r, " ::efl::eina::string_view");
112 }} 112 }}
113 , {"mstring", false, nullptr, nullptr, [&]
114 {
115 regular_type_def r = regular;
116 r.base_qualifier.qualifier |= qualifier_info::is_ref;
117 // r.base_qualifier.qualifier ^= qualifier_info::is_const;
118 if(is_out || is_return)
119 return replace_base_type(r, " ::std::string");
120 return replace_base_type(r, " ::efl::eina::string_view");
121 }}
122 , {"mstring", true, nullptr, nullptr, [&]
123 {
124 regular_type_def r = regular;
125 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
126 // r.base_qualifier.qualifier ^= qualifier_info::is_const;
127 if(is_out || is_return)
128 return replace_base_type(r, " ::std::string");
129 return replace_base_type(r, " ::efl::eina::string_view");
130 }}
113 , {"stringshare", nullptr, nullptr, nullptr, [&] 131 , {"stringshare", nullptr, nullptr, nullptr, [&]
114 { 132 {
115 regular_type_def r = regular; 133 regular_type_def r = regular;
@@ -124,6 +142,13 @@ struct visitor_generate
124 , {"any_value", false, nullptr, nullptr, [&] 142 , {"any_value", false, nullptr, nullptr, [&]
125 { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier, {}}; 143 { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier, {}};
126 }} 144 }}
145 , {"any_value_ptr", true, nullptr, nullptr, [&]
146 {
147 return regular_type_def{" ::efl::eina::value", regular.base_qualifier ^ qualifier_info::is_ref, {}};
148 }}
149 , {"any_value_ptr", false, nullptr, nullptr, [&]
150 { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier ^ qualifier_info::is_ref, {}};
151 }}
127 }; 152 };
128 if(regular.base_type == "void_ptr") 153 if(regular.base_type == "void_ptr")
129 { 154 {
diff --git a/src/tests/eolian_cxx/name1_name2_type_generation.c b/src/tests/eolian_cxx/name1_name2_type_generation.c
index 26dc899d5c..2517bcdd85 100644
--- a/src/tests/eolian_cxx/name1_name2_type_generation.c
+++ b/src/tests/eolian_cxx/name1_name2_type_generation.c
@@ -102,7 +102,7 @@ void _name1_name2_type_generation_instringshareown(Eo *obj EINA_UNUSED, Type_Gen
102 eina_stringshare_del(v); 102 eina_stringshare_del(v);
103} 103}
104 104
105void _name1_name2_type_generation_instringptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, char * *v) 105void _name1_name2_type_generation_instringptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, const char * *v)
106{ 106{
107 ck_assert_str_eq(*v, "foobar"); 107 ck_assert_str_eq(*v, "foobar");
108 free((void*)*v); 108 free((void*)*v);
@@ -197,7 +197,7 @@ char * _name1_name2_type_generation_returnstringown(Eo *obj EINA_UNUSED, Type_Ge
197 return p; 197 return p;
198} 198}
199 199
200char * * _name1_name2_type_generation_returnstringownptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) 200const char * * _name1_name2_type_generation_returnstringownptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED)
201{ 201{
202 const char foobar[] = "foobar"; 202 const char foobar[] = "foobar";
203 char** p1 = malloc(sizeof(const char*)); 203 char** p1 = malloc(sizeof(const char*));