2 * Copyright(c) 2021 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
30 /// <since_tizen> 3 </since_tizen>
31 public PropertyArray() : this(Interop.Property.NewPropertyArray(), true)
33 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36 internal PropertyArray(PropertyArray other) : this(Interop.Property.NewPropertyArray(PropertyArray.getCPtr(other)), true)
38 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
41 internal PropertyArray(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
46 /// The operator to access an element.
48 /// <param name="index">The element index to access. No bounds checking is performed.</param>
49 /// <returns>The reference to the element.</returns>
50 /// <since_tizen> 3 </since_tizen>
51 public PropertyValue this[uint index]
55 return ValueOfIndex(index);
60 /// Retrieves the number of elements in the array.
62 /// <returns>The number of elements in the array.</returns>
63 /// <since_tizen> 3 </since_tizen>
66 uint ret = Interop.Property.ArraySize(SwigCPtr);
67 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72 /// Retrieves the number of elements in the array.
74 /// <returns>The number of elements in the array.</returns>
75 /// <since_tizen> 3 </since_tizen>
78 uint ret = Interop.Property.ArrayCount(SwigCPtr);
79 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
84 /// Returns whether the array is empty.
86 /// <returns>Returns true if empty, false otherwise.</returns>
87 /// <since_tizen> 3 </since_tizen>
90 bool ret = Interop.Property.ArrayEmpty(SwigCPtr);
91 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
98 /// <since_tizen> 3 </since_tizen>
101 Interop.Property.ArrayClear(SwigCPtr);
102 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
106 /// Increases the capacity of the array.
108 /// <param name="size">The size to reserve.</param>
109 /// <since_tizen> 3 </since_tizen>
110 public void Reserve(uint size)
112 Interop.Property.ArrayReserve(SwigCPtr, size);
113 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
119 /// <param name="size">The size to resize</param>
120 /// <since_tizen> 3 </since_tizen>
121 public void Resize(uint size)
123 Interop.Property.ArrayResize(SwigCPtr, size);
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
128 /// Retrieves the capacity of the array.
130 /// <returns>The allocated capacity of the array.</returns>
131 /// <since_tizen> 3 </since_tizen>
132 public uint Capacity()
134 uint ret = Interop.Property.ArrayCapacity(SwigCPtr);
135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140 /// Adds an element to the array.
142 /// <param name="value">The value to add at the end of the array.</param>
143 /// <since_tizen> 3 </since_tizen>
144 public void PushBack(PropertyValue value)
146 Interop.Property.ArrayPushBack(SwigCPtr, PropertyValue.getCPtr(value));
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151 /// Adds an keyvalue to the array.
152 /// This function should be first
154 /// <param name="value">The value to add at the end of the array.</param>
155 /// <exception cref="global::System.ArgumentNullException"> Thrown when value is null. </exception>
156 public PropertyArray Add(KeyValue value)
160 throw new global::System.ArgumentNullException(nameof(value));
162 PropertyArray ret = new PropertyArray(Interop.Property.ArrayAdd(SwigCPtr, PropertyValue.getCPtr(value.TrueValue)), false);
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// Adds an element to the array.
170 /// <param name="value">The value to add at the end of the array.</param>
171 /// <since_tizen> 3 </since_tizen>
172 public PropertyArray Add(PropertyValue value)
174 PropertyArray ret = new PropertyArray(Interop.Property.ArrayAdd(SwigCPtr, PropertyValue.getCPtr(value)), false);
175 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 /// Accesses an element.
182 /// <param name="index">The element index to access. No bounds checking is performed.</param>
183 /// <returns>The reference to the element.</returns>
184 /// <since_tizen> 3 </since_tizen>
185 public PropertyValue GetElementAt(uint index)
187 PropertyValue ret = new PropertyValue(Interop.Property.ArrayGetElementAt(SwigCPtr, index), false);
188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192 /// This will not be public opened.
193 [EditorBrowsable(EditorBrowsableState.Never)]
194 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
196 Interop.Property.DeletePropertyArray(swigCPtr);
200 /// Retrieves the value of elements in the array.
202 /// <param name="index">The element index to retrieve.</param>
203 /// <returns>The reference to the element.</returns>
204 private PropertyValue ValueOfIndex(uint index)
206 PropertyValue ret = new PropertyValue(Interop.Property.ArrayValueOfIndex(SwigCPtr, index), false);
207 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();