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

List:       kde-devel
Subject:    Re: Replacement for deprecated KConfigGroup:entryMap()
From:       Thiago Macieira <thiago () kde ! org>
Date:       2007-10-26 10:15:56
Message-ID: 200710261215.56669.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Em Friday 26 October 2007 11:53:57 Oswald Buddenhagen escreveu:
> > I'd say try a toString() (or equivalent QVariant conversion) and let
> > the default value be returned in case of conversion errors (just like
> > QVariant).
>
> i don't think pretending a legitimate case when an error occurs is good.
> maybe one should even do something as nasty as returning "<value cannot
> be converted to a string>" instead of just QString() - it's probable it
> will get to the user somehow.

I'd say an API like QVariant would then be useful:

if you call convert() and it can't convert, it'll silently fail. You'll get 
the default value for the type (empty lists, null QStrings, 0 integers, 
false, 0.0 for double, etc.).

But if you do that, it's your fault. You should have checked canConvert() 
first.

You say now everything is a string, so the "canConvert()" to string is always 
true. But a new backend could have different logic there.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


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

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