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.
17 using System.ComponentModel;
22 /// An array of property values.
24 /// <since_tizen> 3 </since_tizen>
25 public class PropertyArray : Disposable
31 /// <since_tizen> 3 </since_tizen>
32 public PropertyArray() : this(Interop.Property.NewPropertyArray(), true)
34 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
37 internal PropertyArray(PropertyArray other) : this(Interop.Property.NewPropertyArray(PropertyArray.getCPtr(other)), true)
39 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
42 internal PropertyArray(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
47 /// The operator to access an element.
49 /// <param name="index">The element index to access. No bounds checking is performed.</param>
50 /// <returns>The reference to the element.</returns>
51 /// <since_tizen> 3 </since_tizen>
52 public PropertyValue this[uint index]
56 return ValueOfIndex(index);
61 /// Retrieves the number of elements in the array.
63 /// <returns>The number of elements in the array.</returns>
64 /// <since_tizen> 3 </since_tizen>
67 uint ret = Interop.Property.ArraySize(swigCPtr);
68 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
73 /// Retrieves the number of elements in the array.
75 /// <returns>The number of elements in the array.</returns>
76 /// <since_tizen> 3 </since_tizen>
79 uint ret = Interop.Property.ArrayCount(swigCPtr);
80 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
85 /// Returns whether the array is empty.
87 /// <returns>Returns true if empty, false otherwise.</returns>
88 /// <since_tizen> 3 </since_tizen>
91 bool ret = Interop.Property.ArrayEmpty(swigCPtr);
92 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99 /// <since_tizen> 3 </since_tizen>
102 Interop.Property.ArrayClear(swigCPtr);
103 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
107 /// Increases the capacity of the array.
109 /// <param name="size">The size to reserve.</param>
110 /// <since_tizen> 3 </since_tizen>
111 public void Reserve(uint size)
113 Interop.Property.ArrayReserve(swigCPtr, size);
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
120 /// <param name="size">The size to resize</param>
121 /// <since_tizen> 3 </since_tizen>
122 public void Resize(uint size)
124 Interop.Property.ArrayResize(swigCPtr, size);
125 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 /// Retrieves the capacity of the array.
131 /// <returns>The allocated capacity of the array.</returns>
132 /// <since_tizen> 3 </since_tizen>
133 public uint Capacity()
135 uint ret = Interop.Property.ArrayCapacity(swigCPtr);
136 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
141 /// Adds an element to the array.
143 /// <param name="value">The value to add at the end of the array.</param>
144 /// <since_tizen> 3 </since_tizen>
145 public void PushBack(PropertyValue value)
147 Interop.Property.ArrayPushBack(swigCPtr, PropertyValue.getCPtr(value));
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152 /// Adds an keyvalue to the array.
153 /// This function should be first
155 /// <param name="value">The value to add at the end of the array.</param>
156 /// <exception cref="global::System.ArgumentNullException"> Thrown when value is null. </exception>
157 public PropertyArray Add(KeyValue value)
161 throw new global::System.ArgumentNullException(nameof(value));
163 PropertyArray ret = new PropertyArray(Interop.Property.ArrayAdd(swigCPtr, PropertyValue.getCPtr(value.TrueValue)), false);
164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
169 /// Adds an element to the array.
171 /// <param name="value">The value to add at the end of the array.</param>
172 /// <since_tizen> 3 </since_tizen>
173 public PropertyArray Add(PropertyValue value)
175 PropertyArray ret = new PropertyArray(Interop.Property.ArrayAdd(swigCPtr, PropertyValue.getCPtr(value)), false);
176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181 /// Accesses an element.
183 /// <param name="index">The element index to access. No bounds checking is performed.</param>
184 /// <returns>The reference to the element.</returns>
185 /// <since_tizen> 3 </since_tizen>
186 public PropertyValue GetElementAt(uint index)
188 PropertyValue ret = new PropertyValue(Interop.Property.ArrayGetElementAt(swigCPtr, index), false);
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyArray obj)
195 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
198 /// This will not be public opened.
199 [EditorBrowsable(EditorBrowsableState.Never)]
200 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
202 Interop.Property.DeletePropertyArray(swigCPtr);
206 /// Retrieves the value of elements in the array.
208 /// <param name="index">The element index to retrieve.</param>
209 /// <returns>The reference to the element.</returns>
210 private PropertyValue ValueOfIndex(uint index)
212 PropertyValue ret = new PropertyValue(Interop.Property.ArrayValueOfIndex(swigCPtr, index), false);
213 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();