Add support to create Property::Map with initializer_list
[platform/core/uifw/dali-core.git] / dali / public-api / object / property-map.h
old mode 100644 (file)
new mode 100755 (executable)
index 59c02b0..f1d7e5c
@@ -1,8 +1,8 @@
-#ifndef __DALI_PROPERTY_MAP_H__
-#define __DALI_PROPERTY_MAP_H__
+#ifndef DALI_PROPERTY_MAP_H
+#define DALI_PROPERTY_MAP_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <string>
 #include <sstream>
+#include <initializer_list>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
@@ -42,7 +43,7 @@ typedef std::pair<std::string, Property::Value> 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,6 +56,14 @@ public:
   Map();
 
   /**
+   * @brief Constructor from initializer_list.
+   *
+   * @SINCE_1_4.17
+   * @param[in] values An initializer_list of pairs of index and value.
+   */
+  Map( const std::initializer_list< KeyValuePair >& values );
+
+  /**
    * @brief Copy Constructor.
    *
    * @SINCE_1_0.0
@@ -63,6 +72,15 @@ public:
   Map( const Map& other );
 
   /**
+   * @brief Move Constructor.
+   *
+   * @SINCE_1_4.17
+   * @param[in] other The Map to move from
+   * @note The other array is an r-value so becomes invalid and is no longer usable.
+   */
+  Map( Map&& other );
+
+  /**
    * @brief Non-virtual destructor.
    * @SINCE_1_0.0
    */
@@ -189,6 +207,7 @@ public:
    * @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()
@@ -212,6 +231,7 @@ public:
    * @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()
@@ -358,10 +378,22 @@ public:
   Map& operator=( const Map& other );
 
   /**
+   * @brief Move Assignment Operator.
+   *
+   * @SINCE_1_4.17
+   * @param[in] other The map to move from
+   *
+   * @return The moved map
+   *
+   * @note The other array is an r-value so becomes invalid and is no longer usable.
+   */
+  Map& operator=( Map&& other );
+
+  /**
    * @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
@@ -376,11 +408,11 @@ private:
  * @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 );
 
 /**
  * @}
  */
 } // namespace Dali
 
-#endif // __DALI_PROPERTY_MAP_H__
+#endif // DALI_PROPERTY_MAP_H