Changeset View
Changeset View
Standalone View
Standalone View
src/selection.h
1 | /*************************************************************************** | 1 | /*************************************************************************** | ||
---|---|---|---|---|---|
2 | * Copyright (C) 2003-2011 by Joachim Eibl * | 2 | * Copyright (C) 2003-2011 by Joachim Eibl * | ||
3 | * joachim.eibl at gmx.de * | 3 | * joachim.eibl at gmx.de * | ||
4 | * * | 4 | * * | ||
5 | * This program is free software; you can redistribute it and/or modify * | 5 | * This program is free software; you can redistribute it and/or modify * | ||
6 | * it under the terms of the GNU General Public License as published by * | 6 | * it under the terms of the GNU General Public License as published by * | ||
7 | * the Free Software Foundation; either version 2 of the License, or * | 7 | * the Free Software Foundation; either version 2 of the License, or * | ||
8 | * (at your option) any later version. * | 8 | * (at your option) any later version. * | ||
9 | ***************************************************************************/ | 9 | ***************************************************************************/ | ||
10 | #ifndef SELECTION_H | ||||
11 | #define SELECTION_H | ||||
10 | 12 | | |||
11 | #include "gnudiff_diff.h" | 13 | #include "gnudiff_diff.h" | ||
12 | #include "common.h" | 14 | #include "common.h" | ||
13 | 15 | | |||
14 | class Selection | 16 | class Selection | ||
15 | { | 17 | { | ||
16 | public: | 18 | public: | ||
17 | Selection(){} | 19 | Selection(){} | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 72 | LineRef endLine(){ | |||
71 | if (firstLine<0 && lastLine<0) return invalidRef; | 73 | if (firstLine<0 && lastLine<0) return invalidRef; | ||
72 | return std::max(firstLine,lastLine); | 74 | return std::max(firstLine,lastLine); | ||
73 | } | 75 | } | ||
74 | int beginPos() { return firstLine==lastLine ? std::min(firstPos,lastPos) : | 76 | int beginPos() { return firstLine==lastLine ? std::min(firstPos,lastPos) : | ||
75 | firstLine<lastLine ? (firstLine<0?0:firstPos) : (lastLine<0?0:lastPos); } | 77 | firstLine<lastLine ? (firstLine<0?0:firstPos) : (lastLine<0?0:lastPos); } | ||
76 | int endPos() { return firstLine==lastLine ? std::max(firstPos,lastPos) : | 78 | int endPos() { return firstLine==lastLine ? std::max(firstPos,lastPos) : | ||
77 | firstLine<lastLine ? lastPos : firstPos; } | 79 | firstLine<lastLine ? lastPos : firstPos; } | ||
78 | }; | 80 | }; | ||
81 | | ||||
82 | #endif |