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

Kate

katetexthistory.h

Go to the documentation of this file.
00001 /*  This file is part of the Kate project.
00002  *
00003  *  Copyright (C) 2010 Christoph Cullmann <cullmann@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 #ifndef KATE_TEXTHISTORY_H
00022 #define KATE_TEXTHISTORY_H
00023 
00024 #include <QtCore/QList>
00025 
00026 #include <ktexteditor/range.h>
00027 
00028 #include "katepartprivate_export.h"
00029 #include "katetextcursor.h"
00030 #include "katetextrange.h"
00031 
00032 namespace Kate {
00033 
00034 class TextBuffer;
00035 
00039 class KATEPART_TESTS_EXPORT TextHistory {
00040   friend class TextBuffer;
00041   friend class TextBlock;
00042 
00043   public:
00048     qint64 revision () const;
00049 
00054     qint64 lastSavedRevision () const { return m_lastSavedRevision; }
00055 
00061     void lockRevision (qint64 revision);
00062 
00067     void unlockRevision (qint64 revision);
00068 
00077     void transformCursor (int& line, int& column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision = -1);
00078 
00087     void transformRange (KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, KTextEditor::MovingRange::EmptyBehavior emptyBehavior, qint64 fromRevision, qint64 toRevision = -1);
00088 
00089   private:
00093     class Entry {
00094       public:
00101         void transformCursor (int &line, int &column, bool moveOnInsert) const;
00102         
00109         void reverseTransformCursor (int &line, int &column, bool moveOnInsert) const;
00110 
00114         enum Type {
00115           NoChange
00116           , WrapLine
00117           , UnwrapLine
00118           , InsertText
00119           , RemoveText
00120         };
00121 
00125         Entry ()
00126          : referenceCounter (0), type (NoChange), line (-1), column (-1), length (-1), oldLineLength (-1)
00127         {
00128         }
00129 
00133         unsigned int referenceCounter;
00134 
00138         Type type;
00139 
00143         int line;
00144 
00148         int column;
00149 
00153         int length;
00154 
00158         int oldLineLength;
00159     };
00160 
00165     TextHistory (TextBuffer &buffer);
00166 
00170     ~TextHistory ();
00171 
00175     void clear ();
00176 
00180     void setLastSavedRevision ();
00181 
00186     void wrapLine (const KTextEditor::Cursor &position);
00187 
00193     void unwrapLine (int line, int oldLineLength);
00194 
00201     void insertText (const KTextEditor::Cursor &position, int length, int oldLineLength);
00202 
00208     void removeText (const KTextEditor::Range &range, int oldLineLength);
00209 
00214     void addEntry (const Entry &entry);
00215 
00216   private:
00220     TextBuffer &m_buffer;
00221 
00225     qint64 m_lastSavedRevision;
00226 
00230     QList<Entry> m_historyEntries;
00231 
00235     qint64 m_firstHistoryEntryRevision;
00236 };
00237 
00238 }
00239 
00240 #endif

Kate

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal