diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-14 23:51:41 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-14 23:51:41 +0100 |
commit | 35dbde2dbf65d4e35e64b0ffa3d43f6f96a7ef9a (patch) | |
tree | 6fe7cf355625a859f9e2b83fdeb885696284b8bd /src/core/parser/generic/ParserStateCallbacks.hpp | |
parent | 7e5deb666c9087eedd786adaf38c6118ca91a09c (diff) |
Splitted ParserStateCallbacks into two classes, one for communication between the Handler and the Stack and one for communication between the Stack and the Parser
Diffstat (limited to 'src/core/parser/generic/ParserStateCallbacks.hpp')
-rw-r--r-- | src/core/parser/generic/ParserStateCallbacks.hpp | 44 |
1 files changed, 27 insertions, 17 deletions
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 @@ -61,19 +65,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_ */ |