Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Xml / System / Xml / Schema / XmlSchemaAttributeGroup.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="XmlSchemaAttributeGroup.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>   
5 // <owner current="true" primary="true">Microsoft</owner>                                                             
6 //------------------------------------------------------------------------------
7
8 namespace System.Xml.Schema {
9
10     using System.Collections;
11     using System.Xml.Serialization;
12
13     /// <include file='doc\XmlSchemaAttributeGroup.uex' path='docs/doc[@for="XmlSchemaAttributeGroup"]/*' />
14     /// <devdoc>
15     ///    <para>[To be supplied.]</para>
16     /// </devdoc>
17     public class XmlSchemaAttributeGroup : XmlSchemaAnnotated {
18         string name;        
19         XmlSchemaObjectCollection attributes = new XmlSchemaObjectCollection();
20         XmlSchemaAnyAttribute anyAttribute;
21         XmlQualifiedName qname = XmlQualifiedName.Empty; 
22         XmlSchemaAttributeGroup redefined;
23         XmlSchemaObjectTable attributeUses;
24         XmlSchemaAnyAttribute attributeWildcard;
25         int selfReferenceCount;
26
27         /// <include file='doc\XmlSchemaAttributeGroup.uex' path='docs/doc[@for="XmlSchemaAttributeGroup.Name"]/*' />
28         /// <devdoc>
29         ///    <para>[To be supplied.]</para>
30         /// </devdoc>
31         [XmlAttribute("name")]
32         public string Name { 
33             get { return name; }
34             set { name = value; }
35         }
36
37         /// <include file='doc\XmlSchemaAttributeGroup.uex' path='docs/doc[@for="XmlSchemaAttributeGroup.Attributes"]/*' />
38         /// <devdoc>
39         ///    <para>[To be supplied.]</para>
40         /// </devdoc>
41         [XmlElement("attribute", typeof(XmlSchemaAttribute)),
42          XmlElement("attributeGroup", typeof(XmlSchemaAttributeGroupRef))]
43         public XmlSchemaObjectCollection Attributes {
44             get { return attributes; }
45         }
46
47         /// <include file='doc\XmlSchemaAttributeGroup.uex' path='docs/doc[@for="XmlSchemaAttributeGroup.AnyAttribute"]/*' />
48         /// <devdoc>
49         ///    <para>[To be supplied.]</para>
50         /// </devdoc>
51         [XmlElement("anyAttribute")]
52         public XmlSchemaAnyAttribute AnyAttribute {
53             get { return anyAttribute; }
54             set { anyAttribute = value; }
55         }
56
57         [XmlIgnore]
58         public XmlQualifiedName QualifiedName {
59             get { return qname; }
60         }
61
62         [XmlIgnore]
63         internal XmlSchemaObjectTable AttributeUses {
64             get { 
65                 if (attributeUses == null) {
66                     attributeUses = new XmlSchemaObjectTable();
67                 }
68                 return attributeUses; 
69             }
70         }
71
72         [XmlIgnore]
73         internal XmlSchemaAnyAttribute AttributeWildcard {
74             get { return attributeWildcard; }
75             set { attributeWildcard = value; }
76         }
77
78         /// <include file='doc\XmlSchemaAttributeGroup.uex' path='docs/doc[@for="XmlSchemaAttributeGroup.RedefinedAttributeGroup"]/*' />
79         [XmlIgnore]
80         public XmlSchemaAttributeGroup RedefinedAttributeGroup {
81             get { return redefined; }
82         }
83
84         [XmlIgnore]
85         internal XmlSchemaAttributeGroup Redefined {
86             get { return redefined; }
87             set { redefined = value; }
88         }
89         
90         [XmlIgnore]
91         internal int SelfReferenceCount {
92             get { return selfReferenceCount; }
93             set { selfReferenceCount = value; }
94         }
95
96         [XmlIgnore]
97         internal override string NameAttribute {
98             get { return Name; }
99             set { Name = value; }
100         }
101
102         internal void SetQualifiedName(XmlQualifiedName value) { 
103             qname = value;
104         }
105
106         internal override XmlSchemaObject Clone() {
107             XmlSchemaAttributeGroup newGroup = (XmlSchemaAttributeGroup)MemberwiseClone();
108             if (XmlSchemaComplexType.HasAttributeQNameRef(this.attributes)) { //If a ref/type name is present
109                 newGroup.attributes = XmlSchemaComplexType.CloneAttributes(this.attributes);
110                 
111                 //Clear compiled tables
112                 newGroup.attributeUses = null;
113             }
114             return newGroup;
115         }
116     }
117
118 }