KTextEditor

vimode/range.h
1 /*
2  SPDX-FileCopyrightText: 2008 Erlend Hamberg <[email protected]>
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 <ktexteditor_export.h>
12 #include <vimode/definitions.h>
13 
14 namespace KTextEditor
15 {
16 class Cursor;
17 class Range;
18 }
19 
20 namespace KateVi
21 {
22 enum MotionType { ExclusiveMotion = 0, InclusiveMotion };
23 
24 class KTEXTEDITOR_EXPORT Range
25 {
26 public:
27  Range();
28 
29  /**
30  * For motions which only return a position, in contrast to
31  * "text objects" which returns a full blown range.
32  */
33  explicit Range(int elin, int ecol, MotionType inc);
34 
35  explicit Range(int slin, int scol, int elin, int ecol, MotionType mt);
36  explicit Range(const KTextEditor::Cursor c, MotionType mt);
37  explicit Range(const KTextEditor::Cursor c1, const KTextEditor::Cursor c2, MotionType mt);
38 
39  /**
40  * Modifies this range so the start attributes are lesser than
41  * the end attributes.
42  */
43  void normalize();
44 
45  /**
46  * @returns an equivalent KTextEditor::Range for this Range.
47  */
48  KTextEditor::Range toEditorRange() const;
49 
50  /**
51  * Writes this KateViRange to the debug output in a nicely formatted way.
52  */
53  friend QDebug operator<<(QDebug s, const Range &range);
54 
55  /**
56  * @returns an invalid KateViRange allocated on stack.
57  */
58  static Range invalid();
59 
60 public:
61  int startLine, startColumn;
62  int endLine, endColumn;
63  MotionType motionType;
64  bool valid, jump;
65 };
66 
67 }
68 
69 #endif /* KATEVI_RANGE_H */
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
An object representing a section of text, from one Cursor to another.
QString normalize(QStringView str)
The Cursor represents a position in a Document.
Definition: cursor.h:71
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition: katetextblock.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Jun 26 2022 03:49:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.