mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Specialized the overloaded [] operator for int/unsigned, and added a size() function, so that you can iterate through a sequence node like a vector.
This commit is contained in:
16
sequence.cpp
16
sequence.cpp
@@ -22,18 +22,30 @@ namespace YAML
|
||||
m_data.clear();
|
||||
}
|
||||
|
||||
bool Sequence::GetBegin(std::vector <Node *>::const_iterator& it)
|
||||
bool Sequence::GetBegin(std::vector <Node *>::const_iterator& it) const
|
||||
{
|
||||
it = m_data.begin();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Sequence::GetEnd(std::vector <Node *>::const_iterator& it)
|
||||
bool Sequence::GetEnd(std::vector <Node *>::const_iterator& it) const
|
||||
{
|
||||
it = m_data.end();
|
||||
return true;
|
||||
}
|
||||
|
||||
Node *Sequence::GetNode(unsigned i) const
|
||||
{
|
||||
if(i < m_data.size())
|
||||
return m_data[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned Sequence::GetSize() const
|
||||
{
|
||||
return m_data.size();
|
||||
}
|
||||
|
||||
void Sequence::Parse(Scanner *pScanner, const ParserState& state)
|
||||
{
|
||||
Clear();
|
||||
|
Reference in New Issue
Block a user