Debian Codegraph @

inst/include/sourcetools/collection/Range.h

raw
1 #ifndef SOURCETOOLS_COLLECTION_RANGE_H
2 #define SOURCETOOLS_COLLECTION_RANGE_H
3
4 #include <ostream>
5 #include <sourcetools/collection/Position.h>
6
7 namespace sourcetools {
8 namespace collections {
9
10 class Range
11 {
12 public:
13 Range(const Position& start, const Position& end)
14 : start_(start), end_(end)
15 {
16 }
17
18 friend std::ostream& operator <<(std::ostream& os, const Range& range)
19 {
20 os << "[" << range.start() << "-" << range.end() << "]";
21 return os;
22 }
23
24 const Position start() const { return start_; }
25 const Position end() const { return end_; }
26
27 private:
28 Position start_;
29 Position end_;
30 };
31 } // namespace collections
32 } // namespace sourcetools
33
34 #endif /* SOURCETOOLS_COLLECTION_RANGE_H */