1 #ifndef __DALI_PROPERTY_MAP_H__
2 #define __DALI_PROPERTY_MAP_H__
5 * Copyright (c) 2014 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>
33 * @brief A Map of property values.
35 class DALI_IMPORT_API Property::Map
40 * @brief Default constructor.
45 * @brief Copy Constructor.
47 * @param[in] other The Map to copy from.
49 Map( const Map& other );
52 * @brief Non-virtual destructor.
57 * @brief Retrieve the number of elements in the map.
59 * @return The number of elements in the map.
61 unsigned int Count() const;
64 * @brief Returns whether the map is empty.
66 * @return true if empty, false otherwise
71 * @brief Retrieve the value at the specified position.
73 * @return A reference to the value at the specified position.
75 * @note Will assert if position >= Count()
77 Value& GetValue( unsigned int position ) const;
80 * @brief Retrieve the key at the specified position.
82 * @return A const reference to the key at the specified position.
84 * @note Will assert if position >= Count()
86 const std::string& GetKey( unsigned int position ) const;
89 * @brief Retrieve the key & the value at the specified position.
91 * @return A reference to the pair of key and value at the specified position.
93 * @note Will assert if position >= Count()
95 StringValuePair& GetPair( unsigned int position ) const;
98 * @brief Finds the value for the specified key if it exists.
100 * @param[in] key The key to find.
102 * @return A const pointer to the value if it exists, NULL otherwise
104 Value* Find( const std::string& key ) const;
107 * @brief Clears the map.
112 * @brief Merges values from the map 'from' to the current.
114 * Any values in 'from' will overwrite the values in the current map.
116 * @param[in] from The map to merge from.
118 void Merge( const Map& from );
121 * @brief Const operator to access element with the specified key.
123 * @param[in] key The key whose value to access.
125 * @return The value for the element with the specified key, if key doesn't exist, then Property::NONE is returned.
127 * @note Will assert if invalid-key is given.
129 const Value& operator[]( const std::string& key ) const;
132 * @brief Operator to access the element with the specified key.
134 * @param[in] key The key whose value to access.
136 * @return A reference to the value for the element with the specified key.
138 * @note If an element with the key does not exist, then it is created.
140 Value& operator[]( const std::string& key );
143 * @brief Assignment Operator
145 * @param[in] other The map to copy from.
147 * @return The copied map.
149 Map& operator=( const Map& other );
152 struct DALI_INTERNAL Impl; ///< Private data
153 Impl* mImpl; ///< Pointer to private data
158 #endif // __DALI_PROPERTY_MAP_H__