Re: QCString -> QByteArray
Roger Larsson <[email protected]> Tue, 13 Feb 2007 00:49:44 +0100
| Newsgroups | gmane.comp.kde.devel.optimize |
|---|---|
| Message-ID | <[email protected]> |
On Monday 12 February 2007 14:49, David Faure wrote:
> Converting a QCString to a QByteArray:
What if you like to do something more, like adding a character?
for ( uint i = 0; i < numIterations; ++i ) {
mBodyOld.duplicate( aStr.data(), aStr.length()+1 );
mBodyOld += 'a';
}
for ( uint i = 0; i < numIterations; ++i ) {
mBodyNew = aStr;
mBodyNew.detach();
mBodyNew += 'a';
mBodyNew.truncate( aStr.size() -1+1);
}
for ( uint i = 0; i < numIterations; ++i ) {
mBodyNew.duplicate( aStr );
nBodyNew += 'a'; // Will this work without detach?
mBodyNew.truncate( aStr.size() -1+1 ); // Note: changed object for
size operation, correctly?
}