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

@@ -21,10 +21,12 @@ namespace YAML
virtual void Parse(Scanner *pScanner, const ParserState& state) = 0;
virtual void Write(std::ostream& out, int indent) = 0;
virtual bool GetBegin(std::vector <Node *>::const_iterator& it) { return false; }
virtual bool GetBegin(std::map <Node *, Node *>::const_iterator& it) { return false; }
virtual bool GetEnd(std::vector <Node *>::const_iterator& it) { return false; }
virtual bool GetEnd(std::map <Node *, Node *>::const_iterator& it) { return false; }
virtual bool GetBegin(std::vector <Node *>::const_iterator& it) const { return false; }
virtual bool GetBegin(std::map <Node *, Node *>::const_iterator& it) const { return false; }
virtual bool GetEnd(std::vector <Node *>::const_iterator& it) const { return false; }
virtual bool GetEnd(std::map <Node *, Node *>::const_iterator& it) const { return false; }
virtual Node *GetNode(unsigned i) const { return 0; }
virtual unsigned GetSize() const { return 0; }
// extraction
virtual void Read(std::string& s) { throw InvalidScalar(); }