DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Configuration.Configuration Class Reference
Inheritance diagram for Deveel.Data.Configuration.Configuration:
Deveel.Data.Configuration.IConfiguration

Public Member Functions

 Configuration (IConfiguration parent, IConfigSource source)
 Constructs the Configuration from the given parent. More...
 
 Configuration (IConfigSource source)
 
 Configuration ()
 
 Configuration (IConfiguration parent)
 
IEnumerable< string > GetKeys (ConfigurationLevel level)
 Enumerates the keys that can be obtained by the object, at the given ConfigurationLevel. More...
 
IEnumerator< KeyValuePair< string, object > > GetEnumerator ()
 
void SetValue (string key, object value)
 Sets a given value for a key defined by this object. More...
 
object GetValue (string key)
 Gets a configuration setting for the given key. More...
 

Properties

IConfigSource Source [get, set]
 
IConfiguration Parent [get, set]
 
- Properties inherited from Deveel.Data.Configuration.IConfiguration
IConfigSource Source [get, set]
 Gets or sets an optional source of the configuration object More...
 
IConfiguration Parent [get, set]
 Gets or sets an optional parent object of this configuration. More...
 

Private Member Functions

 Configuration (bool isRoot)
 Constructs the Configuration. More...
 
IEnumerator IEnumerable. GetEnumerator ()
 

Private Attributes

readonly bool isRoot
 
readonly Dictionary< string, object > values
 

Detailed Description

Definition at line 25 of file Configuration.cs.

Constructor & Destructor Documentation

Deveel.Data.Configuration.Configuration.Configuration ( bool  isRoot)
inlineprivate

Constructs the Configuration.

Definition at line 32 of file Configuration.cs.

32  {
33  Parent = null;
34  this.isRoot = isRoot;
35  values = new Dictionary<string, object>();
36  }
readonly Dictionary< string, object > values
Deveel.Data.Configuration.Configuration.Configuration ( IConfiguration  parent,
IConfigSource  source 
)
inline

Constructs the Configuration from the given parent.

Parameters
parentThe parent Configuration object that will provide fallback configurations
source

Definition at line 44 of file Configuration.cs.

45  : this(parent == null) {
46  Parent = parent;
47  Source = source;
48 
49  if (source != null)
50  this.Load(source);
51  }
Deveel.Data.Configuration.Configuration.Configuration ( IConfigSource  source)
inline

Definition at line 53 of file Configuration.cs.

54  : this(null, source) {
55  }
Deveel.Data.Configuration.Configuration.Configuration ( )
inline

Definition at line 57 of file Configuration.cs.

58  : this(true) {
59  }
Deveel.Data.Configuration.Configuration.Configuration ( IConfiguration  parent)
inline

Definition at line 61 of file Configuration.cs.

62  : this(parent, null) {
63  }

Member Function Documentation

IEnumerator<KeyValuePair<string, object> > Deveel.Data.Configuration.Configuration.GetEnumerator ( )
inline

Definition at line 88 of file Configuration.cs.

88  {
89  var keys = GetKeys(ConfigurationLevel.Deep);
90  return keys.Select(key => new KeyValuePair<string, object>(key, GetValue(key))).GetEnumerator();
91  }
IEnumerable< string > GetKeys(ConfigurationLevel level)
Enumerates the keys that can be obtained by the object, at the given ConfigurationLevel.
ConfigurationLevel
Defines the level of configuration settings to save or read
object GetValue(string key)
Gets a configuration setting for the given key.
IEnumerator IEnumerable. Deveel.Data.Configuration.Configuration.GetEnumerator ( )
inlineprivate

Definition at line 93 of file Configuration.cs.

93  {
94  return GetEnumerator();
95  }
IEnumerator< KeyValuePair< string, object > > GetEnumerator()
IEnumerable<string> Deveel.Data.Configuration.Configuration.GetKeys ( ConfigurationLevel  level)
inline

Enumerates the keys that can be obtained by the object, at the given ConfigurationLevel.

Implements Deveel.Data.Configuration.IConfiguration.

Definition at line 72 of file Configuration.cs.

72  {
73  var returnKeys = new Dictionary<string, string>();
74  if (!isRoot && Parent != null && level == ConfigurationLevel.Deep) {
75  var configKeys = Parent.GetKeys(level);
76  foreach (var pair in configKeys) {
77  returnKeys[pair] = pair;
78  }
79  }
80 
81  foreach (var configKey in values.Keys) {
82  returnKeys[configKey] = configKey;
83  }
84 
85  return returnKeys.Values.AsEnumerable();
86  }
readonly Dictionary< string, object > values
ConfigurationLevel
Defines the level of configuration settings to save or read
IEnumerable< string > GetKeys(ConfigurationLevel level)
Enumerates the keys that can be obtained by the object, at the given ConfigurationLevel.
object Deveel.Data.Configuration.Configuration.GetValue ( string  key)
inline

Gets a configuration setting for the given key.

Implements Deveel.Data.Configuration.IConfiguration.

Definition at line 111 of file Configuration.cs.

111  {
112  if (String.IsNullOrEmpty(key))
113  throw new ArgumentNullException("key");
114 
115  object value;
116  if (values.TryGetValue(key, out value))
117  return value;
118 
119  if (!isRoot && Parent != null &&
120  ((value = Parent.GetValue(key)) != null))
121  return value;
122 
123  return null;
124  }
object GetValue(string key)
Gets a configuration setting for the given key.
readonly Dictionary< string, object > values
A long string in the system.
void Deveel.Data.Configuration.Configuration.SetValue ( string  key,
object  value 
)
inline

Sets a given value for a key defined by this object.

Implements Deveel.Data.Configuration.IConfiguration.

Definition at line 99 of file Configuration.cs.

99  {
100  if (String.IsNullOrEmpty(key))
101  throw new ArgumentNullException("key");
102 
103  if (value == null) {
104  values.Remove(key);
105  } else {
106  values[key] = value;
107  }
108  }
readonly Dictionary< string, object > values
A long string in the system.

Member Data Documentation

readonly bool Deveel.Data.Configuration.Configuration.isRoot
private

Definition at line 26 of file Configuration.cs.

readonly Dictionary<string, object> Deveel.Data.Configuration.Configuration.values
private

Definition at line 27 of file Configuration.cs.

Property Documentation

IConfiguration Deveel.Data.Configuration.Configuration.Parent
getset

Definition at line 69 of file Configuration.cs.

IConfigSource Deveel.Data.Configuration.Configuration.Source
getset

Definition at line 66 of file Configuration.cs.


The documentation for this class was generated from the following file: