Revert "[3.0] Exclude internal tag module in Public API reference"
[platform/core/uifw/dali-core.git] / dali / public-api / object / type-info.h
1 #ifndef __DALI_TYPE_INFO_H__
2 #define __DALI_TYPE_INFO_H__
3
4 /*
5  * Copyright (c) 2015 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
22 // INTERNAL INCLUDES
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/common/vector-wrapper.h>
25
26 namespace Dali
27 {
28 /**
29  * @addtogroup dali_core_object
30  * @{
31  */
32
33 class ConnectionTrackerInterface;
34 class FunctorDelegate;
35
36 namespace Internal DALI_INTERNAL
37 {
38   class TypeInfo;
39 };
40
41 /**
42  * @brief TypeInfo class for instantiation of registered types and introspection of
43  * their actions and signals.
44  *
45  * See TypeRegistry for methods of type registration and TypeInfo retrieval.
46  * @SINCE_1_0.0
47  */
48 class DALI_IMPORT_API TypeInfo : public BaseHandle
49 {
50 public:
51   typedef BaseHandle (*CreateFunction)(); ///< Function signature for creating an instance of the associated object type. @SINCE_1_0.0
52
53   typedef bool (*ActionFunction)(BaseObject*, const std::string&, const Property::Map&); ///< Function signature for creating scriptable actions @SINCE_1_0.0
54
55   /**
56    * @brief Connects a callback function with the object's signals.
57    *
58    * @SINCE_1_0.0
59    * @param[in] object The object providing the signal.
60    * @param[in] tracker Used to disconnect the signal.
61    * @param[in] signalName The signal to connect to.
62    * @param[in] functor A newly allocated FunctorDelegate.
63    * @return True if the signal was connected.
64    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
65    */
66   typedef bool (*SignalConnectorFunction)(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
67
68   /**
69    * @brief Callback to set an event-thread only property.
70    *
71    * @SINCE_1_0.0
72    * @param[in] object The object whose property should be set.
73    * @param[in] index The index of the property being set.
74    * @param[in] value The new value of the property for the object specified.
75    * @see PropertyRegistration.
76    */
77   typedef void (*SetPropertyFunction)( BaseObject* object, Property::Index index, const Property::Value& value );
78
79   /**
80    * @brief Callback to get the value of an event-thread only property.
81    *
82    * @SINCE_1_0.0
83    * @param[in] object The object whose property value is required.
84    * @param[in] index The index of the property required.
85    * @return The current value of the property for the object specified.
86    * @see PropertyRegistration.
87    */
88   typedef Property::Value (*GetPropertyFunction)( BaseObject* object, Property::Index index );
89
90   /**
91    * @brief Allows the creation of an empty TypeInfo handle.
92    * @SINCE_1_0.0
93    */
94   TypeInfo();
95
96   /**
97    * @brief Destructor
98    *
99    * This is non-virtual since derived Handle types must not contain data or virtual methods.
100    * @SINCE_1_0.0
101    */
102   ~TypeInfo();
103
104   /**
105    * @brief This copy constructor is required for (smart) pointer semantics.
106    *
107    * @SINCE_1_0.0
108    * @param [in] handle A reference to the copied handle
109    */
110   TypeInfo(const TypeInfo& handle);
111
112   /**
113    * @brief This assignment operator is required for (smart) pointer semantics.
114    *
115    * @SINCE_1_0.0
116    * @param [in] rhs  A reference to the copied handle
117    * @return A reference to this
118    */
119   TypeInfo& operator=(const TypeInfo& rhs);
120
121   /**
122    * @brief Retrieve the type name for this type.
123    *
124    * @SINCE_1_0.0
125    * @return string name
126    */
127   const std::string& GetName() const;
128
129   /**
130    * @brief Retrieve the base type name for this type.
131    *
132    * @SINCE_1_0.0
133    * @return string of base name
134    */
135   const std::string& GetBaseName() const;
136
137   /**
138    * @brief Create an object from this type.
139    *
140    * @SINCE_1_0.0
141    * @return the BaseHandle for the newly created object
142    */
143   BaseHandle CreateInstance() const;
144
145   /**
146    * @brief Retrieve the creator function for this type.
147    *
148    * @SINCE_1_0.0
149    * @return the creator function
150    */
151   CreateFunction GetCreator() const;
152
153   /**
154    * @brief Retrieve the number of actions for this type.
155    *
156    * @SINCE_1_0.0
157    * @return The count
158    */
159   size_t GetActionCount() const;
160
161   /**
162    * @brief Retrieve the action name for the index.
163    *
164    * @SINCE_1_0.0
165    * @param[in] index Index to lookup
166    * @return action name or empty string where index is invalid
167    */
168   std::string GetActionName(size_t index);
169
170   /**
171    * @brief Retrieve the number of signals for this type.
172    *
173    * @SINCE_1_0.0
174    * @return The count
175    */
176   size_t GetSignalCount() const;
177
178   /**
179    * @brief Retrieve the signal name for the index.
180    *
181    * @SINCE_1_0.0
182    * @param[in] index Index to lookup
183    * @return signal name or empty string where index is invalid
184    */
185   std::string GetSignalName(size_t index);
186
187   /**
188    * @brief Retrieve the number of event side type registered properties for this type.
189    *
190    * This count does not include all properties
191    * @SINCE_1_0.0
192    * @return The count
193    */
194   size_t GetPropertyCount() const;
195
196   // Properties
197
198   /**
199    * @brief Retrieve all the property indices for this type.
200    *
201    * @SINCE_1_0.0
202    * @param[out] indices Container of property indices
203    * @note The container will be cleared
204    */
205   void GetPropertyIndices( Property::IndexContainer& indices ) const;
206
207   /**
208    * @brief Given a property index, retrieve the property name associated with it.
209    *
210    * @SINCE_1_0.0
211    * @param[in] index The property index.
212    * @return The name of the property at the given index.
213    * @exception DaliException If index is not valid.
214    *
215    */
216   const std::string& GetPropertyName( Property::Index index ) const;
217
218 public: // Not intended for application developers
219
220   /**
221    * @brief This constructor is used by Dali Get() method.
222    *
223    * @SINCE_1_0.0
224    * @param [in] typeInfo A pointer to a Dali resource
225    */
226   explicit DALI_INTERNAL TypeInfo(Internal::TypeInfo* typeInfo);
227
228 };
229
230 /**
231  * @}
232  */
233 } // namespace Dali
234
235 #endif // __DALI_TYPE_INFO_H__