summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-11-03 17:59:20 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-11-03 17:59:20 -0200
commit137dd4864d07e6c3398f049377bdeb140063d631 (patch)
treeb05ac8f95f9d24ce75951670ceb6cee0f534c3b7 /src/lib/eolian_cxx
parent4fa4be2b14149483fa7aa58b6d0c6e3bf4ed542d (diff)
eina-cxx: eolian-cxx: Fix correct usage of is_eolian_object traits
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp4
-rw-r--r--src/lib/eolian_cxx/grammar/type_impl.hpp72
2 files changed, 50 insertions, 26 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index d2f39d3542..b2125e4cf6 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -13,6 +13,8 @@
13 13
14#include <Eina.hh> 14#include <Eina.hh>
15 15
16#include "eo_concrete.hh"
17
16#include <vector> 18#include <vector>
17#include <memory> 19#include <memory>
18#include <set> 20#include <set>
@@ -251,6 +253,8 @@ inline void type_def::set(Eolian_Type const* eolian_type)
251 break; 253 break;
252 case EOLIAN_TYPE_REGULAR: 254 case EOLIAN_TYPE_REGULAR:
253 { 255 {
256 if(c_type == "va_list *")
257 throw std::runtime_error("");
254 std::vector<std::string> namespaces; 258 std::vector<std::string> namespaces;
255 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type)) 259 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type))
256 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator) 260 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator)
diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp
index 5a5049c68c..a6bd0a9158 100644
--- a/src/lib/eolian_cxx/grammar/type_impl.hpp
+++ b/src/lib/eolian_cxx/grammar/type_impl.hpp
@@ -56,33 +56,47 @@ struct visitor_generate
56 { 56 {
57 eina::optional<std::string> name; 57 eina::optional<std::string> name;
58 eina::optional<bool> has_own; 58 eina::optional<bool> has_own;
59 eina::optional<bool> is_ref;
60 eina::optional<std::vector<std::string>> namespaces;
59 std::function<attributes::type_def::variant_type()> function; 61 std::function<attributes::type_def::variant_type()> function;
60 } 62 }
61 const match_table[] = 63 const match_table[] =
62 { 64 {
63 // signed primitives 65 // signed primitives
64 {"byte", nullptr, [&] { return replace_base_type(regular, " char"); }} 66 {"byte", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " char"); }}
65 , {"llong", nullptr, [&] { return replace_base_type(regular, " long long"); }} 67 , {"llong", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " long long"); }}
66 , {"int8", nullptr, [&] { return replace_base_type(regular, " int8_t"); }} 68 , {"int8", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " int8_t"); }}
67 , {"int16", nullptr, [&] { return replace_base_type(regular, " int16_t"); }} 69 , {"int16", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " int16_t"); }}
68 , {"int32", nullptr, [&] { return replace_base_type(regular, " int32_t"); }} 70 , {"int32", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " int32_t"); }}
69 , {"int64", nullptr, [&] { return replace_base_type(regular, " int64_t"); }} 71 , {"int64", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " int64_t"); }}
70 , {"ssize", nullptr, [&] { return replace_base_type(regular, " ssize_t"); }} 72 , {"ssize", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " ssize_t"); }}
71 // unsigned primitives 73 // unsigned primitives
72 , {"ubyte", nullptr, [&] { return replace_base_type(regular, " unsigned char"); }} 74 , {"ubyte", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned char"); }}
73 , {"ushort", nullptr, [&] { return replace_base_type(regular, " unsigned short"); }} 75 , {"ushort", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned short"); }}
74 , {"uint", nullptr, [&] { return replace_base_type(regular, " unsigned int"); }} 76 , {"uint", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned int"); }}
75 , {"ulong", nullptr, [&] { return replace_base_type(regular, " unsigned long"); }} 77 , {"ulong", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned long"); }}
76 , {"ullong", nullptr, [&] { return replace_base_type(regular, " unsigned long long"); }} 78 , {"ullong", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned long long"); }}
77 , {"uint8", nullptr, [&] { return replace_base_type(regular, " uint8_t"); }} 79 , {"uint8", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " uint8_t"); }}
78 , {"uint16", nullptr, [&] { return replace_base_type(regular, " uint16_t"); }} 80 , {"uint16", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " uint16_t"); }}
79 , {"uint32", nullptr, [&] { return replace_base_type(regular, " uint32_t"); }} 81 , {"uint32", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " uint32_t"); }}
80 , {"uint64", nullptr, [&] { return replace_base_type(regular, " uint64_t"); }} 82 , {"uint64", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " uint64_t"); }}
81 , {"size", nullptr, [&] { return replace_base_type(regular, " size_t"); }} 83 , {"size", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " size_t"); }}
84 , {"size", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " size_t"); }}
85 , {"File", nullptr, nullptr, {{"Eina"}}, [&]
86 {
87 const char const_[] = "const ";
88 if(regular.base_qualifier.qualifier & qualifier_info::is_const)
89 std::copy(&const_[0], &const_[0] + sizeof(const_) - 1, sink);
90 const char name[] = "Eina_File*";
91 std::copy(&name[0], &name[0] + sizeof(name) - 1, sink);
92 if(is_out)
93 *sink++ = '*';
94 return attributes::type_def::variant_type{};
95 }}
82 96
83 , {"ptrdiff", nullptr, [&] { return replace_base_type(regular, " ptrdiff_t"); }} 97 , {"ptrdiff", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " ptrdiff_t"); }}
84 , {"intptr", nullptr, [&] { return replace_base_type(regular, " intptr_t"); }} 98 , {"intptr", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " intptr_t"); }}
85 , {"string", true, [&] 99 , {"string", true, nullptr, nullptr, [&]
86 { 100 {
87 regular_type_def r = regular; 101 regular_type_def r = regular;
88 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 102 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
@@ -90,22 +104,23 @@ struct visitor_generate
90 return replace_base_type(r, " ::std::string"); 104 return replace_base_type(r, " ::std::string");
91 else return replace_base_type(r, " ::efl::eina::string_view"); 105 else return replace_base_type(r, " ::efl::eina::string_view");
92 }} 106 }}
93 , {"string", false, [&] 107 , {"string", false, nullptr, nullptr, [&]
94 { 108 {
95 regular_type_def r = regular; 109 regular_type_def r = regular;
96 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 110 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
97 return replace_base_type(r, " ::efl::eina::string_view"); 111 return replace_base_type(r, " ::efl::eina::string_view");
98 }} 112 }}
99 , {"stringshare", nullptr, [&] 113 , {"stringshare", nullptr, nullptr, nullptr, [&]
100 { 114 {
101 regular_type_def r = regular; 115 regular_type_def r = regular;
102 r.base_qualifier.qualifier ^= qualifier_info::is_ref; 116 r.base_qualifier.qualifier ^= qualifier_info::is_ref;
103 return replace_base_type(r, " ::efl::eina::stringshare"); 117 return replace_base_type(r, " ::efl::eina::stringshare");
104 }} 118 }}
105 , {"generic_value", true, [&] 119 , {"generic_value", true, nullptr, nullptr, [&]
106 { return regular_type_def{" ::efl::eina::value", regular.base_qualifier, {}}; 120 {
121 return regular_type_def{" ::efl::eina::value", regular.base_qualifier ^ qualifier_info::is_ref, {}};
107 }} 122 }}
108 , {"generic_value", false, [&] 123 , {"generic_value", false, nullptr, nullptr, [&]
109 { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier, {}}; 124 { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier, {}};
110 }} 125 }}
111 }; 126 };
@@ -127,11 +142,16 @@ struct visitor_generate
127 { 142 {
128 return (!m.name || *m.name == regular.base_type) 143 return (!m.name || *m.name == regular.base_type)
129 && (!m.has_own || *m.has_own == (bool)(regular.base_qualifier & qualifier_info::is_own)) 144 && (!m.has_own || *m.has_own == (bool)(regular.base_qualifier & qualifier_info::is_own))
145 && (!m.namespaces || *m.namespaces == regular.namespaces)
146 && (!m.is_ref || *m.is_ref == (bool)(regular.base_qualifier & qualifier_info::is_ref))
130 ; 147 ;
131 } 148 }
132 , [&] (attributes::type_def::variant_type const& v) 149 , [&] (attributes::type_def::variant_type const& v)
133 { 150 {
134 return v.visit(*this); // we want to keep is_out info 151 if(!v.empty())
152 return v.visit(*this); // we want to keep is_out info
153 else
154 return true;
135 })) 155 }))
136 { 156 {
137 return *b; 157 return *b;