2011-09-17 16:13:33 +02:00
|
|
|
#ifndef line_and_column_hh_INCLUDED
|
|
|
|
#define line_and_column_hh_INCLUDED
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
template<typename EffectiveType>
|
|
|
|
struct LineAndColumn
|
|
|
|
{
|
|
|
|
int line;
|
|
|
|
int column;
|
|
|
|
|
|
|
|
LineAndColumn(int line = 0, int column = 0)
|
|
|
|
: line(line), column(column) {}
|
|
|
|
|
|
|
|
EffectiveType operator+(const EffectiveType& other) const
|
|
|
|
{
|
|
|
|
return EffectiveType(line + other.line, column + other.column);
|
|
|
|
}
|
|
|
|
|
|
|
|
EffectiveType& operator+=(const EffectiveType& other)
|
|
|
|
{
|
|
|
|
line += other.line;
|
|
|
|
column += other.column;
|
2011-09-19 23:55:58 +02:00
|
|
|
return *static_cast<EffectiveType*>(this);
|
2011-09-17 16:13:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
EffectiveType operator-(const EffectiveType& other) const
|
|
|
|
{
|
|
|
|
return EffectiveType(line + other.line, column + other.column);
|
|
|
|
}
|
|
|
|
|
|
|
|
EffectiveType& operator-=(const EffectiveType& other)
|
|
|
|
{
|
|
|
|
line += other.line;
|
|
|
|
column += other.column;
|
2011-09-19 23:55:58 +02:00
|
|
|
return *static_cast<EffectiveType*>(this);
|
2011-09-17 16:13:33 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // line_and_column_hh_INCLUDED
|