summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bindings/eo_cxx/eo_inherit.hh3
-rw-r--r--src/bindings/eo_cxx/eo_ops.hh3
-rw-r--r--src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh7
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_accessor.cc18
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_ptrarray.cc54
-rw-r--r--src/tests/eina_cxx/eina_cxx_test_ptrlist.cc50
6 files changed, 59 insertions, 76 deletions
diff --git a/src/bindings/eo_cxx/eo_inherit.hh b/src/bindings/eo_cxx/eo_inherit.hh
index 1d3d3125ff..9639e33e4a 100644
--- a/src/bindings/eo_cxx/eo_inherit.hh
+++ b/src/bindings/eo_cxx/eo_inherit.hh
@@ -83,10 +83,9 @@ struct inherit
83 /// 83 ///
84 template<typename... Args> 84 template<typename... Args>
85 inherit(efl::eo::parent_type _p, Args&& ... args) 85 inherit(efl::eo::parent_type _p, Args&& ... args)
86 : _eo_cls(nullptr), _eo_raw(nullptr)
87 { 86 {
88 _eo_cls = detail::create_class<D, E...> (eina::make_index_sequence<sizeof...(E)>()); 87 _eo_cls = detail::create_class<D, E...> (eina::make_index_sequence<sizeof...(E)>());
89 eo_add_ref(&_eo_raw, _eo_cls, _p._eo_raw, detail::inherit_constructor(_eo_raw, this), ::efl::eolian::call_ctors(_eo_raw, args...)); 88 _eo_raw = eo_add_ref(_eo_cls, _p._eo_raw, detail::inherit_constructor(eoid, this), ::efl::eolian::call_ctors(eoid, args...));
90 ::efl::eolian::register_ev_del_free_callback(_eo_raw, args...); 89 ::efl::eolian::register_ev_del_free_callback(_eo_raw, args...);
91 } 90 }
92 91
diff --git a/src/bindings/eo_cxx/eo_ops.hh b/src/bindings/eo_cxx/eo_ops.hh
index 653dcf327d..f2d51334f7 100644
--- a/src/bindings/eo_cxx/eo_ops.hh
+++ b/src/bindings/eo_cxx/eo_ops.hh
@@ -60,8 +60,7 @@ isa(const Eo *obj, const Eo_Class *klass)
60inline Eo* 60inline Eo*
61add(const Eo_Class *klass, Eo *parent = NULL) 61add(const Eo_Class *klass, Eo *parent = NULL)
62{ 62{
63 Eo *eo = nullptr; 63 Eo *eo = eo_add_ref(klass, parent);
64 eo_add_ref(&eo, klass, parent);
65 return eo; 64 return eo;
66} 65}
67 66
diff --git a/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh b/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
index 9fde23aa92..2a7091ad02 100644
--- a/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
+++ b/src/lib/eolian_cxx/grammar/eo_class_constructors_generator.hh
@@ -577,14 +577,13 @@ operator<<(std::ostream& out, function_call_constructor_methods const& x)
577 577
578 out << ")" << endl 578 out << ")" << endl
579 << tab(1) << "{" << endl 579 << tab(1) << "{" << endl
580 << tab(2) << "Eo* _ret_eo = nullptr;" << endl 580 << tab(2) << "Eo* _ret_eo = eo_add_ref(" << x._cls.eo_name << ", _p._eo_raw";
581 << tab(2) << "eo_add_ref(&_ret_eo, " << x._cls.eo_name << ", _p._eo_raw";
582 for (it = first; it != last; ++it) 581 for (it = first; it != last; ++it)
583 { 582 {
584 out << ", _c" << (it-first) << "(_ret_eo)"; 583 out << ", _c" << (it-first) << "(eoid)";
585 } 584 }
586 if (!x._cls.optional_constructors.empty()) 585 if (!x._cls.optional_constructors.empty())
587 out << ", ::efl::eolian::call_ctors(_ret_eo, _opts...)"; 586 out << ", ::efl::eolian::call_ctors(eoid, _opts...)";
588 out << ");" << endl << endl; 587 out << ");" << endl << endl;
589 588
590 for (it = first; it != last; ++it) 589 for (it = first; it != last; ++it)
diff --git a/src/tests/eina_cxx/eina_cxx_test_accessor.cc b/src/tests/eina_cxx/eina_cxx_test_accessor.cc
index 47cb62b7d9..9737f0d383 100644
--- a/src/tests/eina_cxx/eina_cxx_test_accessor.cc
+++ b/src/tests/eina_cxx/eina_cxx_test_accessor.cc
@@ -43,11 +43,10 @@ START_TEST(eina_cxx_eo_accessor_indexing)
43 43
44 efl::eina::list<wrapper> list; 44 efl::eina::list<wrapper> list;
45 45
46 Eo* eoptr = nullptr; 46 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
47 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 47 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
48 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 48 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
49 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 49 wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
50 wrapper const w4(eo_add(&eoptr, SIMPLE_CLASS, NULL));
51 50
52 list.push_back(w1); 51 list.push_back(w1);
53 list.push_back(w2); 52 list.push_back(w2);
@@ -98,11 +97,10 @@ START_TEST(eina_cxx_eo_accessor_iterator)
98 97
99 efl::eina::list<wrapper> list; 98 efl::eina::list<wrapper> list;
100 99
101 Eo* eoptr = nullptr; 100 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
102 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 101 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
103 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 102 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
104 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 103 wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
105 wrapper const w4(eo_add(&eoptr, SIMPLE_CLASS, NULL));
106 104
107 list.push_back(w1); 105 list.push_back(w1);
108 list.push_back(w2); 106 list.push_back(w2);
diff --git a/src/tests/eina_cxx/eina_cxx_test_ptrarray.cc b/src/tests/eina_cxx/eina_cxx_test_ptrarray.cc
index 4b7fce3572..6b2f6271d8 100644
--- a/src/tests/eina_cxx/eina_cxx_test_ptrarray.cc
+++ b/src/tests/eina_cxx/eina_cxx_test_ptrarray.cc
@@ -26,10 +26,9 @@ START_TEST(eina_cxx_ptrarray_push_back)
26 int result[] = {5, 10, 15}; 26 int result[] = {5, 10, 15};
27 int rresult[] = {15, 10, 5}; 27 int rresult[] = {15, 10, 5};
28 28
29 Eo* eoptr = nullptr; 29 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
30 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 30 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
31 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 31 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
32 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL));
33 32
34 { 33 {
35 efl::eina::ptr_array<int> array; 34 efl::eina::ptr_array<int> array;
@@ -103,10 +102,9 @@ START_TEST(eina_cxx_ptrarray_pop_back)
103 ck_assert(std::equal(array.rbegin(), array.rend(), rresult)); 102 ck_assert(std::equal(array.rbegin(), array.rend(), rresult));
104 } 103 }
105 { 104 {
106 Eo* eoptr = nullptr; 105 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
107 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 106 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
108 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 107 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
109 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL));
110 108
111 efl::eina::array<wrapper> array; 109 efl::eina::array<wrapper> array;
112 110
@@ -199,12 +197,11 @@ START_TEST(eina_cxx_ptrarray_insert)
199 ck_assert(std::equal(array.begin(), array.end(), array4.begin())); 197 ck_assert(std::equal(array.begin(), array.end(), array4.begin()));
200 } 198 }
201 { 199 {
202 Eo* eoptr = nullptr; 200 wrapper const w0(eo_add(SIMPLE_CLASS, NULL));
203 wrapper const w0(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 201 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
204 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 202 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
205 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 203 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
206 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 204 wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
207 wrapper const w4(eo_add(&eoptr, SIMPLE_CLASS, NULL));
208 205
209 efl::eina::array<wrapper> array; 206 efl::eina::array<wrapper> array;
210 ck_assert(std::distance(array.begin(), array.end()) == 0u); 207 ck_assert(std::distance(array.begin(), array.end()) == 0u);
@@ -280,8 +277,7 @@ START_TEST(eina_cxx_ptrarray_constructors)
280 efl::eina::eina_init eina_init; 277 efl::eina::eina_init eina_init;
281 efl::eo::eo_init eo_init; 278 efl::eo::eo_init eo_init;
282 279
283 Eo* eoptr = nullptr; 280 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
284 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL));
285 281
286 { 282 {
287 efl::eina::ptr_array<int> array1; 283 efl::eina::ptr_array<int> array1;
@@ -360,13 +356,12 @@ START_TEST(eina_cxx_ptrarray_erase)
360 ck_assert(array1.back() == 25); 356 ck_assert(array1.back() == 25);
361 } 357 }
362 { 358 {
363 Eo* eoptr = nullptr; 359 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
364 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 360 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
365 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 361 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
366 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 362 wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
367 wrapper const w4(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 363 wrapper const w5(eo_add(SIMPLE_CLASS, NULL));
368 wrapper const w5(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 364 wrapper const w6(eo_add(SIMPLE_CLASS, NULL));
369 wrapper const w6(eo_add(&eoptr, SIMPLE_CLASS, NULL));
370 365
371 efl::eina::array<wrapper> array1; 366 efl::eina::array<wrapper> array1;
372 367
@@ -442,13 +437,12 @@ START_TEST(eina_cxx_ptrarray_range)
442 } 437 }
443 438
444 { 439 {
445 Eo* eoptr = nullptr; 440 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
446 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 441 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
447 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 442 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
448 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 443 wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
449 wrapper const w4(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 444 wrapper const w5(eo_add(SIMPLE_CLASS, NULL));
450 wrapper const w5(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 445 wrapper const w6(eo_add(SIMPLE_CLASS, NULL));
451 wrapper const w6(eo_add(&eoptr, SIMPLE_CLASS, NULL));
452 446
453 efl::eina::array<wrapper> array; 447 efl::eina::array<wrapper> array;
454 array.push_back(w1); 448 array.push_back(w1);
diff --git a/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc b/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc
index 2c10263424..039ef971bc 100644
--- a/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc
+++ b/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc
@@ -28,10 +28,9 @@ START_TEST(eina_cxx_ptrlist_push_back)
28 int result[] = {5, 10, 15}; 28 int result[] = {5, 10, 15};
29 int rresult[] = {15, 10, 5}; 29 int rresult[] = {15, 10, 5};
30 30
31 Eo* eoptr = nullptr; 31 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
32 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 32 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
33 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 33 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
34 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL));
35 34
36 { 35 {
37 efl::eina::ptr_list<int> list; 36 efl::eina::ptr_list<int> list;
@@ -78,10 +77,9 @@ START_TEST(eina_cxx_ptrlist_pop_back)
78 int result[] = {5, 10}; 77 int result[] = {5, 10};
79 int rresult[] = {10, 5}; 78 int rresult[] = {10, 5};
80 79
81 Eo* eoptr = nullptr; 80 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
82 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 81 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
83 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 82 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
84 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL));
85 83
86 { 84 {
87 efl::eina::ptr_list<int> list; 85 efl::eina::ptr_list<int> list;
@@ -145,10 +143,9 @@ START_TEST(eina_cxx_ptrlist_push_front)
145 ck_assert(std::equal(list.rbegin(), list.rend(), rresult)); 143 ck_assert(std::equal(list.rbegin(), list.rend(), rresult));
146 } 144 }
147 { 145 {
148 Eo* eoptr = nullptr; 146 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
149 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 147 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
150 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 148 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
151 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL));
152 149
153 efl::eina::list<wrapper> list; 150 efl::eina::list<wrapper> list;
154 151
@@ -174,10 +171,9 @@ START_TEST(eina_cxx_ptrlist_pop_front)
174 int result[] = {10, 5}; 171 int result[] = {10, 5};
175 int rresult[] = {5, 10}; 172 int rresult[] = {5, 10};
176 173
177 Eo* eoptr = nullptr; 174 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
178 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 175 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
179 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 176 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
180 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL));
181 177
182 { 178 {
183 efl::eina::ptr_list<int> list; 179 efl::eina::ptr_list<int> list;
@@ -277,12 +273,11 @@ START_TEST(eina_cxx_ptrlist_insert)
277 ck_assert(std::equal(list.begin(), list.end(), list4.begin())); 273 ck_assert(std::equal(list.begin(), list.end(), list4.begin()));
278 } 274 }
279 { 275 {
280 Eo* eoptr = nullptr; 276 wrapper const w0(eo_add(SIMPLE_CLASS, NULL));
281 wrapper const w0(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 277 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
282 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 278 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
283 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 279 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
284 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 280 wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
285 wrapper const w4(eo_add(&eoptr, SIMPLE_CLASS, NULL));
286 281
287 efl::eina::list<wrapper> list; 282 efl::eina::list<wrapper> list;
288 283
@@ -371,12 +366,11 @@ START_TEST(eina_cxx_ptrlist_constructors)
371 ck_assert(list2 == list4); 366 ck_assert(list2 == list4);
372 } 367 }
373 { 368 {
374 Eo* eoptr = nullptr; 369 wrapper const w0(eo_add(SIMPLE_CLASS, NULL));
375 wrapper const w0(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 370 wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
376 wrapper const w1(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 371 wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
377 wrapper const w2(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 372 wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
378 wrapper const w3(eo_add(&eoptr, SIMPLE_CLASS, NULL)); 373 wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
379 wrapper const w4(eo_add(&eoptr, SIMPLE_CLASS, NULL));
380 374
381 efl::eina::list<wrapper> list1; 375 efl::eina::list<wrapper> list1;
382 ck_assert(list1.empty()); 376 ck_assert(list1.empty());