mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Teach BOOST_FOREACH how to traverse our objects and arrays.
This commit is contained in:
@@ -149,10 +149,28 @@ public:
|
||||
static std::auto_ptr<SerializedType> makeDefaultObject(SField::ref name)
|
||||
{ return makeDefaultObject(name.fieldType, name); }
|
||||
|
||||
// field iterator stuff
|
||||
typedef boost::ptr_vector<SerializedType>::iterator iterator;
|
||||
typedef boost::ptr_vector<SerializedType>::const_iterator const_iterator;
|
||||
iterator begin() { return mData.begin(); }
|
||||
iterator end() { return mData.end(); }
|
||||
const_iterator begin() const { return mData.begin(); }
|
||||
const_iterator end() const { return mData.end(); }
|
||||
|
||||
bool operator==(const STObject& o) const;
|
||||
bool operator!=(const STObject& o) const { return ! (*this == o); }
|
||||
};
|
||||
|
||||
inline STObject::iterator range_begin(STObject& x) { return x.begin(); }
|
||||
inline STObject::iterator range_end(STObject &x) { return x.end(); }
|
||||
namespace boost
|
||||
{
|
||||
template<> struct range_mutable_iterator<STObject> { typedef STObject::iterator type; };
|
||||
template<> struct range_const_iterator<STObject> { typedef STObject::iterator type; };
|
||||
}
|
||||
|
||||
|
||||
|
||||
class STArray : public SerializedType
|
||||
{
|
||||
public:
|
||||
@@ -222,5 +240,13 @@ public:
|
||||
virtual bool isEquivalent(const SerializedType& t) const;
|
||||
};
|
||||
|
||||
inline STArray::iterator range_begin(STArray& x) { return x.begin(); }
|
||||
inline STArray::iterator range_end(STArray &x) { return x.end(); }
|
||||
namespace boost
|
||||
{
|
||||
template<> struct range_mutable_iterator<STArray> { typedef STArray::iterator type; };
|
||||
template<> struct range_const_iterator<STArray> { typedef STArray::iterator type; };
|
||||
}
|
||||
|
||||
#endif
|
||||
// vim:ts=4
|
||||
|
||||
Reference in New Issue
Block a user