Merge "Add dali-vector extension support for types that have destructor and/or copy...
[platform/core/uifw/dali-core.git] / dali / public-api / object / property-array.h
1 #ifndef __DALI_PROPERTY_ARRAY_H__
2 #define __DALI_PROPERTY_ARRAY_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
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>
28
29 namespace Dali
30 {
31
32 /**
33  * @brief A Array of property values.
34  */
35 class DALI_IMPORT_API Property::Array
36 {
37 public:
38
39   /**
40    * @brief Default constructor.
41    */
42   Array();
43
44   /**
45    * @brief Copy Constructor.
46    *
47    * @param[in] other The Array to copy from.
48    */
49   Array( const Array& other );
50
51   /**
52    * @brief Non-virtual destructor.
53    */
54   ~Array();
55
56   /**
57    * @brief Retrieve the number of elements in the array.
58    *
59    * @return The number of elements in the array.
60    */
61   unsigned int Size() const;
62
63   /**
64    * @brief Retrieve the number of elements in the array.
65    *
66    * @return The number of elements in the array.
67    */
68   unsigned int Count() const;
69
70   /**
71    * @brief Returns whether the array is empty.
72    *
73    * @return true if empty, false otherwise
74    */
75   bool Empty() const;
76
77   /**
78    * @brief Clears the array.
79    */
80   void Clear();
81
82   /**
83    * @brief Increase the capcity of the array.
84    */
85   void Reserve(size_t size);
86
87   /**
88    * @brief Resize to size.
89    */
90   void Resize(size_t size);
91
92   /**
93    * @brief Retrieve the capacity of the array.
94    *
95    * @return The allocated capacity of the array
96    */
97   size_t Capacity();
98
99   /**
100    * @brief Add an element to the array.
101    *
102    * @param[in] value The value to add to the end of the array
103    *
104    * @return The a reference to the element.
105    *
106    */
107   void PushBack(const Value& value);
108
109   /**
110    * @brief Const operator to access an element.
111    *
112    * @param[in] index The element index to access. No bounds checking is performed.
113    *
114    * @return The a reference to the element.
115    *
116    */
117   const Value& operator[]( const size_t index ) const;
118
119   /**
120    * @brief Operator to access an element.
121    *
122    * @param[in] index The element index to access. No bounds checking is performed.
123    *
124    * @return The a reference to the element.
125    *
126    */
127   Value& operator[]( const size_t index );
128
129   /**
130    * @brief Assignment Operator
131    *
132    * @param[in] other The array to copy from.
133    *
134    * @return The copied array.
135    */
136   Array& operator=( const Array& other );
137
138 private:
139   struct DALI_INTERNAL Impl; ///< Private data
140   Impl* mImpl; ///< Pointer to private data
141 };
142
143 } // namespace Dali
144
145 #endif // __DALI_PROPERTY_ARRAY_H__