blob: 92f5b9915abdb1882bb331c0be71585cbe9eac59 (
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
37
38
39
40
41
42
43
44
45
46
|
#ifndef PCC_TRAVELER_HH
#define PCC_TRAVELER_HH
#include <ostream>
#include "Type.hh"
#include "TypeIdentifier.hh"
namespace pcc {
enum class TravelPart {
PREFIX,
NAME_BEGIN,
NAME_END,
DESCRPTION_BEGIN,
DESCRPTION_END,
CHILD_BEGIN,
CHILD_END,
LAST_CHILD_BEGIN,
LAST_CHILD_END,
END
};
class BaseNode;
class Traveler {
public:
Traveler(std::ostream& out);
void Travel(std::shared_ptr<BaseNode> root);
virtual Traveler& operator<<(TravelPart part) = 0;
Traveler& operator<<(std::shared_ptr<Type> type);
Traveler& operator<<(std::shared_ptr<TypeIdentifier> identifier);
template <typename T>
Traveler& operator<<(T value) {
out_ << value;
return *this;
}
protected:
virtual void PreTravel();
virtual void PostTravel();
std::ostream& out_;
};
} // namespace pcc
#endif // !PCC_TRAVELER_HH
|