// EXTERNAL INCLUDES
#include <string>
+#include <sstream>
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/property-value.h>
#include <dali/public-api/object/property.h>
+#include <dali/public-api/object/property-key.h>
+#include <dali/public-api/object/property-value.h>
namespace Dali
{
* @{
*/
+typedef std::pair< Property::Key, Property::Value > KeyValuePair;
typedef std::pair<std::string, Property::Value> StringValuePair;
/**
*
* Does not check for duplicates
* @SINCE_1_0.0
- * @param key to insert
- * @param value to insert
+ * @param[in] key to insert
+ * @param[in] value to insert
*/
void Insert( const char* key, const Value& value );
*
* Does not check for duplicates
* @SINCE_1_0.0
- * @param key to insert
- * @param value to insert
+ * @param[in] key to insert
+ * @param[in] value to insert
*/
void Insert( const std::string& key, const Value& value );
*
* Does not check for duplicates
* @SINCE_1_1.39
+ * @param[in] key to insert
+ * @param[in] value to insert
+ */
+ void Insert( Property::Index key, const Value& value );
+
+
+ /**
+ * @brief Inserts the key-value pair in the Map, with the key type as string.
+ *
+ * Does not check for duplicates
+ * @SINCE_1_2.5
* @param key to insert
* @param value to insert
+ * @return a reference to this object
*/
- void Insert( Property::Index key, const Value& value );
+ inline Property::Map& Add( const char* key, const Value& value )
+ {
+ Insert(key, value);
+ return *this;
+ }
/**
- * DEPRECATED_1_1.39. Retrieve the value with key instead of position, Use Find( key ) instead.
+ * @brief Inserts the key-value pair in the Map, with the key type as string.
*
- * @brief Retrieve the value of the string-value pair at the specified position.
+ * Does not check for duplicates
+ * @SINCE_1_2.5
+ * @param key to insert
+ * @param value to insert
+ * @return a reference to this object
+ */
+ inline Property::Map& Add( const std::string& key, const Value& value )
+ {
+ Insert(key, value);
+ return *this;
+ }
+
+
+ /**
+ * @brief Inserts the key-value pair in the Map, with the key type as index.
+ *
+ * Does not check for duplicates
+ * @SINCE_1_2.5
+ * @param key to insert
+ * @param value to insert
+ * @return a reference to this object
+ */
+ inline Property::Map& Add( Property::Index key, const Value& value )
+ {
+ Insert(key, value);
+ return *this;
+ }
+
+ /**
+ * @brief Retrieve the value at the specified position.
*
* @SINCE_1_0.0
+ * @param[in] position The specified position
* @return A reference to the value at the specified position.
*
* @note Will assert if position >= Count()
* @brief Retrieve the key at the specified position.
*
* @SINCE_1_0.0
+ * @param[in] position The specified position
* @return A const reference to the key at the specified position.
*
* @note Will assert if position >= Count()
*/
- const std::string& GetKey( SizeType position ) const;
+ const std::string& GetKey( SizeType position ) const DALI_DEPRECATED_API;
+
+ /**
+ * @brief Retrieve the key at the specified position.
+ *
+ * @SINCE_1_2.7
+ * @return A copy of the key at the specified position.
+ *
+ * @note Will assert if position >= Count()
+ */
+ Key GetKeyAt( SizeType position ) const;
/**
* DEPRECATED_1_1.39 Position based retrieval is no longer supported after extending the key type to both Index and String.
* @brief Retrieve the key & the value at the specified position.
*
* @SINCE_1_0.0
+ * @param[in] position The specified position
* @return A reference to the pair of key and value at the specified position.
*
+ * @note Will assert if position >= Count() or key at position is an index key.
+ */
+ StringValuePair& GetPair( SizeType position ) const DALI_DEPRECATED_API;
+
+ /**
+ * @brief Retrieve the key & the value at the specified position.
+ *
+ * @SINCE_1_2.7
+ * @return A copy of the pair of key and value at the specified position.
+ *
* @note Will assert if position >= Count()
*/
- StringValuePair& GetPair( SizeType position ) const;
+ KeyValuePair GetKeyValue( SizeType position ) const;
/**
* @brief Finds the value for the specified key if it exists.
Value* Find( Property::Index key ) const;
/**
+ * @brief Finds the value for the specified keys if either exist.
+ *
+ * Will search for the index key first.
+ *
+ * @SINCE_1_1.45
+ * @param[in] indexKey The index key to find.
+ * @param[in] stringKey The string key to find.
+ *
+ * @return A const pointer to the value if it exists, NULL otherwise
+ */
+ Value* Find( Property::Index indexKey, const std::string& stringKey ) const;
+
+ /**
* @brief Finds the value for the specified key if it exists and its type is type
*
* @SINCE_1_0.0
*/
DALI_IMPORT_API std::ostream& operator<<( std::ostream& stream, const Property::Map& map );
-
/**
* @}
*/