summaryrefslogtreecommitdiff
path: root/src/core/CSS.hpp
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-03 17:01:46 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-03 17:01:46 +0100
commite91ba1faf25790eea34e7ae743aff06752f1ea8c (patch)
tree8ebacca554e639ddcbc547621076154d5cfaba45 /src/core/CSS.hpp
parent4a398a6771b42e1c928e2cbee35f8e5645e40369 (diff)
Convenience versions for SelectorNode::getChildren.
Diffstat (limited to 'src/core/CSS.hpp')
-rw-r--r--src/core/CSS.hpp68
1 files changed, 65 insertions, 3 deletions
diff --git a/src/core/CSS.hpp b/src/core/CSS.hpp
index c313f25..8c87ee7 100644
--- a/src/core/CSS.hpp
+++ b/src/core/CSS.hpp
@@ -250,6 +250,13 @@ private:
// TODO: This is temporarily commented out until the TypeSystem works.
// Owned<RuleSet> ruleSets;
+ /**
+ * This is an internal method all getChildren variants refer to.
+ */
+ std::vector<Rooted<SelectorNode>> getChildren(const SelectionOperator *op,
+ const std::string *className,
+ const PseudoSelector *select);
+
public:
SelectorNode(Manager &mgr, std::string name, PseudoSelector pseudoSelector)
: Node(mgr, std::move(name)),
@@ -260,6 +267,15 @@ public:
{
}
+ SelectorNode(Manager &mgr, std::string name)
+ : Node(mgr, std::move(name)),
+ pseudoSelector("true", false),
+ edges(this) //,
+ // TODO: This is temporarily commented out until the TypeSystem works.
+ // ruleSets(acquire(ruleSets))
+ {
+ }
+
const PseudoSelector &getPseudoSelector() const { return pseudoSelector; }
ManagedVector<SelectorEdge> &getEdges() { return edges; }
@@ -269,15 +285,61 @@ public:
// ruleSets; }
/**
- * This returns all children of this SelectorNode that are connected by
- * the given operator, have the given className and the given
- * PseudoSelector.
+ * This returns the child of this SelectorNode that is connected by
+ * the given operator, has the given className and the given
+ * PseudoSelector. For convention reasons with the other methods, this
+ * also returns a vector, which might either be empty or has exactly one
+ * element.
*/
std::vector<Rooted<SelectorNode>> getChildren(const SelectionOperator &op,
const std::string &className,
const PseudoSelector &select);
/**
+ * This returns all children of this SelectorNode that have the given
+ * className and the given PseudoSelector.
+ */
+ std::vector<Rooted<SelectorNode>> getChildren(const std::string &className,
+ const PseudoSelector &select);
+
+ /**
+ * This returns all children of this SelectorNode that are connected by the
+ * given SelectionOperator and have the given PseudoSelector.
+ */
+ std::vector<Rooted<SelectorNode>> getChildren(const SelectionOperator &op,
+ const PseudoSelector &select);
+
+ /**
+ * This returns all children of this SelectorNode that are connected by the
+ * given SelectionOperator and have the given className.
+ */
+ std::vector<Rooted<SelectorNode>> getChildren(const SelectionOperator &op,
+ const std::string &className);
+
+ /**
+ * This returns all children of this SelectorNode that are connected by the
+ * given SelectionOperator.
+ */
+ std::vector<Rooted<SelectorNode>> getChildren(const SelectionOperator &op);
+
+ /**
+ * This returns all children of this SelectorNode that have the given
+ * className.
+ */
+ std::vector<Rooted<SelectorNode>> getChildren(const std::string &className);
+
+ /**
+ * This returns all children of this SelectorNode that have the given
+ * PseudoSelector.
+ */
+ std::vector<Rooted<SelectorNode>> getChildren(const PseudoSelector &select);
+
+ /**
+ * This returns all children of this SelectorNode.
+ */
+ std::vector<Rooted<SelectorNode>> getChildren();
+
+ /**
* This appends the given edge and the subsequent SelectorTree to
* this SelectorNode. Note that only those nodes get appended to the
* SelectorTree that are not already contained in this SelectorTree.