Reintegrated the event-api branch (second iteration) into the rtweeks21-staging branch.

This commit is contained in:
rtweeks21
2010-09-11 22:11:02 +00:00
parent 7220c6b783
commit 55c8486ee3
38 changed files with 1575 additions and 617 deletions

View File

@@ -4,19 +4,20 @@
#define PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#include "node.h"
#include "graphbuilder.h"
#include "noncopyable.h"
#include <ios>
#include <string>
#include <vector>
#include <map>
#include <memory>
namespace YAML
{
class Scanner;
struct ParserState;
struct Directives;
struct Mark;
struct Token;
class EventHandler;
class GraphBuilderInterface;
class Node;
class Scanner;
class Parser: private noncopyable
{
@@ -28,6 +29,18 @@ namespace YAML
operator bool() const;
void Load(std::istream& in);
bool HandleNextDocument(EventHandler& eventHandler);
void *BuildNextDocumentGraph(GraphBuilderInterface& graphBuilder);
template <class Builder>
typename Builder::Node *BuildNextDocumentGraph(Builder& graphBuilder)
{
GraphBuilder<Builder> wrapper(graphBuilder); // Must be lvalue to make C++ happy
return static_cast<typename Builder::Node *>(
BuildNextDocumentGraph(wrapper.AsBuilderInterface())
);
}
bool GetNextDocument(Node& document);
void PrintTokens(std::ostream& out);
@@ -36,10 +49,10 @@ namespace YAML
void HandleDirective(const Token& token);
void HandleYamlDirective(const Token& token);
void HandleTagDirective(const Token& token);
private:
std::auto_ptr<Scanner> m_pScanner;
std::auto_ptr<ParserState> m_pState;
std::auto_ptr<Directives> m_pDirectives;
};
}