(Scripting) Helper method for bit-mask enum properties & moved enum-string macros...
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-helper.h
index 8ebf477..0fa0a47 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_PROPERTY_HELPER_H__
-#define __DALI_PROPERTY_HELPER_H__
+#ifndef DALI_PROPERTY_HELPER_H
+#define DALI_PROPERTY_HELPER_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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,6 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/bitmap.h>
+#include <dali/devel-api/scripting/enum-helper.h>
 
 namespace Dali
 {
@@ -76,27 +77,21 @@ struct PropertyDetails
 #endif
 
 /**
- * Macros for creating enumeration to string tables.
- * Example:
+ * @brief Case insensitive string comparison.
  *
- * DALI_ENUM_TO_STRING_TABLE_BEGIN( SizeMode )
- * DALI_ENUM_TO_STRING( USE_OWN_SIZE )
- * DALI_ENUM_TO_STRING( SIZE_EQUAL_TO_PARENT )
- * DALI_ENUM_TO_STRING_TABLE_END( SizeMode )
+ * Additionally, '-' and '_' can be used interchangeably as well.
+ * Returns if both strings have a ',' or a '\0' at the same point.
  *
- * Creates:
- * const Scripting::StringEnum< SizeMode > SizeModeTable[] = {
- * { "USE_OWN_SIZE", USE_OWN_SIZE },
- * { "SIZE_EQUAL_TO_PARENT", SIZE_EQUAL_TO_PARENT },
- * }; const unsigned int SizeModeTableCount = sizeof( SizeModeTable ) / sizeof( SizeModeTable[0] );
+ * @param[in]   first   The first string.
+ * @param[in]   second  The string to compare it to.
+ * @param[out]  size    The size of the string.
+ *
+ * @return true if strings are the same
  */
-#define DALI_ENUM_TO_STRING_TABLE_BEGIN( t ) const Scripting::StringEnum< t > t##Table[] = {
-#define DALI_ENUM_TO_STRING_TABLE_END( t )   }; const unsigned int t##TableCount = sizeof( t##Table ) / sizeof( t##Table[0] );
-#define DALI_ENUM_TO_STRING( s ) { #s, s },
-
+bool CompareTokens( const char * first, const char * second, size_t& size );
 
 } // namespace Internal
 
 } // namespace Dali
 
-#endif // __DALI_PROPERTY_HELPER_H__
+#endif // DALI_PROPERTY_HELPER_H