2008-11-20 Gonzalo Paniagua Javier <gonzalo@novell.com>
[mono.git] / mcs / class / System / System.Configuration / DictionarySectionHandler.cs
1
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
10 // 
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
13 // 
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22
23 //
24 // System.Configuration.DictionarySectionHandler.cs
25 //
26 // Author:
27 //   Christopher Podurgiel (cpodurgiel@msn.com)
28 //
29 // (C) Chris Podurgiel
30 //
31 using System;
32 using System.Collections;
33 using System.Collections.Specialized;
34 #if (XML_DEP)
35 using System.Xml;
36 #endif
37
38 namespace System.Configuration
39 {
40         /// <summary>
41         /// Summary description for DictionarySectionHandler.
42         /// </summary>
43         public class DictionarySectionHandler : IConfigurationSectionHandler
44         {
45 #if (XML_DEP)
46
47                 /// <summary>
48                 ///             Creates a new DictionarySectionHandler object and adds the object to the collection.
49                 /// </summary>
50                 /// <param name="parent">Composed from the configuration settings in a corresponding parent configuration section.</param>
51                 /// <param name="context">Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null.</param>
52                 /// <param name="section">The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.</param>
53                 /// <returns></returns>
54                 public virtual object Create(object parent, object context, XmlNode section)
55                 {
56                         return ConfigHelper.GetDictionary (parent as IDictionary, section,
57                                                            KeyAttributeName, ValueAttributeName);
58                 }
59 #endif
60
61                 /// <summary>
62                 ///             Gets the name of the key attribute tag. This property is overidden by derived classes to change 
63                 ///             the name of the key attribute tag. The default is "key".
64                 /// </summary>
65                 protected virtual string KeyAttributeName
66                 {
67                         get {
68                                 return "key";
69                         }
70                 }
71
72                 /// <summary>
73                 ///             Gets the name of the value tag. This property may be overidden by derived classes to change
74                 ///             the name of the value tag. The default is "value".
75                 /// </summary>
76                 protected virtual string ValueAttributeName 
77                 {
78                         get {
79                                 return "value";
80                         }
81                 }
82         }
83 }