Replace registered visuals only when replacement is ready
[platform/core/uifw/dali-toolkit.git] / plugins / dali-sharp / dali-bindings / common.h
1 #ifndef CSHARP_COMMON_H
2 #define CSHARP_COMMON_H
3
4 /*
5  * Copyright (c) 2017 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 #define SWIG_DIRECTORS
22
23 #ifdef __cplusplus
24 /* SwigValueWrapper is described in swig.swg */
25 template<typename T> class SwigValueWrapper
26 {
27   struct SwigMovePointer
28   {
29     T *ptr;
30     SwigMovePointer(T *p) : ptr(p) { }
31     ~SwigMovePointer() { delete ptr; }
32     SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
33   } pointer;
34   SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
35   SwigValueWrapper(const SwigValueWrapper<T>& rhs);
36 public:
37   SwigValueWrapper() : pointer(0) { }
38   SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
39   operator T&() const { return *pointer.ptr; }
40   T *operator&() { return pointer.ptr; }
41 };
42
43 template <typename T> T SwigValueInit()
44 {
45   return T();
46 }
47 #endif
48
49 #include <stdexcept>
50
51 #define SWIGSTDCALL
52
53 /* attribute recognised by some compilers to avoid 'unused' warnings */
54 #ifndef SWIGUNUSED
55 # if defined(__GNUC__)
56 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
57 #     define SWIGUNUSED __attribute__ ((__unused__))
58 #   else
59 #     define SWIGUNUSED
60 #   endif
61 # elif defined(__ICC)
62 #   define SWIGUNUSED __attribute__ ((__unused__))
63 # else
64 #   define SWIGUNUSED
65 # endif
66 #endif
67
68 /* internal SWIG method */
69 #ifndef SWIGINTERN
70 # define SWIGINTERN static SWIGUNUSED
71 #endif
72
73 #ifndef SWIGEXPORT
74 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
75 #   if defined(STATIC_LINKED)
76 #     define SWIGEXPORT
77 #   else
78 #     define SWIGEXPORT __declspec(dllexport)
79 #   endif
80 # else
81 #   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
82 #     define SWIGEXPORT __attribute__ ((visibility("default")))
83 #   else
84 #     define SWIGEXPORT
85 #   endif
86 # endif
87 #endif
88
89 #include <stdlib.h>
90 #include <string.h>
91 #include <stdio.h>
92
93 /*  Errors in SWIG */
94 #define  SWIG_UnknownError         -1
95 #define  SWIG_IOError            -2
96 #define  SWIG_RuntimeError       -3
97 #define  SWIG_IndexError         -4
98 #define  SWIG_TypeError          -5
99 #define  SWIG_DivisionByZero     -6
100 #define  SWIG_OverflowError      -7
101 #define  SWIG_SyntaxError        -8
102 #define  SWIG_ValueError         -9
103 #define  SWIG_SystemError        -10
104 #define  SWIG_AttributeError     -11
105 #define  SWIG_MemoryError        -12
106 #define  SWIG_NullReferenceError   -13
107
108 /* Support for throwing C# exceptions from C/C++. There are two types:
109  * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
110 typedef enum
111 {
112   SWIG_CSharpApplicationException,
113   SWIG_CSharpArithmeticException,
114   SWIG_CSharpDivideByZeroException,
115   SWIG_CSharpIndexOutOfRangeException,
116   SWIG_CSharpInvalidCastException,
117   SWIG_CSharpInvalidOperationException,
118   SWIG_CSharpIOException,
119   SWIG_CSharpNullReferenceException,
120   SWIG_CSharpOutOfMemoryException,
121   SWIG_CSharpOverflowException,
122   SWIG_CSharpSystemException
123 } SWIG_CSharpExceptionCodes;
124
125 typedef enum
126 {
127   SWIG_CSharpArgumentException,
128   SWIG_CSharpArgumentNullException,
129   SWIG_CSharpArgumentOutOfRangeException
130 } SWIG_CSharpExceptionArgumentCodes;
131
132 typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
133 typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
134
135 typedef struct
136 {
137   SWIG_CSharpExceptionCodes code;
138   SWIG_CSharpExceptionCallback_t callback;
139 } SWIG_CSharpException_t;
140
141 typedef struct
142 {
143   SWIG_CSharpExceptionArgumentCodes code;
144   SWIG_CSharpExceptionArgumentCallback_t callback;
145 } SWIG_CSharpExceptionArgument_t;
146
147 static SWIG_CSharpException_t SWIG_csharp_exceptions[] =
148 {
149   { SWIG_CSharpApplicationException, NULL },
150   { SWIG_CSharpArithmeticException, NULL },
151   { SWIG_CSharpDivideByZeroException, NULL },
152   { SWIG_CSharpIndexOutOfRangeException, NULL },
153   { SWIG_CSharpInvalidCastException, NULL },
154   { SWIG_CSharpInvalidOperationException, NULL },
155   { SWIG_CSharpIOException, NULL },
156   { SWIG_CSharpNullReferenceException, NULL },
157   { SWIG_CSharpOutOfMemoryException, NULL },
158   { SWIG_CSharpOverflowException, NULL },
159   { SWIG_CSharpSystemException, NULL }
160 };
161
162 static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] =
163 {
164   { SWIG_CSharpArgumentException, NULL },
165   { SWIG_CSharpArgumentNullException, NULL },
166   { SWIG_CSharpArgumentOutOfRangeException, NULL }
167 };
168
169 static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg)
170 {
171   SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
172   if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t))
173   {
174     callback = SWIG_csharp_exceptions[code].callback;
175   }
176   callback(msg);
177 }
178
179 static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
180   SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
181   if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
182     callback = SWIG_csharp_exceptions_argument[code].callback;
183   }
184   callback(msg, param_name);
185 }
186
187 SWIGINTERN void SWIG_CSharpException(int code, const char *msg)
188 {
189   if (code == SWIG_ValueError)
190   {
191     SWIG_CSharpExceptionArgumentCodes exception_code = SWIG_CSharpArgumentOutOfRangeException;
192     SWIG_CSharpSetPendingExceptionArgument(exception_code, msg, 0);
193   }
194   else
195   {
196     SWIG_CSharpExceptionCodes exception_code = SWIG_CSharpApplicationException;
197     switch(code)
198     {
199       case SWIG_MemoryError:
200         exception_code = SWIG_CSharpOutOfMemoryException;
201         break;
202       case SWIG_IndexError:
203         exception_code = SWIG_CSharpIndexOutOfRangeException;
204         break;
205       case SWIG_DivisionByZero:
206         exception_code = SWIG_CSharpDivideByZeroException;
207         break;
208       case SWIG_IOError:
209         exception_code = SWIG_CSharpIOException;
210         break;
211       case SWIG_OverflowError:
212         exception_code = SWIG_CSharpOverflowException;
213         break;
214       case SWIG_RuntimeError:
215       case SWIG_TypeError:
216       case SWIG_SyntaxError:
217       case SWIG_SystemError:
218       case SWIG_UnknownError:
219       default:
220         exception_code = SWIG_CSharpApplicationException;
221         break;
222     }
223     SWIG_CSharpSetPendingException(exception_code, msg);
224   }
225 }
226
227 #include <stdexcept>
228
229 #define SWIGSTDCALL
230
231 #include <dali/dali.h>
232 #include <dali-toolkit/dali-toolkit.h>
233
234 #include <dali-toolkit/devel-api/controls/control-wrapper.h>
235 #include <dali-toolkit/devel-api/controls/control-wrapper-impl.h>
236
237 #endif // CSHARP_COMMON_H