(PropertyRegistration) Moved enums outside of PropertyRegistration class. 01/17701/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 6 Mar 2014 15:53:52 +0000 (15:53 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Fri, 7 Mar 2014 14:01:33 +0000 (14:01 +0000)
[Issue#]   N/A
[Problem]  PropertyRegistration is not in CAPI but the enum is being used by Toolkit headers that
           are in CAPI.
[Cause]    N/A
[Solution] Move the enum outside of CAPI as we do not want to include type-registry in CAPI yet.

Change-Id: Iabc97d6257c1bac1870dab5084a1c9a53d3fad7e
Signed-off-by: Paul Wisbey <p.wisbey@samsung.com>
13 files changed:
automated-tests/dali-test-suite/actors/utc-Dali-Handle.cpp
automated-tests/dali-test-suite/animation/utc-Dali-ActiveConstraint.cpp
automated-tests/dali-test-suite/animation/utc-Dali-Constraint.cpp
automated-tests/dali-test-suite/property-notification/utc-Dali-PropertyNotification.cpp
automated-tests/dali-test-suite/type-registry/utc-Dali-TypeRegistry.cpp
capi/dali/public-api/dali-core-capi-internal.h
capi/dali/public-api/file.list
capi/dali/public-api/object/property-index.h [new file with mode: 0644]
dali/internal/event/common/property-index-ranges.h
dali/internal/event/common/proxy-object.cpp
dali/public-api/object/type-info.h
dali/public-api/object/type-registry.cpp
dali/public-api/object/type-registry.h

index 34b8467..bec8c06 100644 (file)
@@ -296,9 +296,9 @@ void UtcDaliHandleIsPropertyAnimatable()
   DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::WORLD_POSITION_Z ) );
 
   // Type registered properties are not animatable
-  DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PropertyRegistration::START_INDEX ) ); // START
-  DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PropertyRegistration::START_INDEX + ( ( PropertyRegistration::MAX_INDEX - PropertyRegistration::START_INDEX ) * 0.5 ) ) ); // MIDDLE
-  DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PropertyRegistration::MAX_INDEX ) ); // MAX
+  DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PROPERTY_REGISTRATION_START_INDEX ) ); // START
+  DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PROPERTY_REGISTRATION_START_INDEX + ( ( PROPERTY_REGISTRATION_MAX_INDEX - PROPERTY_REGISTRATION_START_INDEX ) * 0.5 ) ) ); // MIDDLE
+  DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( PROPERTY_REGISTRATION_MAX_INDEX ) ); // MAX
 }
 
 void UtcDaliHandleGetPropertyType()
index facc341..97d2402 100644 (file)
@@ -360,7 +360,7 @@ void UtcDaliConstraintProperties()
   // Invalid Property
   try
   {
-    active.GetPropertyName( PropertyRegistration::START_INDEX );
+    active.GetPropertyName( PROPERTY_REGISTRATION_START_INDEX );
     tet_result( TET_FAIL );
   }
   catch ( DaliException& e )
@@ -370,17 +370,17 @@ void UtcDaliConstraintProperties()
   DALI_TEST_EQUALS( active.GetPropertyIndex( "invalid-property-name"), Property::INVALID_INDEX, TEST_LOCATION );
   try
   {
-    active.IsPropertyWritable( PropertyRegistration::START_INDEX );
+    active.IsPropertyWritable( PROPERTY_REGISTRATION_START_INDEX );
     tet_result( TET_FAIL );
   }
   catch ( DaliException& e )
   {
     DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"Cannot find property index", TEST_LOCATION );
   }
-  DALI_TEST_CHECK( ! active.IsPropertyAnimatable( PropertyRegistration::START_INDEX ) );
+  DALI_TEST_CHECK( ! active.IsPropertyAnimatable( PROPERTY_REGISTRATION_START_INDEX ) );
   try
   {
-    active.GetPropertyType( PropertyRegistration::START_INDEX );
+    active.GetPropertyType( PROPERTY_REGISTRATION_START_INDEX );
     tet_result( TET_FAIL );
   }
   catch ( DaliException& e )
@@ -389,7 +389,7 @@ void UtcDaliConstraintProperties()
   }
   try
   {
-    active.SetProperty( PropertyRegistration::START_INDEX, true );
+    active.SetProperty( PROPERTY_REGISTRATION_START_INDEX, true );
     tet_result( TET_FAIL );
   }
   catch ( DaliException& e )
@@ -398,7 +398,7 @@ void UtcDaliConstraintProperties()
   }
   try
   {
-    active.GetProperty< bool >( PropertyRegistration::START_INDEX );
+    active.GetProperty< bool >( PROPERTY_REGISTRATION_START_INDEX );
     tet_result( TET_FAIL );
   }
   catch ( DaliException& e )
index 1d6027e..6500c7b 100644 (file)
@@ -3261,7 +3261,7 @@ void UtcDaliConstraintInvalidInputProperty()
 {
   TestApplication application;
   Actor actor = Actor::New();
-  Constraint constraint = Constraint::New<Vector3>( Actor::POSITION, LocalSource( PropertyRegistration::START_INDEX ), MultiplyConstraint() );
+  Constraint constraint = Constraint::New<Vector3>( Actor::POSITION, LocalSource( PROPERTY_REGISTRATION_START_INDEX ), MultiplyConstraint() );
 
   Stage::GetCurrent().Add( actor );
 
index c1ffd40..0eba8f7 100644 (file)
@@ -292,7 +292,7 @@ void UtcDaliAddPropertyNotificationTypeProperty()
   // Currently, Type registry properties cannot be animated
   try
   {
-    actor.AddPropertyNotification( PropertyRegistration::START_INDEX, GreaterThanCondition( 100.0f ) );
+    actor.AddPropertyNotification( PROPERTY_REGISTRATION_START_INDEX, GreaterThanCondition( 100.0f ) );
   }
   catch ( DaliException& e )
   {
index 16eea9f..380859e 100644 (file)
@@ -657,7 +657,7 @@ void UtcDaliPropertyRegistration()
   unsigned int initialPropertyCount( customActor.GetPropertyCount() );
 
   std::string propertyName( "prop-1" );
-  int propertyIndex( PropertyRegistration::START_INDEX );
+  int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
   Property::Type propertyType( Property::BOOLEAN );
   PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
 
@@ -712,30 +712,30 @@ void UtcDaliPropertyRegistrationIndexOutOfBounds()
   // Attempt to register a property type out-of-bounds index (less than)
   try
   {
-    PropertyRegistration property1( customType1, "prop-name", PropertyRegistration::START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
+    PropertyRegistration property1( customType1, "prop-name", PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
     tet_result( TET_FAIL );
   }
   catch ( DaliException& e )
   {
-    DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "( index >= START_INDEX ) && ( index <= MAX_INDEX )", TEST_LOCATION );
+    DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
   }
 
   // Attempt to register a property type out-of-bounds index (greater than)
   try
   {
-    PropertyRegistration property1( customType1, "prop-name", PropertyRegistration::MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
+    PropertyRegistration property1( customType1, "prop-name", PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
     tet_result( TET_FAIL );
   }
   catch ( DaliException& e )
   {
-    DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "( index >= START_INDEX ) && ( index <= MAX_INDEX )", TEST_LOCATION );
+    DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
   }
 }
 
 void UtcDaliPropertyRegistrationFunctions()
 {
   TestApplication application;
-  int propertyIndex = PropertyRegistration::START_INDEX + 10;
+  int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
 
   // Attempt to register a property without a setter
   try
@@ -756,14 +756,14 @@ void UtcDaliPropertyRegistrationFunctions()
   }
   catch ( DaliException& e )
   {
-    DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"GetProperty", TEST_LOCATION );
+    DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
   }
 }
 
 void UtcDaliPropertyRegistrationAddSameIndex()
 {
   TestApplication application;
-  int propertyIndex = PropertyRegistration::START_INDEX + 100;
+  int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
 
   // Add one property with a valid property index
   PropertyRegistration property1( customType1, "prop-name", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
@@ -775,15 +775,15 @@ void UtcDaliPropertyRegistrationAddSameIndex()
   }
   catch ( DaliException& e )
   {
-    DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"Property index already added", TEST_LOCATION );
+    DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
   }
 }
 
 void UtcDaliPropertyRegistrationPropertyWritable()
 {
   TestApplication application;
-  int propertyIndex1 = PropertyRegistration::START_INDEX + 200;
-  int propertyIndex2 = PropertyRegistration::START_INDEX + 201;
+  int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
+  int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
 
   // Add two properties, one with SetProperty, one without
   PropertyRegistration property1( customType1, "prop-name-readwrite", propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
@@ -805,7 +805,7 @@ void UtcDaliPropertyRegistrationPropertyWritable()
 void UtcDaliPropertyRegistrationPropertyAnimatable()
 {
   TestApplication application;
-  int propertyIndex = PropertyRegistration::START_INDEX + 400;
+  int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
 
   // These properties are not animatable
   PropertyRegistration property1( customType1, "prop-name", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
@@ -825,7 +825,7 @@ void UtcDaliPropertyRegistrationPropertyAnimatable()
 void UtcDaliPropertyRegistrationInvalidGetAndSet()
 {
   TestApplication application;
-  int propertyIndex = PropertyRegistration::START_INDEX + 2000;
+  int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
 
   // Create custom-actor
   TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
@@ -843,7 +843,7 @@ void UtcDaliPropertyRegistrationInvalidGetAndSet()
   }
   catch ( DaliException& e )
   {
-    DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"Cannot find property index", TEST_LOCATION );
+    DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
   }
 
   // Try to get an index that hasn't been added
@@ -854,6 +854,6 @@ void UtcDaliPropertyRegistrationInvalidGetAndSet()
   }
   catch ( DaliException& e )
   {
-    DALI_TEST_ASSERT_CONDITION_STARTS_WITH_SUBSTRING( e, "! \"Cannot find property index", TEST_LOCATION );
+    DALI_TEST_ASSERT( e, "! \"Cannot find property index", TEST_LOCATION );
   }
 }
index a850b3c..3a99f22 100644 (file)
@@ -94,6 +94,7 @@
 #include <dali/public-api/object/handle.h>
 #include <dali/public-api/object/object-registry.h>
 #include <dali/public-api/object/property-conditions.h>
+#include <dali/public-api/object/property-index.h>
 #include <dali/public-api/object/property-input.h>
 #include <dali/public-api/object/property-notification-declarations.h>
 #include <dali/public-api/object/property-notification.h>
index 0d99c9c..2df2ff0 100644 (file)
@@ -90,6 +90,7 @@ capi_devel_object_header_files =  \
   $(capi_devel_src_dir)/object/handle.h \
   $(capi_devel_src_dir)/object/object-registry.h \
   $(capi_devel_src_dir)/object/property-conditions.h \
+  $(capi_devel_src_dir)/object/property-index.h \
   $(capi_devel_src_dir)/object/property-input.h \
   $(capi_devel_src_dir)/object/property-notification-declarations.h \
   $(capi_devel_src_dir)/object/property-notification.h \
diff --git a/capi/dali/public-api/object/property-index.h b/capi/dali/public-api/object/property-index.h
new file mode 100644 (file)
index 0000000..92b53bb
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef __DALI_PROPERTY_INDEX_H__
+#define __DALI_PROPERTY_INDEX_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @addtogroup CAPI_DALI_FRAMEWORK
+ * @{
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali DALI_IMPORT_API
+{
+
+/**
+ * PropertyRegistration indices should be between this range.
+ * Enumerations are being used here rather than static constants so that switch statements can be
+ * used to compare property indices.
+ */
+enum
+{
+  PROPERTY_REGISTRATION_START_INDEX = 10000000,   ///< The index when registering a property should start from this number
+  PROPERTY_REGISTRATION_MAX_INDEX   = 19999999    ///< The maximum index supported when registering a property
+};
+
+} // namespace Dali
+
+/**
+ * @}
+ */
+#endif // __DALI_PROPERTY_INDEX_H__
index 963a5fe..c55d143 100644 (file)
@@ -17,7 +17,7 @@
 // limitations under the License.
 //
 
-#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/property-index.h>
 
 namespace Dali
 {
@@ -29,7 +29,7 @@ namespace Internal
  * Specifies the allowed ranges for different class types to cater for future allocation
  */
 
-#define DEFAULT_PROPERTY_MAX_COUNT                  PropertyRegistration::START_INDEX ///< Default Property Range:     0 to 9999999
+#define DEFAULT_PROPERTY_MAX_COUNT                  PROPERTY_REGISTRATION_START_INDEX ///< Default Property Range:     0 to 9999999
 
 #define DEFAULT_ACTOR_PROPERTY_MAX_COUNT            10000                             ///< Actor Range:                0 to    9999
 #define DEFAULT_RENDERABLE_ACTOR_PROPERTY_MAX_COUNT 20000                             ///< Renderable Actor Range: 10000 to   19999
index e8f3ccf..801a055 100644 (file)
@@ -21,6 +21,7 @@
 #include <algorithm>
 
 // INTERNAL INCLUDES
+#include <dali/public-api/object/property-index.h>
 #include <dali/integration-api/debug.h>
 #include <dali/internal/event/common/stage-impl.h>
 #include <dali/internal/update/common/animatable-property.h>
@@ -161,7 +162,7 @@ const std::string& ProxyObject::GetPropertyName( Property::Index index ) const
     return GetDefaultPropertyName( index );
   }
 
-  if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
     TypeInfo* typeInfo( GetTypeInfo() );
     if ( typeInfo )
@@ -224,7 +225,7 @@ bool ProxyObject::IsPropertyWritable( Property::Index index ) const
     return IsDefaultPropertyWritable( index );
   }
 
-  if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
     TypeInfo* typeInfo( GetTypeInfo() );
     if ( typeInfo )
@@ -257,7 +258,7 @@ bool ProxyObject::IsPropertyAnimatable( Property::Index index ) const
     return IsDefaultPropertyAnimatable( index );
   }
 
-  if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
     // Type Registry event-thread only properties are not animatable.
     return false;
@@ -283,7 +284,7 @@ Property::Type ProxyObject::GetPropertyType( Property::Index index ) const
     return GetDefaultPropertyType( index );
   }
 
-  if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+  if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
     TypeInfo* typeInfo( GetTypeInfo() );
     if ( typeInfo )
@@ -316,7 +317,7 @@ void ProxyObject::SetProperty( Property::Index index, const Property::Value& pro
 
     SetDefaultProperty( index, propertyValue );
   }
-  else if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+  else if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
     TypeInfo* typeInfo( GetTypeInfo() );
     if ( typeInfo )
@@ -354,7 +355,7 @@ Property::Value ProxyObject::GetProperty(Property::Index index) const
   {
     value = GetDefaultProperty( index );
   }
-  else if ( ( index >= PropertyRegistration::START_INDEX ) && ( index <= PropertyRegistration::MAX_INDEX ) )
+  else if ( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) )
   {
     TypeInfo* typeInfo( GetTypeInfo() );
     if ( typeInfo )
@@ -609,7 +610,7 @@ Dali::PropertyNotification ProxyObject::AddPropertyNotification(Property::Index
 {
   if ( index >= DEFAULT_PROPERTY_MAX_COUNT )
   {
-    if ( index <= PropertyRegistration::MAX_INDEX )
+    if ( index <= PROPERTY_REGISTRATION_MAX_INDEX )
     {
       DALI_ASSERT_ALWAYS( false && "Property notification added to non animatable property." );
     }
index 612196f..d11c991 100644 (file)
 // limitations under the License.
 //
 
-/**
- * @addtogroup CAPI_DALI_FRAMEWORK
- * @{
- */
-
 // INTERNAL INCLUDES
 #include <dali/public-api/object/base-handle.h>
 
@@ -144,6 +139,7 @@ public:
   const std::string& GetPropertyName( Property::Index index ) const;
 
 public: // Not intended for application developers
+
   /**
    * This constructor is used by Dali Get() method
    * @param [in] typeInfo A pointer to a Dali resource
@@ -154,7 +150,4 @@ public: // Not intended for application developers
 
 } // namespace Dali
 
-/**
- * @}
- */
 #endif // __DALI_TYPE_INFO_H__
index e18b789..58e5099 100644 (file)
@@ -20,6 +20,7 @@
 // EXTERNAL INCLUDES
 
 // INTERNAL INCLUDES
+#include <dali/public-api/object/property-index.h>
 #include <dali/internal/event/common/type-registry-impl.h>
 #include <dali/internal/event/common/property-index-ranges.h>
 
@@ -113,7 +114,7 @@ TypeAction::TypeAction( TypeRegistration &registered, const std::string &name, T
 
 PropertyRegistration::PropertyRegistration( TypeRegistration& registered, const std::string& name, Property::Index index, Property::Type type, TypeInfo::SetPropertyFunction setFunc, TypeInfo::GetPropertyFunction getFunc )
 {
-  DALI_ASSERT_ALWAYS( ( index >= START_INDEX ) && ( index <= MAX_INDEX ) );
+  DALI_ASSERT_ALWAYS( ( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX ) );
 
   Internal::TypeRegistry::Get()->RegisterProperty( registered, name, index, type, setFunc, getFunc );
 }
index 196b08d..bb761f5 100644 (file)
 // limitations under the License.
 //
 
-/**
- * @addtogroup CAPI_DALI_FRAMEWORK
- * @{
- */
-
 // EXTERNAL INCLUDES
 #include <typeinfo>
 
@@ -229,13 +224,6 @@ class PropertyRegistration
 {
 public:
 
-  // Enumerations are being used here rather than static constants so that switch statements can be used to compare property indices
-  enum
-  {
-    START_INDEX = 10000000,   ///< The index for this type should start from this number
-    MAX_INDEX   = 19999999    ///< The maximum index supported for this type
-  };
-
   /**
    * This constructor registers the property with the registered type. This constructor is for event-thread
    * only properties where the value of the property can be retrieved and set via specified functions.
@@ -248,7 +236,7 @@ public:
    *
    * @param [in] registered The TypeRegistration object
    * @param [in] name The name of the property
-   * @param [in] index The property index. Must be a value between START_INDEX and MAX_INDEX inclusive.
+   * @param [in] index The property index. Must be a value between PROPERTY_REGISTRATION_START_INDEX and PROPERTY_REGISTRATION_MAX_INDEX inclusive.
    * @param [in] type The property value type.
    * @param [in] setFunc The function to call when setting the property. If NULL, then the property becomes read-only.
    * @param [in] getFunc The function to call to retrieve the current value of the property. MUST be provided.
@@ -266,7 +254,4 @@ public:
 
 } // namespace Dali
 
-/**
- * @}
- */
 #endif // header