| 1 |
// -*- related-file-name: "../../liblcdf/landmark.cc" -*- |
| 2 |
#ifndef LCDF_LANDMARK_HH |
| 3 |
#define LCDF_LANDMARK_HH |
| 4 |
#include <lcdf/string.hh> |
| 5 |
|
| 6 |
class Landmark { public: |
| 7 |
|
| 8 |
Landmark() : _file(), _line(~0U) { } |
| 9 |
explicit Landmark(const String &f) : _file(f), _line(~0U) { } |
| 10 |
Landmark(const String &f, unsigned l) : _file(f), _line(l) { } |
| 11 |
|
| 12 |
operator bool() const { return _file; } |
| 13 |
bool operator!() const { return !_file; } |
| 14 |
bool has_line() const { return _line != ~0U; } |
| 15 |
|
| 16 |
const String &file() const { return _file; } |
| 17 |
unsigned line() const { return _line; } |
| 18 |
|
| 19 |
Landmark next_line() const; |
| 20 |
Landmark whole_file() const { return Landmark(_file); } |
| 21 |
|
| 22 |
operator String() const; |
| 23 |
|
| 24 |
private: |
| 25 |
|
| 26 |
String _file; |
| 27 |
unsigned _line; |
| 28 |
|
| 29 |
}; |
| 30 |
|
| 31 |
Landmark operator+(const Landmark &, int); |
| 32 |
|
| 33 |
inline Landmark |
| 34 |
Landmark::next_line() const |
| 35 |
{ |
| 36 |
return *this + 1; |
| 37 |
} |
| 38 |
|
| 39 |
#endif |