#region CPL License /* Nuclex Framework Copyright (C) 2002-2014 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #endregion using System; using System.Collections.Generic; namespace Nuclex.Support.Configuration { /// Interface by which settings and configuration data can be accessed public interface ISettingsStore { /// Enumerates the categories defined in the configuration /// An enumerable list of all used categories IEnumerable EnumerateCategories(); /// Enumerates the options stored under the specified category /// Category whose options will be enumerated /// An enumerable list of all options in the category IEnumerable EnumerateOptions(string category = null); /// Retrieves the value of the specified option /// Type the option will be converted to /// Category the option can be found in. Can be null. /// Name of the option that will be looked up /// The value of the option with the specified name TValue Get(string category, string optionName); /// Tries to retrieve the value of the specified option /// Type the option will be converted to /// Category the option can be found in. Can be null. /// Name of the option that will be looked up /// Will receive the value of the option, if found /// /// True if the option existed and its value was written into the /// parameter, false otherwise /// bool TryGet(string category, string optionName, out TValue value); /// Saves an option in the settings store /// Type of value that will be saved /// Category the option will be placed in. Can be null. /// Name of the option that will be saved /// The value under which the option will be saved void Set(string category, string optionName, TValue value); /// Removes the option with the specified name /// Category the option is found in. Can be null. /// Name of the option that will be removed /// True if the option was found and removed bool Remove(string category, string optionName); } } // namespace Nuclex.Support.Configuration #if WANT_TO_SUPPORT_MESSED_UP_CONFIGURATION_FILES /// /// Some settings stores allow multiple options with the same name to exist. /// If you request a collection of values (IEnumerable, ICollection, IList or their /// generic variants), you will be given a collection of all values appearing /// in the scope you specified. /// #endif