Now we have two versions of KisImageConfig:
- KisImageConfig -- read only type of the config, in which you can request only getters. Accessing any setter method will throw a compile-time error (due to SFINAE)
- KisImageConfigMutable -- fully featured version of the config object that allows setters and that dumps all the settings to the filesystem on destruction.
Implementation details:
The thing is implemeted using templates and SFINAE. The
original KConfig object is wrapped into special wrappers:
KisKConfigWrapper and KisKConfigMutableWrapper. The former
one forwards all readEntry calls to KConfig, the latter
forwards everything, including writeEntry and deleteEntry.
KisImageConfig is implemented as a template and has two explicit
specializations for KisKConfigWrapper and KisKConfigMutableWrapper.
Setter methods of the class access m_config.writeEntry, so they
become disabled for a read-only specialization, based on
KisKConfigWrapper, which doesn't have these methods.