2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.ComponentModel;
19 using System.Diagnostics.CodeAnalysis;
24 /// A key type which can be either a std::string or a Property::Index.
26 /// <since_tizen> 3 </since_tizen>
27 public class PropertyKey : Disposable
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)
36 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
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)
46 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
49 internal PropertyKey(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
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")]
62 /// The type of key is index.
64 /// <since_tizen> 3 </since_tizen>
67 /// The type of key is string.
69 /// <since_tizen> 3 </since_tizen>
74 /// The type of the key.
76 /// <since_tizen> 3 </since_tizen>
77 public PropertyKey.KeyType Type
81 Interop.Property.KeyTypeSet(SwigCPtr, (int)value);
82 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86 PropertyKey.KeyType ret = (PropertyKey.KeyType)Interop.Property.KeyTypeGet(SwigCPtr);
87 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
95 /// <since_tizen> 3 </since_tizen>
100 Interop.Property.KeyIndexKeySet(SwigCPtr, value);
101 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
105 int ret = Interop.Property.KeyIndexKeyGet(SwigCPtr);
106 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
114 /// <since_tizen> 3 </since_tizen>
115 public string StringKey
119 Interop.Property.KeyStringKeySet(SwigCPtr, value);
120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
124 string ret = Interop.Property.KeyStringKeyGet(SwigCPtr);
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
131 /// Compares if rhs is equal to.
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)
138 bool ret = Interop.Property.KeyEqualTo(SwigCPtr, rhs);
139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
144 /// Compares if rhs is equal to.
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)
151 bool ret = Interop.Property.KeyEqualTo(SwigCPtr, rhs);
152 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
157 /// Compares if rhs is equal to
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)
164 bool ret = Interop.Property.KeyEqualTo(SwigCPtr, PropertyKey.getCPtr(rhs));
165 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
170 /// Compares if rhs is not equal to.
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)
177 bool ret = Interop.Property.KeyNotEqualTo(SwigCPtr, rhs);
178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
183 /// Compares if rhs is not equal to.
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)
190 bool ret = Interop.Property.KeyNotEqualTo(SwigCPtr, rhs);
191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
196 /// Compares if rhs is not equal to.
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)
203 bool ret = Interop.Property.KeyNotEqualTo(SwigCPtr, PropertyKey.getCPtr(rhs));
204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
208 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyKey obj)
210 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
213 /// This will not be public opened.
214 [EditorBrowsable(EditorBrowsableState.Never)]
215 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
217 Interop.Property.DeletePropertyKey(swigCPtr);