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/plugins/css/CSSParser.cpp | 5 ++--- src/plugins/css/CSSParser.hpp | 7 +++++-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/plugins/css') diff --git a/src/plugins/css/CSSParser.cpp b/src/plugins/css/CSSParser.cpp index 9a041f2..40486cc 100644 --- a/src/plugins/css/CSSParser.cpp +++ b/src/plugins/css/CSSParser.cpp @@ -75,10 +75,9 @@ static const std::map CSS_DESCRIPTORS = { {ESCAPE, {CodeTokenMode::ESCAPE, ESCAPE}}, {LINEBREAK, {CodeTokenMode::LINEBREAK, LINEBREAK}}}; -Rooted CSSParser::parse(std::istream &is, ParserContext &ctx) +Rooted CSSParser::parse(CharReader &reader, ParserContext &ctx) { - CharReader input{is}; - CodeTokenizer tokenizer{input, CSS_ROOT, CSS_DESCRIPTORS}; + CodeTokenizer tokenizer{reader, CSS_ROOT, CSS_DESCRIPTORS}; tokenizer.ignoreComments = true; tokenizer.ignoreLinebreaks = true; Rooted root = {new SelectorNode{ctx.manager, "root"}}; diff --git a/src/plugins/css/CSSParser.hpp b/src/plugins/css/CSSParser.hpp index eeb5b2c..6d84dbf 100644 --- a/src/plugins/css/CSSParser.hpp +++ b/src/plugins/css/CSSParser.hpp @@ -142,13 +142,16 @@ public: * rules. You are permitted to just insert a CSS Selector expression * specifying some part of a DocumentTree you want to refer to. * - * @param is is a reference to the input stream that should be parsed. + * @param reader is a reference to the CharReader instance from which the + * input data should be read. * @param ctx is a reference to the context that should be used while * parsing the document. * @return returns the root node of the resulting SelectorTree. For more * information on the return conventions consult the Parser.hpp. */ - Rooted parse(std::istream &is, ParserContext &ctx) override; + Rooted parse(CharReader &reader, ParserContext &ctx) override; + + using Parser::parse; /** * As befits a class called CSSParser, this Parser parses CSS. -- cgit v1.2.3