blob: ac965ca19acd17c253a9ee0fab7ba719002b1c48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#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
|