From 4484f6deea0e098a140e878484d020bec839d1bd Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Thu, 1 Jan 2015 18:06:04 +0100 Subject: Using CharReader instead of inputstream in Parser function --- src/core/parser/Parser.cpp | 6 ++---- src/core/parser/Parser.hpp | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/parser/Parser.cpp b/src/core/parser/Parser.cpp index 23fd9b7..b5d9656 100644 --- a/src/core/parser/Parser.cpp +++ b/src/core/parser/Parser.cpp @@ -16,8 +16,6 @@ along with this program. If not, see . */ -#include - #include "Parser.hpp" namespace ousia { @@ -25,8 +23,8 @@ namespace parser { Rooted Parser::parse(const std::string &str, ParserContext &ctx) { - std::istringstream is{str}; - return parse(is, ctx); + CharReader reader{str}; + return parse(reader, ctx); } } } diff --git a/src/core/parser/Parser.hpp b/src/core/parser/Parser.hpp index 40ac87a..63303e2 100644 --- a/src/core/parser/Parser.hpp +++ b/src/core/parser/Parser.hpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -62,6 +63,7 @@ struct ParserContext { * Reference to the Logger the parser should log any messages to. */ Logger &logger; + /** * Reference to the Manager the parser should append nodes to. */ @@ -132,7 +134,7 @@ public: * inclusion in the document graph. This method should be overridden by * derived classes. * - * @param is is a reference to the input stream that should be parsed. + * @param reader is a reference to the CharReader that should be used. * @param ctx is a reference to the context that should be used while * parsing the document. * @return a reference to the node representing the subgraph that has been @@ -140,7 +142,7 @@ public: * calling code will try to resolve these. If no valid node can be produced, * a corresponding LoggableException must be thrown by the parser. */ - virtual Rooted parse(std::istream &is, ParserContext &ctx) = 0; + virtual Rooted parse(CharReader &reader, ParserContext &ctx) = 0; /** * Parses the given string and returns a corresponding node for -- cgit v1.2.3