forked from enlightenment/efl
cxx: Fix uses of intrinsic eolian binbuf type
Add special binbuf and Eina_Strbuf conversions Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11950
This commit is contained in:
parent
dade4fc2f7
commit
15acb0586a
|
@ -53,6 +53,10 @@ template <>
|
||||||
struct in_traits<efl::eina::strbuf> { typedef efl::eina::strbuf type; };
|
struct in_traits<efl::eina::strbuf> { typedef efl::eina::strbuf type; };
|
||||||
template <>
|
template <>
|
||||||
struct in_traits<efl::eina::strbuf const> { typedef efl::eina::strbuf const type; };
|
struct in_traits<efl::eina::strbuf const> { typedef efl::eina::strbuf const type; };
|
||||||
|
template <>
|
||||||
|
struct in_traits<efl::eina::strbuf_view> { typedef efl::eina::strbuf_view type; };
|
||||||
|
template <>
|
||||||
|
struct in_traits<efl::eina::strbuf_view const> { typedef efl::eina::strbuf_view const type; };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct in_traits<T&> { typedef T& type; };
|
struct in_traits<T&> { typedef T& type; };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -550,10 +554,22 @@ inline const char* convert_to_c_impl(efl::eina::stringshare x, tag<const char*,
|
||||||
{
|
{
|
||||||
return eina_stringshare_ref(x.c_str());
|
return eina_stringshare_ref(x.c_str());
|
||||||
}
|
}
|
||||||
|
inline Eina_Strbuf const* convert_to_c_impl(efl::eina::strbuf& x, tag<Eina_Strbuf const*, efl::eina::strbuf, false>)
|
||||||
|
{
|
||||||
|
return x.native_handle();
|
||||||
|
}
|
||||||
inline Eina_Strbuf* convert_to_c_impl(efl::eina::strbuf& x, tag<Eina_Strbuf*, efl::eina::strbuf, false>)
|
inline Eina_Strbuf* convert_to_c_impl(efl::eina::strbuf& x, tag<Eina_Strbuf*, efl::eina::strbuf, false>)
|
||||||
{
|
{
|
||||||
return x.native_handle();
|
return x.native_handle();
|
||||||
}
|
}
|
||||||
|
inline Eina_Strbuf const* convert_to_c_impl(efl::eina::strbuf_view const& x, tag<Eina_Strbuf const*, efl::eina::strbuf_view, false>)
|
||||||
|
{
|
||||||
|
return x.native_handle();
|
||||||
|
}
|
||||||
|
inline Eina_Strbuf* convert_to_c_impl(efl::eina::strbuf_view const& x, tag<Eina_Strbuf*, efl::eina::strbuf_view, false>)
|
||||||
|
{
|
||||||
|
return const_cast<Eina_Strbuf*>(x.native_handle());
|
||||||
|
}
|
||||||
template <typename T, typename U, typename Deleter>
|
template <typename T, typename U, typename Deleter>
|
||||||
T* convert_to_c_impl(std::unique_ptr<U, Deleter>& v, tag<T*, std::unique_ptr<U, Deleter>>)
|
T* convert_to_c_impl(std::unique_ptr<U, Deleter>& v, tag<T*, std::unique_ptr<U, Deleter>>)
|
||||||
{
|
{
|
||||||
|
@ -732,6 +748,19 @@ T convert_to_return(U* value, tag<T, U*>, typename std::enable_if<is_range<T>::v
|
||||||
// const should be to the type if value is const
|
// const should be to the type if value is const
|
||||||
return T{const_cast<typename std::remove_const<U>::type*>(value)};
|
return T{const_cast<typename std::remove_const<U>::type*>(value)};
|
||||||
}
|
}
|
||||||
|
inline eina::strbuf convert_to_return(Eina_Strbuf* value, tag<Eina_Strbuf*, efl::eina::strbuf>)
|
||||||
|
{
|
||||||
|
eina::strbuf_wrapper t{value};
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
inline eina::strbuf_view convert_to_return(Eina_Strbuf* value, tag<Eina_Strbuf*, efl::eina::strbuf_view>)
|
||||||
|
{
|
||||||
|
return {value};
|
||||||
|
}
|
||||||
|
inline eina::strbuf_view convert_to_return(Eina_Strbuf const* value, tag<Eina_Strbuf const*, efl::eina::strbuf_view>)
|
||||||
|
{
|
||||||
|
return {value};
|
||||||
|
}
|
||||||
inline eina::stringshare convert_to_return(const Eina_Stringshare* value, tag<const char*, efl::eina::stringshare>)
|
inline eina::stringshare convert_to_return(const Eina_Stringshare* value, tag<const char*, efl::eina::stringshare>)
|
||||||
{
|
{
|
||||||
return efl::eina::stringshare(value);
|
return efl::eina::stringshare(value);
|
||||||
|
|
|
@ -174,10 +174,10 @@ struct visitor_generate
|
||||||
if (r.base_qualifier.qualifier & qualifier_info::is_const)
|
if (r.base_qualifier.qualifier & qualifier_info::is_const)
|
||||||
{
|
{
|
||||||
r.base_qualifier.qualifier ^= qualifier_info::is_const;
|
r.base_qualifier.qualifier ^= qualifier_info::is_const;
|
||||||
return replace_base_type(r, " Eina_Binbuf*");
|
return replace_base_type(r, " ::efl::eina::strbuf");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return replace_base_type(r, " Eina_Binbuf const*");
|
return replace_base_type(r, " ::efl::eina::strbuf_view");
|
||||||
}}
|
}}
|
||||||
/* FIXME: handle any_value_ref */
|
/* FIXME: handle any_value_ref */
|
||||||
, {"any_value", true, nullptr, nullptr, [&]
|
, {"any_value", true, nullptr, nullptr, [&]
|
||||||
|
|
Loading…
Reference in New Issue