I am looking for a good data-structure to store a simple key value mapping, but with
a special key construct in place.
A key is defined as section + group + keyword and this values represents some Ini like format:
[section]
(group)
keyword = value
Per definition it must be possible to find the wanted value by using
– section, group and keyword as key
– group and keyword as key
– keyword as key
I thought about using a QHash where I could add following keys to the hasmap:
– section|group|keyword
– group|keyword
– keyword
But this would mean that I use three key’s for the same value. Are there any better ways to do this in respect of wasted memory?
Thanks
QSettings already supports that but in different way. You can define any combination of / seperated texts to make Groups/SubGroups/Keys combination. But if it is “some ini kind format that already exists”, I’d suggest to write your own QSettings format and register it with QSettings::registerFormat. It should be quite easy task, and It is less work then writing whole class for reading/managing such format