19 #ifndef BOOST_PYTHON_INDEXING_INT_SLICE_HELPER_HPP 20 #define BOOST_PYTHON_INDEXING_INT_SLICE_HELPER_HPP 22 # include <boost/python/errors.hpp> 23 # include <indexing_suite/workaround.hpp> 25 namespace boost {
namespace python {
namespace indexing {
26 template<
typename Algorithms,
typename SliceType>
32 typedef Algorithms algorithms_type;
33 typedef SliceType slice_type;
35 typedef typename algorithms_type::container container;
36 typedef typename algorithms_type::reference reference;
37 typedef typename algorithms_type::value_param value_param;
38 typedef typename algorithms_type::container_traits container_traits;
39 typedef typename slice_type::index_type index_type;
45 reference current ()
const;
46 void write (value_param val);
47 void erase_remaining ()
const;
50 void assign (value_param val)
const;
51 void insert (value_param val);
59 template<
typename Algorithms,
typename SliceType>
68 template<
typename Algorithms,
typename SliceType>
77 m_pos = m_slice.start();
78 result = m_slice.in_range (m_pos);
81 else if (m_slice.in_range (m_pos))
84 m_pos += m_slice.step();
85 result = m_slice.in_range (m_pos);
91 template<
typename Algorithms,
typename SliceType>
92 typename int_slice_helper<Algorithms, SliceType>::reference
95 return algorithms_type::get (*m_ptr, m_pos);
98 template<
typename Algorithms,
typename SliceType>
112 template<
typename Algorithms,
typename SliceType>
115 algorithms_type::assign (*m_ptr, m_pos, val);
125 template<
class Algorithms>
127 #
if defined (BOOST_NO_MEMBER_TEMPLATES) && defined (BOOST_MSVC6_MEMBER_TEMPLATES)
133 typename Algorithms::container &,
134 typename Algorithms::index_param,
135 typename Algorithms::value_param)
139 "container does not support insertion into slice");
141 boost::python::throw_error_already_set ();
146 template<
class Algorithms>
148 #
if defined (BOOST_NO_MEMBER_TEMPLATES) && defined (BOOST_MSVC6_MEMBER_TEMPLATES)
151 typename Algorithms::container &c,
152 typename Algorithms::index_param i,
153 typename Algorithms::value_param v)
155 Algorithms::insert (c, i, v);
160 template<
typename Algorithms,
typename SliceType>
163 if (m_slice.step() != 1)
166 PyExc_ValueError,
"attempt to insert via extended slice");
168 boost::python::throw_error_already_set ();
175 container_traits::supported_methods, method_insert>::value>::
176 # if defined (BOOST_NO_MEMBER_TEMPLATES) && defined (BOOST_MSVC6_MEMBER_TEMPLATES) 177 apply_ (static_cast<Algorithms *>(0),
179 BOOST_NESTED_TEMPLATE apply_ <Algorithms>(
189 template<
class Algorithms>
191 #
if defined (BOOST_NO_MEMBER_TEMPLATES) && defined (BOOST_MSVC6_MEMBER_TEMPLATES)
194 typename Algorithms::container &,
195 typename Algorithms::index_param,
196 typename Algorithms::index_param)
199 PyExc_TypeError,
"container does not support item deletion");
201 boost::python::throw_error_already_set ();
206 template<
class Algorithms>
208 #
if defined (BOOST_NO_MEMBER_TEMPLATES) && defined (BOOST_MSVC6_MEMBER_TEMPLATES)
211 typename Algorithms::container &c,
212 typename Algorithms::index_param from,
213 typename Algorithms::index_param to)
215 Algorithms::erase_range (c, from, to);
220 template<
typename Algorithms,
typename SliceType>
223 if (m_slice.step() != 1)
226 PyExc_ValueError,
"attempt to delete via extended slice");
228 boost::python::throw_error_already_set ();
235 container_traits::supported_methods, method_delitem>::value>::
237 # if defined (BOOST_NO_MEMBER_TEMPLATES) && defined (BOOST_MSVC6_MEMBER_TEMPLATES) 238 apply_ (static_cast<Algorithms *>(0),
240 BOOST_NESTED_TEMPLATE apply_ <Algorithms>(
242 *m_ptr, m_pos, m_slice.stop());
248 #endif // BOOST_PYTHON_INDEXING_INT_SLICE_HELPER_HPP Definition: python_CEGUI.h:11
Definition: int_slice_helper.hpp:188
Definition: methods.hpp:108
Definition: int_slice_helper.hpp:119
Definition: int_slice_helper.hpp:27