Dali 3D User Interface Engine
property-helper.h
Go to the documentation of this file.
1 #ifndef __DALI_PROPERTY_HELPER_H__
2 #define __DALI_PROPERTY_HELPER_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // INTERNAL INCLUDES
24 
25 namespace Dali
26 {
27 
28 namespace Internal
29 {
30 
35 {
36  const char* name;
38  bool writable:1;
39  bool animatable:1;
40  bool constraintInput:1;
41 #ifdef DEBUG_ENABLED
42  Property::Index enumIndex;
43 #endif
44 };
45 
51 #define DALI_PROPERTY_TABLE_BEGIN const Internal::PropertyDetails DEFAULT_PROPERTY_DETAILS[] = {
52 #ifdef DEBUG_ENABLED
53 #define DALI_PROPERTY_TABLE_END( startIndex ) }; const int DEFAULT_PROPERTY_COUNT = sizeof( DEFAULT_PROPERTY_DETAILS ) / sizeof( Internal::PropertyDetails ); \
54  struct PROPERTY_CHECK \
55  { \
56  PROPERTY_CHECK() \
57  { \
58  for( int i = 0; i < DEFAULT_PROPERTY_COUNT; i++ ) \
59  { \
60  if ( DEFAULT_PROPERTY_DETAILS[i].enumIndex != ( startIndex + i ) ) \
61  { \
62  DALI_LOG_ERROR( "Checking property failed: index:%d, enumIndex:%d == index+start:%d, (name:%s)\n", i, \
63  DEFAULT_PROPERTY_DETAILS[i].enumIndex, (startIndex + i), DEFAULT_PROPERTY_DETAILS[i].name ); \
64  DALI_ASSERT_DEBUG( false && "Property enumeration mismatch" ); \
65  } \
66  } \
67  } \
68  }; \
69  static PROPERTY_CHECK PROPERTY_CHECK_INSTANCE;
70 #else
71 #define DALI_PROPERTY_TABLE_END( startIndex ) }; const int DEFAULT_PROPERTY_COUNT = sizeof( DEFAULT_PROPERTY_DETAILS ) / sizeof( Internal::PropertyDetails );
72 #endif
73 #ifdef DEBUG_ENABLED
74 #define DALI_PROPERTY( text, type, writable, animatable, constraint, index ) { text, Dali::Property::type, writable, animatable, constraint, index },
75 #else
76 #define DALI_PROPERTY( text, type, writable, animatable, constraint, index ) { text, Dali::Property::type, writable, animatable, constraint },
77 #endif
78 
94 #define DALI_ENUM_TO_STRING_TABLE_BEGIN( t ) const Dali::Scripting::StringEnum t##Table[] = {
95 #define DALI_ENUM_TO_STRING_TABLE_END( t ) }; const unsigned int t##TableCount = sizeof( t##Table ) / sizeof( t##Table[0] );
96 #define DALI_ENUM_TO_STRING( s ) { #s, s },
97 
102 #define DALI_ENUM_TO_STRING_INSIDE_CLASS( className, enumName) { #enumName, className::enumName },
103 
104 
105 } // namespace Internal
106 
107 } // namespace Dali
108 
109 #endif // __DALI_PROPERTY_HELPER_H__
Dali Docs Home
Read more about Dali