1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef SOURCE_LOCATION_H
6#define SOURCE_LOCATION_H
7
8#include <SupportDefs.h>
9
10
11class SourceLocation {
12public:
13	SourceLocation(int32 line = 0, int32 column = 0)
14		:
15		fLine(line),
16		fColumn(column)
17	{
18	}
19
20	bool operator==(const SourceLocation& other) const
21	{
22		return fLine == other.fLine && fColumn == other.fColumn;
23	}
24
25	bool operator!=(const SourceLocation& other) const
26	{
27		return !(*this == other);
28	}
29
30	bool operator<(const SourceLocation& other) const
31	{
32		return fLine < other.fLine
33			|| (fLine == other.fLine && fColumn < other.fColumn);
34	}
35
36	bool operator<=(const SourceLocation& other) const
37	{
38		return fLine < other.fLine
39			|| (fLine == other.fLine && fColumn <= other.fColumn);
40	}
41
42	int32 Line() const
43	{
44		return fLine;
45	}
46
47	int32 Column() const
48	{
49		return fColumn;
50	}
51
52private:
53	int32	fLine;
54	int32	fColumn;
55};
56
57
58#endif	// SOURCE_LOCATION_H
59