1 #ifndef DALI_PROPERTY_ARRAY_H
2 #define DALI_PROPERTY_ARRAY_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
25 #include <dali/public-api/common/dali-common.h>
26 #include <dali/public-api/object/property-value.h>
27 #include <dali/public-api/object/property.h>
32 * @addtogroup dali_core_object
37 * @brief A Array of property values.
40 class DALI_CORE_API Property::Array
44 typedef std::size_t SizeType;
47 * @brief Default constructor.
53 * @brief Copy Constructor.
56 * @param[in] other The Array to copy from
58 Array( const Array& other );
61 * @brief Move Constructor.
64 * @param[in] other The Array to move from
65 * @note The other array is an r-value so becomes invalid and is no longer usable.
67 Array( Array&& other );
70 * @brief Non-virtual destructor.
76 * @brief Retrieves the number of elements in the array.
79 * @return The number of elements in the array
87 * @brief Retrieves the number of elements in the array.
90 * @return The number of elements in the array
92 SizeType Count() const;
95 * @brief Returns whether the array is empty.
98 * @return @c true if empty, @c false otherwise
106 * @brief Clears the array.
112 * @brief Increases the capacity of the array.
114 * @param[in] size The size to reserve
116 void Reserve( SizeType size );
119 * @brief Resizes to size.
121 * @param[in] size The size to resize
123 void Resize( SizeType size );
126 * @brief Retrieves the capacity of the array.
129 * @return The allocated capacity of the array
134 * @brief Adds an element to the array.
137 * @param[in] value The value to add to the end of the array
139 void PushBack( const Value& value );
142 * @brief Add an element to the array.
145 * @param[in] value The value to add to the end of the array
146 * @return A reference to this object
148 inline Property::Array& Add( const Value& value )
155 * @brief Const access an element.
158 * @param[in] index The element index to access. No bounds checking is performed
159 * @return The a reference to the element
161 const Value& GetElementAt( SizeType index ) const
163 return operator[]( index );
167 * @brief Accesses an element.
170 * @param[in] index The element index to access. No bounds checking is performed
171 * @return The a reference to the element
173 Value& GetElementAt( SizeType index )
175 return operator[]( index );
179 * @brief Const operator to access an element.
182 * @param[in] index The element index to access. No bounds checking is performed
183 * @return The a reference to the element
186 const Value& operator[]( SizeType index ) const;
189 * @brief Operator to access an element.
192 * @param[in] index The element index to access. No bounds checking is performed
193 * @return The a reference to the element
196 Value& operator[]( SizeType index );
199 * @brief Assignment Operator.
202 * @param[in] other The array to copy from
204 * @return The copied array.
206 Array& operator=( const Array& other );
209 * @brief Move Assignment Operator.
212 * @param[in] other The array to copy from
214 * @return The moved array.
216 * @note The other array is an r-value so becomes invalid and is no longer usable.
218 Array& operator=( Array&& other );
221 * @brief Output to stream.
224 friend DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Array& array );
227 struct DALI_INTERNAL Impl; ///< Private data
228 Impl* mImpl; ///< Pointer to private data
232 * @brief Converts the values of the property array into a string and append to an output stream.
235 * @param[in] stream The output stream operator
236 * @param[in] array The array to insert
237 * @return The output stream operator
239 DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Array& array );
246 #endif // DALI_PROPERTY_ARRAY_H