summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertise.dev>2020-06-08 18:05:49 -0300
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-06-09 10:29:32 +0200
commit15acb0586a3e8e6a17d074e1e0142403752aa41b (patch)
treeecbf82b71569ff4572629abfc9e3ac64b15890d9 /src/bindings
parentdade4fc2f7a75c1f54a4903c3bb9c4c5690f6fa9 (diff)
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
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/cxx/eo_cxx/eo_cxx_interop.hh29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
index 633d377b0b..3f4521fe66 100644
--- a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
+++ b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh
@@ -53,6 +53,10 @@ template <>
53struct in_traits<efl::eina::strbuf> { typedef efl::eina::strbuf type; }; 53struct in_traits<efl::eina::strbuf> { typedef efl::eina::strbuf type; };
54template <> 54template <>
55struct in_traits<efl::eina::strbuf const> { typedef efl::eina::strbuf const type; }; 55struct in_traits<efl::eina::strbuf const> { typedef efl::eina::strbuf const type; };
56template <>
57struct in_traits<efl::eina::strbuf_view> { typedef efl::eina::strbuf_view type; };
58template <>
59struct in_traits<efl::eina::strbuf_view const> { typedef efl::eina::strbuf_view const type; };
56template <typename T> 60template <typename T>
57struct in_traits<T&> { typedef T& type; }; 61struct in_traits<T&> { typedef T& type; };
58template <typename T> 62template <typename T>
@@ -550,10 +554,22 @@ inline const char* convert_to_c_impl(efl::eina::stringshare x, tag<const char*,
550{ 554{
551 return eina_stringshare_ref(x.c_str()); 555 return eina_stringshare_ref(x.c_str());
552} 556}
557inline Eina_Strbuf const* convert_to_c_impl(efl::eina::strbuf& x, tag<Eina_Strbuf const*, efl::eina::strbuf, false>)
558{
559 return x.native_handle();
560}
553inline Eina_Strbuf* convert_to_c_impl(efl::eina::strbuf& x, tag<Eina_Strbuf*, efl::eina::strbuf, false>) 561inline Eina_Strbuf* convert_to_c_impl(efl::eina::strbuf& x, tag<Eina_Strbuf*, efl::eina::strbuf, false>)
554{ 562{
555 return x.native_handle(); 563 return x.native_handle();
556} 564}
565inline Eina_Strbuf const* convert_to_c_impl(efl::eina::strbuf_view const& x, tag<Eina_Strbuf const*, efl::eina::strbuf_view, false>)
566{
567 return x.native_handle();
568}
569inline Eina_Strbuf* convert_to_c_impl(efl::eina::strbuf_view const& x, tag<Eina_Strbuf*, efl::eina::strbuf_view, false>)
570{
571 return const_cast<Eina_Strbuf*>(x.native_handle());
572}
557template <typename T, typename U, typename Deleter> 573template <typename T, typename U, typename Deleter>
558T* convert_to_c_impl(std::unique_ptr<U, Deleter>& v, tag<T*, std::unique_ptr<U, Deleter>>) 574T* convert_to_c_impl(std::unique_ptr<U, Deleter>& v, tag<T*, std::unique_ptr<U, Deleter>>)
559{ 575{
@@ -732,6 +748,19 @@ T convert_to_return(U* value, tag<T, U*>, typename std::enable_if<is_range<T>::v
732 // const should be to the type if value is const 748 // const should be to the type if value is const
733 return T{const_cast<typename std::remove_const<U>::type*>(value)}; 749 return T{const_cast<typename std::remove_const<U>::type*>(value)};
734} 750}
751inline eina::strbuf convert_to_return(Eina_Strbuf* value, tag<Eina_Strbuf*, efl::eina::strbuf>)
752{
753 eina::strbuf_wrapper t{value};
754 return t;
755}
756inline eina::strbuf_view convert_to_return(Eina_Strbuf* value, tag<Eina_Strbuf*, efl::eina::strbuf_view>)
757{
758 return {value};
759}
760inline eina::strbuf_view convert_to_return(Eina_Strbuf const* value, tag<Eina_Strbuf const*, efl::eina::strbuf_view>)
761{
762 return {value};
763}
735inline eina::stringshare convert_to_return(const Eina_Stringshare* value, tag<const char*, efl::eina::stringshare>) 764inline eina::stringshare convert_to_return(const Eina_Stringshare* value, tag<const char*, efl::eina::stringshare>)
736{ 765{
737 return efl::eina::stringshare(value); 766 return efl::eina::stringshare(value);