Update Reference Sources to .NET Framework 4.6.1
[mono.git] / mcs / class / referencesource / System / compmod / system / codedom / CodeMemberProperty.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="CodeMemberProperty.cs" company="Microsoft">
3 // 
4 // <OWNER>[....]</OWNER>
5 //     Copyright (c) Microsoft Corporation.  All rights reserved.
6 // </copyright>                                                                
7 //------------------------------------------------------------------------------
8
9 namespace System.CodeDom {
10
11     using System.Diagnostics;
12     using System;
13     using Microsoft.Win32;
14     using System.Collections;
15     using System.Runtime.InteropServices;
16
17     /// <devdoc>
18     ///    <para>
19     ///       Represents a class property.
20     ///    </para>
21     /// </devdoc>
22     [
23         ClassInterface(ClassInterfaceType.AutoDispatch),
24         ComVisible(true),
25         Serializable,
26     ]
27     public class CodeMemberProperty : CodeTypeMember {
28         private CodeTypeReference type;
29         private CodeParameterDeclarationExpressionCollection parameters = new CodeParameterDeclarationExpressionCollection();
30         private bool hasGet;
31         private bool hasSet;
32         private CodeStatementCollection getStatements = new CodeStatementCollection();
33         private CodeStatementCollection setStatements = new CodeStatementCollection();
34         private CodeTypeReference privateImplements = null;
35         private CodeTypeReferenceCollection implementationTypes = null;
36         
37         /// <devdoc>
38         ///    <para>[To be supplied.]</para>
39         /// </devdoc>
40         public CodeTypeReference PrivateImplementationType {
41             get {
42                 return privateImplements;
43             }
44             set {
45                 privateImplements = value;
46             }
47         }
48
49         /// <devdoc>
50         ///    <para>[To be supplied.]</para>
51         /// </devdoc>
52         public CodeTypeReferenceCollection ImplementationTypes {
53             get {
54                 if (implementationTypes == null) {
55                     implementationTypes = new CodeTypeReferenceCollection();
56                 }
57                 return implementationTypes;
58             }
59         }
60
61         /// <devdoc>
62         ///    <para>Gets or sets the data type of the property.</para>
63         /// </devdoc>
64         public CodeTypeReference Type {
65             get {
66                 if (type == null) {
67                     type = new CodeTypeReference("");
68                 }
69                 return type;
70             }
71             set {
72                 type = value;
73             }
74         }
75
76         /// <devdoc>
77         ///    <para>
78         ///       Gets a value
79         ///       indicating whether the property has a get method accessor.
80         ///    </para>
81         /// </devdoc>
82         public bool HasGet {
83             get {
84                 return hasGet || getStatements.Count > 0;
85             }
86             set {
87                 hasGet = value;
88                 if (!value) {
89                     getStatements.Clear();
90                 }
91             }
92         }
93
94         /// <devdoc>
95         ///    <para>
96         ///       Gets a value
97         ///       indicating whether the property has a set method accessor.
98         ///    </para>
99         /// </devdoc>
100         public bool HasSet {
101             get {
102                 return hasSet || setStatements.Count > 0;
103             }
104             set {
105                 hasSet = value;
106                 if (!value) {
107                     setStatements.Clear();
108                 }
109             }
110         }
111
112         /// <devdoc>
113         ///    <para>
114         ///       Gets or sets the collection of get statements for the
115         ///       property.
116         ///    </para>
117         /// </devdoc>
118         public CodeStatementCollection GetStatements {
119             get {
120                 return getStatements;
121             }
122         }
123
124         /// <devdoc>
125         ///    <para>
126         ///       Gets or sets the collection of get statements for the property.
127         ///    </para>
128         /// </devdoc>
129         public CodeStatementCollection SetStatements {
130             get {
131                 return setStatements;
132             }
133         }
134
135         /// <devdoc>
136         ///    <para>
137         ///       Gets or sets the collection of declaration expressions
138         ///       for
139         ///       the property.
140         ///    </para>
141         /// </devdoc>
142         public CodeParameterDeclarationExpressionCollection Parameters {
143             get {
144                 return parameters;
145             }
146         }
147     }
148 }