2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-23 05:42:30 +00:00

Rename CamelCase variable and function names

[SVN r20386]
This commit is contained in:
Raoul Gough
2003-10-15 11:22:40 +00:00
parent 20896e809d
commit 89122d2415
11 changed files with 189 additions and 189 deletions

View File

@@ -148,37 +148,37 @@ namespace boost { namespace python { namespace indexing {
private:
typedef boost::shared_ptr<shared_proxy> pointer_impl;
typedef std::map<size_type, pointer_impl> MapType;
typedef typename MapType::iterator MapIterator;
typedef typename MapType::value_type MapEntry;
typedef std::map<size_type, pointer_impl> map_type;
typedef typename map_type::iterator map_iterator;
typedef typename map_type::value_type map_value;
private:
Container &raw_container();
static void detach_if_shared (MapEntry const &);
static void detach_if_shared (map_value const &);
void adjustIndexes (MapIterator, MapIterator, difference_type offset);
void adjustIndexesReverse (MapIterator, MapIterator, difference_type offs);
void adjustIndex (MapIterator, difference_type offset);
void adjust_indexes_front (map_iterator, map_iterator, difference_type);
void adjust_indexes_back (map_iterator, map_iterator, difference_type);
void adjust_index (map_iterator, difference_type offset);
private:
held_type myHeldObj;
MapType myMap;
held_type m_held_obj;
map_type m_map;
};
template<class Container, class Holder>
container_proxy<Container, Holder>
::container_proxy ()
: myHeldObj ()
, myMap ()
: m_held_obj ()
, m_map ()
{
}
template<class Container, class Holder>
container_proxy<Container, Holder>
::container_proxy (held_type const &heldType)
: myHeldObj (heldType)
, myMap ()
::container_proxy (held_type const &held)
: m_held_obj (held)
, m_map ()
{
}
@@ -186,8 +186,8 @@ namespace boost { namespace python { namespace indexing {
template<typename Iter>
container_proxy<Container, Holder>
::container_proxy (Iter start, Iter finish)
: myHeldObj (Holder::create())
, myMap ()
: m_held_obj (Holder::create())
, m_map ()
{
insert (begin(), start, finish);
}
@@ -195,8 +195,8 @@ namespace boost { namespace python { namespace indexing {
template<class Container, class Holder>
container_proxy<Container, Holder>
::container_proxy (container_proxy const &copy)
: myHeldObj (Holder::copy (copy.myHeldObj))
, myMap () // Do *not* duplicate map
: m_held_obj (Holder::copy (copy.m_held_obj))
, m_map () // Do *not* duplicate map
{
}
@@ -206,9 +206,9 @@ namespace boost { namespace python { namespace indexing {
::operator= (container_proxy const &copy)
{
// All of our contained values are about to be dis-owned
std::for_each (myMap.begin(), myMap.end(), detach_if_shared);
myMap.clear();
Holder::assign (myHeldObj, copy.myHeldObj);
std::for_each (m_map.begin(), m_map.end(), detach_if_shared);
m_map.clear();
Holder::assign (m_held_obj, copy.m_held_obj);
return *this;
}
@@ -217,8 +217,8 @@ namespace boost { namespace python { namespace indexing {
::~container_proxy ()
{
// All of our contained values are about to be dis-owned
std::for_each (myMap.begin(), myMap.end(), detach_if_shared);
Holder::pre_destruction (myHeldObj);
std::for_each (m_map.begin(), m_map.end(), detach_if_shared);
Holder::pre_destruction (m_held_obj);
}
template<class Container, class Holder>
@@ -226,7 +226,7 @@ namespace boost { namespace python { namespace indexing {
container_proxy<Container, Holder>
::raw_container ()
{
return Holder::get (myHeldObj);
return Holder::get (m_held_obj);
}
template<class Container, class Holder>
@@ -234,7 +234,7 @@ namespace boost { namespace python { namespace indexing {
container_proxy<Container, Holder>
::raw_container () const
{
return Holder::get (myHeldObj);
return Holder::get (m_held_obj);
}
template<class Container, class Holder>
@@ -242,7 +242,7 @@ namespace boost { namespace python { namespace indexing {
container_proxy<Container, Holder>
::at (size_type index)
{
pointer_impl &entry = myMap[index];
pointer_impl &entry = m_map[index];
if (!entry.get())
{
@@ -292,36 +292,36 @@ namespace boost { namespace python { namespace indexing {
container_proxy<Container, Holder>
::swap_elements (size_type index1, size_type index2)
{
MapIterator iter1 = myMap.find (index1);
MapIterator iter2 = myMap.find (index2);
map_iterator iter1 = m_map.find (index1);
map_iterator iter2 = m_map.find (index2);
difference_type distance
= static_cast<difference_type>(index2)
- static_cast<difference_type>(index1);
if ((iter1 == myMap.end()) && (iter2 == myMap.end()))
if ((iter1 == m_map.end()) && (iter2 == m_map.end()))
{
// No proxies exist for these indexes.
}
else if ((iter1 != myMap.end()) && (iter2 == myMap.end()))
else if ((iter1 != m_map.end()) && (iter2 == m_map.end()))
{
// Proxy for the first index only
MapIterator temp (iter1);
adjustIndexes (iter1, ++temp, distance); // Exactly one element
map_iterator temp (iter1);
adjust_indexes_front (iter1, ++temp, distance); // Exactly one element
}
else if ((iter1 == myMap.end()) && (iter2 != myMap.end()))
else if ((iter1 == m_map.end()) && (iter2 != m_map.end()))
{
// Proxy for the second index only
MapIterator temp (iter2);
adjustIndexes (iter2, ++temp, -distance);
map_iterator temp (iter2);
adjust_indexes_front (iter2, ++temp, -distance);
}
else
{
// Proxies for both indexes
std::swap (iter1->second->myIndex, iter2->second->myIndex);
std::swap (iter1->second->m_index, iter2->second->m_index);
std::swap (iter1->second, iter2->second);
}
@@ -345,15 +345,15 @@ namespace boost { namespace python { namespace indexing {
assert (to.ptr == this);
difference_type deleting = to.index - from.index;
MapIterator erase_begin = myMap.lower_bound (from.index);
MapIterator erase_end = myMap.lower_bound (to.index);
map_iterator erase_begin = m_map.lower_bound (from.index);
map_iterator erase_end = m_map.lower_bound (to.index);
// Detach any proxies for the soon-to-be-erased elements
std::for_each (erase_begin, erase_end, detach_if_shared);
myMap.erase (erase_begin, erase_end); // Note: erase_end remains valid
m_map.erase (erase_begin, erase_end); // Note: erase_end remains valid
// Adjust the indexes of any following proxies
adjustIndexes (erase_end, myMap.end(), -deleting);
adjust_indexes_front (erase_end, m_map.end(), -deleting);
// Erase the elements from the real container
raw_iterator result
@@ -372,9 +372,9 @@ namespace boost { namespace python { namespace indexing {
// Adjust indexes from iter.index onwards, since insert goes
// before this element
adjustIndexesReverse (myMap.lower_bound (iter.index)
, myMap.end()
, 1);
adjust_indexes_back (m_map.lower_bound (iter.index)
, m_map.end()
, 1);
// Insert the element into the real container
raw_iterator result
@@ -406,9 +406,9 @@ namespace boost { namespace python { namespace indexing {
// Adjust indexes from iter.index onwanrds (insert goes before
// this element)
adjustIndexesReverse (myMap.lower_bound (iter.index)
, myMap.end()
, std::distance (from, to));
adjust_indexes_back (m_map.lower_bound (iter.index)
, m_map.end()
, std::distance (from, to));
// Insert the element into the real container
raw_container().insert (raw_container().begin() + iter.index, from, to);
@@ -431,7 +431,7 @@ namespace boost { namespace python { namespace indexing {
template<class Container, class Holder>
void
container_proxy<Container, Holder>
::detach_if_shared (MapEntry const &ent)
::detach_if_shared (map_value const &ent)
{
if (!ent.second.unique())
{
@@ -446,24 +446,24 @@ namespace boost { namespace python { namespace indexing {
container_proxy<Container, Holder>
::detach_proxy (size_type index)
{
MapIterator iter = myMap.find (index);
map_iterator iter = m_map.find (index);
if (iter != myMap.end())
if (iter != m_map.end())
{
detach_if_shared (*iter);
myMap.erase (iter);
m_map.erase (iter);
}
}
template<class Container, class Holder>
void
container_proxy<Container, Holder>
::detach_proxies (size_type fromIndex, size_type toIndex)
::detach_proxies (size_type from_index, size_type to_index)
{
MapIterator from = myMap.lower_bound (fromIndex);
MapIterator to = myMap.lower_bound (toIndex);
map_iterator from = m_map.lower_bound (from_index);
map_iterator to = m_map.lower_bound (to_index);
std::for_each (from, to, detach_if_shared);
myMap.erase (from, to);
m_map.erase (from, to);
}
template<class Container, class Holder>
@@ -479,27 +479,27 @@ namespace boost { namespace python { namespace indexing {
template<class Container, class Holder>
void
container_proxy<Container, Holder>
::adjustIndex (MapIterator iter, difference_type offset)
::adjust_index (map_iterator iter, difference_type offset)
{
pointer_impl ptr (iter->second); // Copy the shared pointer
myMap.erase (iter); // Remove the map copy of it
m_map.erase (iter); // Remove the map copy of it
if (!ptr.unique())
{
// Reinsert only if there are other pointers "out there"
// referring to the shared proxy
ptr->myIndex += offset;
myMap.insert (typename MapType::value_type (ptr->myIndex, ptr));
ptr->m_index += offset;
m_map.insert (typename map_type::value_type (ptr->m_index, ptr));
}
}
template<class Container, class Holder>
void
container_proxy<Container, Holder>
::adjustIndexes (MapIterator low_bound
, MapIterator high_bound
, difference_type offset)
::adjust_indexes_front (map_iterator low_bound
, map_iterator high_bound
, difference_type offset)
{
// Adjust indexes in the given range of proxies by the given offset.
// The adjustment is done by erasing and re-inserting the entries
@@ -513,20 +513,20 @@ namespace boost { namespace python { namespace indexing {
while (low_bound != high_bound)
{
MapIterator target (low_bound);
map_iterator target (low_bound);
++low_bound; // Find next node before erasing the current target
adjustIndex (target, offset);
adjust_index (target, offset);
}
}
template <class Container, class Holder>
void
container_proxy<Container, Holder>
::adjustIndexesReverse (MapIterator low_bound
, MapIterator high_bound
, difference_type offset)
::adjust_indexes_back (map_iterator low_bound
, map_iterator high_bound
, difference_type offset)
{
if (low_bound != high_bound)
{
@@ -536,17 +536,17 @@ namespace boost { namespace python { namespace indexing {
{
if (high_bound == low_bound)
{
adjustIndex (high_bound, offset); // Last one to adjust
adjust_index (high_bound, offset); // Last one to adjust
break;
}
else
{
MapIterator target (high_bound);
map_iterator target (high_bound);
--high_bound; // Find previous node before doing erase
adjustIndex (target, offset); // Do erase
adjust_index (target, offset); // Do erase
}
}
}

View File

@@ -41,7 +41,7 @@ namespace boost { namespace python { namespace indexing {
typedef typename container_proxy::raw_value_type raw_value_type;
typedef typename container_proxy::size_type size_type;
proxy_pointer mPtr;
proxy_pointer m_ptr;
public:
typedef typename proxy_type::value_type value_type;
@@ -52,18 +52,18 @@ namespace boost { namespace python { namespace indexing {
typedef value_type element_type; // Alias for register_ptr_to_python
element_proxy () : mPtr () { }
explicit element_proxy (proxy_type *ptr) : mPtr (ptr) { }
element_proxy (proxy_pointer const &ptr) : mPtr (ptr) { }
element_proxy () : m_ptr () { }
explicit element_proxy (proxy_type *ptr) : m_ptr (ptr) { }
element_proxy (proxy_pointer const &ptr) : m_ptr (ptr) { }
explicit element_proxy (raw_value_type const &val)
: mPtr (new proxy_type(val))
: m_ptr (new proxy_type(val))
{
// Create new standalone value (i.e. detached)
}
reference operator* () const { return mPtr->operator*(); }
pointer operator-> () const { return (*mPtr).operator->(); }
reference operator* () const { return m_ptr->operator*(); }
pointer operator-> () const { return (*m_ptr).operator->(); }
pointer get () const { return operator->(); } // Alias for pointer_holder
// Implicit conversion to raw_value_type
@@ -81,7 +81,7 @@ namespace boost { namespace python { namespace indexing {
element_proxy &operator= (value_type const &copy)
{
proxy_type &proxy (*mPtr);
proxy_type &proxy (*m_ptr);
container_proxy *container = proxy.owner();
size_type index = proxy.index();
@@ -91,7 +91,7 @@ namespace boost { namespace python { namespace indexing {
// Proxy was attached before, but is now detached. Make sure
// we now refer to the new element, instead of the detached
// copy of the old element
mPtr = container->at (index).mPtr;
m_ptr = container->at (index).m_ptr;
// Note: in the special case that this we and the container
// proxy itself have the only references to the
@@ -116,7 +116,7 @@ namespace boost { namespace python { namespace indexing {
return (*this) = *copy;
}
size_t use_count() const { return mPtr.use_count(); } // For debugging
size_t use_count() const { return m_ptr.use_count(); } // For debugging
};
template<typename ContainerProxy>
@@ -127,7 +127,7 @@ namespace boost { namespace python { namespace indexing {
typedef boost::shared_ptr<proxy_type> proxy_pointer;
typedef typename container_proxy::raw_value_type raw_value_type;
proxy_pointer mPtr;
proxy_pointer m_ptr;
public:
typedef typename proxy_type::value_type const value_type;
@@ -136,28 +136,28 @@ namespace boost { namespace python { namespace indexing {
typedef typename proxy_type::iterator_category iterator_category;
typedef typename proxy_type::difference_type difference_type;
const_element_proxy () : mPtr () { }
explicit const_element_proxy (proxy_type *ptr) : mPtr (ptr) { }
const_element_proxy (proxy_pointer const &ptr) : mPtr (ptr) { }
const_element_proxy () : m_ptr () { }
explicit const_element_proxy (proxy_type *ptr) : m_ptr (ptr) { }
const_element_proxy (proxy_pointer const &ptr) : m_ptr (ptr) { }
const_element_proxy (element_proxy<container_proxy> const &copy)
: mPtr (copy.mPtr)
: m_ptr (copy.m_ptr)
{
}
explicit const_element_proxy (raw_value_type const &val)
: mPtr (new proxy_type(val))
: m_ptr (new proxy_type(val))
{
// Create new standalone value (i.e. detached)
}
reference operator* () const { return mPtr->operator*(); }
pointer operator-> () const { return mPtr->operator->(); }
reference operator* () const { return m_ptr->operator*(); }
pointer operator-> () const { return m_ptr->operator->(); }
// Implicit conversion to raw_value_type
operator reference () const { return operator*(); }
size_t use_count() const { return mPtr.use_count(); } // For debugging
size_t use_count() const { return m_ptr.use_count(); } // For debugging
};
} } }

View File

@@ -49,17 +49,17 @@ namespace boost { namespace python { namespace indexing {
void insert (value_param val);
private:
slice_type mSlice;
container *mPtr;
index_type mPos;
slice_type m_slice;
container *m_ptr;
index_type m_pos;
};
template<typename Algorithms, typename SliceType>
int_slice_helper<Algorithms, SliceType>
::int_slice_helper (container &c, slice_type const &sl)
: mSlice (sl)
, mPtr (&c)
, mPos (-1)
: m_slice (sl)
, m_ptr (&c)
, m_pos (-1)
{
}
@@ -69,18 +69,18 @@ namespace boost { namespace python { namespace indexing {
{
bool result = false; // Assume the worst
if (mPos == -1)
if (m_pos == -1)
{
// First time call - get to start of the slice (if any)
mPos = mSlice.start();
result = mSlice.in_range (mPos);
m_pos = m_slice.start();
result = m_slice.in_range (m_pos);
}
else if (mSlice.in_range (mPos))
else if (m_slice.in_range (m_pos))
{
// Subsequent calls - advance by the slice's stride
mPos += mSlice.step();
result = mSlice.in_range (mPos);
m_pos += m_slice.step();
result = m_slice.in_range (m_pos);
}
return result;
@@ -90,7 +90,7 @@ namespace boost { namespace python { namespace indexing {
typename int_slice_helper<Algorithms, SliceType>::reference
int_slice_helper<Algorithms, SliceType>::current () const
{
return algorithms::get (*mPtr, mPos);
return algorithms::get (*m_ptr, m_pos);
}
template<typename Algorithms, typename SliceType>
@@ -110,7 +110,7 @@ namespace boost { namespace python { namespace indexing {
template<typename Algorithms, typename SliceType>
void int_slice_helper<Algorithms, SliceType>::assign (value_param val) const
{
algorithms::assign (*mPtr, mPos, val);
algorithms::assign (*m_ptr, m_pos, val);
}
namespace detail {
@@ -141,7 +141,7 @@ namespace boost { namespace python { namespace indexing {
template<typename Algorithms, typename SliceType>
void int_slice_helper<Algorithms, SliceType>::insert (value_param val)
{
if (mSlice.step() != 1)
if (m_slice.step() != 1)
{
PyErr_SetString (PyExc_ValueError
, "attempt to insert via extended slice");
@@ -152,9 +152,9 @@ namespace boost { namespace python { namespace indexing {
else
{
detail::maybe_insert<container_traits::has_insert>
::template apply<Algorithms> (*mPtr, mPos, val);
::template apply<Algorithms> (*m_ptr, m_pos, val);
++mPos; // Advance for any subsequent inserts
++m_pos; // Advance for any subsequent inserts
}
}
@@ -186,7 +186,7 @@ namespace boost { namespace python { namespace indexing {
template<typename Algorithms, typename SliceType>
void int_slice_helper<Algorithms, SliceType>::erase_remaining () const
{
if (mSlice.step() != 1)
if (m_slice.step() != 1)
{
PyErr_SetString (PyExc_ValueError
, "attempt to delete via extended slice");
@@ -197,7 +197,7 @@ namespace boost { namespace python { namespace indexing {
else
{
detail::maybe_erase<container_traits::has_erase>
::template apply<Algorithms> (*mPtr, mPos, mSlice.stop());
::template apply<Algorithms> (*m_ptr, m_pos, m_slice.stop());
}
}
} } }

View File

@@ -62,23 +62,23 @@ namespace boost { namespace python { namespace indexing {
reference at (size_type) const;
private:
iterator myBegin;
iterator myEnd;
iterator m_begin;
iterator m_end;
};
template<typename Iterator>
iterator_pair<Iterator>::iterator_pair (iterator_param begin
, iterator_param end)
: myBegin (begin)
, myEnd (end)
: m_begin (begin)
, m_end (end)
{
}
template<typename Iterator>
iterator_pair<Iterator>
::iterator_pair (std::pair<iterator, iterator> const &pair)
: myBegin (pair.first)
, myEnd (pair.second)
: m_begin (pair.first)
, m_end (pair.second)
{
}
@@ -86,14 +86,14 @@ namespace boost { namespace python { namespace indexing {
typename iterator_pair<Iterator>::iterator
iterator_pair<Iterator>::begin() const
{
return myBegin;
return m_begin;
}
template<typename Iterator>
typename iterator_pair<Iterator>::iterator
iterator_pair<Iterator>::end() const
{
return myEnd;
return m_end;
}
template<typename Iterator>

View File

@@ -46,9 +46,9 @@ namespace boost { namespace python { namespace indexing {
virtual boost::python::object current() const;
private:
boost::python::object mGetitemMethod;
int mIndex;
boost::python::object mCurrent;
boost::python::object m_getitem_method;
int m_index;
boost::python::object m_current;
};
struct BOOST_PYTHON_DECL python_iter_iterator : public python_iterator
@@ -59,8 +59,8 @@ namespace boost { namespace python { namespace indexing {
virtual boost::python::object current() const;
private:
boost::python::object mNextMethod;
boost::python::object mCurrent;
boost::python::object m_next_method;
boost::python::object m_current;
};
} } }

View File

@@ -40,8 +40,8 @@ namespace boost { namespace python { namespace indexing {
reference operator*() const;
pointer operator->() const { return &(**this); }
ContainerProxy *owner() const { return myOwnerPtr; }
size_t index() const { return myIndex; }
ContainerProxy *owner() const { return m_owner_ptr; }
size_t index() const { return m_index; }
shared_proxy_impl (value_type const &copy);
// Creates value-only (detached) proxy
@@ -53,9 +53,9 @@ namespace boost { namespace python { namespace indexing {
void detach ();
private:
ContainerProxy *myOwnerPtr; // When attached
size_t myIndex; // When attached
std::auto_ptr<value_type> myElementPtr; // When detached
ContainerProxy *m_owner_ptr; // When attached
size_t m_index; // When attached
std::auto_ptr<value_type> m_element_ptr; // When detached
private:
// Not implemented
@@ -64,19 +64,19 @@ namespace boost { namespace python { namespace indexing {
};
template<class ContainerProxy>
shared_proxy_impl<ContainerProxy>::shared_proxy_impl (ContainerProxy *ownerPtr
shared_proxy_impl<ContainerProxy>::shared_proxy_impl (ContainerProxy *owner
, size_t index)
: myOwnerPtr (ownerPtr)
, myIndex (index)
, myElementPtr ()
: m_owner_ptr (owner)
, m_index (index)
, m_element_ptr ()
{
}
template<class ContainerProxy>
shared_proxy_impl<ContainerProxy>::shared_proxy_impl (value_type const &val)
: myOwnerPtr (0)
, myIndex (static_cast<size_t>(-1))
, myElementPtr (new value_type (val))
: m_owner_ptr (0)
, m_index (static_cast<size_t>(-1))
, m_element_ptr (new value_type (val))
{
}
@@ -84,17 +84,17 @@ namespace boost { namespace python { namespace indexing {
typename shared_proxy_impl<ContainerProxy>::reference
shared_proxy_impl<ContainerProxy>::operator* () const
{
return myOwnerPtr
? myOwnerPtr->raw_container().at (myIndex)
: *myElementPtr;
return m_owner_ptr
? m_owner_ptr->raw_container().at (m_index)
: *m_element_ptr;
}
template<class ContainerProxy>
void shared_proxy_impl<ContainerProxy>::detach ()
{
myElementPtr.reset (new value_type (**this));
myOwnerPtr = 0;
myIndex = static_cast<size_t>(-1);
m_element_ptr.reset (new value_type (**this));
m_owner_ptr = 0;
m_index = static_cast<size_t>(-1);
}
} } }

View File

@@ -41,24 +41,24 @@ namespace boost { namespace python { namespace indexing {
typedef int index_type;
integer_slice (slice const &, index_type sequenceLength);
integer_slice (slice const &, index_type length);
// integer_slice must know how big the container is so it can
// adjust for negative indexes, etc...
index_type start() const { return mStart; }
index_type step() const { return mStep; }
index_type stop() const { return mStop; }
index_type start() const { return m_start; }
index_type step() const { return m_step; }
index_type stop() const { return m_stop; }
index_type size() const { return (mStop - mStart) / mStep; }
index_type size() const { return (m_stop - m_start) / m_step; }
bool in_range (index_type index);
private:
slice mSlice;
index_type mStart;
index_type mStep;
index_type mStop;
index_type mDirection;
slice m_slice;
index_type m_start;
index_type m_step;
index_type m_stop;
index_type m_direction;
};
} } }

View File

@@ -65,7 +65,7 @@ namespace boost { namespace python { namespace indexing {
PyObject* postcall (PyObject *args, PyObject *result);
private:
Policy mBase;
Policy m_base;
};
};
@@ -76,7 +76,7 @@ namespace boost { namespace python { namespace indexing {
template<class Algorithms, class Policy>
slice_handler<Algorithms, Policy>
::postcall_override::postcall_override (Policy const &p)
: mBase (p)
: m_base (p)
{
}
@@ -89,7 +89,7 @@ namespace boost { namespace python { namespace indexing {
slice_handler<Algorithms, Policy>
::postcall_override::precall (PyObject *args)
{
return mBase.precall (args);
return m_base.precall (args);
}
//////////////////////////////////////////////////////////////////////////
@@ -105,7 +105,7 @@ namespace boost { namespace python { namespace indexing {
for (int count = 0; count < size; ++count)
{
mBase.postcall (args, PyList_GetItem (result, count));
m_base.postcall (args, PyList_GetItem (result, count));
}
return result;

View File

@@ -34,14 +34,14 @@ namespace boost { namespace python { namespace indexing {
// except precall, which must be provided by the template
// argument.
precall_only () : mPrecall () { }
explicit precall_only (PrecallPolicy const &copy) : mPrecall (copy) { }
precall_only () : m_precall () { }
explicit precall_only (PrecallPolicy const &copy) : m_precall (copy) { }
bool precall (PyObject *args) { return mPrecall.precall (args); }
bool precall (PyObject *args) const { return mPrecall.precall (args); }
bool precall (PyObject *args) { return m_precall.precall (args); }
bool precall (PyObject *args) const { return m_precall.precall (args); }
private:
PrecallPolicy mPrecall;
PrecallPolicy m_precall;
};
}
@@ -453,19 +453,19 @@ namespace boost { namespace python { namespace indexing {
class visitor
: public boost::python::def_visitor< visitor< Algorithms, Policy > >
{
Policy mPolicy;
Policy m_policy;
public:
typedef Algorithms algorithms;
typedef typename algorithms::container_traits traits;
typedef typename traits::value_traits_ value_traits_;
explicit visitor (Policy const &policy = Policy()) : mPolicy (policy) { }
explicit visitor (Policy const &policy = Policy()) : m_policy (policy) { }
template <class PythonClass>
void visit (PythonClass &pyClass) const
{
detail::precall_only<Policy> precallPolicy (mPolicy);
detail::precall_only<Policy> precallPolicy (m_policy);
// Note - this will add __len__ for anything that can determine
// its size, even if that might be inefficient (e.g. have linear
@@ -476,17 +476,17 @@ namespace boost { namespace python { namespace indexing {
::apply (pyClass, algorithms(), precallPolicy);
maybe_add_getitem<traits::index_style>
::apply (pyClass, algorithms(), mPolicy);
::apply (pyClass, algorithms(), m_policy);
maybe_add_setitem<traits::index_style>
::apply (pyClass, algorithms(), mPolicy);
::apply (pyClass, algorithms(), m_policy);
maybe_add_delitem<traits::has_erase, traits::index_style>
::apply (pyClass, algorithms(), mPolicy);
::apply (pyClass, algorithms(), m_policy);
maybe_add_iter<((traits::index_style != index_style_linear)
&& traits::has_copyable_iter)>
::apply (pyClass, algorithms(), mPolicy);
::apply (pyClass, algorithms(), m_policy);
maybe_add_sort<traits::is_reorderable
, value_traits_::lessthan_comparable>
@@ -512,7 +512,7 @@ namespace boost { namespace python { namespace indexing {
maybe_add_count<traits::has_find, traits::index_style>
::apply (pyClass, algorithms(), precallPolicy);
Algorithms::visitor_helper (pyClass, mPolicy);
Algorithms::visitor_helper (pyClass, m_policy);
}
};
} } }

View File

@@ -63,9 +63,9 @@ boost::python::indexing::python_iterator::~python_iterator ()
boost::python::indexing::python_getitem_iterator
::python_getitem_iterator (boost::python::object obj)
: mGetitemMethod (obj.attr ("__getitem__"))
, mIndex (0)
, mCurrent()
: m_getitem_method (obj.attr ("__getitem__"))
, m_index (0)
, m_current()
{
}
@@ -79,8 +79,8 @@ bool boost::python::indexing::python_getitem_iterator::next ()
try
{
mCurrent = mGetitemMethod (mIndex);
++mIndex;
m_current = m_getitem_method (m_index);
++m_index;
}
catch (boost::python::error_already_set const &)
@@ -89,7 +89,7 @@ bool boost::python::indexing::python_getitem_iterator::next ()
{
// Eat this exception
PyErr_Clear ();
mCurrent = boost::python::object ();
m_current = boost::python::object ();
result = false;
}
@@ -110,7 +110,7 @@ bool boost::python::indexing::python_getitem_iterator::next ()
boost::python::object
boost::python::indexing::python_getitem_iterator::current () const
{
return mCurrent;
return m_current;
}
////////////////////////////////////////////////////////////////////////////
@@ -119,8 +119,8 @@ boost::python::indexing::python_getitem_iterator::current () const
boost::python::indexing::python_iter_iterator
::python_iter_iterator (boost::python::object obj)
: mNextMethod (obj.attr ("__iter__")().attr ("next"))
, mCurrent()
: m_next_method (obj.attr ("__iter__")().attr ("next"))
, m_current()
{
}
@@ -134,7 +134,7 @@ bool boost::python::indexing::python_iter_iterator::next ()
try
{
mCurrent = mNextMethod ();
m_current = m_next_method ();
}
catch (boost::python::error_already_set const &)
@@ -143,7 +143,7 @@ bool boost::python::indexing::python_iter_iterator::next ()
{
// Eat this exception
PyErr_Clear ();
mCurrent = boost::python::object ();
m_current = boost::python::object ();
result = false;
}
@@ -164,5 +164,5 @@ bool boost::python::indexing::python_iter_iterator::next ()
boost::python::object
boost::python::indexing::python_iter_iterator::current () const
{
return mCurrent;
return m_current;
}

View File

@@ -32,26 +32,26 @@ boost::python::indexing::slice::slice (slice const &copy)
/////////////////////////////////////////////////////////////////////////////
boost::python::indexing::integer_slice
::integer_slice (slice const &sl, index_type sequenceLength)
: mSlice (sl)
::integer_slice (slice const &sl, index_type length)
: m_slice (sl)
// Leave index members uninitialized
{
PySlice_GetIndices (reinterpret_cast<PySliceObject *> (mSlice.ptr())
, sequenceLength
, &mStart
, &mStop
, &mStep);
PySlice_GetIndices (reinterpret_cast<PySliceObject *> (m_slice.ptr())
, length
, &m_start
, &m_stop
, &m_step);
if (mStep == 0)
if (m_step == 0)
{
// Can happen with Python prior to 2.3
PyErr_SetString (PyExc_ValueError, "slice step cannot be zero");
boost::python::throw_error_already_set ();
}
mStart = std::max (0, std::min (sequenceLength, mStart));
mStop = std::max (0, std::min (sequenceLength, mStop));
mDirection = (mStep > 0) ? 1 : -1;
m_start = std::max (0, std::min (length, m_start));
m_stop = std::max (0, std::min (length, m_stop));
m_direction = (m_step > 0) ? 1 : -1;
}
/////////////////////////////////////////////////////////////////////////////
@@ -60,5 +60,5 @@ boost::python::indexing::integer_slice
bool boost::python::indexing::integer_slice::in_range (index_type index)
{
return ((mStop - index) * mDirection) > 0;
return ((m_stop - index) * m_direction) > 0;
}