diff options
author | Vitor Sousa <vitorsousasilva@gmail.com> | 2015-01-05 15:47:52 -0200 |
---|---|---|
committer | Vitor Sousa <vitorsousasilva@gmail.com> | 2015-01-05 15:54:15 -0200 |
commit | 00c0d28588014eec4ac3c81cfcdb23aeee389e2f (patch) | |
tree | 6a1ac311b0f72727c1f57699fa54f17f98c04c70 | |
parent | 5a42e66910dbc6abf0c1a6c9899e27d437164e4f (diff) | |
download | elementary-00c0d28588014eec4ac3c81cfcdb23aeee389e2f.tar.gz |
cxx: Update examples to handle eina::optional types used by the new C++ wrappers
-rw-r--r-- | src/examples/box_cxx_example_02.cc | 8 | ||||
-rw-r--r-- | src/examples/button_cxx_example_01.cc | 14 | ||||
-rw-r--r-- | src/examples/hoversel_cxx_example_01.cc | 2 | ||||
-rw-r--r-- | src/examples/icon_cxx_example_01.cc | 4 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/examples/box_cxx_example_02.cc b/src/examples/box_cxx_example_02.cc index ecfb9eb05..273130fcb 100644 --- a/src/examples/box_cxx_example_02.cc +++ b/src/examples/box_cxx_example_02.cc @@ -107,10 +107,10 @@ elm_main(int argc, char *argv[]) { elm_button btn ( efl::eo::parent = *box ); btn.text_set("elm.text", "I do nothing"); - efl::eina::list<evas::object> childrens(box->children_get()); - if (!childrens.empty()) + efl::eina::optional<efl::eina::list<evas::object> > childrens(box->children_get()); + if (childrens && !childrens->empty()) { - box->pack_after(btn, childrens.front()); + box->pack_after(btn, childrens->front()); } else box->pack_end(btn); @@ -135,7 +135,7 @@ elm_main(int argc, char *argv[]) elm_button btn = efl::eo::downcast<elm_button>(obj); tdata.box.lock()->unpack(btn); btn.position_set(0, 50); - btn.color_set(128, 64, 0, 128); + btn.object::color_set(128, 64, 0, 128); }, std::placeholders::_1) ; diff --git a/src/examples/button_cxx_example_01.cc b/src/examples/button_cxx_example_01.cc index adc8df5f5..1a59c886c 100644 --- a/src/examples/button_cxx_example_01.cc +++ b/src/examples/button_cxx_example_01.cc @@ -64,20 +64,20 @@ elm_main(int argc, char *argv[]) { ::elm_button b(eo_ref(ci._eo_ptr())); std::string::size_type ptr; - std::string lbl = b.text_get("elm.text"); + efl::eina::optional<std::string> lbl = b.text_get("elm.text"); - ptr = lbl.find(":"); + ptr = lbl->find(":"); ptr += 2; - double t = std::stod(lbl.substr(ptr)); + double t = std::stod(lbl->substr(ptr)); - if (lbl.compare(0,7,"Initial") != 0) + if (lbl->compare(0,7,"Initial") != 0) { up.autorepeat_initial_timeout_set(t); down.autorepeat_initial_timeout_set(t); left.autorepeat_initial_timeout_set(t); right.autorepeat_initial_timeout_set(t); } - else if (lbl.compare(0,3,"Gap") != 0) + else if (lbl->compare(0,3,"Gap") != 0) { up.autorepeat_gap_timeout_set(t); down.autorepeat_gap_timeout_set(t); @@ -140,8 +140,8 @@ elm_main(int argc, char *argv[]) if (!icon_still) { ::elm_icon obj(efl::eo::parent = mid); - evas::object icon_still = mid.content_unset("icon"); - icon_still.visibility_set(false); + efl::eina::optional<evas::object> icon_still = mid.content_unset("icon"); + icon_still->visibility_set(false); obj.standard_set("chat"); mid.content_set("icon", obj); } diff --git a/src/examples/hoversel_cxx_example_01.cc b/src/examples/hoversel_cxx_example_01.cc index d76009843..4f4d53e16 100644 --- a/src/examples/hoversel_cxx_example_01.cc +++ b/src/examples/hoversel_cxx_example_01.cc @@ -119,7 +119,7 @@ _print_items(void *data, Evas_Object *obj, void *event_info) for (auto i : items)
try
{
- std::cout << i.part_text_get("elm.text") << std::endl;
+ std::cout << *(i.part_text_get("elm.text")) << std::endl;
}
catch (std::logic_error const&) {}
}
diff --git a/src/examples/icon_cxx_example_01.cc b/src/examples/icon_cxx_example_01.cc index da87ec1cd..f06992bc4 100644 --- a/src/examples/icon_cxx_example_01.cc +++ b/src/examples/icon_cxx_example_01.cc @@ -35,7 +35,7 @@ EAPI_MAIN int elm_main (int argc, char *argv[])
{
const char *path, *group;
- std::string name;
+ efl::eina::optional<std::string> name;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm_win win(elm_win_util_standard_add("icon", "Icon"));
@@ -47,7 +47,7 @@ elm_main (int argc, char *argv[]) icon.file_get(&path, &group);
name = icon.standard_get();
- std::cout << "path = " << path << ", group = " << group << ", name = " << name << std::endl;
+ std::cout << "path = " << path << ", group = " << group << ", name = " << *name << std::endl;
icon.no_scale_set(true);
icon.resizable_set(false, true);
|