[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-optimize
Subject:    Re: QCString -> QByteArray
From:       Roger Larsson <roger.larsson () norran ! net>
Date:       2007-02-12 23:49:44
Message-ID: 200702130049.44820.roger.larsson () norran ! net
[Download RAW message or body]

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?
    }
_______________________________________________
Kde-optimize mailing list
Kde-optimize@kde.org
https://mail.kde.org/mailman/listinfo/kde-optimize
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic