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:
Jesse Beder 2008-07-02 21:41:54 +00:00
parent 2ccbfeff47
commit 2be40919de
8 changed files with 81 additions and 25 deletions

View file

@ -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();