1 #ifndef __DALI_PROPERTY_ARRAY_H__
2 #define __DALI_PROPERTY_ARRAY_H__
5 * Copyright (c) 2018 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 Non-virtual destructor.
67 * @brief Retrieves the number of elements in the array.
70 * @return The number of elements in the array
78 * @brief Retrieves the number of elements in the array.
81 * @return The number of elements in the array
83 SizeType Count() const;
86 * @brief Returns whether the array is empty.
89 * @return @c true if empty, @c false otherwise
97 * @brief Clears the array.
103 * @brief Increases the capacity of the array.
105 * @param[in] size The size to reserve
107 void Reserve( SizeType size );
110 * @brief Resizes to size.
112 * @param[in] size The size to resize
114 void Resize( SizeType size );
117 * @brief Retrieves the capacity of the array.
120 * @return The allocated capacity of the array
125 * @brief Adds an element to the array.
128 * @param[in] value The value to add to the end of the array
130 void PushBack( const Value& value );
133 * @brief Add an element to the array.
136 * @param[in] value The value to add to the end of the array
137 * @return A reference to this object
139 inline Property::Array& Add( const Value& value )
146 * @brief Const access an element.
149 * @param[in] index The element index to access. No bounds checking is performed
150 * @return The a reference to the element
152 const Value& GetElementAt( SizeType index ) const
154 return operator[]( index );
158 * @brief Accesses an element.
161 * @param[in] index The element index to access. No bounds checking is performed
162 * @return The a reference to the element
164 Value& GetElementAt( SizeType index )
166 return operator[]( index );
170 * @brief Const operator to access an element.
173 * @param[in] index The element index to access. No bounds checking is performed
174 * @return The a reference to the element
177 const Value& operator[]( SizeType index ) const;
180 * @brief Operator to access an element.
183 * @param[in] index The element index to access. No bounds checking is performed
184 * @return The a reference to the element
187 Value& operator[]( SizeType index );
190 * @brief Assignment Operator.
193 * @param[in] other The array to copy from
195 * @return The copied array.
197 Array& operator=( const Array& other );
200 * @brief Output to stream.
203 friend std::ostream& operator<<( std::ostream& stream, const Property::Array& array );
206 struct DALI_INTERNAL Impl; ///< Private data
207 Impl* mImpl; ///< Pointer to private data
211 * @brief Converts the values of the property array into a string and append to an output stream.
214 * @param[in] stream The output stream operator
215 * @param[in] array The array to insert
216 * @return The output stream operator
218 DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Array& array );
225 #endif // __DALI_PROPERTY_ARRAY_H__