From 3abc94696e0ee447b02f2c427723c41e7fb3c087 Mon Sep 17 00:00:00 2001 From: Felipe Magno de Almeida Date: Thu, 17 Jul 2014 21:47:36 -0300 Subject: [PATCH] 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 b26fff91c6..da68ff4dec 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 #include #include #include @@ -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) + std::vector types; types.push_back(type); + efl::eina::iterator iterator ( ::eolian_type_subtypes_list_get(type) ); + while(iterator != efl::eina::iterator()) + 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) { - lt = static_cast(::eina_iterator_container_get(it)); - n_ = ::eina_list_count(lt) + 1; - ::eina_iterator_free(it); + v[i] = type_find(lut.begin(), lut.end(), type_from_eolian(*types[i])); } - else + + // Let's degrade to opaque classes when not enough information + // is available for complex types + if(v.size() == 1 && type_is_complex(v[0])) { - n_ = 1; - } - // assert(n_ > 0); - efl::eolian::eolian_type_instance v(n_); - for (size_t i=0; i