eina-cxx: eolian-cxx: Fix correct usage of is_eolian_object traits

This commit is contained in:
Felipe Magno de Almeida 2016-11-03 17:59:20 -02:00
parent 4fa4be2b14
commit 137dd4864d
15 changed files with 154 additions and 113 deletions

View File

@ -165,7 +165,7 @@ template <typename T, typename Enable = T>
struct accessor; struct accessor;
template <typename T> template <typename T>
struct accessor<T, typename std::enable_if< ! std::is_base_of<::efl::eo::concrete, T>::value, T>::type> struct accessor<T, typename std::enable_if< ! ::efl::eo::is_eolian_object<T>::value, T>::type>
: accessor_common_base<T> : accessor_common_base<T>
{ {
typedef accessor_common_base<T> _base_type; typedef accessor_common_base<T> _base_type;
@ -277,7 +277,7 @@ struct accessor<T, typename std::enable_if< ! std::is_base_of<::efl::eo::concret
}; };
template <typename T> template <typename T>
struct accessor<T, typename std::enable_if<std::is_base_of<::efl::eo::concrete, T>::value, T>::type> struct accessor<T, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value, T>::type>
: accessor_common_base<T> : accessor_common_base<T>
{ {
typedef accessor_common_base<T> _base_type; typedef accessor_common_base<T> _base_type;
@ -419,7 +419,7 @@ struct accessor_iterator;
* Random access iterator for <tt>eina::accessor</tt>. * Random access iterator for <tt>eina::accessor</tt>.
*/ */
template <typename T> template <typename T>
struct accessor_iterator<T, typename std::enable_if< ! std::is_base_of<::efl::eo::concrete, T>::value, T>::type> struct accessor_iterator<T, typename std::enable_if< ! ::efl::eo::is_eolian_object<T>::value, T>::type>
{ {
typedef T value_type; /**< Type of the elements. */ typedef T value_type; /**< Type of the elements. */
typedef value_type* pointer; /**< Pointer to element type. */ typedef value_type* pointer; /**< Pointer to element type. */
@ -571,7 +571,7 @@ struct accessor_iterator<T, typename std::enable_if< ! std::is_base_of<::efl::eo
* Specialization for all data types that are not derivated from efl::eo::concrete. * Specialization for all data types that are not derivated from efl::eo::concrete.
*/ */
template <typename T> template <typename T>
struct accessor_iterator<T, typename std::enable_if<std::is_base_of<::efl::eo::concrete, T>::value, T>::type> struct accessor_iterator<T, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value, T>::type>
{ {
typedef T value_type; /**< Type of the elements. */ typedef T value_type; /**< Type of the elements. */
typedef value_type* pointer; /**< Pointer to element type. */ typedef value_type* pointer; /**< Pointer to element type. */

View File

@ -230,7 +230,7 @@ struct _eo_array_access_traits : _ptr_array_access_traits
}; };
template <typename T, typename CloneAllocator> template <typename T, typename CloneAllocator>
class array<T, CloneAllocator, typename std::enable_if<std::is_base_of<::efl::eo::concrete, T>::value>::type> class array<T, CloneAllocator, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value>::type>
: ptr_array<Eo, typename std::conditional : ptr_array<Eo, typename std::conditional
<std::is_same<CloneAllocator, default_clone_allocator_placeholder>::value <std::is_same<CloneAllocator, default_clone_allocator_placeholder>::value
, eo_clone_allocator, CloneAllocator>::type> , eo_clone_allocator, CloneAllocator>::type>
@ -497,7 +497,7 @@ public:
}; };
template <typename T> template <typename T>
class range_array<T, typename std::enable_if<std::is_base_of<::efl::eo::concrete, T>::value>::type> class range_array<T, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value>::type>
: range_ptr_array<Eo> : range_ptr_array<Eo>
{ {
typedef range_ptr_array<Eo> _base_type; typedef range_ptr_array<Eo> _base_type;

View File

@ -3,6 +3,8 @@
#include <eina_workarounds.hh> #include <eina_workarounds.hh>
#include <Eina.h>
namespace efl { namespace eina { namespace efl { namespace eina {
struct malloc_deleter struct malloc_deleter
@ -13,6 +15,10 @@ struct malloc_deleter
object->~T(); object->~T();
free(object); free(object);
} }
void operator()(Eina_Binbuf* /*object*/) const
{
// how to free binbuf?
}
}; };
template <typename T> template <typename T>

View File

@ -7,27 +7,11 @@
namespace efl { namespace eo { namespace efl { namespace eo {
struct concrete; struct concrete;
template <typename T>
struct is_eolian_object;
} } } }
namespace std {
template <>
struct is_base_of< ::efl::eo::concrete, ::Eo > : std::false_type {};
template <>
struct is_base_of< ::efl::eo::concrete, const ::Eo > : std::false_type {};
template <>
struct is_base_of< ::efl::eo::concrete, volatile ::Eo > : std::false_type {};
template <>
struct is_base_of< ::efl::eo::concrete, const volatile ::Eo > : std::false_type {};
template <>
struct is_base_of< const ::efl::eo::concrete, ::Eo > : std::false_type {};
template <>
struct is_base_of< const ::efl::eo::concrete, const ::Eo > : std::false_type {};
template <>
struct is_base_of< const ::efl::eo::concrete, volatile ::Eo > : std::false_type {};
template <>
struct is_base_of< const ::efl::eo::concrete, const volatile ::Eo > : std::false_type {};
}
#endif #endif

View File

@ -32,7 +32,7 @@ struct _common_iterator_base
private: private:
typedef _common_iterator_base<T> self_type; /**< Type for the iterator instantiation itself. */ typedef _common_iterator_base<T> self_type; /**< Type for the iterator instantiation itself. */
public: public:
typedef T const value_type; /**< Type for elements returned by the iterator. */ typedef typename std::remove_reference<T>::type const value_type; /**< Type for elements returned by the iterator. */
typedef value_type* pointer; /**< Type for a pointer to an element. */ typedef value_type* pointer; /**< Type for a pointer to an element. */
typedef value_type& reference; /**< Type for a reference to an element. */ typedef value_type& reference; /**< Type for a reference to an element. */
typedef std::ptrdiff_t difference_type; /**< Type to represent the distance between two iterators. */ typedef std::ptrdiff_t difference_type; /**< Type to represent the distance between two iterators. */
@ -148,7 +148,7 @@ protected:
*/ */
template <typename T, typename Enable = void> template <typename T, typename Enable = void>
struct iterator struct iterator
: _common_iterator_base<typename std::enable_if<!std::is_convertible<T*, ::efl::eo::concrete const* const>::value, T const>::type> : _common_iterator_base<typename std::enable_if<! ::efl::eo::is_eolian_object<T>::value, T const>::type>
{ {
private: private:
typedef _common_iterator_base<T const> base_type; /**< Type for the base class. */ typedef _common_iterator_base<T const> base_type; /**< Type for the base class. */
@ -225,7 +225,7 @@ public:
}; };
template <typename T> template <typename T>
struct iterator<T, typename std::enable_if<std::is_convertible<T*, ::efl::eo::concrete const* const>::value, void>::type> struct iterator<T, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value, void>::type>
: _common_iterator_base<Eo const> : _common_iterator_base<Eo const>
{ {
private: private:

View File

@ -230,7 +230,7 @@ public:
}; };
template <typename T, typename CloneAllocator> template <typename T, typename CloneAllocator>
class list<T, CloneAllocator, typename std::enable_if<std::is_base_of<::efl::eo::concrete, T>::value>::type> class list<T, CloneAllocator, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value>::type>
: ptr_list<Eo, typename std::conditional : ptr_list<Eo, typename std::conditional
<std::is_same<CloneAllocator, default_clone_allocator_placeholder>::value <std::is_same<CloneAllocator, default_clone_allocator_placeholder>::value
, eo_clone_allocator, CloneAllocator>::type> , eo_clone_allocator, CloneAllocator>::type>
@ -515,7 +515,7 @@ public:
}; };
template <typename T> template <typename T>
class range_list<T, typename std::enable_if<std::is_base_of<::efl::eo::concrete, T>::value>::type> class range_list<T, typename std::enable_if< ::efl::eo::is_eolian_object<T>::value>::type>
: range_ptr_list<typename std::conditional<std::is_const<T>::value, Eo const, Eo>::type> : range_ptr_list<typename std::conditional<std::is_const<T>::value, Eo const, Eo>::type>
{ {
typedef range_ptr_list<typename std::conditional<std::is_const<T>::value, Eo const, Eo>::type> _base_type; typedef range_ptr_list<typename std::conditional<std::is_const<T>::value, Eo const, Eo>::type> _base_type;

View File

@ -311,6 +311,7 @@ struct range_ptr_list : _range_template<T, _ptr_list_access_traits>
template <typename T, typename CloneAllocator> template <typename T, typename CloneAllocator>
struct _ptr_list_common_base struct _ptr_list_common_base
{ {
typedef typename remove_cv<typename std::remove_reference<T>::type>::type value_type;
typedef CloneAllocator clone_allocator_type; /**< Type for the clone allocator. */ typedef CloneAllocator clone_allocator_type; /**< Type for the clone allocator. */
/** /**
@ -363,7 +364,7 @@ struct _ptr_list_common_base
/** /**
* @internal * @internal
*/ */
void _delete_clone(T const* p) void _delete_clone(value_type const* p)
{ {
_get_clone_allocator().deallocate_clone(p); _get_clone_allocator().deallocate_clone(p);
} }
@ -371,7 +372,7 @@ struct _ptr_list_common_base
/** /**
* @internal * @internal
*/ */
T* _new_clone(typename container_value_type<T>::type const& a) value_type* _new_clone(typename container_value_type<T>::type const& a)
{ {
return _get_clone_allocator().allocate_clone(a); return _get_clone_allocator().allocate_clone(a);
} }
@ -420,8 +421,8 @@ public:
typedef value_type const& const_reference; /**< Type for a constant reference to an element. */ typedef value_type const& const_reference; /**< Type for a constant reference to an element. */
typedef _ptr_list_iterator<value_type const> const_iterator; /**< Type for a iterator for this container. */ typedef _ptr_list_iterator<value_type const> const_iterator; /**< Type for a iterator for this container. */
typedef _ptr_list_iterator<value_type> iterator; /**< Type for a constant iterator for this container. */ typedef _ptr_list_iterator<value_type> iterator; /**< Type for a constant iterator for this container. */
typedef T* pointer; /**< Type for a pointer to an element. */ typedef value_type* pointer; /**< Type for a pointer to an element. */
typedef T const* const_pointer; /**< Type for a constant pointer for an element. */ typedef value_type const* const_pointer; /**< Type for a constant pointer for an element. */
typedef std::size_t size_type; /**< Type for size information. */ typedef std::size_t size_type; /**< Type for size information. */
typedef std::ptrdiff_t difference_type; /**< Type to represent the distance between two iterators. */ typedef std::ptrdiff_t difference_type; /**< Type to represent the distance between two iterators. */
typedef CloneAllocator clone_allocator_type; /** Type for the clone allocator. */ typedef CloneAllocator clone_allocator_type; /** Type for the clone allocator. */

View File

@ -69,7 +69,7 @@ struct container_value_type
{ {
typedef typename std::conditional< typedef typename std::conditional<
std::is_void<T>::value std::is_void<T>::value
, T*, T>::type type; , std::add_pointer<T>, std::remove_reference<T>>::type::type type;
}; };
template <typename T> template <typename T>
@ -77,7 +77,7 @@ struct nonconst_container_value_type
{ {
typedef typename std::conditional< typedef typename std::conditional<
std::is_void<T>::value std::is_void<T>::value
, T*, typename std::remove_const<T>::type>::type type; , std::add_pointer<T>, std::remove_cv<typename std::remove_reference<T>::type>>::type::type type;
}; };
/** /**

View File

@ -10,62 +10,62 @@ struct _Elm_Calendar_Mark;
struct Elm_Gen_Item; struct Elm_Gen_Item;
struct _Elm_Map_Overlay; struct _Elm_Map_Overlay;
namespace std { // namespace std {
template <> // template <>
struct is_base_of< ::efl::eo::concrete, _Elm_Calendar_Mark > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, _Elm_Calendar_Mark > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, _Elm_Calendar_Mark const > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, _Elm_Calendar_Mark const > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, _Elm_Calendar_Mark volatile > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, _Elm_Calendar_Mark volatile > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, _Elm_Calendar_Mark const volatile > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, _Elm_Calendar_Mark const volatile > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, _Elm_Calendar_Mark > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, _Elm_Calendar_Mark > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, _Elm_Calendar_Mark const > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, _Elm_Calendar_Mark const > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, _Elm_Calendar_Mark volatile > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, _Elm_Calendar_Mark volatile > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, _Elm_Calendar_Mark const volatile > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, _Elm_Calendar_Mark const volatile > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, Elm_Gen_Item > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, Elm_Gen_Item > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, Elm_Gen_Item const > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, Elm_Gen_Item const > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, Elm_Gen_Item volatile > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, Elm_Gen_Item volatile > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, Elm_Gen_Item const volatile > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, Elm_Gen_Item const volatile > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, Elm_Gen_Item > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, Elm_Gen_Item > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, Elm_Gen_Item const > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, Elm_Gen_Item const > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, Elm_Gen_Item volatile > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, Elm_Gen_Item volatile > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, Elm_Gen_Item const volatile > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, Elm_Gen_Item const volatile > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, _Elm_Map_Overlay > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, _Elm_Map_Overlay > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, _Elm_Map_Overlay const > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, _Elm_Map_Overlay const > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, _Elm_Map_Overlay volatile > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, _Elm_Map_Overlay volatile > : std::false_type {};
template <> // template <>
struct is_base_of< ::efl::eo::concrete, _Elm_Map_Overlay const volatile > : std::false_type {}; // struct is_base_of< ::efl::eo::concrete, _Elm_Map_Overlay const volatile > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, _Elm_Map_Overlay > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, _Elm_Map_Overlay > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, _Elm_Map_Overlay const > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, _Elm_Map_Overlay const > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, _Elm_Map_Overlay volatile > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, _Elm_Map_Overlay volatile > : std::false_type {};
template <> // template <>
struct is_base_of< const ::efl::eo::concrete, _Elm_Map_Overlay const volatile > : std::false_type {}; // struct is_base_of< const ::efl::eo::concrete, _Elm_Map_Overlay const volatile > : std::false_type {};
} // }
#endif #endif

View File

@ -85,10 +85,15 @@ struct tag
}; };
template <typename T> template <typename T>
void assign_out_impl(T& lhs, T*& rhs, tag<T&, T*>) void assign_out_impl(T& lhs, T*& rhs, tag<T&, T*>, typename std::enable_if<!std::is_const<T>::value>::type* = 0)
{ {
lhs = *rhs; lhs = *rhs;
} }
template <typename T>
void assign_out_impl(T const& lhs, T const*& rhs, tag<T const&, T const*>)
{
const_cast<T&>(lhs) = *rhs;
}
inline void assign_out_impl(void*&, void*&, tag<void*, void*>) inline void assign_out_impl(void*&, void*&, tag<void*, void*>)
{ {
std::abort(); // out parameter of void type? std::abort(); // out parameter of void type?

View File

@ -13,6 +13,8 @@
#include <Eina.hh> #include <Eina.hh>
#include "eo_concrete.hh"
#include <vector> #include <vector>
#include <memory> #include <memory>
#include <set> #include <set>
@ -251,6 +253,8 @@ inline void type_def::set(Eolian_Type const* eolian_type)
break; break;
case EOLIAN_TYPE_REGULAR: case EOLIAN_TYPE_REGULAR:
{ {
if(c_type == "va_list *")
throw std::runtime_error("");
std::vector<std::string> namespaces; std::vector<std::string> namespaces;
for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type)) for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type))
, namespace_last; namespace_iterator != namespace_last; ++namespace_iterator) , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator)

View File

@ -56,33 +56,47 @@ struct visitor_generate
{ {
eina::optional<std::string> name; eina::optional<std::string> name;
eina::optional<bool> has_own; eina::optional<bool> has_own;
eina::optional<bool> is_ref;
eina::optional<std::vector<std::string>> namespaces;
std::function<attributes::type_def::variant_type()> function; std::function<attributes::type_def::variant_type()> function;
} }
const match_table[] = const match_table[] =
{ {
// signed primitives // signed primitives
{"byte", nullptr, [&] { return replace_base_type(regular, " char"); }} {"byte", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " char"); }}
, {"llong", nullptr, [&] { return replace_base_type(regular, " long long"); }} , {"llong", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " long long"); }}
, {"int8", nullptr, [&] { return replace_base_type(regular, " int8_t"); }} , {"int8", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " int8_t"); }}
, {"int16", nullptr, [&] { return replace_base_type(regular, " int16_t"); }} , {"int16", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " int16_t"); }}
, {"int32", nullptr, [&] { return replace_base_type(regular, " int32_t"); }} , {"int32", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " int32_t"); }}
, {"int64", nullptr, [&] { return replace_base_type(regular, " int64_t"); }} , {"int64", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " int64_t"); }}
, {"ssize", nullptr, [&] { return replace_base_type(regular, " ssize_t"); }} , {"ssize", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " ssize_t"); }}
// unsigned primitives // unsigned primitives
, {"ubyte", nullptr, [&] { return replace_base_type(regular, " unsigned char"); }} , {"ubyte", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned char"); }}
, {"ushort", nullptr, [&] { return replace_base_type(regular, " unsigned short"); }} , {"ushort", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned short"); }}
, {"uint", nullptr, [&] { return replace_base_type(regular, " unsigned int"); }} , {"uint", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned int"); }}
, {"ulong", nullptr, [&] { return replace_base_type(regular, " unsigned long"); }} , {"ulong", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned long"); }}
, {"ullong", nullptr, [&] { return replace_base_type(regular, " unsigned long long"); }} , {"ullong", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " unsigned long long"); }}
, {"uint8", nullptr, [&] { return replace_base_type(regular, " uint8_t"); }} , {"uint8", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " uint8_t"); }}
, {"uint16", nullptr, [&] { return replace_base_type(regular, " uint16_t"); }} , {"uint16", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " uint16_t"); }}
, {"uint32", nullptr, [&] { return replace_base_type(regular, " uint32_t"); }} , {"uint32", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " uint32_t"); }}
, {"uint64", nullptr, [&] { return replace_base_type(regular, " uint64_t"); }} , {"uint64", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " uint64_t"); }}
, {"size", nullptr, [&] { return replace_base_type(regular, " size_t"); }} , {"size", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " size_t"); }}
, {"size", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " size_t"); }}
, {"File", nullptr, nullptr, {{"Eina"}}, [&]
{
const char const_[] = "const ";
if(regular.base_qualifier.qualifier & qualifier_info::is_const)
std::copy(&const_[0], &const_[0] + sizeof(const_) - 1, sink);
const char name[] = "Eina_File*";
std::copy(&name[0], &name[0] + sizeof(name) - 1, sink);
if(is_out)
*sink++ = '*';
return attributes::type_def::variant_type{};
}}
, {"ptrdiff", nullptr, [&] { return replace_base_type(regular, " ptrdiff_t"); }} , {"ptrdiff", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " ptrdiff_t"); }}
, {"intptr", nullptr, [&] { return replace_base_type(regular, " intptr_t"); }} , {"intptr", nullptr, nullptr, nullptr, [&] { return replace_base_type(regular, " intptr_t"); }}
, {"string", true, [&] , {"string", true, nullptr, nullptr, [&]
{ {
regular_type_def r = regular; regular_type_def r = regular;
r.base_qualifier.qualifier ^= qualifier_info::is_ref; r.base_qualifier.qualifier ^= qualifier_info::is_ref;
@ -90,22 +104,23 @@ struct visitor_generate
return replace_base_type(r, " ::std::string"); return replace_base_type(r, " ::std::string");
else return replace_base_type(r, " ::efl::eina::string_view"); else return replace_base_type(r, " ::efl::eina::string_view");
}} }}
, {"string", false, [&] , {"string", false, nullptr, nullptr, [&]
{ {
regular_type_def r = regular; regular_type_def r = regular;
r.base_qualifier.qualifier ^= qualifier_info::is_ref; r.base_qualifier.qualifier ^= qualifier_info::is_ref;
return replace_base_type(r, " ::efl::eina::string_view"); return replace_base_type(r, " ::efl::eina::string_view");
}} }}
, {"stringshare", nullptr, [&] , {"stringshare", nullptr, nullptr, nullptr, [&]
{ {
regular_type_def r = regular; regular_type_def r = regular;
r.base_qualifier.qualifier ^= qualifier_info::is_ref; r.base_qualifier.qualifier ^= qualifier_info::is_ref;
return replace_base_type(r, " ::efl::eina::stringshare"); return replace_base_type(r, " ::efl::eina::stringshare");
}} }}
, {"generic_value", true, [&] , {"generic_value", true, nullptr, nullptr, [&]
{ return regular_type_def{" ::efl::eina::value", regular.base_qualifier, {}}; {
return regular_type_def{" ::efl::eina::value", regular.base_qualifier ^ qualifier_info::is_ref, {}};
}} }}
, {"generic_value", false, [&] , {"generic_value", false, nullptr, nullptr, [&]
{ return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier, {}}; { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier, {}};
}} }}
}; };
@ -127,11 +142,16 @@ struct visitor_generate
{ {
return (!m.name || *m.name == regular.base_type) return (!m.name || *m.name == regular.base_type)
&& (!m.has_own || *m.has_own == (bool)(regular.base_qualifier & qualifier_info::is_own)) && (!m.has_own || *m.has_own == (bool)(regular.base_qualifier & qualifier_info::is_own))
&& (!m.namespaces || *m.namespaces == regular.namespaces)
&& (!m.is_ref || *m.is_ref == (bool)(regular.base_qualifier & qualifier_info::is_ref))
; ;
} }
, [&] (attributes::type_def::variant_type const& v) , [&] (attributes::type_def::variant_type const& v)
{ {
return v.visit(*this); // we want to keep is_out info if(!v.empty())
return v.visit(*this); // we want to keep is_out info
else
return true;
})) }))
{ {
return *b; return *b;

View File

@ -17,6 +17,13 @@ struct wrapper : efl::eo::concrete
: concrete(o) {} : concrete(o) {}
}; };
namespace efl { namespace eo {
template <>
struct is_eolian_object< ::wrapper> : std::true_type {};
} }
START_TEST(eina_cxx_accessor_indexing) START_TEST(eina_cxx_accessor_indexing)
{ {
efl::eina::eina_init eina_init; efl::eina::eina_init eina_init;

View File

@ -18,6 +18,13 @@ struct wrapper : efl::eo::concrete
: concrete(o) {} : concrete(o) {}
}; };
namespace efl { namespace eo {
template <>
struct is_eolian_object< ::wrapper> : std::true_type {};
} }
START_TEST(eina_cxx_ptrarray_push_back) START_TEST(eina_cxx_ptrarray_push_back)
{ {
efl::eina::eina_init eina_init; efl::eina::eina_init eina_init;

View File

@ -20,6 +20,13 @@ struct wrapper : efl::eo::concrete
: concrete(o) {} : concrete(o) {}
}; };
namespace efl { namespace eo {
template <>
struct is_eolian_object< ::wrapper> : std::true_type {};
} }
START_TEST(eina_cxx_ptrlist_push_back) START_TEST(eina_cxx_ptrlist_push_back)
{ {
efl::eina::eina_init eina_init; efl::eina::eina_init eina_init;