Added an iterator class that can iterate through both sequence and map nodes.

This commit is contained in:
Jesse Beder 2008-07-02 01:22:39 +00:00
parent f7358701f2
commit d56b54b34f
16 changed files with 393 additions and 105 deletions

View file

@ -1,12 +1,16 @@
#pragma once
#include <ios>
#include <vector>
#include <map>
#include "parserstate.h"
#include "exceptions.h"
namespace YAML
{
class Scanner;
class Parser;
class Node;
class Content
{
@ -17,6 +21,20 @@ 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; }
// extraction
virtual void Read(std::string& s) { throw InvalidScalar(); }
virtual void Read(int& i) { throw InvalidScalar(); }
virtual void Read(unsigned& u) { throw InvalidScalar(); }
virtual void Read(long& l) { throw InvalidScalar(); }
virtual void Read(float& f) { throw InvalidScalar(); }
virtual void Read(double& d) { throw InvalidScalar(); }
virtual void Read(char& c) { throw InvalidScalar(); }
protected:
};
}