summaryrefslogtreecommitdiff
path: root/traveler/Traveler.hh
blob: 09f8d0d78cd8dfea91c1d92fa955c79966cbecb1 (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
#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 Traveler {
  public:
    Traveler(std::ostream& out);
    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:
    std::ostream& out_;
};
} // namespace pcc

#endif // !PCC_TRAVELER_HH