MCPcopy Create free account
hub / github.com/Simsys/qhexedit2 / insert

Method insert

src/chunks.cpp:212–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210// ***************************************** Char manipulations
211
212bool Chunks::insert(qint64 pos, char b)
213{
214 if ((pos < 0) || (pos > _size))
215 return false;
216 int chunkIdx;
217 if (pos == _size)
218 chunkIdx = getChunkIndex(pos-1);
219 else
220 chunkIdx = getChunkIndex(pos);
221 qint64 posInBa = pos - _chunks[chunkIdx].absPos;
222 _chunks[chunkIdx].data.insert(posInBa, b);
223 _chunks[chunkIdx].dataChanged.insert(posInBa, char(1));
224 for (int idx=chunkIdx+1; idx < _chunks.size(); idx++)
225 _chunks[idx].absPos += 1;
226 _size += 1;
227 _pos = pos;
228 return true;
229}
230
231bool Chunks::overwrite(qint64 pos, char b)
232{

Callers 1

getChunkIndexMethod · 0.45

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected