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 {
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 */
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 Mon Nov 18 2024 12:11:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.