• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • interfaces
  • 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
25using namespace KTextEditor;
26
27class KTextEditor::SmartInterfacePrivate
28{
29public:
30 SmartInterfacePrivate()
31 : mutex(QMutex::Recursive)
32 , clearOnDocumentReload(true)
33 {}
34
35 QMutex mutex;
36 bool clearOnDocumentReload;
37};
38
39SmartInterface::SmartInterface()
40 : d(new SmartInterfacePrivate)
41{
42}
43
44SmartInterface::~ SmartInterface( )
45{
46 delete d;
47}
48
49bool SmartInterface::clearOnDocumentReload() const
50{
51 return d->clearOnDocumentReload;
52}
53
54void SmartInterface::setClearOnDocumentReload(bool clearOnReload)
55{
56 QMutexLocker lock(smartMutex());
57 d->clearOnDocumentReload = clearOnReload;
58}
59
60QMutex * SmartInterface::smartMutex() const
61{
62 return &d->mutex;
63}
64
65void SmartInterface::clearRevision()
66{
67 useRevision(-1);
68}
69
70Cursor SmartInterface::translateFromRevision(const Cursor& cursor, SmartCursor::InsertBehavior insertBehavior) const
71{
72 Q_UNUSED(insertBehavior);
73 return cursor;
74}
75
76SmartCursor* SmartInterface::newSmartCursor(int line, int column, SmartCursor::InsertBehavior insertBehavior)
77{
78 return newSmartCursor(Cursor(line, column), insertBehavior);
79}
80
81SmartRange* 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
89SmartRange* 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
94Range 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;
KTextEditor::Cursor
An object which represents a position in a Document.
Definition: cursor.h:62
KTextEditor::Range
An object representing a section of text, from one Cursor to another.
Definition: range.h:55
KTextEditor::SmartCursor
A Cursor which is bound to a specific Document, and maintains its position.
Definition: smartcursor.h:66
KTextEditor::SmartCursor::InsertBehavior
InsertBehavior
Definition: smartcursor.h:187
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::SmartInterface::clearOnDocumentReload
bool clearOnDocumentReload() const
Returns whether the smart interface will be cleared on reload of the document.
Definition: smartinterface.cpp:49
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::SmartInterface::newSmartRange
virtual SmartRange * newSmartRange(const Range &range=Range(), SmartRange *parent=0L, SmartRange::InsertBehaviors insertBehavior=SmartRange::DoNotExpand)=0
Creates a new SmartRange.
KTextEditor::SmartInterface::newSmartCursor
virtual SmartCursor * newSmartCursor(const Cursor &position=Cursor::start(), SmartCursor::InsertBehavior insertBehavior=SmartCursor::MoveOnInsert)=0
Creates a new SmartCursor.
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::useRevision
virtual void useRevision(int revision)=0
Tell the smart interface to work against the given revision when creating cursors and ranges.
KTextEditor::SmartInterface::clearRevision
void clearRevision()
Clear any previous setting to use a specific revision.
Definition: smartinterface.cpp:65
KTextEditor::SmartInterface::SmartInterface
SmartInterface()
Definition: smartinterface.cpp:39
KTextEditor::SmartRange
A Range which is bound to a specific Document, and maintains its position.
Definition: smartrange.h:95
KTextEditor
Namespace for the KDE Text Editor Interfaces.
Definition: annotationinterface.h:31
smartinterface.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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