namespace UnityEditor.SettingsManagement { /// /// An interface that represents a settings repository, which is responsible for implementing the saving and loading of values. /// public interface ISettingsRepository { /// /// Implement this property to get the this repository applies to. /// /// /// Indicates whether this is a setting /// or a preference. /// SettingsScope scope { get; } /// /// Implement this property to get the name to identify this repository. /// /// The bare filename of this repository. string name { get; } /// /// Implement this property to get the file path to the serialized settings data. /// /// Full path to the JSON file containing the settings data. string path { get; } /// /// Implement this method to save all settings to their serialized state. /// void Save(); /// /// Implement this method to set a value for a settings entry with a matching key and type `T`. /// /// The key used to identify the settings entry. /// The value to set. Must be serializable. /// The type of value that this key points to. void Set(string key, T value); /// /// Implement this method to get a value for a settings entry with a matching key and type `T`. /// /// The key used to identify the settings entry. /// Specify the value of type `T` to return if the entry can't be found. /// The type of value that this key points to. /// The value matching both `key` and type `T`. If there was no match, this returns the `fallback` value. T Get(string key, T fallback = default(T)); /// /// Implement this method to evaluate whether the repository contains a settings entry that matches the specified key and is of type `T`. /// /// The key used to identify the settings entry. /// The type of value that this key points to. /// True if a settings entry matches both `key` and type `T`; false if no entry is found. bool ContainsKey(string key); /// /// Implement this method to remove a key-value pair from the settings repository. This method identifies the settings entry to remove /// by matching the specified key for a value of type `T`. /// /// The key used to identify the settings entry. /// The type of value that this key points to. void Remove(string key); } }