2006-02-21 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.XML / System.Xml.Serialization / XmlReflectionMember.cs
1 // \r
2 // System.Xml.Serialization.XmlReflectionMember \r
3 //\r
4 // Author:\r
5 //   Tim Coleman (tim@timcoleman.com)\r
6 //\r
7 // Copyright (C) Tim Coleman, 2002\r
8 //\r
9 \r
10 //\r
11 // Permission is hereby granted, free of charge, to any person obtaining\r
12 // a copy of this software and associated documentation files (the\r
13 // "Software"), to deal in the Software without restriction, including\r
14 // without limitation the rights to use, copy, modify, merge, publish,\r
15 // distribute, sublicense, and/or sell copies of the Software, and to\r
16 // permit persons to whom the Software is furnished to do so, subject to\r
17 // the following conditions:\r
18 // \r
19 // The above copyright notice and this permission notice shall be\r
20 // included in all copies or substantial portions of the Software.\r
21 // \r
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
29 //\r
30 \r
31 namespace System.Xml.Serialization {\r
32         public class XmlReflectionMember {\r
33 \r
34                 #region Fields\r
35 \r
36                 bool isReturnValue;\r
37                 string memberName;\r
38                 Type memberType;\r
39                 bool overrideIsNullable;\r
40                 SoapAttributes soapAttributes;\r
41                 XmlAttributes xmlAttributes;\r
42                 Type declaringType;\r
43 \r
44                 #endregion\r
45 \r
46                 #region Constructors\r
47 \r
48                 public XmlReflectionMember ()\r
49                 {\r
50                 }\r
51 \r
52                 internal XmlReflectionMember (string name, Type type, XmlAttributes attributes)\r
53                 {\r
54                         memberName = name;\r
55                         memberType = type;\r
56                         xmlAttributes = attributes;\r
57                 }\r
58 \r
59                 internal XmlReflectionMember (string name, Type type, SoapAttributes attributes)\r
60                 {\r
61                         memberName = name;\r
62                         memberType = type;\r
63                         soapAttributes = attributes;\r
64                 }\r
65 \r
66                 #endregion // Constructors\r
67 \r
68                 #region Properties\r
69 \r
70                 public bool IsReturnValue {\r
71                         get { return isReturnValue; }\r
72                         set { isReturnValue = value; }\r
73                 }\r
74 \r
75                 public string MemberName {\r
76                         get { return memberName; }\r
77                         set { memberName = value; }\r
78                 }\r
79 \r
80                 public Type MemberType {\r
81                         get { return memberType; }\r
82                         set { memberType = value; }\r
83                 }\r
84 \r
85                 public bool OverrideIsNullable {\r
86                         get { return overrideIsNullable; }\r
87                         set { overrideIsNullable = value; }\r
88                 }\r
89 \r
90                 public SoapAttributes SoapAttributes {\r
91                         get { \r
92                                 if (soapAttributes == null) soapAttributes = new SoapAttributes();\r
93                                 return soapAttributes; \r
94                         }\r
95                         set { soapAttributes = value; }\r
96                 }\r
97 \r
98                 public XmlAttributes XmlAttributes {\r
99                         get { \r
100                                 if (xmlAttributes == null) xmlAttributes = new XmlAttributes();\r
101                                 return xmlAttributes; \r
102                         }\r
103                         set { xmlAttributes = value; }\r
104                 }\r
105                 \r
106                 internal Type DeclaringType {\r
107                         get { return declaringType; }\r
108                         set { declaringType = value; }\r
109                 }\r
110                 \r
111                 internal void AddKeyHash (System.Text.StringBuilder sb)\r
112                 {\r
113                         sb.Append ("XRM ");\r
114                         KeyHelper.AddField (sb, 1, isReturnValue);\r
115                         KeyHelper.AddField (sb, 1, memberName);\r
116                         KeyHelper.AddField (sb, 1, memberType);\r
117                         KeyHelper.AddField (sb, 1, overrideIsNullable);\r
118                         \r
119                         if (soapAttributes != null)\r
120                                 soapAttributes.AddKeyHash (sb);\r
121                         \r
122                         if (xmlAttributes != null)\r
123                                 xmlAttributes.AddKeyHash (sb);\r
124                         \r
125                         sb.Append ('|');\r
126                 }\r
127 \r
128                 #endregion // Properties\r
129         }\r
130 }\r