KTextEditor
smartinterface.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Christoph Cullmann (cullmann@kde.org) 00003 Copyright (C) 2005-2006 Hamish Rodda <rodda@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "smartinterface.h" 00022 00023 #include <QtCore/QMutex> 00024 00025 using namespace KTextEditor; 00026 00027 class KTextEditor::SmartInterfacePrivate 00028 { 00029 public: 00030 SmartInterfacePrivate() 00031 : mutex(QMutex::Recursive) 00032 , clearOnDocumentReload(true) 00033 {} 00034 00035 QMutex mutex; 00036 bool clearOnDocumentReload; 00037 }; 00038 00039 SmartInterface::SmartInterface() 00040 : d(new SmartInterfacePrivate) 00041 { 00042 } 00043 00044 SmartInterface::~ SmartInterface( ) 00045 { 00046 delete d; 00047 } 00048 00049 bool SmartInterface::clearOnDocumentReload() const 00050 { 00051 return d->clearOnDocumentReload; 00052 } 00053 00054 void SmartInterface::setClearOnDocumentReload(bool clearOnReload) 00055 { 00056 QMutexLocker lock(smartMutex()); 00057 d->clearOnDocumentReload = clearOnReload; 00058 } 00059 00060 QMutex * SmartInterface::smartMutex() const 00061 { 00062 return &d->mutex; 00063 } 00064 00065 void SmartInterface::clearRevision() 00066 { 00067 useRevision(-1); 00068 } 00069 00070 Cursor SmartInterface::translateFromRevision(const Cursor& cursor, SmartCursor::InsertBehavior insertBehavior) const 00071 { 00072 Q_UNUSED(insertBehavior); 00073 return cursor; 00074 } 00075 00076 SmartCursor* SmartInterface::newSmartCursor(int line, int column, SmartCursor::InsertBehavior insertBehavior) 00077 { 00078 return newSmartCursor(Cursor(line, column), insertBehavior); 00079 } 00080 00081 SmartRange* SmartInterface::newSmartRange(const Cursor& startPosition, 00082 const Cursor& endPosition, 00083 SmartRange* parent, 00084 SmartRange::InsertBehaviors insertBehavior) 00085 { 00086 return newSmartRange(Range(startPosition, endPosition), parent, insertBehavior); 00087 } 00088 00089 SmartRange* SmartInterface::newSmartRange(int startLine, int startColumn, int endLine, int endColumn, SmartRange* parent, SmartRange::InsertBehaviors insertBehavior) 00090 { 00091 return newSmartRange(Range(startLine, startColumn, endLine, endColumn), parent, insertBehavior); 00092 } 00093 00094 Range SmartInterface::translateFromRevision(const Range& range, SmartRange::InsertBehaviors insertBehavior) const 00095 { 00096 Q_UNUSED(insertBehavior); 00097 return range; 00098 } 00099 00100 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference