KTextEditor

vimode/range.h
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 { ExclusiveMotion = 0, InclusiveMotion };
22
23class Range
24{
25public:
26 Range();
27
28 /**
29 * For motions which only return a position, in contrast to
30 * "text objects" which returns a full blown range.
31 */
32 explicit Range(int elin, int ecol, MotionType inc);
33
34 explicit Range(int slin, int scol, int elin, int ecol, MotionType mt);
35 explicit Range(const KTextEditor::Cursor c, MotionType mt);
36 explicit Range(const KTextEditor::Cursor c1, const KTextEditor::Cursor c2, MotionType mt);
37
38 /**
39 * Modifies this range so the start attributes are lesser than
40 * the end attributes.
41 */
42 void normalize();
43
44 /**
45 * @returns an equivalent KTextEditor::Range for this Range.
46 */
47 KTextEditor::Range toEditorRange() const;
48
49 /**
50 * Writes this KateViRange to the debug output in a nicely formatted way.
51 */
52 friend QDebug operator<<(QDebug s, const Range &range);
53
54 /**
55 * @returns an invalid KateViRange allocated on stack.
56 */
57 static Range invalid();
58
59public:
60 int startLine, startColumn;
61 int endLine, endColumn;
62 MotionType motionType;
63 bool valid, jump;
64};
65
66}
67
68#endif /* KATEVI_RANGE_H */
The Cursor represents a position in a Document.
Definition cursor.h:75
An object representing a section of text, from one Cursor to another.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Feb 24 2024 20:00:58 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.