json/tree: add const begin/end
This commit is contained in:
parent
1877767614
commit
9230de8c98
@ -528,6 +528,58 @@ json::tree::array::operator[] (unsigned int idx) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
json::tree::array::iterator
|
||||||
|
json::tree::array::begin (void)
|
||||||
|
{
|
||||||
|
return iterator (m_values.begin ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
json::tree::array::iterator
|
||||||
|
json::tree::array::end (void)
|
||||||
|
{
|
||||||
|
return iterator (m_values.end ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
json::tree::array::const_iterator
|
||||||
|
json::tree::array::begin (void) const
|
||||||
|
{
|
||||||
|
return const_iterator (m_values.begin ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
json::tree::array::const_iterator
|
||||||
|
json::tree::array::end (void) const
|
||||||
|
{
|
||||||
|
return const_iterator (m_values.end ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
json::tree::array::const_iterator
|
||||||
|
json::tree::array::cbegin (void) const
|
||||||
|
{
|
||||||
|
return const_iterator (m_values.cbegin ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
json::tree::array::const_iterator
|
||||||
|
json::tree::array::cend (void) const
|
||||||
|
{
|
||||||
|
return const_iterator (m_values.cend ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
std::ostream&
|
std::ostream&
|
||||||
json::tree::array::write (std::ostream &os) const {
|
json::tree::array::write (std::ostream &os) const {
|
||||||
|
@ -139,6 +139,8 @@ namespace json { namespace tree {
|
|||||||
|
|
||||||
virtual const_iterator begin (void) const;
|
virtual const_iterator begin (void) const;
|
||||||
virtual const_iterator end (void) const;
|
virtual const_iterator end (void) const;
|
||||||
|
virtual const_iterator cbegin (void) const { return begin (); }
|
||||||
|
virtual const_iterator cend (void) const { return end (); }
|
||||||
|
|
||||||
virtual std::ostream& write (std::ostream &os) const;
|
virtual std::ostream& write (std::ostream &os) const;
|
||||||
};
|
};
|
||||||
@ -175,8 +177,12 @@ namespace json { namespace tree {
|
|||||||
virtual node& operator [](unsigned int idx);
|
virtual node& operator [](unsigned int idx);
|
||||||
virtual const node& operator [](unsigned int idx) const;
|
virtual const node& operator [](unsigned int idx) const;
|
||||||
|
|
||||||
virtual const_iterator begin (void) const { return const_iterator (m_values.begin ()); }
|
virtual iterator begin (void);
|
||||||
virtual const_iterator end (void) const { return const_iterator (m_values.end ()); }
|
virtual iterator end (void);
|
||||||
|
virtual const_iterator begin (void) const;
|
||||||
|
virtual const_iterator end (void) const;
|
||||||
|
virtual const_iterator cbegin (void) const;
|
||||||
|
virtual const_iterator cend (void) const;
|
||||||
|
|
||||||
virtual void insert (std::unique_ptr<json::tree::node> &&_value);
|
virtual void insert (std::unique_ptr<json::tree::node> &&_value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user