13 #ifndef mitkIPreferences_h
14 #define mitkIPreferences_h
68 std::string m_Property;
69 std::string m_OldValue;
70 std::string m_NewValue;
89 virtual std::string
Get(
const std::string& key,
const std::string& def)
const = 0;
102 virtual void Put(
const std::string& key,
const std::string& value) = 0;
111 virtual int GetInt(
const std::string& key,
int def)
const = 0;
118 virtual void PutInt(
const std::string& key,
int value) = 0;
126 virtual bool GetBool(
const std::string& key,
bool def)
const = 0;
134 virtual void PutBool(
const std::string& key,
bool value) = 0;
143 virtual float GetFloat(
const std::string& key,
float def)
const = 0;
150 virtual void PutFloat(
const std::string& key,
float value) = 0;
159 virtual double GetDouble(
const std::string& key,
double def)
const = 0;
166 virtual void PutDouble(
const std::string& key,
double value) = 0;
186 virtual std::vector<std::byte>
GetByteArray(
const std::string& key,
const std::byte* def,
size_t size)
const = 0;
205 virtual void PutByteArray(
const std::string& key,
const std::byte* array,
size_t size) = 0;
216 virtual void Override(
const std::string& key,
const std::string& value) = 0;
251 virtual void OverrideByteArray(
const std::string& key,
const std::byte* array,
size_t size) = 0;
296 virtual bool Remove(
const std::string& key,
bool forceRemoval =
false) = 0;
308 virtual void Clear(
bool includeOverrides =
false) = 0;
315 virtual std::vector<std::string>
Keys(
bool includeOverrides =
false)
const = 0;
325 virtual std::string
Name()
const = 0;
Event object sent on IPreferences::OnPropertyChanged events.
std::string GetProperty() const
std::string GetOldValue() const
IPreferences * GetSource() const
std::string GetNewValue() const
ChangeEvent(IPreferences *source, const std::string &property, const std::string &oldValue, const std::string &newValue)
Interface to application preferences.
virtual void OverrideDouble(const std::string &key, double value)=0
Set a session-only override for a double property.
virtual std::vector< std::byte > GetByteArray(const std::string &key, const std::byte *def, size_t size) const =0
Get a property value as typeless binary representation.
virtual void RemoveOverride(const std::string &key)=0
Remove a session-only override for a property.
virtual std::vector< std::string > ChildrenNames() const =0
Get the names of all direct child preference nodes.
virtual std::string AbsolutePath() const =0
Get the absolute path (relative to the root node) of this preferences node.
virtual void PutFloat(const std::string &key, float value)=0
Set a float property value.
virtual double GetDouble(const std::string &key, double def) const =0
Get a property value as double.
virtual void PutDouble(const std::string &key, double value)=0
Set a double property value.
virtual void Put(const std::string &key, const std::string &value)=0
Set a property value.
Message1< const IPreferences * > OnChanged
Notify on node changes.
virtual void PutInt(const std::string &key, int value)=0
Set an int property value.
virtual int GetInt(const std::string &key, int def) const =0
Get a property value as int.
virtual std::string Get(const std::string &key, const std::string &def) const =0
Get a property value as string.
virtual float GetFloat(const std::string &key, float def) const =0
Get a property value as float.
virtual IPreferences * Root()=0
Get the root preferences node.
virtual void PutBool(const std::string &key, bool value)=0
Set a bool property value.
virtual void Clear(bool includeOverrides=false)=0
Remove all properties from this preferences node.
virtual void Override(const std::string &key, const std::string &value)=0
Set a session-only override for a string property.
virtual void Flush()=0
Write all (!) preferences to disk.
virtual void PutByteArray(const std::string &key, const std::byte *array, size_t size)=0
Put binary data into a property value.
virtual void OverrideInt(const std::string &key, int value)=0
Set a session-only override for an int property.
virtual const IPreferences * Root() const =0
virtual IPreferences * Parent()=0
Get the parent preferences node or nullptr in case of the root node.
virtual bool Remove(const std::string &key, bool forceRemoval=false)=0
Remove a property from this preferences node.
virtual void OverrideByteArray(const std::string &key, const std::byte *array, size_t size)=0
Set a session-only override for a byte array property.
virtual void ClearOverrides()=0
Remove all session-only overrides from this preferences node.
virtual std::vector< std::string > Keys(bool includeOverrides=false) const =0
Get the names of all properties of this preferences node.
virtual bool GetBool(const std::string &key, bool def) const =0
Get a property value as bool.
virtual IPreferences * Node(const std::string &path)=0
Get (and possibly create) the preferences node specified by the given path.
virtual const IPreferences * Parent() const =0
Message1< const ChangeEvent & > OnPropertyChanged
Notify on property changes.
virtual void RemoveNode()=0
Remove this preferences node from its parent node.
virtual void OverrideFloat(const std::string &key, float value)=0
Set a session-only override for a float property.
virtual bool IsOverridden(const std::string &key) const =0
Check whether a property has a session-only override.
virtual void OverrideBool(const std::string &key, bool value)=0
Set a session-only override for a bool property.
virtual std::string Name() const =0
Get the name of this preferences node.
Event/message class with one parameter.
Find image slices visible on a given plane.
MITKCORE_EXPORT void ApplyPreferencesOverrides(const std::string &xmlContent, IPreferences *prefs)
Apply preference overrides from XML content.
MITKCORE_EXPORT void ApplyPreferencesPatches(const std::string &xmlContent, IPreferences *prefs)
Permanently patch preferences from an XML string.