• 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
bytearraymodel.cpp
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 2003,2007-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 #include "bytearraymodel.h"
24 
25 // lib
26 #include "bytearraymodel_p.h"
27 #include "arraychangemetricslist.h"
28 
29 
30 namespace Okteta
31 {
32 
33 ByteArrayModel::ByteArrayModel( Byte* data, int size, int rawSize, bool keepMemory, QObject* parent )
34  : AbstractByteArrayModel( parent ),
35  d( new ByteArrayModelPrivate(this,data,size,rawSize,keepMemory) )
36 {}
37 
38 ByteArrayModel::ByteArrayModel( const Byte* data, int size, QObject* parent )
39  : AbstractByteArrayModel( parent ),
40  d( new ByteArrayModelPrivate(this,data,size) )
41 {}
42 
43 ByteArrayModel::ByteArrayModel( int size, int maxSize, QObject* parent )
44  : AbstractByteArrayModel( parent ),
45  d( new ByteArrayModelPrivate(this,size,maxSize) )
46 {}
47 
48 
49 Byte ByteArrayModel::byte( Address offset ) const { return d->byte(offset); }
50 Size ByteArrayModel::size() const { return d->size(); }
51 
52 bool ByteArrayModel::isReadOnly() const { return d->isReadOnly(); }
53 bool ByteArrayModel::isModified() const { return d->isModified(); }
54 
55 void ByteArrayModel::setReadOnly( bool readOnly ) { d->setReadOnly( readOnly ); }
56 void ByteArrayModel::setModified( bool modified ) { d->setModified( modified ); }
57 void ByteArrayModel::setMaxSize( int maxSize ) { d->setMaxSize( maxSize ); }
58 void ByteArrayModel::setKeepsMemory( bool keepsMemory ) { d->setKeepsMemory( keepsMemory ); }
59 void ByteArrayModel::setAutoDelete( bool autoDelete ) { d->setAutoDelete( autoDelete ); }
60 
61 void ByteArrayModel::setData( Byte* data, int size, int rawSize, bool keepMemory )
62 {
63  d->setData( data, size, rawSize, keepMemory );
64 }
65 
66 Byte* ByteArrayModel::data() const { return d->data(); }
67 int ByteArrayModel::maxSize() const { return d->maxSize(); }
68 bool ByteArrayModel::keepsMemory() const { return d->keepsMemory(); }
69 bool ByteArrayModel::autoDelete() const { return d->autoDelete(); }
70 
71 void ByteArrayModel::signalContentsChanged( int start, int end )
72 {
73  const int length = end - start + 1;
74  emit contentsChanged( ArrayChangeMetricsList::oneReplacement(start,length,length) );
75 }
76 
77 
78 void ByteArrayModel::setByte( Address offset, Byte byte )
79 {
80  d->setByte( offset, byte );
81 }
82 
83 Size ByteArrayModel::insert( Address offset, const Byte* insertData, int insertLength )
84 {
85  return d->insert( offset, insertData, insertLength );
86 }
87 
88 Size ByteArrayModel::remove( const AddressRange& removeRange )
89 {
90  return d->remove( removeRange );
91 }
92 
93 Size ByteArrayModel::replace( const AddressRange& removeRange, const Byte* insertData, int insertLength )
94 {
95  return d->replace( removeRange, insertData, insertLength );
96 }
97 
98 bool ByteArrayModel::swap( Address firstStart, const AddressRange& secondRange )
99 {
100  return d->swap( firstStart, secondRange );
101 }
102 
103 Size ByteArrayModel::fill( Byte fillByte, Address offset, Size fillLength )
104 {
105  return d->fill( fillByte, offset, fillLength );
106 }
107 
108 void ByteArrayModel::addBookmarks( const QList<Okteta::Bookmark> &bookmarks )
109 {
110  d->addBookmarks( bookmarks );
111 }
112 
113 void ByteArrayModel::removeBookmarks( const QList<Okteta::Bookmark> &bookmarks )
114 {
115  d->removeBookmarks( bookmarks );
116 }
117 
118 void ByteArrayModel::removeAllBookmarks()
119 {
120  d->removeAllBookmarks();
121 }
122 
123 void ByteArrayModel::setBookmark( unsigned int index, const Okteta::Bookmark& bookmark )
124 {
125  d->setBookmark( index, bookmark );
126 }
127 
128 Okteta::BookmarksConstIterator ByteArrayModel::createBookmarksConstIterator() const
129 {
130  return d->createBookmarksConstIterator();
131 }
132 
133 const Okteta::Bookmark& ByteArrayModel::bookmarkFor( int offset ) const
134 {
135  return d->bookmarkFor( offset );
136 }
137 
138 const Okteta::Bookmark& ByteArrayModel::bookmarkAt( unsigned int index ) const
139 {
140  return d->bookmarkAt( index );
141 }
142 
143 bool ByteArrayModel::containsBookmarkFor( int offset ) const
144 {
145  return d->containsBookmarkFor( offset );
146 }
147 
148 unsigned int ByteArrayModel::bookmarksCount() const
149 {
150  return d->bookmarksCount();
151 }
152 
153 ByteArrayModel::~ByteArrayModel()
154 {
155  delete d;
156 }
157 
158 }
Okteta::ByteArrayModelPrivate
Definition: bytearraymodel_p.h:39
Okteta::ByteArrayModelPrivate::bookmarksCount
unsigned int bookmarksCount() const
Definition: bytearraymodel_p.h:206
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
Okteta::ByteArrayModel::bookmarksCount
virtual unsigned int bookmarksCount() const
Definition: bytearraymodel.cpp:148
Okteta::ByteArrayModel::isModified
virtual bool isModified() const
Definition: bytearraymodel.cpp:53
Okteta::ByteArrayModel::setAutoDelete
void setAutoDelete(bool autoDelete=true)
sets whether the memory given by setData or in the constructor gets deleted in destructor or when new...
Definition: bytearraymodel.cpp:59
Okteta::ByteArrayModel::autoDelete
bool autoDelete() const
Definition: bytearraymodel.cpp:69
Okteta::ByteArrayModel::keepsMemory
bool keepsMemory() const
returns whether the memory of the byte array is kept on resize
Definition: bytearraymodel.cpp:68
Okteta::ByteArrayModelPrivate::removeBookmarks
void removeBookmarks(const QList< Bookmark > &bookmarks)
Definition: bytearraymodel_p.h:171
Okteta::ByteArrayModelPrivate::addBookmarks
void addBookmarks(const QList< Bookmark > &bookmarks)
Definition: bytearraymodel_p.h:166
Okteta::Bookmark
Definition: bookmark.h:38
KDE::NumberRange< Address, Size >
Okteta::ByteArrayModelPrivate::setAutoDelete
void setAutoDelete(bool autoDelete=true)
Definition: bytearraymodel_p.h:143
Okteta::Byte
unsigned char Byte
Definition: byte.h:29
Okteta::ByteArrayModel::addBookmarks
virtual void addBookmarks(const QList< Okteta::Bookmark > &bookmarks)
Definition: bytearraymodel.cpp:108
Okteta::ByteArrayModel::replace
virtual Size replace(const AddressRange &removeRange, const Byte *insertData, int insertLength)
replaces as much as possible
Definition: bytearraymodel.cpp:93
Okteta::ByteArrayModelPrivate::isModified
bool isModified() const
Definition: bytearraymodel_p.h:131
Okteta::ByteArrayModel::setKeepsMemory
void setKeepsMemory(bool keepsMemory=true)
sets whether the memory given by setData or in the constructor should be kept on resize ...
Definition: bytearraymodel.cpp:58
Okteta::ByteArrayModel::insert
virtual Size insert(Address offset, const Byte *insertData, int insertLength)
inserts bytes copied from the given source at Position.
Definition: bytearraymodel.cpp:83
Okteta::ByteArrayModelPrivate::maxSize
int maxSize() const
Definition: bytearraymodel_p.h:162
Okteta::ByteArrayModel::setData
void setData(Byte *data, int size, int rawSize=-1, bool keepsMemory=true)
Definition: bytearraymodel.cpp:61
QObject
Okteta::ByteArrayModelPrivate::setByte
void setByte(Address offset, Byte byte)
Definition: bytearraymodel_p.h:144
Okteta::ByteArrayModelPrivate::autoDelete
bool autoDelete() const
Definition: bytearraymodel_p.h:164
Okteta::ByteArrayModelPrivate::data
Byte * data() const
Definition: bytearraymodel_p.h:161
Okteta::ByteArrayModelPrivate::removeAllBookmarks
void removeAllBookmarks()
Definition: bytearraymodel_p.h:177
Okteta::BookmarksConstIterator
Definition: bookmarksconstiterator.h:36
Okteta::ByteArrayModel::createBookmarksConstIterator
virtual Okteta::BookmarksConstIterator createBookmarksConstIterator() const
Definition: bytearraymodel.cpp:128
Okteta::ByteArrayModelPrivate::replace
Size replace(const AddressRange &removeRange, const Byte *insertData, int insertLength)
Okteta::ByteArrayModel::ByteArrayModel
ByteArrayModel(Byte *data, int size, int rawSize=-1, bool keepsMemory=true, QObject *parent=0)
Definition: bytearraymodel.cpp:33
Okteta::ByteArrayModel::signalContentsChanged
void signalContentsChanged(int i1, int i2)
Definition: bytearraymodel.cpp:71
Okteta::ByteArrayModel::isReadOnly
virtual bool isReadOnly() const
Default returns true.
Definition: bytearraymodel.cpp:52
Okteta::ByteArrayModelPrivate::setMaxSize
void setMaxSize(int maxSize)
Definition: bytearraymodel_p.h:141
Okteta::ByteArrayModel::swap
virtual bool swap(Address firstStart, const AddressRange &secondRange)
moves the second section before the start of the first which is the same as moving the first behind t...
Definition: bytearraymodel.cpp:98
Okteta::ByteArrayModel::setModified
virtual void setModified(bool modified=true)
sets the modified flag for the buffer
Definition: bytearraymodel.cpp:56
Okteta::ByteArrayModel::remove
virtual Size remove(const AddressRange &removeRange)
removes beginning with position as much as possible
Definition: bytearraymodel.cpp:88
Okteta::ByteArrayModelPrivate::bookmarkAt
const Bookmark & bookmarkAt(unsigned int index) const
Definition: bytearraymodel_p.h:201
Okteta::ByteArrayModelPrivate::createBookmarksConstIterator
BookmarksConstIterator createBookmarksConstIterator() const
Definition: bytearraymodel_p.h:192
Okteta::ByteArrayModel::d
ByteArrayModelPrivate *const d
Definition: bytearraymodel.h:112
Okteta::ByteArrayModel::bookmarkFor
virtual const Okteta::Bookmark & bookmarkFor(int offset) const
Definition: bytearraymodel.cpp:133
Okteta::ByteArrayModelPrivate::fill
Size fill(Byte fillByte, Address offset=0, Size fillLength=-1)
Okteta::AbstractByteArrayModel::contentsChanged
void contentsChanged(const Okteta::ArrayChangeMetricsList &changeList)
Okteta::ArrayChangeMetricsList::oneReplacement
static ArrayChangeMetricsList oneReplacement(Address offset, Size removeLength, Size insertLength)
Definition: arraychangemetricslist.h:47
Okteta::ByteArrayModelPrivate::byte
Byte byte(Address offset) const
Definition: bytearraymodel_p.h:127
Okteta::ByteArrayModel::size
virtual Size size() const
Definition: bytearraymodel.cpp:50
Okteta::ByteArrayModelPrivate::swap
bool swap(Address firstStart, const AddressRange &secondRange)
Okteta::ByteArrayModelPrivate::remove
Size remove(const AddressRange &removeRange)
Okteta::ByteArrayModel::setMaxSize
void setMaxSize(int maxSize)
Definition: bytearraymodel.cpp:57
Okteta::ByteArrayModelPrivate::isReadOnly
bool isReadOnly() const
Definition: bytearraymodel_p.h:130
Okteta::ByteArrayModel::setBookmark
virtual void setBookmark(unsigned int index, const Okteta::Bookmark &bookmark)
Definition: bytearraymodel.cpp:123
Okteta::ByteArrayModelPrivate::insert
Size insert(Address offset, const Byte *insertData, int insertLength)
arraychangemetricslist.h
bytearraymodel.h
Okteta::ByteArrayModel::setByte
virtual void setByte(Address offset, Byte byte)
sets a single byte if the offset is not valid the behaviour is undefined
Definition: bytearraymodel.cpp:78
Okteta::ByteArrayModelPrivate::keepsMemory
bool keepsMemory() const
returns whether the memory of the byte array is kept on resize
Definition: bytearraymodel_p.h:163
Okteta::ByteArrayModel::removeAllBookmarks
virtual void removeAllBookmarks()
Definition: bytearraymodel.cpp:118
Okteta::ByteArrayModelPrivate::setKeepsMemory
void setKeepsMemory(bool keepsMemory=true)
sets whether the memory given by setData or in the constructor should be kept on resize ...
Definition: bytearraymodel_p.h:142
Okteta::ByteArrayModel::containsBookmarkFor
virtual bool containsBookmarkFor(int offset) const
Definition: bytearraymodel.cpp:143
Okteta::ByteArrayModel::removeBookmarks
virtual void removeBookmarks(const QList< Okteta::Bookmark > &bookmarks)
Definition: bytearraymodel.cpp:113
Okteta::Size
qint32 Size
Definition: size.h:33
bytearraymodel_p.h
Okteta::ByteArrayModel::data
Byte * data() const
Definition: bytearraymodel.cpp:66
Okteta::ByteArrayModel::setReadOnly
virtual void setReadOnly(bool isReadOnly=true)
sets the readonly flag for the byte array if this is possible.
Definition: bytearraymodel.cpp:55
Okteta::ByteArrayModel::byte
virtual Byte byte(Address offset) const
locates working range The idea behind is to tell buffer which range will be requested in the followin...
Definition: bytearraymodel.cpp:49
Okteta::ByteArrayModelPrivate::size
Size size() const
Definition: bytearraymodel_p.h:128
Okteta::ByteArrayModelPrivate::setBookmark
void setBookmark(unsigned int index, const Bookmark &bookmark)
Definition: bytearraymodel_p.h:183
Okteta::ByteArrayModelPrivate::containsBookmarkFor
bool containsBookmarkFor(int offset) const
Definition: bytearraymodel_p.h:205
Okteta::ByteArrayModel::~ByteArrayModel
virtual ~ByteArrayModel()
Definition: bytearraymodel.cpp:153
QList
Definition: bookmarkable.h:29
Okteta::ByteArrayModelPrivate::setReadOnly
void setReadOnly(bool readOnly=true)
Definition: bytearraymodel_p.h:133
Okteta::ByteArrayModel::bookmarkAt
virtual const Okteta::Bookmark & bookmarkAt(unsigned int index) const
Definition: bytearraymodel.cpp:138
Okteta::ByteArrayModel::fill
virtual Size fill(Byte fillByte, Address offset=0, Size fillLength=-1)
fills the buffer with the FillChar.
Definition: bytearraymodel.cpp:103
Okteta::ByteArrayModelPrivate::setData
void setData(Byte *data, int size, int rawSize=-1, bool keepsMemory=true)
Okteta::ByteArrayModelPrivate::setModified
void setModified(bool modified=true)
Definition: bytearraymodel_p.h:153
Okteta::ByteArrayModelPrivate::bookmarkFor
const Bookmark & bookmarkFor(int offset) const
Definition: bytearraymodel_p.h:197
Okteta::ByteArrayModel::maxSize
int maxSize() const
Definition: bytearraymodel.cpp:67
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:07 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