[NUI] Fixing the emtpy finalizers(CA1821)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / PropertyKey.cs
1 /*
2  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 using System;
18 using System.ComponentModel;
19 using System.Diagnostics.CodeAnalysis;
20
21 namespace Tizen.NUI
22 {
23     /// <summary>
24     /// A key type which can be either a std::string or a Property::Index.
25     /// </summary>
26     /// <since_tizen> 3 </since_tizen>
27     public class PropertyKey : Disposable
28     {
29         /// <summary>
30         /// The constructor.
31         /// </summary>
32         /// <param name="key">The string key.</param>
33         /// <since_tizen> 3 </since_tizen>
34         public PropertyKey(string key) : this(Interop.Property.NewPropertyKey(key), true)
35         {
36             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
37         }
38
39         /// <summary>
40         /// The constructor.
41         /// </summary>
42         /// <param name="key">The index key.</param>
43         /// <since_tizen> 3 </since_tizen>
44         public PropertyKey(int key) : this(Interop.Property.NewPropertyKey(key), true)
45         {
46             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
47         }
48
49         internal PropertyKey(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
50         {
51         }
52
53         /// <summary>
54         /// The type of key.
55         /// </summary>
56         /// <since_tizen> 3 </since_tizen>
57         /// Can't fix because it's already used by other GBM.
58         [SuppressMessage("Microsoft.Naming", "CA1720:Identifiers should not contain type names")]
59         public enum KeyType
60         {
61             /// <summary>
62             /// The type of key is index.
63             /// </summary>
64             /// <since_tizen> 3 </since_tizen>
65             Index,
66             /// <summary>
67             /// The type of key is string.
68             /// </summary>
69             /// <since_tizen> 3 </since_tizen>
70             String
71         }
72
73         /// <summary>
74         /// The type of the key.
75         /// </summary>
76         /// <since_tizen> 3 </since_tizen>
77         public PropertyKey.KeyType Type
78         {
79             set
80             {
81                 Interop.Property.KeyTypeSet(SwigCPtr, (int)value);
82                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
83             }
84             get
85             {
86                 PropertyKey.KeyType ret = (PropertyKey.KeyType)Interop.Property.KeyTypeGet(SwigCPtr);
87                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
88                 return ret;
89             }
90         }
91
92         /// <summary>
93         /// The index key.
94         /// </summary>
95         /// <since_tizen> 3 </since_tizen>
96         public int IndexKey
97         {
98             set
99             {
100                 Interop.Property.KeyIndexKeySet(SwigCPtr, value);
101                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
102             }
103             get
104             {
105                 int ret = Interop.Property.KeyIndexKeyGet(SwigCPtr);
106                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
107                 return ret;
108             }
109         }
110
111         /// <summary>
112         /// The string key.
113         /// </summary>
114         /// <since_tizen> 3 </since_tizen>
115         public string StringKey
116         {
117             set
118             {
119                 Interop.Property.KeyStringKeySet(SwigCPtr, value);
120                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
121             }
122             get
123             {
124                 string ret = Interop.Property.KeyStringKeyGet(SwigCPtr);
125                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
126                 return ret;
127             }
128         }
129
130         /// <summary>
131         /// Compares if rhs is equal to.
132         /// </summary>
133         /// <param name="rhs">A string key to compare against.</param>
134         /// <returns>Returns true if the key compares, or false if it isn't equal or of the wrong type.</returns>
135         /// <since_tizen> 3 </since_tizen>
136         public bool EqualTo(string rhs)
137         {
138             bool ret = Interop.Property.KeyEqualTo(SwigCPtr, rhs);
139             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140             return ret;
141         }
142
143         /// <summary>
144         /// Compares if rhs is equal to.
145         /// </summary>
146         /// <param name="rhs">The index key to compare against.</param>
147         /// <returns>Returns true if the key compares, or false if it isn't equal or of the wrong type.</returns>
148         /// <since_tizen> 3 </since_tizen>
149         public bool EqualTo(int rhs)
150         {
151             bool ret = Interop.Property.KeyEqualTo(SwigCPtr, rhs);
152             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153             return ret;
154         }
155
156         /// <summary>
157         /// Compares if rhs is equal to
158         /// </summary>
159         /// <param name="rhs">A key to compare against</param>
160         /// <returns>Returns true if the keys are of the same type and have the same value.</returns>
161         /// <since_tizen> 3 </since_tizen>
162         public bool EqualTo(PropertyKey rhs)
163         {
164             bool ret = Interop.Property.KeyEqualTo(SwigCPtr, PropertyKey.getCPtr(rhs));
165             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166             return ret;
167         }
168
169         /// <summary>
170         /// Compares if rhs is not equal to.
171         /// </summary>
172         /// <param name="rhs">The index key to compare against.</param>
173         /// <returns>Returns true if the key is not equal or not a string key.</returns>
174         /// <since_tizen> 3 </since_tizen>
175         public bool NotEqualTo(string rhs)
176         {
177             bool ret = Interop.Property.KeyNotEqualTo(SwigCPtr, rhs);
178             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
179             return ret;
180         }
181
182         /// <summary>
183         /// Compares if rhs is not equal to.
184         /// </summary>
185         /// <param name="rhs">The index key to compare against.</param>
186         /// <returns>Returns true if the key is not equal, or not the index key.</returns>
187         /// <since_tizen> 3 </since_tizen>
188         public bool NotEqualTo(int rhs)
189         {
190             bool ret = Interop.Property.KeyNotEqualTo(SwigCPtr, rhs);
191             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192             return ret;
193         }
194
195         /// <summary>
196         /// Compares if rhs is not equal to.
197         /// </summary>
198         /// <param name="rhs">A key to compare against.</param>
199         /// <returns>Returns true if the keys are not of the same type or are not equal.</returns>
200         /// <since_tizen> 3 </since_tizen>
201         public bool NotEqualTo(PropertyKey rhs)
202         {
203             bool ret = Interop.Property.KeyNotEqualTo(SwigCPtr, PropertyKey.getCPtr(rhs));
204             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205             return ret;
206         }
207
208         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyKey obj)
209         {
210             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
211         }
212
213         /// This will not be public opened.
214         [EditorBrowsable(EditorBrowsableState.Never)]
215         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
216         {
217             Interop.Property.DeletePropertyKey(swigCPtr);
218         }
219     }
220 }