From e2e32eef55406519c744002a404e7e5ca66b29a1 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sun, 15 Feb 2015 20:57:27 +0100 Subject: Declaring States in the Handler classes --- src/core/parser/stack/DocumentHandler.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/core/parser/stack/DocumentHandler.cpp') diff --git a/src/core/parser/stack/DocumentHandler.cpp b/src/core/parser/stack/DocumentHandler.cpp index b28f0fb..9fedabb 100644 --- a/src/core/parser/stack/DocumentHandler.cpp +++ b/src/core/parser/stack/DocumentHandler.cpp @@ -16,8 +16,6 @@ along with this program. If not, see . */ -#include "DocumentHandler.hpp" - #include #include @@ -30,6 +28,9 @@ #include #include +#include "DocumentHandler.hpp" +#include "State.hpp" + namespace ousia { namespace parser_stack { @@ -274,6 +275,22 @@ bool DocumentChildHandler::data(Variant &data) } return true; } + +namespace States { +const State Document = StateBuilder() + .parent(&None) + .createdNodeType(&RttiTypes::Document) + .elementHandler(DocumentHandler::create) + .arguments({Argument::String("name", "")}); + +const State DocumentChild = + StateBuilder() + .parents({&Document, &DocumentChild}) + .createdNodeTypes({&RttiTypes::StructureNode, + &RttiTypes::AnnotationEntity, + &RttiTypes::DocumentField}) + .elementHandler(DocumentChildHandler::create); +} } namespace RttiTypes { -- cgit v1.2.3