1/*
2 SPDX-FileCopyrightText: 2008 Erlend Hamberg <ehamberg@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATEVI_RANGE_H
8#define KATEVI_RANGE_H
9
10#include <QDebug>
11#include <vimode/definitions.h>
12
13namespace KTextEditor
14{
15class Cursor;
16class Range;
17}
18
19namespace KateVi
20{
21enum MotionType {
22 ExclusiveMotion = 0,
23 InclusiveMotion
24};
25
26class Range
27{
28public:
29 Range();
30
31 /**
32 * For motions which only return a position, in contrast to
33 * "text objects" which returns a full blown range.
34 */
35 explicit Range(int elin, int ecol, MotionType inc);
36
37 explicit Range(int slin, int scol, int elin, int ecol, MotionType mt);
38 explicit Range(const KTextEditor::Cursor c, MotionType mt);
39 explicit Range(const KTextEditor::Cursor c1, const KTextEditor::Cursor c2, MotionType mt);
40
41 /**
42 * Modifies this range so the start attributes are lesser than
43 * the end attributes.
44 */
45 void normalize();
46
47 /**
48 * @returns an equivalent KTextEditor::Range for this Range.
49 */
50 KTextEditor::Range toEditorRange() const;
51
52 /**
53 * Writes this KateViRange to the debug output in a nicely formatted way.
54 */
55 friend QDebug operator<<(QDebug s, const Range &range);
56
57 /**
58 * @returns an invalid KateViRange allocated on stack.
59 */
60 static Range invalid();
61
62public:
63 int startLine, startColumn;
64 int endLine, endColumn;
65 MotionType motionType;
66 bool valid, jump;
67};
68
69}
70
71#endif /* KATEVI_RANGE_H */
72

source code of ktexteditor/src/vimode/range.h