forked from KDE/okteta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbytearraymodel.cpp
242 lines (172 loc) · 4.86 KB
/
bytearraymodel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/*
This file is part of the Okteta Core library, made within the KDE community.
SPDX-FileCopyrightText: 2003, 2007-2009 Friedrich W. H. Kossebau <[email protected]>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "bytearraymodel.hpp"
// lib
#include "bytearraymodel_p.hpp"
#include "arraychangemetricslist.hpp"
namespace Okteta {
ByteArrayModel::ByteArrayModel(Byte* data, int size, int rawSize, bool keepMemory, QObject* parent)
: AbstractByteArrayModel(std::make_unique<ByteArrayModelPrivate>(this, data, size, rawSize, keepMemory), parent)
{}
ByteArrayModel::ByteArrayModel(const Byte* data, int size, QObject* parent)
: AbstractByteArrayModel(std::make_unique<ByteArrayModelPrivate>(this, data, size), parent)
{}
ByteArrayModel::ByteArrayModel(int size, int maxSize, QObject* parent)
: AbstractByteArrayModel(std::make_unique<ByteArrayModelPrivate>(this, size, maxSize), parent)
{}
ByteArrayModel::~ByteArrayModel() = default;
Byte ByteArrayModel::byte(Address offset) const
{
Q_D(const ByteArrayModel);
return d->byte(offset);
}
Size ByteArrayModel::size() const
{
Q_D(const ByteArrayModel);
return d->size();
}
bool ByteArrayModel::isReadOnly() const
{
Q_D(const ByteArrayModel);
return d->isReadOnly();
}
bool ByteArrayModel::isModified() const
{
Q_D(const ByteArrayModel);
return d->isModified();
}
void ByteArrayModel::setReadOnly(bool readOnly)
{
Q_D(ByteArrayModel);
d->setReadOnly(readOnly);
}
void ByteArrayModel::setModified(bool modified)
{
Q_D(ByteArrayModel);
d->setModified(modified);
}
void ByteArrayModel::setMaxSize(int maxSize)
{
Q_D(ByteArrayModel);
d->setMaxSize(maxSize);
}
void ByteArrayModel::setKeepsMemory(bool keepsMemory)
{
Q_D(ByteArrayModel);
d->setKeepsMemory(keepsMemory);
}
void ByteArrayModel::setAutoDelete(bool autoDelete)
{
Q_D(ByteArrayModel);
d->setAutoDelete(autoDelete);
}
void ByteArrayModel::setData(Byte* data, int size, int rawSize, bool keepMemory)
{
Q_D(ByteArrayModel);
d->setData(data, size, rawSize, keepMemory);
}
Byte* ByteArrayModel::data() const
{
Q_D(const ByteArrayModel);
return d->data();
}
int ByteArrayModel::maxSize() const
{
Q_D(const ByteArrayModel);
return d->maxSize();
}
bool ByteArrayModel::keepsMemory() const
{
Q_D(const ByteArrayModel);
return d->keepsMemory();
}
bool ByteArrayModel::autoDelete() const
{
Q_D(const ByteArrayModel);
return d->autoDelete();
}
void ByteArrayModel::signalContentsChanged(int start, int end)
{
const int length = end - start + 1;
Q_EMIT contentsChanged(ArrayChangeMetricsList::oneReplacement(start, length, length));
}
void ByteArrayModel::setByte(Address offset, Byte byte)
{
Q_D(ByteArrayModel);
d->setByte(offset, byte);
}
Size ByteArrayModel::insert(Address offset, const Byte* insertData, int insertLength)
{
Q_D(ByteArrayModel);
return d->insert(offset, insertData, insertLength);
}
Size ByteArrayModel::remove(const AddressRange& removeRange)
{
Q_D(ByteArrayModel);
return d->remove(removeRange);
}
Size ByteArrayModel::replace(const AddressRange& removeRange, const Byte* insertData, int insertLength)
{
Q_D(ByteArrayModel);
return d->replace(removeRange, insertData, insertLength);
}
bool ByteArrayModel::swap(Address firstStart, const AddressRange& secondRange)
{
Q_D(ByteArrayModel);
return d->swap(firstStart, secondRange);
}
Size ByteArrayModel::fill(Byte fillByte, Address offset, Size fillLength)
{
Q_D(ByteArrayModel);
return d->fill(fillByte, offset, fillLength);
}
void ByteArrayModel::addBookmarks(const QVector<Okteta::Bookmark>& bookmarks)
{
Q_D(ByteArrayModel);
d->addBookmarks(bookmarks);
}
void ByteArrayModel::removeBookmarks(const QVector<Okteta::Bookmark>& bookmarks)
{
Q_D(ByteArrayModel);
d->removeBookmarks(bookmarks);
}
void ByteArrayModel::removeAllBookmarks()
{
Q_D(ByteArrayModel);
d->removeAllBookmarks();
}
void ByteArrayModel::setBookmark(unsigned int index, const Okteta::Bookmark& bookmark)
{
Q_D(ByteArrayModel);
d->setBookmark(index, bookmark);
}
Okteta::BookmarksConstIterator ByteArrayModel::createBookmarksConstIterator() const
{
Q_D(const ByteArrayModel);
return d->createBookmarksConstIterator();
}
const Okteta::Bookmark& ByteArrayModel::bookmarkFor(int offset) const
{
Q_D(const ByteArrayModel);
return d->bookmarkFor(offset);
}
const Okteta::Bookmark& ByteArrayModel::bookmarkAt(unsigned int index) const
{
Q_D(const ByteArrayModel);
return d->bookmarkAt(index);
}
bool ByteArrayModel::containsBookmarkFor(int offset) const
{
Q_D(const ByteArrayModel);
return d->containsBookmarkFor(offset);
}
unsigned int ByteArrayModel::bookmarksCount() const
{
Q_D(const ByteArrayModel);
return d->bookmarksCount();
}
}
#include "moc_bytearraymodel.cpp"