From c2e5a26f355a7b51743740323c8e28156c0deee5 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 5 Dec 2014 17:14:55 +0100 Subject: replaced tuple handling by pair handling for nicer reading. --- src/plugins/css/CSSParser.cpp | 18 +++++++++--------- src/plugins/css/CSSParser.hpp | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/plugins/css/CSSParser.cpp b/src/plugins/css/CSSParser.cpp index fc37184..51b2fd2 100644 --- a/src/plugins/css/CSSParser.cpp +++ b/src/plugins/css/CSSParser.cpp @@ -123,13 +123,13 @@ void CSSParser::parseSelectors(Rooted root, auto tuple = parseSelector(tokenizer, ctx); // append the SelectorPath to the root node. std::vector> unmergedLeafs = - root->append(std::get<0>(tuple)); + root->append(tuple.first); // append the leaf to the leafList. switch (unmergedLeafs.size()) { case 0: // if the leaf could be merged we take the leaf reference from the // parseSelector method. - leafList.push_back(std::get<1>(tuple)); + leafList.push_back(tuple.second); break; case 1: // if the leaf could not be merged we take the existing leaf. @@ -149,7 +149,7 @@ void CSSParser::parseSelectors(Rooted root, } } -std::tuple, Rooted> CSSParser::parseSelector( +std::pair, Rooted> CSSParser::parseSelector( CodeTokenizer &tokenizer, ParserContext &ctx) { Rooted s = parsePrimitiveSelector(tokenizer, ctx); @@ -157,7 +157,7 @@ std::tuple, Rooted> CSSParser::parseSelector( if (!tokenizer.peek(t)) { // if we are at the end the found selector is the immediate child as // well as the leaf. - return std::make_tuple(s, s); + return std::make_pair(s, s); } switch (t.tokenId) { case TOKEN_TEXT: { @@ -168,9 +168,9 @@ std::tuple, Rooted> CSSParser::parseSelector( auto tuple = parseSelector(tokenizer, ctx); // then we establish the DESCENDANT relationship s->getEdges().push_back(new SelectorNode::SelectorEdge( - ctx.manager, std::get<0>(tuple))); + ctx.manager, tuple.first)); // and we return this node as well as the leaf. - return std::make_tuple(s, std::get<1>(tuple)); + return std::make_pair(s, tuple.second); } case ARROW: { tokenizer.consumePeek(); @@ -180,15 +180,15 @@ std::tuple, Rooted> CSSParser::parseSelector( auto tuple = parseSelector(tokenizer, ctx); // then we establish the DESCENDANT relationship s->getEdges().push_back(new SelectorNode::SelectorEdge( - ctx.manager, std::get<0>(tuple), + ctx.manager, tuple.first, SelectionOperator::DIRECT_DESCENDANT)); // and we return this node as well as the leaf. - return std::make_tuple(s, std::get<1>(tuple)); + return std::make_pair(s, tuple.second); } default: // everything else is not part of the SelectorPath anymore. tokenizer.resetPeek(); - return std::make_tuple(s, s); + return std::make_pair(s, s); } } diff --git a/src/plugins/css/CSSParser.hpp b/src/plugins/css/CSSParser.hpp index 27a483d..a4d8cdc 100644 --- a/src/plugins/css/CSSParser.hpp +++ b/src/plugins/css/CSSParser.hpp @@ -20,7 +20,7 @@ #define _OUSIA_CSS_PARSER_HPP_ #include -#include +#include #include #include @@ -79,7 +79,7 @@ private: * of the SelectorTree and returns the beginning node of the path as first * element as well as the leaf of the path as second tuple element. */ - std::tuple, Rooted> parseSelector( + std::pair, Rooted> parseSelector( CodeTokenizer &tokenizer, ParserContext &ctx); /** -- cgit v1.2.3