using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IPA
{
///
/// An interface for configuration providers.
///
public interface IConfigProvider
{
///
/// Loads the data provided by this into an object of type .
///
/// the type of the object to parse into
/// the values from the config provider parsed into the object
T Parse();
///
/// Stores the data from into the .
///
///
/// NOTE TO IMPLEMENTERS:
/// Since is bundled with this library, try to include support for its attributes.
///
/// the type of
/// the object containing the data to save
void Store(T obj);
#region Getters
///
/// Gets the acting as a sub-object for a given key.
///
/// the name of the field with the
/// an accessor for the selected sub-object
IConfigProvider GetSubObject(string name);
///
/// Gets the value of type for key .
///
///
/// If is , behavior should be identical to .
///
/// the type of the value to get
/// the name of the field to get the value of
/// the value of the field
T Get(string name); // can be IConfigProvider
///
/// The non-generic version of .
/// If key corresponds to a sub-object, will return an .
///
/// the name of the field to get the value of
/// the value of the field
object Get(string name); // can return IConfigProvider
///
/// Gets the value of type of the element at .
///
///
/// If is , behavior should be identical to if it were executed on the immediate parent of the target element.
///
/// the type of the value to get
/// an ordered array specifying keys starting from the root (this)
/// the value at path
T GetPath(params string[] path);
///
/// The non-generic version of .
/// If key corresponds to a sub-object, will return an .
///
/// an ordered array specifying keys starting from the root (this)
/// the value at path
object GetPath(params string[] path);
#endregion
#region Setters
///
/// Sets the object for key '' to .
///
/// the key to set it as
/// the provider value
void SetSubObject(string name, IConfigProvider provider); // argument should be same provider type
///
/// Sets the value for key to .
///
///
/// If is , behavior should be identical to .
///
/// the type of the value to set
/// the key
/// the value to set
void Set(string name, T value);
///
/// Sets the value for path to .
///
///
/// If is , behavior should be identical to if it were executed on the immediate parent of the target element.
///
/// the type of the value to set
/// the path to the new value location
/// the value to set
void SetPath(string[] path, T value);
#endregion
}
}