diff options
author | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-10-31 01:19:06 (GMT) |
---|---|---|
committer | kintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-10-31 01:19:06 (GMT) |
commit | 6ed27af1392953d44cf0c3f0f0bd0b82e3c69c4f (patch) | |
tree | fbcb75d32e8763aac3f0ad28528936a0ec11930b /src/nodedumper.h | |
parent | c8a2578bcb71c8d3f258c03d24e209dd8c2fef1e (diff) |
Committed current version of visitor refactoring
git-svn-id: http://svn.clifford.at/openscad/trunk@571 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src/nodedumper.h')
-rw-r--r-- | src/nodedumper.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/nodedumper.h b/src/nodedumper.h new file mode 100644 index 0000000..568d578 --- /dev/null +++ b/src/nodedumper.h @@ -0,0 +1,37 @@ +#ifndef NODEDUMPER_H_ +#define NODEDUMPER_H_ + +#include <string> +#include <map> +#include <list> +#include "visitor.h" +#include "nodecache.h" + +using std::string; +using std::map; +using std::list; + +class NodeDumper : public Visitor +{ +public: + NodeDumper() : root(NULL) {} + virtual ~NodeDumper() {} + + virtual Response visit(const State &state, const AbstractNode &node); + + const string &getDump() const; +private: + void handleVisitedChildren(const State &state, const AbstractNode &node); + bool isCached(const AbstractNode &node); + void handleIndent(const State &state); + string dumpChildren(const AbstractNode &node); + + string currindent; + const AbstractNode *root; + typedef list<const AbstractNode *> ChildList; + map<int, ChildList> visitedchildren; + NodeCache<string> cache; +}; + + +#endif |