summaryrefslogtreecommitdiff
path: root/src/core/CSS.cpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2014-12-17 02:29:22 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2014-12-17 02:29:22 +0100
commitf97c969d3a184dbb868eca97c850f2adaa72e3b7 (patch)
tree4fad7ef8d48434df2c03d0af20164632c2f019ed /src/core/CSS.cpp
parent0b4f9d0cb880bb1baa041c867e0a4bf191b0dfa2 (diff)
small style changed -- always pass input arguments as Handles and not Rooted -- otherwise a temporary Rooted has to be created and freed which may trigger unwanted garbage collector runs. Always use the C++ nullptr instread of NULL -- the first one is typesafe, the latter is not
Diffstat (limited to 'src/core/CSS.cpp')
-rw-r--r--src/core/CSS.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/core/CSS.cpp b/src/core/CSS.cpp
index d131fec..c42cf6c 100644
--- a/src/core/CSS.cpp
+++ b/src/core/CSS.cpp
@@ -60,42 +60,42 @@ std::vector<Rooted<SelectorNode>> SelectorNode::getChildren(
std::vector<Rooted<SelectorNode>> SelectorNode::getChildren(
const std::string &className, const PseudoSelector &select)
{
- return getChildren(NULL, &className, &select);
+ return getChildren(nullptr, &className, &select);
}
std::vector<Rooted<SelectorNode>> SelectorNode::getChildren(
const SelectionOperator &op, const PseudoSelector &select)
{
- return getChildren(&op, NULL, &select);
+ return getChildren(&op, nullptr, &select);
}
std::vector<Rooted<SelectorNode>> SelectorNode::getChildren(
const SelectionOperator &op, const std::string &className)
{
- return getChildren(&op, &className, NULL);
+ return getChildren(&op, &className, nullptr);
}
std::vector<Rooted<SelectorNode>> SelectorNode::getChildren(
const SelectionOperator &op)
{
- return getChildren(&op, NULL, NULL);
+ return getChildren(&op, nullptr, nullptr);
}
std::vector<Rooted<SelectorNode>> SelectorNode::getChildren(
const std::string &className)
{
- return getChildren(NULL, &className, NULL);
+ return getChildren(nullptr, &className, nullptr);
}
std::vector<Rooted<SelectorNode>> SelectorNode::getChildren(
const PseudoSelector &select)
{
- return getChildren(NULL, NULL, &select);
+ return getChildren(nullptr, nullptr, &select);
}
std::vector<Rooted<SelectorNode>> SelectorNode::getChildren()
{
- return getChildren(NULL, NULL, NULL);
+ return getChildren(nullptr, nullptr, nullptr);
}
/*
@@ -103,7 +103,7 @@ std::vector<Rooted<SelectorNode>> SelectorNode::getChildren()
*/
std::vector<Rooted<SelectorNode>> SelectorNode::append(
- Rooted<SelectorEdge> edge)
+ Handle<SelectorEdge> edge)
{
std::vector<Rooted<SelectorNode>> out;
// look if we already have a child in an equivalent edge.
@@ -111,7 +111,7 @@ std::vector<Rooted<SelectorNode>> SelectorNode::append(
getChildren(edge->getSelectionOperator(), edge->getTarget()->getName(),
edge->getTarget()->getPseudoSelector());
// note that this can only be one child or no child.
- if (children.size() == 0) {
+ if (children.empty()) {
// if there is no child the appending process is trivial: We can just
// add the whole subtree represented by the other node as child here.
edges.push_back(edge);
@@ -119,7 +119,7 @@ std::vector<Rooted<SelectorNode>> SelectorNode::append(
// otherwise we start the appending process recursively on the child
// level.
// TODO: RuleSet merging
- if (edge->getTarget()->getEdges().size() == 0) {
+ if (edge->getTarget()->getEdges().empty()) {
// if there are no more subsequent edges this is a leafe we could
// not merge, because it is already present in the Tree.
out.push_back(children[0]);
@@ -136,8 +136,7 @@ std::vector<Rooted<SelectorNode>> SelectorNode::append(
return out;
}
-std::vector<Rooted<SelectorNode>> SelectorNode::append(Rooted<SelectorNode> node){
- const Rooted<SelectorEdge> e {new SelectorEdge{node->getManager(), node}};
- return std::move(append(e));
+std::vector<Rooted<SelectorNode>> SelectorNode::append(Handle<SelectorNode> node){
+ return append(new SelectorEdge{this->getManager(), node});
}
}