111f5bd8a7e6b5837259174d5c120e60b3ca703c
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / TypeInfo.cs
1 /*
2  * Copyright(c) 2017 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 namespace Tizen.NUI
19 {
20
21     /// <summary>
22     /// TypeInfo class for instantiation of registered types and introspection of their actions and signals.
23     /// </summary>
24     /// <since_tizen> 3 </since_tizen>
25     public class TypeInfo : BaseHandle
26     {
27         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
28
29         /// <summary>
30         /// Creates TypeInfo object.
31         /// </summary>
32         /// <since_tizen> 3 </since_tizen>
33         public TypeInfo() : this(Interop.TypeInfo.new_TypeInfo__SWIG_0(), true)
34         {
35             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
36         }
37
38         /// <summary>
39         /// Creates TypeInfo object.
40         /// </summary>
41         /// <param name="handle">This copy constructor is required for (smart) pointer semantics.</param>
42         /// <since_tizen> 3 </since_tizen>
43         public TypeInfo(TypeInfo handle) : this(Interop.TypeInfo.new_TypeInfo__SWIG_1(TypeInfo.getCPtr(handle)), true)
44         {
45             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
46         }
47
48         internal TypeInfo(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.TypeInfo.TypeInfo_SWIGUpcast(cPtr), cMemoryOwn)
49         {
50             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
51         }
52
53         /// <summary>
54         /// Retrieves the type name for this type.
55         /// </summary>
56         /// <returns>The string name.</returns>
57         /// <since_tizen> 3 </since_tizen>
58         public string GetName()
59         {
60             string ret = Interop.TypeInfo.TypeInfo_GetName(swigCPtr);
61             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
62             return ret;
63         }
64
65         /// <summary>
66         /// Retrieves the type name for this type.
67         /// </summary>
68         /// <returns>The string name.</returns>
69         /// <since_tizen> 3 </since_tizen>
70         public string GetBaseName()
71         {
72             string ret = Interop.TypeInfo.TypeInfo_GetBaseName(swigCPtr);
73             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
74             return ret;
75         }
76
77         /// <summary>
78         /// Creates an object from this type.
79         /// </summary>
80         /// <returns>The BaseHandle for the newly created object.</returns>
81         /// <since_tizen> 3 </since_tizen>
82         public BaseHandle CreateInstance()
83         {
84             BaseHandle ret = new BaseHandle(Interop.TypeInfo.TypeInfo_CreateInstance(swigCPtr), true);
85             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
86             return ret;
87         }
88
89         /// <summary>
90         /// Retrieves the number of event side type registered properties for this type.<br />
91         /// This count does not include all properties.
92         /// </summary>
93         /// <returns>The count.</returns>
94         /// <since_tizen> 3 </since_tizen>
95         public uint GetPropertyCount()
96         {
97             uint ret = Interop.TypeInfo.TypeInfo_GetPropertyCount(swigCPtr);
98             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
99             return ret;
100         }
101
102         /// <summary>
103         /// Given a property index, retrieve the property name associated with it.
104         /// </summary>
105         /// <param name="index">The property index.</param>
106         /// <returns>The name of the property at the given index.</returns>
107         /// <since_tizen> 3 </since_tizen>
108         public string GetPropertyName(int index)
109         {
110             string ret = Interop.TypeInfo.TypeInfo_GetPropertyName(swigCPtr, index);
111             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
112             return ret;
113         }
114
115         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TypeInfo obj)
116         {
117             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
118         }
119
120         /// <summary>
121         /// Dispose.
122         /// </summary>
123         /// <param name="type">The dispose type</param>
124         /// <since_tizen> 3 </since_tizen>
125         protected override void Dispose(DisposeTypes type)
126         {
127             if (disposed)
128             {
129                 return;
130             }
131
132             if (type == DisposeTypes.Explicit)
133             {
134                 //Called by User
135                 //Release your own managed resources here.
136                 //You should release all of your own disposable objects here.
137
138             }
139
140             //Release your own unmanaged resources here.
141             //You should not access any managed member here except static instance.
142             //because the execution order of Finalizes is non-deterministic.
143
144             if (swigCPtr.Handle != global::System.IntPtr.Zero)
145             {
146                 if (swigCMemOwn)
147                 {
148                     swigCMemOwn = false;
149                     Interop.TypeInfo.delete_TypeInfo(swigCPtr);
150                 }
151                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
152             }
153
154             base.Dispose(type);
155         }
156
157     }
158
159 }