felipealmeida pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3abc94696e0ee447b02f2c427723c41e7fb3c087
commit 3abc94696e0ee447b02f2c427723c41e7fb3c087 Author: Felipe Magno de Almeida <fel...@expertisesolutions.com.br> Date: Thu Jul 17 21:47:36 2014 -0300 Fixed type looking up for complex types --- src/bin/eolian_cxx/type_lookup.hh | 43 +++++++++++++++------------------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/src/bin/eolian_cxx/type_lookup.hh b/src/bin/eolian_cxx/type_lookup.hh index b26fff9..da68ff4 100644 --- a/src/bin/eolian_cxx/type_lookup.hh +++ b/src/bin/eolian_cxx/type_lookup.hh @@ -2,7 +2,6 @@ #ifndef EOLIAN_CXX_TYPE_LOOKUP_HH #define EOLIAN_CXX_TYPE_LOOKUP_HH -#include <iostream> #include <algorithm> #include <string> #include <vector> @@ -52,36 +51,26 @@ type_lookup(const Eolian_Type* type, { if (type == NULL) return { efl::eolian::void_type }; // XXX shouldn't - Eina_List const* lt = NULL; - Eina_Iterator *it = NULL; - unsigned int n_; - if ( (it = ::eolian_type_subtypes_list_get(type)) != NULL) - { - lt = static_cast<Eina_List const*>(::eina_iterator_container_get(it)); - n_ = ::eina_list_count(lt) + 1; - ::eina_iterator_free(it); - } - else + std::vector<Eolian_Type const*> types; types.push_back(type); + efl::eina::iterator<Eolian_Type const> iterator ( ::eolian_type_subtypes_list_get(type) ); + while(iterator != efl::eina::iterator<Eolian_Type const>()) + if(Eolian_Type const* t = &*iterator) + types.push_back(t), ++iterator; + + efl::eolian::eolian_type_instance v(types.size()); + for (std::size_t i = 0; i != types.size(); ++i) { - n_ = 1; + v[i] = type_find(lut.begin(), lut.end(), type_from_eolian(*types[i])); } - // assert(n_ > 0); - efl::eolian::eolian_type_instance v(n_); - for (size_t i=0; i<n_; i++) + + // Let's degrade to opaque classes when not enough information + // is available for complex types + if(v.size() == 1 && type_is_complex(v[0])) { - v[i] = type_find(lut.begin(), lut.end(), type_from_eolian(*type)); - // XXX temporary workaround to allow incomplete complex-types until - // we don't have a full support. - if (type_is_complex(v[i])) - { - assert(i == 0); - efl::eolian::eolian_type tmp = v[i]; - v.clear(); - v.push_back(efl::eolian::type_to_native(tmp)); - return v; - } - assert(i == n_-1 || type_is_complex(v[i])); + efl::eolian::eolian_type tmp = v[0]; + return {efl::eolian::type_to_native(tmp)}; } + return v; } --