diff options
Diffstat (limited to 'src/bindings/eina_cxx/eina_ptrlist.hh')
-rw-r--r-- | src/bindings/eina_cxx/eina_ptrlist.hh | 79 |
1 files changed, 45 insertions, 34 deletions
diff --git a/src/bindings/eina_cxx/eina_ptrlist.hh b/src/bindings/eina_cxx/eina_ptrlist.hh index 2f18d10ffb..f7254b1ef2 100644 --- a/src/bindings/eina_cxx/eina_ptrlist.hh +++ b/src/bindings/eina_cxx/eina_ptrlist.hh @@ -9,6 +9,7 @@ #include <eina_eo_concrete_fwd.hh> #include <eina_iterator.hh> #include <eina_throw.hh> +#include <eina_range_types.hh> #include <memory> #include <iterator> @@ -370,7 +371,7 @@ struct _ptr_list_common_base /** * @internal */ - T* _new_clone(T const& a) + T* _new_clone(typename container_value_type<T>::type const& a) { return _get_clone_allocator().allocate_clone(a); } @@ -413,11 +414,12 @@ class ptr_list : protected _ptr_list_common_base<T, CloneAllocator> { typedef _ptr_list_common_base<T, CloneAllocator> _base_type; /**< Type for the base class. */ public: - typedef T value_type; /**< The type of each element. */ - typedef T& reference; /**< Type for a reference to an element. */ - typedef T const& const_reference; /**< Type for a constant reference to an element. */ - typedef _ptr_list_iterator<T const> const_iterator; /**< Type for a iterator for this container. */ - typedef _ptr_list_iterator<T> iterator; /**< Type for a constant iterator for this container. */ + typedef typename container_value_type<T>::type + value_type; /**< The type of each element. */ + typedef value_type& reference; /**< Type for a 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> iterator; /**< Type for a constant iterator for this container. */ typedef T* pointer; /**< Type for a pointer to an element. */ typedef T const* const_pointer; /**< Type for a constant pointer for an element. */ typedef std::size_t size_type; /**< Type for size information. */ @@ -427,6 +429,8 @@ public: typedef std::reverse_iterator<iterator> reverse_iterator; /**< Type for reverse iterator for this container. */ typedef std::reverse_iterator<const_iterator> const_reverse_iterator; /**< Type for reverse iterator for this container. */ + typedef Eina_List* native_handle_type; + typedef std::unique_ptr<value_type, clone_allocator_deleter<clone_allocator_type> > _unique_ptr; /** @@ -554,7 +558,7 @@ public: */ std::size_t size() const { - return _ptr_list_access_traits::size<T>(this->_impl._list); + return _ptr_list_access_traits::size<value_type>(this->_impl._list); } /** @@ -566,7 +570,7 @@ public: */ bool empty() const { - return _ptr_list_access_traits::empty<T>(this->_impl._list); + return _ptr_list_access_traits::empty<value_type>(this->_impl._list); } /** @@ -940,7 +944,7 @@ public: */ value_type& back() { - return _ptr_list_access_traits::back<T>(this->_impl._list); + return _ptr_list_access_traits::back<value_type>(this->_impl._list); } /** @@ -952,7 +956,7 @@ public: */ value_type const& back() const { - return _ptr_list_access_traits::back<T>(this->_impl._list); + return _ptr_list_access_traits::back<value_type>(this->_impl._list); } /** @@ -961,7 +965,7 @@ public: */ value_type& front() { - return _ptr_list_access_traits::front<T>(this->_impl._list); + return _ptr_list_access_traits::front<value_type>(this->_impl._list); } /** @@ -973,7 +977,7 @@ public: */ value_type const& front() const { - return _ptr_list_access_traits::front<T>(this->_impl._list); + return _ptr_list_access_traits::front<value_type>(this->_impl._list); } /** @@ -985,7 +989,7 @@ public: */ const_iterator begin() const { - return _ptr_list_access_traits::cbegin<T>(this->_impl._list); + return _ptr_list_access_traits::cbegin<value_type>(this->_impl._list); } /** @@ -997,7 +1001,7 @@ public: */ const_iterator end() const { - return _ptr_list_access_traits::cend<T>(this->_impl._list); + return _ptr_list_access_traits::cend<value_type>(this->_impl._list); } /** @@ -1010,7 +1014,7 @@ public: */ iterator begin() { - return _ptr_list_access_traits::begin<T>(this->_impl._list); + return _ptr_list_access_traits::begin<value_type>(this->_impl._list); } /** @@ -1026,7 +1030,7 @@ public: */ iterator end() { - return _ptr_list_access_traits::end<T>(this->_impl._list); + return _ptr_list_access_traits::end<value_type>(this->_impl._list); } /** @@ -1038,7 +1042,7 @@ public: */ const_reverse_iterator rbegin() const { - return _ptr_list_access_traits::rbegin<T>(this->_impl._list); + return _ptr_list_access_traits::rbegin<value_type>(this->_impl._list); } /** @@ -1050,7 +1054,7 @@ public: */ const_reverse_iterator rend() const { - return _ptr_list_access_traits::rend<T>(this->_impl._list); + return _ptr_list_access_traits::rend<value_type>(this->_impl._list); } /** @@ -1063,7 +1067,7 @@ public: */ reverse_iterator rbegin() { - return _ptr_list_access_traits::rbegin<T>(this->_impl._list); + return _ptr_list_access_traits::rbegin<value_type>(this->_impl._list); } /** @@ -1080,7 +1084,7 @@ public: */ reverse_iterator rend() { - return _ptr_list_access_traits::rend<T>(this->_impl._list); + return _ptr_list_access_traits::rend<value_type>(this->_impl._list); } /** @@ -1093,7 +1097,7 @@ public: */ const_iterator cbegin() const { - return _ptr_list_access_traits::cbegin<T>(this->_impl._list); + return _ptr_list_access_traits::cbegin<value_type>(this->_impl._list); } /** @@ -1106,7 +1110,7 @@ public: */ const_iterator cend() const { - return _ptr_list_access_traits::cend<T>(this->_impl._list); + return _ptr_list_access_traits::cend<value_type>(this->_impl._list); } /** @@ -1119,7 +1123,7 @@ public: */ const_reverse_iterator crbegin() const { - return _ptr_list_access_traits::crbegin<T>(this->_impl._list); + return _ptr_list_access_traits::crbegin<value_type>(this->_impl._list); } /** @@ -1132,7 +1136,7 @@ public: */ const_reverse_iterator crend() const { - return _ptr_list_access_traits::crend<T>(this->_impl._list); + return _ptr_list_access_traits::crend<value_type>(this->_impl._list); } /** @@ -1143,9 +1147,9 @@ public: * the first element of the list. If the list is empty the returned * iterator is the same as the one returned by @ref iend(). */ - eina::iterator<T> ibegin() + eina::iterator<value_type> ibegin() { - return _ptr_list_access_traits::ibegin<T>(this->_impl._list); + return _ptr_list_access_traits::ibegin<value_type>(this->_impl._list); } /** @@ -1160,9 +1164,9 @@ public: * @note Note that attempting to access this position causes undefined * behavior. */ - eina::iterator<T> iend() + eina::iterator<value_type> iend() { - return _ptr_list_access_traits::iend<T>(this->_impl._list); + return _ptr_list_access_traits::iend<value_type>(this->_impl._list); } /** @@ -1174,7 +1178,7 @@ public: */ eina::iterator<T const> ibegin() const { - return _ptr_list_access_traits::ibegin<T>(this->_impl._list); + return _ptr_list_access_traits::ibegin<value_type>(this->_impl._list); } /** @@ -1186,7 +1190,7 @@ public: */ eina::iterator<T const> iend() const { - return _ptr_list_access_traits::iend<T>(this->_impl._list); + return _ptr_list_access_traits::iend<value_type>(this->_impl._list); } /** @@ -1199,7 +1203,7 @@ public: */ eina::iterator<T const> cibegin() const { - return _ptr_list_access_traits::cibegin<T>(this->_impl._list); + return _ptr_list_access_traits::cibegin<value_type>(this->_impl._list); } /** @@ -1212,7 +1216,7 @@ public: */ eina::iterator<T const> ciend() const { - return _ptr_list_access_traits::ciend<T>(this->_impl._list); + return _ptr_list_access_traits::ciend<value_type>(this->_impl._list); } /** @@ -1230,6 +1234,13 @@ public: */ size_type max_size() const { return -1; } + Eina_List* release_native_handle() + { + Eina_List* tmp = this->_impl._list; + this->_impl._list = 0; + return tmp; + } + /** * @brief Get a handle for the wrapped @c Eina_List. * @return Handle for the native Eina list. @@ -1275,9 +1286,9 @@ public: * @brief Get a @ref eina::accessor for the list. * @return <tt>eina::accessor</tt> to the list. */ - eina::accessor<T> accessor() + eina::accessor<value_type> accessor() { - return eina::accessor<T>(eina_list_accessor_new(this->_impl._list)); + return eina::accessor<value_type>(eina_list_accessor_new(this->_impl._list)); } }; |