KConfig nested groups
Paolo Capriotti
p.capriotti at gmail.com
Sun Mar 4 09:29:02 GMT 2007
On 3/3/07, Aaron J. Seigo <aseigo at kde.org> wrote:
>
> some thoughts:
>
> aIt.key().mKey.startsWith(prefix) looks slow, and is really a backend detail
> related to how it is stored on disk. e.g. backends that can actually store
> hierarchies of data (e.g. ldap) will not follow this pattern.
>
> perhaps it makes more sense to actually store the entries as a tree in kconfig
> and leave it up to the backend to populate that tree? that way getting the
> entrymap for a group is simply descending the tree once and returning all the
> non-default, non-deleted entries.
Yes, that's a good idea. Some notes on how I intend to implement this:
KConfig stores a KEntryMap, representing the whole config. Each KEntry
has an optional KEntryMap field, which, when nonnull, identifies it as
a subgroup. This way we can represent a tree-like structure without
changing too much in the existing code.
KConfigGroup no longer refers to a master KConfig, but stores a
pointer to a KEntryMap.
KConfig represents the whole configuration, and should only be used
internally. There is still the concept of "current group" and
functions to change it. Using the read / write api acts on the current
group. All of this is deprecated, though.
KConfigGroup can represent any node in the configuration (even the
topmost node). It has some extra functions: parent(), which returns
the parent node, and group(QString), which returns a nested group. I
don't like changeGroup very much, and in this context it makes little
sense... can I remove it?
Backends, of course, have to be changed to reflect the new data
structure, but probably not the abstract class KConfigBackend.
In summary, the API would be pretty much compatible, but the internals
would change a lot.
Attached is a patch which only removes the extra key inside KEntryKey.
Can I commit it?
Paolo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kentrykey.patch
Type: application/octet-stream
Size: 3764 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070304/84cd8ca4/attachment.obj>
More information about the kde-core-devel
mailing list