diff options
author | Marius Kintel <marius@kintel.net> | 2011-09-11 05:37:14 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-09-11 05:37:14 (GMT) |
commit | 9afeded46c0e9023002dc04ba6131adcb39762b1 (patch) | |
tree | 0096a12ce36a5b39aa18d7ec5da45c05eb3d42dd /src/Tree.cc | |
parent | b087e68e5430c3dde6adfe452becbaba0f680196 (diff) | |
parent | dc7eeb30d06a928a30ee47a765be3e5a61288d35 (diff) |
Merge branch 'polyset-cleanup' into visitor
Diffstat (limited to 'src/Tree.cc')
-rw-r--r-- | src/Tree.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/Tree.cc b/src/Tree.cc index a451f24..7615a3d 100644 --- a/src/Tree.cc +++ b/src/Tree.cc @@ -2,12 +2,18 @@ #include "nodedumper.h" #include <assert.h> +#include <algorithm> + +static bool filter(char c) +{ + return c == ' ' || c == '\n' || c == '\t' || c == '\r'; +} /*! - Returns the cached string representation of the subtree rootet by \a node. + Returns the cached string representation of the subtree rooted by \a node. If node is not cached, the cache will be rebuilt. */ -const std::string &Tree::getString(const AbstractNode &node) const +const std::string Tree::getString(const AbstractNode &node) const { assert(this->root_node); if (!this->nodecache.contains(node)) { @@ -17,7 +23,10 @@ const std::string &Tree::getString(const AbstractNode &node) const assert(this->nodecache.contains(*this->root_node) && "NodeDumper failed to create a cache"); } - return this->nodecache[node]; + std::string str = this->nodecache[node]; + str.erase(std::remove_if(str.begin(), str.end(), filter), str.end()); + + return str; } /*! |