diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-03 17:01:46 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-03 17:01:46 +0100 |
commit | e91ba1faf25790eea34e7ae743aff06752f1ea8c (patch) | |
tree | 8ebacca554e639ddcbc547621076154d5cfaba45 /src/core/CSS.cpp | |
parent | 4a398a6771b42e1c928e2cbee35f8e5645e40369 (diff) |
Convenience versions for SelectorNode::getChildren.
Diffstat (limited to 'src/core/CSS.cpp')
-rw-r--r-- | src/core/CSS.cpp | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/src/core/CSS.cpp b/src/core/CSS.cpp index c2397d1..8beb075 100644 --- a/src/core/CSS.cpp +++ b/src/core/CSS.cpp @@ -20,19 +20,23 @@ namespace ousia { +/* + * different versions of "getChildren". + */ + std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( - const SelectionOperator &op, const std::string &className, - const PseudoSelector &select) + const SelectionOperator *op, const std::string *className, + const PseudoSelector *select) { std::vector<Rooted<SelectorNode>> out; for (auto &e : edges) { - if (e->getSelectionOperator() != op) { + if (op && e->getSelectionOperator() != *op) { continue; } - if (e->getTarget()->getName() != className) { + if (className && e->getTarget()->getName() != *className) { continue; } - if (e->getTarget()->getPseudoSelector() != select) { + if (select && e->getTarget()->getPseudoSelector() != *select) { continue; } out.push_back(e->getTarget()); @@ -40,6 +44,58 @@ std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( return out; } +std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( + const SelectionOperator &op, const std::string &className, + const PseudoSelector &select) +{ + return getChildren(&op, &className, &select); +} + +std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( + const std::string &className, const PseudoSelector &select) +{ + return getChildren(NULL, &className, &select); +} + +std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( + const SelectionOperator &op, const PseudoSelector &select) +{ + return getChildren(&op, NULL, &select); +} + +std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( + const SelectionOperator &op, const std::string &className) +{ + return getChildren(&op, &className, NULL); +} + +std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( + const SelectionOperator &op) +{ + return getChildren(&op, NULL, NULL); +} + +std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( + const std::string &className) +{ + return getChildren(NULL, &className, NULL); +} + +std::vector<Rooted<SelectorNode>> SelectorNode::getChildren( + const PseudoSelector &select) +{ + return getChildren(NULL, NULL, &select); +} + +std::vector<Rooted<SelectorNode>> SelectorNode::getChildren() +{ + return getChildren(NULL, NULL, NULL); +} + +/* + * append + */ + std::vector<Rooted<SelectorNode>> SelectorNode::append( Rooted<SelectorEdge> edge) { |