Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / object / property.h
index b280269..60236e9 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_PROPERTY_H__
 
 /*
- * Copyright (c) 2016 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.
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <string>
 #include <utility>
+#include <cstdint> // int32_t
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
@@ -39,17 +40,17 @@ class Handle;
  * @brief An object + property pair.
  * @SINCE_1_0.0
  */
-struct DALI_IMPORT_API Property
+struct DALI_CORE_API Property
 {
   /**
    * @brief A valid property index is zero or greater.
    * @SINCE_1_0.0
    */
-  typedef int Index;
+  typedef int32_t Index;
 
-  static const int INVALID_INDEX; ///< -1 is not a valid property index
-  static const int INVALID_KEY;   ///< -1 is not a valid property key
-  static const int INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
+  static const int32_t INVALID_INDEX; ///< -1 is not a valid property index
+  static const int32_t INVALID_KEY;   ///< -1 is not a valid property key
+  static const int32_t INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
 
   typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices @SINCE_1_0.0
 
@@ -59,6 +60,11 @@ struct DALI_IMPORT_API Property
   class Value;
 
   /**
+   * @brief A Key used by Map
+   */
+  struct Key;
+
+  /**
    * @brief A Map of property values.
    */
   class Map;
@@ -69,7 +75,7 @@ struct DALI_IMPORT_API Property
   class Array;
 
   /**
-   * @brief The property types supported.
+   * @brief Enumeration for the property types supported.
    * @SINCE_1_0.0
    */
   enum Type
@@ -88,11 +94,12 @@ struct DALI_IMPORT_API Property
     ROTATION,        ///< either a quaternion or an axis angle rotation @SINCE_1_0.0
     STRING,          ///< A string type @SINCE_1_0.0
     ARRAY,           ///< an array of Property::Value @SINCE_1_0.0
-    MAP              ///< a string key to Property:value mapping @SINCE_1_0.0
+    MAP,             ///< a string key to Property:value mapping @SINCE_1_0.0
+    EXTENTS          ///< a collection of 4 x uint16_t @SINCE_1_2.62
   };
 
   /**
-   * @brief The access mode for custom properties
+   * @brief Enumeration for the access mode for custom properties.
    * @SINCE_1_0.0
    */
   enum AccessMode
@@ -105,47 +112,47 @@ struct DALI_IMPORT_API Property
 
 
   /**
-   * @brief Create a Property instance.
+   * @brief Creates a Property instance.
    *
    * @SINCE_1_0.0
-   * @param [in] object A valid handle to the target object.
-   * @param [in] propertyIndex The index of a property.
+   * @param[in] object A valid handle to the target object
+   * @param[in] propertyIndex The index of a property
    */
   Property( Handle& object, Property::Index propertyIndex );
 
 
   /**
-   * @brief Create a Property instance.
+   * @brief Creates a Property instance.
    *
    * @SINCE_1_0.0
-   * @param [in] object A valid handle to the target object.
-   * @param [in] propertyIndex The index of a property.
-   * @param [in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
+   * @param[in] object A valid handle to the target object.
+   * @param[in] propertyIndex The index of a property.
+   * @param[in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
    */
-  Property( Handle& object, Property::Index propertyIndex, int componentIndex );
+  Property( Handle& object, Property::Index propertyIndex, int32_t componentIndex );
 
   /**
-   * @brief Create a Property instance.
+   * @brief Creates a Property instance.
    *
    * @SINCE_1_0.0
-   * @param [in] object A valid handle to the target object.
-   * @param [in] propertyName The property name.
+   * @param[in] object A valid handle to the target object
+   * @param[in] propertyName The property name
    * @note This performs a property index query and is therefore slower than
    * constructing a Property directly with the index.
    */
   Property( Handle& object, const std::string& propertyName );
 
   /**
-   * @brief Create a Property instance.
+   * @brief Creates a Property instance.
    *
    * @SINCE_1_0.0
-   * @param [in] object A valid handle to the target object.
-   * @param [in] propertyName The property name.
-   * @param [in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
+   * @param[in] object A valid handle to the target object
+   * @param[in] propertyName The property name
+   * @param[in] componentIndex Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1)
    * @note This performs a property index query and is therefore slower than
    * constructing a Property directly with the index.
    */
-  Property( Handle& object, const std::string& propertyName, int componentIndex );
+  Property( Handle& object, const std::string& propertyName, int32_t componentIndex );
 
   /**
    * @brief Non-virtual destructor; Property is not intended as a base class.
@@ -157,7 +164,7 @@ struct DALI_IMPORT_API Property
 
   Index propertyIndex; ///< The index of a property provided by object.
 
-  int componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property
+  int32_t componentIndex; ///< Index of a property sub component, for use with Vector2, Vector3 and Vector4, -1 if using main property
 };
 
 /**