KConfigGroup (Re: KDE/kdelibs/khtml)

Aaron J. Seigo aseigo at kde.org
Sat Feb 10 23:11:00 GMT 2007


On February 10, 2007, David Faure wrote:
> On Friday 09 February 2007, Aaron J. Seigo wrote:
> >  - a method in KConfig that returns a KConfigGroup object
>
> Does this change anything?

for me it comes down to which makes an easier to understand API: a kconfig 
object that provides access to groups, or a kconfig object you need to use 
with another class to get at groups. the former is nearly self-documenting, 
the latter requires a bit of a tutorial.

on a related note, are we going to hide readEntry() and writeEntry as well and 
move them to KConfigGroup? if not, what does a KConfig object with no ability 
to directly set the group do precisely? i would guess it writes to [General], 
but again it's just a very odd API now.

> >  - providing a KConfigGroup(const QString& config, const QString& group)
> > which creates an internal KConfig as a shortcut for this common idiom:
>
> I am strongly against this. People will write code like
> KConfigGroup group1("myconfigrc","group1");
> group1.writeEntry(..);
> KConfigGroup group2("myconfigrc","group2");
> group2.writeEntry(..);
> ... which will lead to myconfigrc being parsed twice. Very slow.

sorry, my assumption was that we'd be using a KSharedConfigPtr internally so 
this wouldn't be an issue.

> > IOW, if we remove KConfig::setGroup() from the public API, we will want
> > to make KConfigGroup more convenient to get to and use. which is
> > thankfully pretty trivial to do.
>
> KConfigGroup doesn't strike me as difficult to use as it is, to be honest.
> Well, especially now that I added entryMap() to it, for the case where
> that's needed ;)

it's not hard, it's just making the API a bit less obvious imho.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

Full time KDE developer sponsored by Trolltech (http://www.trolltech.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070210/08d98464/attachment.sig>


More information about the kde-core-devel mailing list