From 35dbde2dbf65d4e35e64b0ffa3d43f6f96a7ef9a Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sat, 14 Feb 2015 23:51:41 +0100 Subject: Splitted ParserStateCallbacks into two classes, one for communication between the Handler and the Stack and one for communication between the Stack and the Parser --- src/core/parser/generic/ParserStateCallbacks.cpp | 2 ++ src/core/parser/generic/ParserStateCallbacks.hpp | 44 +++++++++++++++--------- 2 files changed, 29 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/core/parser/generic/ParserStateCallbacks.cpp b/src/core/parser/generic/ParserStateCallbacks.cpp index e684ee4..50bac57 100644 --- a/src/core/parser/generic/ParserStateCallbacks.cpp +++ b/src/core/parser/generic/ParserStateCallbacks.cpp @@ -20,5 +20,7 @@ namespace ousia { +/* Class ParserStateCallbacks */ + } diff --git a/src/core/parser/generic/ParserStateCallbacks.hpp b/src/core/parser/generic/ParserStateCallbacks.hpp index c2d7cb3..7ec5264 100644 --- a/src/core/parser/generic/ParserStateCallbacks.hpp +++ b/src/core/parser/generic/ParserStateCallbacks.hpp @@ -36,14 +36,18 @@ namespace ousia { /** - * Interface defining a set of callback functions that can be directed from a - * ParserStateHandler to the ParserStateStack and form the ParserStateStack - * to the actual parser. + * Interface defining a set of callback functions that act as a basis for the + * ParserStateStackCallbacks and the ParserCallbacks. */ class ParserStateCallbacks { public: /** - * Sets the whitespace mode that specifies how (string data) should be + * Virtual descructor. + */ + virtual ~ParserStateCallbacks() {}; + + /** + * Sets the whitespace mode that specifies how string data should be * processed. * * @param whitespaceMode specifies one of the three WhitespaceMode constants @@ -60,19 +64,6 @@ public: */ virtual void setDataType(VariantType type) = 0; - /** - * Checks whether the given token is supported by the parser. The parser - * returns true, if the token is supported, false if this token cannot be - * registered. Note that parsers that do not support the registration of - * tokens at all should always return "true". - * - * @param token is the token that should be checked for support. - * @return true if the token is generally supported (or the parser does not - * support registering tokens at all), false if the token is not supported, - * because e.g. it is a reserved token or it interferes with other tokens. - */ - virtual bool supportsToken(const std::string &token) = 0; - /** * Registers the given token as token that should be reported to the handler * using the "token" function. @@ -90,6 +81,25 @@ public: virtual void unregisterToken(const std::string &token) = 0; }; +/** + * Interface defining the callback functions that can be passed from a + * ParserStateStack to the underlying parser. + */ +class ParserCallbacks : public ParserStateCallbacks { + /** + * Checks whether the given token is supported by the parser. The parser + * returns true, if the token is supported, false if this token cannot be + * registered. Note that parsers that do not support the registration of + * tokens at all should always return "true". + * + * @param token is the token that should be checked for support. + * @return true if the token is generally supported (or the parser does not + * support registering tokens at all), false if the token is not supported, + * because e.g. it is a reserved token or it interferes with other tokens. + */ + virtual bool supportsToken(const std::string &token) = 0; +} + } #endif /* _OUSIA_PARSER_STATE_CALLBACKS_HPP_ */ -- cgit v1.2.3