/* * Copyright(c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System; using System.ComponentModel; namespace Tizen.NUI { /// /// A key type which can be either a std::string or a Property::Index. /// /// 3 public class PropertyKey : Disposable { /// /// The constructor. /// /// The string key. /// 3 public PropertyKey(string key) : this(Interop.Property.NewPropertyKey(key), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /// /// The constructor. /// /// The index key. /// 3 public PropertyKey(int key) : this(Interop.Property.NewPropertyKey(key), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } internal PropertyKey(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { } /// /// The type of key. /// /// 3 public enum KeyType { /// /// The type of key is index. /// /// 3 Index, /// /// The type of key is string. /// /// 3 String } /// /// The type of the key. /// /// 3 public PropertyKey.KeyType Type { set { Interop.Property.KeyTypeSet(swigCPtr, (int)value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { PropertyKey.KeyType ret = (PropertyKey.KeyType)Interop.Property.KeyTypeGet(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); return ret; } } /// /// The index key. /// /// 3 public int IndexKey { set { Interop.Property.KeyIndexKeySet(swigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { int ret = Interop.Property.KeyIndexKeyGet(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); return ret; } } /// /// The string key. /// /// 3 public string StringKey { set { Interop.Property.KeyStringKeySet(swigCPtr, value); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } get { string ret = Interop.Property.KeyStringKeyGet(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve()); return ret; } } /// /// Compares if rhs is equal to. /// /// A string key to compare against. /// Returns true if the key compares, or false if it isn't equal or of the wrong type. /// 3 public bool EqualTo(string rhs) { bool ret = Interop.Property.KeyEqualTo(swigCPtr, rhs); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Compares if rhs is equal to. /// /// The index key to compare against. /// Returns true if the key compares, or false if it isn't equal or of the wrong type. /// 3 public bool EqualTo(int rhs) { bool ret = Interop.Property.KeyEqualTo(swigCPtr, rhs); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Compares if rhs is equal to /// /// A key to compare against /// Returns true if the keys are of the same type and have the same value. /// 3 public bool EqualTo(PropertyKey rhs) { bool ret = Interop.Property.KeyEqualTo(swigCPtr, PropertyKey.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Compares if rhs is not equal to. /// /// The index key to compare against. /// Returns true if the key is not equal or not a string key. /// 3 public bool NotEqualTo(string rhs) { bool ret = Interop.Property.KeyNotEqualTo(swigCPtr, rhs); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Compares if rhs is not equal to. /// /// The index key to compare against. /// Returns true if the key is not equal, or not the index key. /// 3 public bool NotEqualTo(int rhs) { bool ret = Interop.Property.KeyNotEqualTo(swigCPtr, rhs); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } /// /// Compares if rhs is not equal to. /// /// A key to compare against. /// Returns true if the keys are not of the same type or are not equal. /// 3 public bool NotEqualTo(PropertyKey rhs) { bool ret = Interop.Property.KeyNotEqualTo(swigCPtr, PropertyKey.getCPtr(rhs)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyKey obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } /// This will not be public opened. [EditorBrowsable(EditorBrowsableState.Never)] protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { Interop.Property.DeletePropertyKey(swigCPtr); } } }