• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • kde-4.14
  • applications
  • kate
  • ktexteditor
smartinterface.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 2001 Christoph Cullmann (cullmann@kde.org)
3  Copyright (C) 2005-2006 Hamish Rodda <rodda@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "smartinterface.h"
22 
23 #include <QtCore/QMutex>
24 
25 using namespace KTextEditor;
26 
27 class KTextEditor::SmartInterfacePrivate
28 {
29 public:
30  SmartInterfacePrivate()
31  : mutex(QMutex::Recursive)
32  , clearOnDocumentReload(true)
33  {}
34 
35  QMutex mutex;
36  bool clearOnDocumentReload;
37 };
38 
39 SmartInterface::SmartInterface()
40  : d(new SmartInterfacePrivate)
41 {
42 }
43 
44 SmartInterface::~ SmartInterface( )
45 {
46  delete d;
47 }
48 
49 bool SmartInterface::clearOnDocumentReload() const
50 {
51  return d->clearOnDocumentReload;
52 }
53 
54 void SmartInterface::setClearOnDocumentReload(bool clearOnReload)
55 {
56  QMutexLocker lock(smartMutex());
57  d->clearOnDocumentReload = clearOnReload;
58 }
59 
60 QMutex * SmartInterface::smartMutex() const
61 {
62  return &d->mutex;
63 }
64 
65 void SmartInterface::clearRevision()
66 {
67  useRevision(-1);
68 }
69 
70 Cursor SmartInterface::translateFromRevision(const Cursor& cursor, SmartCursor::InsertBehavior insertBehavior) const
71 {
72  Q_UNUSED(insertBehavior);
73  return cursor;
74 }
75 
76 SmartCursor* SmartInterface::newSmartCursor(int line, int column, SmartCursor::InsertBehavior insertBehavior)
77 {
78  return newSmartCursor(Cursor(line, column), insertBehavior);
79 }
80 
81 SmartRange* SmartInterface::newSmartRange(const Cursor& startPosition,
82  const Cursor& endPosition,
83  SmartRange* parent,
84  SmartRange::InsertBehaviors insertBehavior)
85 {
86  return newSmartRange(Range(startPosition, endPosition), parent, insertBehavior);
87 }
88 
89 SmartRange* SmartInterface::newSmartRange(int startLine, int startColumn, int endLine, int endColumn, SmartRange* parent, SmartRange::InsertBehaviors insertBehavior)
90 {
91  return newSmartRange(Range(startLine, startColumn, endLine, endColumn), parent, insertBehavior);
92 }
93 
94 Range SmartInterface::translateFromRevision(const Range& range, SmartRange::InsertBehaviors insertBehavior) const
95 {
96  Q_UNUSED(insertBehavior);
97  return range;
98 }
99 
100 // kate: space-indent on; indent-width 2; replace-tabs on;
QMutex
KTextEditor::SmartInterface::~SmartInterface
virtual ~SmartInterface()
Definition: smartinterface.cpp:44
KTextEditor::SmartInterface::translateFromRevision
virtual KTextEditor::Cursor translateFromRevision(const KTextEditor::Cursor &cursor, KTextEditor::SmartCursor::InsertBehavior insertBehavior=KTextEditor::SmartCursor::StayOnInsert) const
Translate the given cursor against the revision specified through useRevision(), using the given inse...
Definition: smartinterface.cpp:70
KTextEditor::SmartCursor::InsertBehavior
InsertBehavior
Definition: smartcursor.h:187
KTextEditor::SmartInterface::useRevision
virtual void useRevision(int revision)=0
Tell the smart interface to work against the given revision when creating cursors and ranges...
KTextEditor::SmartInterface::setClearOnDocumentReload
void setClearOnDocumentReload(bool clearOnReload)
Specify whether the smart interface should be cleared on reload of the document.
Definition: smartinterface.cpp:54
KTextEditor::SmartRange
A Range which is bound to a specific Document, and maintains its position.
Definition: smartrange.h:94
KTextEditor::Cursor
An object which represents a position in a Document.
Definition: cursor.h:55
KTextEditor::SmartInterface::newSmartRange
virtual SmartRange * newSmartRange(const Range &range=Range(), SmartRange *parent=0L, SmartRange::InsertBehaviors insertBehavior=SmartRange::DoNotExpand)=0
Creates a new SmartRange.
KTextEditor::SmartCursor
A Cursor which is bound to a specific Document, and maintains its position.
Definition: smartcursor.h:65
KTextEditor::Range
An object representing a section of text, from one Cursor to another.
Definition: range.h:54
KTextEditor::SmartInterface::smartMutex
QMutex * smartMutex() const
Provides access to the recursive mutex used to protect write access to smart interface objects (curso...
Definition: smartinterface.cpp:60
KTextEditor::SmartInterface::clearOnDocumentReload
bool clearOnDocumentReload() const
Returns whether the smart interface will be cleared on reload of the document.
Definition: smartinterface.cpp:49
QMutexLocker
smartinterface.h
KTextEditor::SmartInterface::clearRevision
void clearRevision()
Clear any previous setting to use a specific revision.
Definition: smartinterface.cpp:65
KTextEditor::SmartInterface::newSmartCursor
virtual SmartCursor * newSmartCursor(const Cursor &position=Cursor::start(), SmartCursor::InsertBehavior insertBehavior=SmartCursor::MoveOnInsert)=0
Creates a new SmartCursor.
KTextEditor::SmartInterface::SmartInterface
SmartInterface()
Definition: smartinterface.cpp:39
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal