2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 // common name mappings
19 #if defined(SWIGCSHARP)
20 %rename(Assign) operator=;
21 %rename(Add) operator+;
22 %rename(AddAssign) operator+=;
23 %rename(Subtract) operator-;
24 %rename(SubtractAssign) operator-=;
25 %rename(Multiply) operator*;
26 %rename(MultiplyAssign) operator*=;
27 %rename(Divide) operator/;
28 %rename(DivideAssign) operator/=;
29 %rename(Assign) operator=;
30 %rename(EqualTo) operator==;
31 %rename(NotEqualTo) operator!=;
32 %rename(LessThan) operator<;
33 %rename(GreaterThan) operator>;
34 %rename(ValueOfIndex) operator[];
37 %typemap(cscode) Dali::Vector2 %{
38 public static Vector2 operator+(Vector2 arg1, Vector2 arg2) {
39 return arg1.Add(arg2);
42 public static Vector2 operator-(Vector2 arg1, Vector2 arg2) {
43 return arg1.Subtract(arg2);
46 public static Vector2 operator-(Vector2 arg1) {
47 return arg1.Subtract();
50 public static Vector2 operator*(Vector2 arg1, Vector2 arg2) {
51 return arg1.Multiply(arg2);
54 public static Vector2 operator*(Vector2 arg1, float arg2) {
55 return arg1.Multiply(arg2);
58 public static Vector2 operator/(Vector2 arg1, Vector2 arg2) {
59 return arg1.Divide(arg2);
62 public static Vector2 operator/(Vector2 arg1, float arg2) {
63 return arg1.Divide(arg2);
66 public float this[uint index]
70 return ValueOfIndex(index);
75 %typemap(cscode) Dali::Vector3 %{
76 public static Vector3 operator+(Vector3 arg1, Vector3 arg2) {
77 return arg1.Add(arg2);
80 public static Vector3 operator-(Vector3 arg1, Vector3 arg2) {
81 return arg1.Subtract(arg2);
84 public static Vector3 operator-(Vector3 arg1) {
85 return arg1.Subtract();
88 public static Vector3 operator*(Vector3 arg1, Vector3 arg2) {
89 return arg1.Multiply(arg2);
92 public static Vector3 operator*(Vector3 arg1, float arg2) {
93 return arg1.Multiply(arg2);
96 public static Vector3 operator/(Vector3 arg1, Vector3 arg2) {
97 return arg1.Divide(arg2);
100 public static Vector3 operator/(Vector3 arg1, float arg2) {
101 return arg1.Divide(arg2);
104 public float this[uint index]
108 return ValueOfIndex(index);
113 %typemap(cscode) Dali::Vector4 %{
114 public static Vector4 operator+(Vector4 arg1, Vector4 arg2) {
115 return arg1.Add(arg2);
118 public static Vector4 operator-(Vector4 arg1, Vector4 arg2) {
119 return arg1.Subtract(arg2);
122 public static Vector4 operator-(Vector4 arg1) {
123 return arg1.Subtract();
126 public static Vector4 operator*(Vector4 arg1, Vector4 arg2) {
127 return arg1.Multiply(arg2);
130 public static Vector4 operator*(Vector4 arg1, float arg2) {
131 return arg1.Multiply(arg2);
134 public static Vector4 operator/(Vector4 arg1, Vector4 arg2) {
135 return arg1.Divide(arg2);
138 public static Vector4 operator/(Vector4 arg1, float arg2) {
139 return arg1.Divide(arg2);
142 public float this[uint index]
146 return ValueOfIndex(index);
151 %typemap(cscode) Dali::Matrix %{
152 public static Vector4 operator*(Matrix arg1, Vector4 arg2) {
153 return arg1.Multiply(arg2);
157 %typemap(cscode) Dali::Quaternion %{
158 public static Quaternion operator+(Quaternion arg1, Quaternion arg2) {
159 return arg1.Add(arg2);
162 public static Quaternion operator-(Quaternion arg1, Quaternion arg2) {
163 return arg1.Subtract(arg2);
166 public static Quaternion operator-(Quaternion arg1) {
167 return arg1.Subtract();
170 public static Quaternion operator*(Quaternion arg1, Quaternion arg2) {
171 return arg1.Multiply(arg2);
174 public static Vector3 operator*(Quaternion arg1, Vector3 arg2) {
175 return arg1.Multiply(arg2);
178 public static Quaternion operator*(Quaternion arg1, float arg2) {
179 return arg1.Multiply(arg2);
182 public static Quaternion operator/(Quaternion arg1, Quaternion arg2) {
183 return arg1.Divide(arg2);
186 public static Quaternion operator/(Quaternion arg1, float arg2) {
187 return arg1.Divide(arg2);
191 %typemap(cscode) Dali::Property::Array %{
192 public Property.Value this[uint index]
196 return ValueOfIndex(index);
201 %typemap(cscode) Dali::Property::Map %{
202 public Property.Value this[string key]
206 return ValueOfIndex(key);
210 public Property.Value this[int key]
214 return ValueOfIndex(key);
219 %typemap(cscode) Dali::Uint16Pair %{
220 public static bool operator<(Uint16Pair arg1, Uint16Pair arg2) {
221 return arg1.LessThan(arg2);
224 public static bool operator>(Uint16Pair arg1, Uint16Pair arg2) {
225 return arg1.GreaterThan(arg2);
231 * Extend the C++ base handle to include a IsHandleEmpty() function
232 * This is because from C# we can't wrap the operator BooleanType() function
234 %extend Dali::BaseHandle {
235 bool IsHandleEmpty() const {
248 * Extend C# base handle to support true / false testing of base handle
255 %typemap(cscode) Dali::BaseHandle %{
257 public static bool operator true(BaseHandle handle)
261 return handle.IsHandleEmpty();
268 public static bool operator false(BaseHandle handle)
270 return handle.IsHandleEmpty();