• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "boost/python/slice.hpp"
2 
3 // Copyright (c) 2004 Jonathan Brandmeyer
4 //  Use, modification and distribution are subject to the
5 //  Boost Software License, Version 1.0. (See accompanying file
6 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 
8 
9 namespace boost { namespace python { namespace detail {
10 
slice_base(PyObject * start,PyObject * stop,PyObject * step)11 slice_base::slice_base(PyObject* start, PyObject* stop, PyObject* step)
12   : object(detail::new_reference( PySlice_New(start, stop, step)))
13 {
14 }
15 
16 object
start() const17 slice_base::start() const
18 {
19     return object( detail::borrowed_reference(
20         ((PySliceObject*)this->ptr())->start));
21 }
22 
23 object
stop() const24 slice_base::stop() const
25 {
26     return object( detail::borrowed_reference(
27         ((PySliceObject*)this->ptr())->stop));
28 }
29 
30 object
step() const31 slice_base::step() const
32 {
33     return object( detail::borrowed_reference(
34         ((PySliceObject*)this->ptr())->step));
35 }
36 
37 } } } // !namespace boost::python::detail
38