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

List:       kde-devel
Subject:    Re: KConfig using too much ascii() ?
From:       <pbrown () redhat ! com>
Date:       1999-07-16 0:03:47
[Download RAW message or body]

On Thu, 15 Jul 1999, Rik Hemsley wrote:

> 
> Just been looking through the KConfig stuff trying to figure out
> if it saves QString properly yet...
> 
> I stumbled across some stuff like this:
> 
> void KConfigBase::writeEntry( const QString& pKey, const QRect& rRect, 
>                               bool bPersistent, bool bGlobal,
>                               bool bNLS )
> {
>   QStrList list;
>   QString tempstr;
>   list.insert( 0, tempstr.setNum( rRect.left() ).ascii() );
>   list.insert( 1, tempstr.setNum( rRect.top() ).ascii() );
>   list.insert( 2, tempstr.setNum( rRect.width() ).ascii() );
>   list.insert( 3, tempstr.setNum( rRect.height() ).ascii() );
> 
>   writeEntry( pKey, list, ',', bPersistent, bGlobal, bNLS );
> }
> 
> Are all these ascii() calls necessary ? Could 'QString tempstr' not simply
> be replaced by a QCString ?

QStrLists are really just wrappers around QList<char>.  So you need to
make an .ascii() method call on a QString (or preferably .data()).  If you
don't, it will happen implictly anyway.

However, using a QCString would probably be faster here, you are right.
I'll change it.

> Another thing I just noticed. Could list.append() not be used ? Is this faster ?

insert is no slower than append, because QList is a linked list.  inSort()
would be slower of course.

---
  Preston Brown                                    Systems Engineer
  pbrown@redhat.com                                Red Hat, Inc. 

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

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