summaryrefslogtreecommitdiff
path: root/src/examples/eolian_cxx
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-05-19 11:41:27 +0100
committerTom Hacohen <tom@stosb.com>2015-05-20 13:03:24 +0100
commit6efbfe227aaaa24eda7bcb7df916d4daf0a74400 (patch)
treec96e166b7348c5e825aca2d4af084675172e0cec /src/examples/eolian_cxx
parente7ed0bfcedcea87f8645107a8a0775f67227d7c1 (diff)
Eo: Add a return value to eo_constructor().
From now on, constructors should return a value, usually the object being worked on, or NULL (if the constructor failed). This can also be used for implementing singletons, by just always returning the same object from the constructor. This is one of the final steps towards stabilizing Eo. @feature
Diffstat (limited to 'src/examples/eolian_cxx')
-rw-r--r--src/examples/eolian_cxx/colourable.c4
-rw-r--r--src/examples/eolian_cxx/colourable_cxx.cc4
-rw-r--r--src/examples/eolian_cxx/colourable_stub.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/examples/eolian_cxx/colourable.c b/src/examples/eolian_cxx/colourable.c
index 1c7ff5e..655d63c 100644
--- a/src/examples/eolian_cxx/colourable.c
+++ b/src/examples/eolian_cxx/colourable.c
@@ -26,7 +26,7 @@ struct _Colourable_Data
26 26
27typedef struct _Colourable_Data Colourable_Data; 27typedef struct _Colourable_Data Colourable_Data;
28 28
29void 29Eo *
30_colourable_eo_base_constructor(Eo *obj, Colourable_Data *self EINA_UNUSED) 30_colourable_eo_base_constructor(Eo *obj, Colourable_Data *self EINA_UNUSED)
31{ 31{
32 if(!_colourable_impl_logdomain) 32 if(!_colourable_impl_logdomain)
@@ -35,7 +35,7 @@ _colourable_eo_base_constructor(Eo *obj, Colourable_Data *self EINA_UNUSED)
35 = eina_log_domain_register("colourable", EINA_COLOR_BLUE); 35 = eina_log_domain_register("colourable", EINA_COLOR_BLUE);
36 } 36 }
37 DBG("_colourable_constructor(%p, %p)\n", obj, MY_CLASS); 37 DBG("_colourable_constructor(%p, %p)\n", obj, MY_CLASS);
38 eo_do_super(obj, MY_CLASS, eo_constructor()); 38 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
39} 39}
40 40
41void 41void
diff --git a/src/examples/eolian_cxx/colourable_cxx.cc b/src/examples/eolian_cxx/colourable_cxx.cc
index bd4fa46..934a5d0 100644
--- a/src/examples/eolian_cxx/colourable_cxx.cc
+++ b/src/examples/eolian_cxx/colourable_cxx.cc
@@ -19,12 +19,12 @@ extern "C"
19 19
20static efl::eina::log_domain domain("colourable"); 20static efl::eina::log_domain domain("colourable");
21 21
22void 22Eo *
23_colourable_eo_base_constructor(Eo *obj, Colourable_Data *self) 23_colourable_eo_base_constructor(Eo *obj, Colourable_Data *self)
24{ 24{
25 EINA_CXX_DOM_LOG_DBG(domain) << __func__ << std::endl; 25 EINA_CXX_DOM_LOG_DBG(domain) << __func__ << std::endl;
26 self->r = self->g = self->b = 0; 26 self->r = self->g = self->b = 0;
27 eo_do_super(obj, MY_CLASS, eo_constructor()); 27 return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
28} 28}
29 29
30void 30void
diff --git a/src/examples/eolian_cxx/colourable_stub.h b/src/examples/eolian_cxx/colourable_stub.h
index f6d758c..26b44b1 100644
--- a/src/examples/eolian_cxx/colourable_stub.h
+++ b/src/examples/eolian_cxx/colourable_stub.h
@@ -13,7 +13,7 @@ struct _Colourable_Data
13}; 13};
14typedef struct _Colourable_Data Colourable_Data; 14typedef struct _Colourable_Data Colourable_Data;
15 15
16void _colourable_eo_base_constructor(Eo *obj, Colourable_Data *self); 16Eo *_colourable_eo_base_constructor(Eo *obj, Colourable_Data *self);
17void _colourable_eo_base_destructor(Eo *obj, Colourable_Data *self); 17void _colourable_eo_base_destructor(Eo *obj, Colourable_Data *self);
18void _colourable_rgb_24bits_constructor(Eo *obj, Colourable_Data *self, int rgb); 18void _colourable_rgb_24bits_constructor(Eo *obj, Colourable_Data *self, int rgb);
19void _colourable_print_colour(Eo *obj, Colourable_Data *self); 19void _colourable_print_colour(Eo *obj, Colourable_Data *self);