forked from enlightenment/efl
eolian-cxx: Fix C++ generation errors with handle opaque types
This commit is contained in:
parent
81d01cfbd0
commit
0fcee227aa
|
@ -84,6 +84,11 @@ struct tag
|
|||
typedef std::integral_constant<bool, Own> own;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void assign_out_impl(T*& lhs, T* rhs, tag<T*, T*>)
|
||||
{
|
||||
lhs = rhs;
|
||||
}
|
||||
template <typename T>
|
||||
void assign_out_impl(T& lhs, T*& rhs, tag<T&, T*>, typename std::enable_if<!std::is_const<T>::value>::type* = 0)
|
||||
{
|
||||
|
@ -535,6 +540,11 @@ Eina_Array** convert_to_c_impl(efl::eina::range_array<T>& /*c*/, tag<Eina_Array
|
|||
{
|
||||
std::abort();
|
||||
}
|
||||
template <typename T>
|
||||
T* convert_to_c_impl(T const* p, tag<T*, T const*>) // needed for property_get
|
||||
{
|
||||
return const_cast<T*>(p);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename U, bool Own, typename V>
|
||||
|
|
|
@ -52,6 +52,9 @@ extern "C" {
|
|||
*/
|
||||
typedef struct tm Efl_Time;
|
||||
|
||||
typedef struct _Efl_Text_Cursor_Cursor_Data Efl_Text_Cursor_Cursor_Data;
|
||||
typedef struct _Efl_Canvas_Text_Annotation Efl_Canvas_Text_Annotation;
|
||||
|
||||
#ifdef EFL_BETA_API_SUPPORT
|
||||
|
||||
#include "interfaces/efl_types.eot.h"
|
||||
|
|
|
@ -20,9 +20,9 @@ enum Efl.Text.Cursor.Cursor_Get_Type {
|
|||
user_extra [[User extra cursor state]]
|
||||
}
|
||||
|
||||
struct Efl.Canvas.Text.Annotation; [[EFL text annotations data structure]]
|
||||
type @extern Efl.Canvas.Text.Annotation: __undefined_type; [[EFL text annotations data structure]]
|
||||
|
||||
struct Efl.Text.Cursor.Cursor_Data; [[Text cursor data structure]]
|
||||
type @extern Efl.Text.Cursor.Cursor_Data: __undefined_type; [[Text cursor data structure]]
|
||||
|
||||
enum Efl.Text.Cursor.Cursor_Type
|
||||
{
|
||||
|
|
|
@ -174,6 +174,7 @@ struct regular_type_def
|
|||
std::string base_type;
|
||||
qualifier_def base_qualifier;
|
||||
std::vector<std::string> namespaces;
|
||||
bool is_undefined = false;
|
||||
};
|
||||
|
||||
inline bool operator==(regular_type_def const& rhs, regular_type_def const& lhs)
|
||||
|
@ -253,13 +254,24 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
|
|||
break;
|
||||
case EOLIAN_TYPE_REGULAR:
|
||||
{
|
||||
bool is_undefined = false;
|
||||
Eolian_Typedecl const* decl = eolian_type_typedecl_get(eolian_type);
|
||||
if(decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_ALIAS)
|
||||
{
|
||||
Eolian_Type const* aliased = eolian_typedecl_base_type_get(decl);
|
||||
if(aliased && eolian_type_type_get(aliased) == EOLIAN_TYPE_UNDEFINED)
|
||||
{
|
||||
is_undefined = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(c_type == "va_list *")
|
||||
throw std::runtime_error("");
|
||||
std::vector<std::string> namespaces;
|
||||
for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type))
|
||||
, namespace_last; namespace_iterator != namespace_last; ++namespace_iterator)
|
||||
namespaces.push_back(&*namespace_iterator);
|
||||
original_type = {regular_type_def{ ::eolian_type_name_get(eolian_type), {qualifiers(eolian_type), {}}, namespaces}};
|
||||
original_type = {regular_type_def{ ::eolian_type_name_get(eolian_type), {qualifiers(eolian_type), {}}, namespaces, is_undefined}};
|
||||
}
|
||||
break;
|
||||
case EOLIAN_TYPE_CLASS:
|
||||
|
|
|
@ -132,7 +132,7 @@ struct visitor_generate
|
|||
(
|
||||
lit("void") << (regular.base_qualifier & qualifier_info::is_const ? " const" : "")
|
||||
<< "*"
|
||||
<< (is_out ? "&" : "")
|
||||
<< (is_out ? "*" : "")
|
||||
)
|
||||
.generate(sink, attributes::unused, *context);
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ struct visitor_generate
|
|||
|| (regular.base_qualifier & qualifier_info::is_ref
|
||||
&& !is_return && !is_out)
|
||||
? " const" : "")
|
||||
<< (regular.base_qualifier & qualifier_info::is_ref? "&" : "")
|
||||
<< (regular.base_qualifier & qualifier_info::is_ref ? (regular.is_undefined ? "*" : "&") : "")
|
||||
)
|
||||
.generate(sink, std::make_tuple(regular.namespaces, regular.base_type), *context))
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue