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

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • core
piecetablebytearraymodel.h
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Core library, made within the KDE community.
3 
4  Copyright 2008-2009 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef OKTETA_PIECETABLEBYTEARRAYMODEL_H
24 #define OKTETA_PIECETABLEBYTEARRAYMODEL_H
25 
26 // lib
27 #include "abstractbytearraymodel.h"
28 #include "versionable.h"
29 #include "bookmarkable.h"
30 #include "changesdescribable.h"
31 #include "changehistory.h"
32 
33 
34 namespace Okteta
35 {
36 
37 class PieceTableByteArrayModelPrivate;
38 
39 
44 class OKTETACORE_EXPORT PieceTableByteArrayModel : public AbstractByteArrayModel,
45  public Versionable,
46  public Bookmarkable,
47  public ChangesDescribable,
48  public ChangeHistory
49 {
50  Q_OBJECT
51  Q_INTERFACES(
52  Okteta::Versionable
53  Okteta::Bookmarkable
54  Okteta::ChangesDescribable
55  Okteta::ChangeHistory
56  )
57 
58  friend class PieceTableByteArrayModelPrivate;
59 
60  public:
61  explicit PieceTableByteArrayModel( const QByteArray& data, QObject* parent = 0 );
62  explicit PieceTableByteArrayModel( int size = 0, Byte fillByte = '\0', QObject* parent = 0 );
63 
64  virtual ~PieceTableByteArrayModel();
65 
66  public: // AbstractByteArrayModel API
67  virtual Byte byte( Address offset ) const;
68  virtual Size size() const;
69  virtual bool isReadOnly() const;
70  virtual bool isModified() const;
71 
72  virtual Size insert( Address offset, const Byte* insertData, int insertLength );
73  virtual Size remove( const AddressRange& removeRange );
74  virtual Size replace( const AddressRange& removeRange, const Byte* insertData, int insertLength );
75  virtual bool swap( Address firstStart, const AddressRange& secondRange );
76  virtual Size fill( Byte fillByte, Address offset = 0, Size fillLength = -1 );
77  virtual void setByte( Address offset, Byte byte );
78 
79  virtual void setModified( bool modified = true );
80  virtual void setReadOnly( bool isReadOnly = true );
81 
82 // virtual int indexOf( const char *searchString, int length, int from = 0 ) const;
83 // virtual int lastIndexOf( const char *searchString, int length, int from = -1 ) const;
84 
85  public: // Versionable API
86  virtual int versionIndex() const;
87  virtual int versionCount() const;
88  virtual QString versionDescription( int versionIndex ) const;
89 
90  public: // set/action
91  virtual void revertToVersionByIndex( int versionIndex );
92 
93  public: // Bookmarkable API
94  virtual void addBookmarks( const QList<Okteta::Bookmark> &bookmarks );
95  virtual void removeBookmarks( const QList<Okteta::Bookmark> &bookmarks );
96  virtual void removeAllBookmarks();
97  virtual void setBookmark( unsigned int index, const Okteta::Bookmark& bookmark );
98 
99  virtual Okteta::BookmarksConstIterator createBookmarksConstIterator() const;
100  virtual const Okteta::Bookmark& bookmarkAt( unsigned int index ) const;
101  virtual const Okteta::Bookmark& bookmarkFor( int offset ) const;
102  virtual bool containsBookmarkFor( int offset ) const;
103  virtual unsigned int bookmarksCount() const;
104 
105  public: // ChangesDescribable API
106  virtual void openGroupedChange( const QString &description );
107  virtual void cancelGroupedChange();
108  virtual void closeGroupedChange( const QString &description );
109 
110  public: // ChangeHistory API
111  virtual QList<ByteArrayChange> changes( int firstVersionIndex, int lastVersionIndex ) const;
112  virtual QByteArray initialData() const;
113  virtual void doChanges( const QList<Okteta::ByteArrayChange>& changes,
114  int oldVersionIndex, int newVersionIndex );
115 
116  public:
117  void setData( const QByteArray& data );
118 
119  Q_SIGNALS: // Versionable signals
120  /*virtual*/ void revertedToVersionIndex( int versionIndex );
121  /*virtual*/ void headVersionDescriptionChanged( const QString& versionDescription );
122  /*virtual*/ void headVersionChanged( int newHeadVersionIndex );
123 
124  Q_SIGNALS: // Bookmarkable signals
125  /*virtual*/ void bookmarksAdded( const QList<Okteta::Bookmark> &bookmarks );
126  /*virtual*/ void bookmarksRemoved( const QList<Okteta::Bookmark> &bookmarks );
127  /*virtual*/ void bookmarksModified( bool modified );
128  /*virtual*/ void bookmarksModified( const QList<int>& indizes );
129 
130  Q_SIGNALS: // ChangeHistory signals
131  /*virtual*/ void changesDone( const QList<Okteta::ByteArrayChange>& changes,
132  int oldVersionIndex, int newVersionIndex );
133 
134  protected:
135  PieceTableByteArrayModelPrivate* const d;
136 };
137 
138 }
139 
140 #endif
Okteta::Address
qint32 Address
Definition: address.h:34
Okteta::AbstractByteArrayModel
could it be useful to hide the data access behind an iterator? * class KDataBufferIterator { public: ...
Definition: abstractbytearraymodel.h:79
abstractbytearraymodel.h
versionable.h
Okteta::Bookmark
Definition: bookmark.h:38
KDE::NumberRange< Address, Size >
Okteta::Byte
unsigned char Byte
Definition: byte.h:29
Okteta::ChangesDescribable
Definition: changesdescribable.h:33
QObject
Okteta::Bookmarkable
Definition: bookmarkable.h:39
Okteta::ChangeHistory
Definition: changehistory.h:39
OKTETACORE_EXPORT
#define OKTETACORE_EXPORT
Definition: oktetacore_export.h:36
Okteta::BookmarksConstIterator
Definition: bookmarksconstiterator.h:36
changehistory.h
Okteta::PieceTableByteArrayModel::d
PieceTableByteArrayModelPrivate *const d
Definition: piecetablebytearraymodel.h:135
Okteta::PieceTableByteArrayModelPrivate
Definition: piecetablebytearraymodel_p.h:40
changesdescribable.h
Okteta::Versionable
Definition: core/versionable.h:34
Okteta::Size
qint32 Size
Definition: size.h:33
Okteta::PieceTableByteArrayModel
Definition: piecetablebytearraymodel.h:44
bookmarkable.h
QList
Definition: bookmarkable.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

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

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

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