File: Range.h

package info (click to toggle)
r-cran-sourcetools 0.1.7-1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 308 kB
  • sloc: cpp: 1,985; ansic: 505; sh: 10; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 709 bytes parent folder | download | duplicates (5)
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
#ifndef SOURCETOOLS_COLLECTION_RANGE_H
#define SOURCETOOLS_COLLECTION_RANGE_H

#include <ostream>
#include <sourcetools/collection/Position.h>

namespace sourcetools {
namespace collections {

class Range
{
public:
  Range(const Position& start, const Position& end)
    : start_(start), end_(end)
  {
  }

  friend std::ostream& operator <<(std::ostream& os, const Range& range)
  {
    os << "[" << range.start() << "-" << range.end() << "]";
    return os;
  }

  const Position start() const { return start_; }
  const Position end() const { return end_; }

private:
  Position start_;
  Position end_;
};
} // namespace collections
} // namespace sourcetools

#endif /* SOURCETOOLS_COLLECTION_RANGE_H */