File: IniSectionCollection.cs

package info (click to toggle)
nini 1.1.0%2Bdfsg.3-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 880 kB
  • sloc: cs: 7,649; xml: 2,945; makefile: 28; ansic: 7
file content (95 lines) | stat: -rw-r--r-- 2,702 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#region Copyright
//
// Nini Configuration Project.
// Copyright (C) 2006 Brent R. Matzelle.  All rights reserved.
//
// This software is published under the terms of the MIT X11 license, a copy of 
// which has been included with this distribution in the LICENSE.txt file.
// 
#endregion

using System;
using System.Collections;
using Nini.Util;

namespace Nini.Ini
{
	/// <include file='IniSectionCollection.xml' path='//Class[@name="IniSectionCollection"]/docs/*' />
	public class IniSectionCollection : ICollection, IEnumerable
	{
		#region Private variables
		OrderedList list = new OrderedList ();
		#endregion

		#region Public properties	
		/// <include file='IniSectionCollection.xml' path='//Property[@name="ItemIndex"]/docs/*' />
		public IniSection this[int index]
		{
			get { return (IniSection)list[index]; }
		}
		
		/// <include file='IniSectionCollection.xml' path='//Property[@name="ItemName"]/docs/*' />
		public IniSection this[string configName]
		{
			get { return (IniSection)list[configName]; }
		}

		/// <include file='IniSectionCollection.xml' path='//Property[@name="Count"]/docs/*' />
		public int Count
		{
			get { return list.Count; }
		}
		
		/// <include file='IniSectionCollection.xml' path='//Property[@name="SyncRoot"]/docs/*' />
		public object SyncRoot
		{
			get { return list.SyncRoot; }
		}
		
		/// <include file='IniSectionCollection.xml' path='//Property[@name="IsSynchronized"]/docs/*' />
		public bool IsSynchronized
		{
			get { return list.IsSynchronized; }
		}
		#endregion

		#region Public methods
		/// <include file='IniSectionCollection.xml' path='//Method[@name="Add"]/docs/*' />
		public void Add (IniSection section)
		{
			if (list.Contains (section)) {
				throw new ArgumentException ("IniSection already exists");
			}
			
			list.Add (section.Name, section);
		}
		
		/// <include file='IniSectionCollection.xml' path='//Method[@name="Remove"]/docs/*' />
		public void Remove (string config)
		{
			list.Remove (config);
		}
		
		/// <include file='IniSectionCollection.xml' path='//Method[@name="CopyTo"]/docs/*' />
		public void CopyTo (Array array, int index) 
		{
			list.CopyTo (array, index);
		}
		
		/// <include file='IniSectionCollection.xml' path='//Method[@name="CopyToStrong"]/docs/*' />
		public void CopyTo (IniSection[] array, int index)
		{
			((ICollection)list).CopyTo (array, index);
		}

		/// <include file='IniSectionCollection.xml' path='//Method[@name="GetEnumerator"]/docs/*' />
		public IEnumerator GetEnumerator () 
		{
			return list.GetEnumerator ();
		}
		#endregion
		
		#region Private methods
		#endregion
	}
}