summaryrefslogtreecommitdiff
path: root/src/core/CSS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/CSS.cpp')
-rw-r--r--src/core/CSS.cpp66
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)
{