X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fobject%2Fproperty-map.h;h=44a132feccfa6eab4fe8e38e5ff4458350a85cbf;hb=4d75040ab200bd306ec5a48f2a617480062eef4c;hp=c530a02df3e5244fafc5c648f3cc334a905a5ff0;hpb=3c1e3d96db855ef9cf7d391a6fc016a268425ad4;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/object/property-map.h b/dali/public-api/object/property-map.h old mode 100644 new mode 100755 index c530a02..44a132f --- a/dali/public-api/object/property-map.h +++ b/dali/public-api/object/property-map.h @@ -2,7 +2,7 @@ #define __DALI_PROPERTY_MAP_H__ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,13 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include -#include #include +#include +#include namespace Dali { @@ -33,13 +35,14 @@ namespace Dali * @{ */ +typedef std::pair< Property::Key, Property::Value > KeyValuePair; typedef std::pair StringValuePair; /** * @brief A Map of property values, the key type could be String or Property::Index. * @SINCE_1_0.0 */ -class DALI_IMPORT_API Property::Map +class DALI_CORE_API Property::Map { public: @@ -55,7 +58,7 @@ public: * @brief Copy Constructor. * * @SINCE_1_0.0 - * @param[in] other The Map to copy from. + * @param[in] other The Map to copy from */ Map( const Map& other ); @@ -66,10 +69,10 @@ public: ~Map(); /** - * @brief Retrieve the number of elements in the map. + * @brief Retrieves the number of elements in the map. * * @SINCE_1_0.0 - * @return The number of elements in the map. + * @return The number of elements in the map */ SizeType Count() const; @@ -77,47 +80,93 @@ public: * @brief Returns whether the map is empty. * * @SINCE_1_0.0 - * @return true if empty, false otherwise + * @return @c true if empty, @c false otherwise */ bool Empty() const; /** * @brief Inserts the key-value pair in the Map, with the key type as string. * - * Does not check for duplicates + * Does not check for duplicates. + * @SINCE_1_0.0 + * @param[in] key The key to insert + * @param[in] value The value to insert + */ + void Insert( const char* 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_0.0 + * @param[in] key The key to insert + * @param[in] value The value to insert + */ + void Insert( const std::string& key, const Value& value ); + + /** + * @brief Inserts the key-value pair in the Map, with the key type as index. + * + * Does not check for duplicates. + * @SINCE_1_1.39 + * @param[in] key The key to insert + * @param[in] value The 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( const char* key, const Value& value ); + inline Property::Map& Add( const char* key, const Value& value ) + { + Insert(key, value); + return *this; + } /** * @brief Inserts the key-value pair in the Map, with the key type as string. * * Does not check for duplicates - * @SINCE_1_0.0 + * @SINCE_1_2.5 * @param key to insert * @param value to insert + * @return a reference to this object */ - void Insert( const std::string& key, const Value& value ); + 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_1.39 + * @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( Property::Index 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 Retrieve the value of the string-value pair at the specified position. + * @brief Retrieves the value at the specified position. * * @SINCE_1_0.0 - * @return A reference to the value at the specified position. + * @param[in] position The specified position + * @return A reference to the value at the specified position * * @note Will assert if position >= Count() */ @@ -126,32 +175,56 @@ public: /** * 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 at the specified position. + * @brief Retrieves the key at the specified position. * * @SINCE_1_0.0 - * @return A const reference to the key at the specified position. + * @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 DALI_DEPRECATED_API; + + /** + * @brief Retrieve the key at the specified position. + * + * @SINCE_1_2.7 + * @param[in] position The specified position + * @return A copy of the key at the specified position. * * @note Will assert if position >= Count() */ - const std::string& GetKey( SizeType position ) const; + 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. + * @brief Retrieves the key & the value at the specified position. * * @SINCE_1_0.0 - * @return A reference to the pair of key and value at the specified position. + * @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 + * @param[in] position The specified position + * @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. * * @SINCE_1_0.0 - * @param[in] key The key to find. + * @param[in] key The key to find * * @return A const pointer to the value if it exists, NULL otherwise */ @@ -161,7 +234,7 @@ public: * @brief Finds the value for the specified key if it exists. * * @SINCE_1_0.0 - * @param[in] key The key to find. + * @param[in] key The key to find * * @return A const pointer to the value if it exists, NULL otherwise */ @@ -171,7 +244,7 @@ public: * @brief Finds the value for the specified key if it exists. * * @SINCE_1_1.39 - * @param[in] key The key to find. + * @param[in] key The key to find * * @return A const pointer to the value if it exists, NULL otherwise */ @@ -183,30 +256,30 @@ public: * 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. + * @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 + * @brief Finds the value for the specified key if it exists and its type is type. * * @SINCE_1_0.0 - * @param[in] key The key to find. - * @param[in] type The type to check. + * @param[in] key The key to find + * @param[in] type The type to check * * @return A const pointer to the value if it exists, NULL otherwise */ Value* Find( const std::string& key, Property::Type type ) const; /** - * @brief Finds the value for the specified key if it exists and its type is type + * @brief Finds the value for the specified key if it exists and its type is type. * * @SINCE_1_1.39 - * @param[in] key The key to find. - * @param[in] type The type to check. + * @param[in] key The key to find + * @param[in] type The type to check * * @return A const pointer to the value if it exists, NULL otherwise */ @@ -224,7 +297,7 @@ public: * Any values in 'from' will overwrite the values in the current map. * * @SINCE_1_0.0 - * @param[in] from The map to merge from. + * @param[in] from The map to merge from */ void Merge( const Map& from ); @@ -232,9 +305,9 @@ public: * @brief Const operator to access element with the specified string key. * * @SINCE_1_0.0 - * @param[in] key The key whose value to access. + * @param[in] key The key whose value to access * - * @return The value for the element with the specified key, if key doesn't exist, then Property::NONE is returned. + * @return The value for the element with the specified key, if key doesn't exist, then Property::NONE is returned * * @note Will assert if invalid-key is given. */ @@ -244,9 +317,9 @@ public: * @brief Operator to access the element with the specified string key. * * @SINCE_1_0.0 - * @param[in] key The key whose value to access. + * @param[in] key The key whose value to access * - * @return A reference to the value for the element with the specified key. + * @return A reference to the value for the element with the specified key * * @note If an element with the key does not exist, then it is created. */ @@ -256,9 +329,9 @@ public: * @brief Const operator to access element with the specified index key. * * @SINCE_1_1.39 - * @param[in] key The key whose value to access. + * @param[in] key The key whose value to access * - * @return The value for the element with the specified key, if key doesn't exist, then Property::NONE is returned. + * @return The value for the element with the specified key, if key doesn't exist, then Property::NONE is returned * * @note Will assert if invalid-key is given. */ @@ -268,29 +341,29 @@ public: * @brief Operator to access the element with the specified index key. * * @SINCE_1_1.39 - * @param[in] key The key whose value to access. + * @param[in] key The key whose value to access * - * @return A reference to the value for the element with the specified key. + * @return A reference to the value for the element with the specified key * * @note If an element with the key does not exist, then it is created. */ Value& operator[]( Property::Index key ); /** - * @brief Assignment Operator + * @brief Assignment Operator. * * @SINCE_1_0.0 - * @param[in] other The map to copy from. + * @param[in] other The map to copy from * - * @return The copied map. + * @return The copied map */ Map& operator=( const Map& other ); /** - * @brief output to stream + * @brief Output to stream. * @SINCE_1_1.28 */ - friend std::ostream& operator<<( std::ostream& stream, const Property::Map& map ); + friend DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Map& map ); private: struct DALI_INTERNAL Impl; ///< Private data @@ -298,15 +371,14 @@ private: }; /** - * @brief Convert the key/value pairs of the property map into a string and append to an output stream. + * @brief Converts the key/value pairs of the property map into a string and append to an output stream. * * @SINCE_1_1.28 - * @param [in] stream The output stream operator. - * @param [in] map The map to insert - * @return The output stream operator. + * @param[in] stream The output stream operator + * @param[in] map The map to insert + * @return The output stream operator */ -DALI_IMPORT_API std::ostream& operator<<( std::ostream& stream, const Property::Map& map ); - +DALI_CORE_API std::ostream& operator<<( std::ostream& stream, const Property::Map& map ); /** * @}