summaryrefslogtreecommitdiff
path: root/src/bin/eolian_cxx
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2014-07-17 21:47:36 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2014-07-18 18:57:14 -0300
commit3abc94696e0ee447b02f2c427723c41e7fb3c087 (patch)
treebcb8c21bf023db32da6dfb40a9e6323815dd6414 /src/bin/eolian_cxx
parent2ff390e087587f755ec09a2ccf2bcd673e6272a5 (diff)
Fixed type looking up for complex types
Diffstat (limited to 'src/bin/eolian_cxx')
-rw-r--r--src/bin/eolian_cxx/type_lookup.hh43
1 files 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 @@
2#ifndef EOLIAN_CXX_TYPE_LOOKUP_HH 2#ifndef EOLIAN_CXX_TYPE_LOOKUP_HH
3#define EOLIAN_CXX_TYPE_LOOKUP_HH 3#define EOLIAN_CXX_TYPE_LOOKUP_HH
4 4
5#include <iostream>
6#include <algorithm> 5#include <algorithm>
7#include <string> 6#include <string>
8#include <vector> 7#include <vector>
@@ -52,36 +51,26 @@ type_lookup(const Eolian_Type* type,
52{ 51{
53 if (type == NULL) return { efl::eolian::void_type }; // XXX shouldn't 52 if (type == NULL) return { efl::eolian::void_type }; // XXX shouldn't
54 53
55 Eina_List const* lt = NULL; 54 std::vector<Eolian_Type const*> types; types.push_back(type);
56 Eina_Iterator *it = NULL; 55 efl::eina::iterator<Eolian_Type const> iterator ( ::eolian_type_subtypes_list_get(type) );
57 unsigned int n_; 56 while(iterator != efl::eina::iterator<Eolian_Type const>())
58 if ( (it = ::eolian_type_subtypes_list_get(type)) != NULL) 57 if(Eolian_Type const* t = &*iterator)
59 { 58 types.push_back(t), ++iterator;
60 lt = static_cast<Eina_List const*>(::eina_iterator_container_get(it)); 59
61 n_ = ::eina_list_count(lt) + 1; 60 efl::eolian::eolian_type_instance v(types.size());
62 ::eina_iterator_free(it); 61 for (std::size_t i = 0; i != types.size(); ++i)
63 }
64 else
65 { 62 {
66 n_ = 1; 63 v[i] = type_find(lut.begin(), lut.end(), type_from_eolian(*types[i]));
67 } 64 }
68 // assert(n_ > 0); 65
69 efl::eolian::eolian_type_instance v(n_); 66 // Let's degrade to opaque classes when not enough information
70 for (size_t i=0; i<n_; i++) 67 // is available for complex types
68 if(v.size() == 1 && type_is_complex(v[0]))
71 { 69 {
72 v[i] = type_find(lut.begin(), lut.end(), type_from_eolian(*type)); 70 efl::eolian::eolian_type tmp = v[0];
73 // XXX temporary workaround to allow incomplete complex-types until 71 return {efl::eolian::type_to_native(tmp)};
74 // we don't have a full support.
75 if (type_is_complex(v[i]))
76 {
77 assert(i == 0);
78 efl::eolian::eolian_type tmp = v[i];
79 v.clear();
80 v.push_back(efl::eolian::type_to_native(tmp));
81 return v;
82 }
83 assert(i == n_-1 || type_is_complex(v[i]));
84 } 72 }
73
85 return v; 74 return v;
86} 75}
87 76