[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Use of const arg in KConfigGroup constructors doesn't work with
From: Richard Dale <rdale () foton ! es>
Date: 2008-03-04 20:09:52
Message-ID: 200803042009.53230.rdale () foton ! es
[Download RAW message or body]
I've had a problem with these two pairs of constructors in kconfiggroup.h:
KConfigGroup(KConfigBase *master, const QString &group);
KConfigGroup(KConfigBase *master, const char *group);
KConfigGroup(const KConfigBase *master, const QString &group);
KConfigGroup(const KConfigBase *master, const char *group);
They only differ by the const-ness of the first argument, and this is
impossible to get working with any other language than c++. I would prefer an
enum to be passed, like KConfigBase::AccessType to specify whether or not the
KConfigGroup can be written too. I've worked round the problem by just
ignoring the read-only const method calls, and so bindings will always get a
writable KConfigGroup.
A comment in the header says this:
/**
* Construct a read-only config group. A read-only group will silently
ignore
* any attempts to write to it.
...
I think something like this is clearer and less error prone:
KConfigGroup(KConfigBase *master, const QString &group, AccessType mode =
ReadOnly);
KConfigGroup(KConfigBase *master, const char *group, AccessType mode =
ReadOnly);
-- Richard
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic