(StyleManager) Remove StyleManager header include form CAPI
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / internal / builder / replacement.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT__
2 #define __DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 #include <dali/public-api/object/property-value.h>
21 #include <dali-toolkit/public-api/builder/builder.h>
22 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29   class TreeNode;
30 }
31
32 namespace Toolkit
33 {
34
35 namespace Internal
36 {
37
38 /*
39  * Supports template replacement functionality
40  *
41  */
42 class Replacement
43 {
44 public:
45
46   /*
47    * Constructor
48    */
49   Replacement();
50
51   /*
52    * Constructor with default and overriding map
53    *
54    * Make a deep copy of the tree.
55    * @param overrideMap The user overriding map
56    * @param defaultMap The default map to use
57    */
58   Replacement( const PropertyValueMap& overrideMap, const PropertyValueMap& defaultMap );
59
60   /*
61    * Constructor with default map
62    *
63    * Make a deep copy of the tree.
64    * @param overrideMap The user overriding map
65    */
66   Replacement( const PropertyValueMap& defaultMap );
67
68   /* @brief Check node for a type
69    *
70    * @param node The TreeNode to check
71    * @return Optional value
72    */
73   OptionalString IsString( const TreeNode& node ) const;
74
75   /* @brief Check node for a type
76    *
77    * @param node The TreeNode to check
78    * @return Optional value
79    */
80   OptionalBoolean IsBoolean( const TreeNode & node ) const;
81
82   /* @brief Check node for a type
83    *
84    * @param node The TreeNode to check
85    * @return Optional value
86    */
87   OptionalFloat IsFloat( const TreeNode & node ) const;
88
89   /* @brief Check node for a type
90    *
91    * @param node The TreeNode to check
92    * @return Optional value
93    */
94   OptionalInteger IsInteger( const TreeNode & node ) const;
95
96   /* @brief Check node for a type
97    *
98    * @param node The TreeNode to check
99    * @return Optional value
100    */
101   OptionalVector2 IsVector2( const TreeNode & node ) const;
102
103   /* @brief Check node for a type
104    *
105    * @param node The TreeNode to check
106    * @return Optional value
107    */
108   OptionalVector3 IsVector3( const TreeNode & node ) const;
109
110   /* @brief Check node for a type
111    *
112    * @param node The TreeNode to check
113    * @return Optional value
114    */
115   OptionalVector4 IsVector4( const TreeNode & node ) const;
116
117   /* @brief Check node for a type
118    *
119    * @param node The TreeNode to check
120    * @return Optional value
121    */
122   OptionalMatrix IsMatrix( const TreeNode & node ) const;
123
124   /* @brief Check node for a type
125    *
126    * @param node The TreeNode to check
127    * @return Optional value
128    */
129   OptionalMatrix3 IsMatrix3( const TreeNode & node ) const;
130
131   /* @brief Check node for a type
132    *
133    * @param node The TreeNode to check
134    * @return Optional value
135    */
136   OptionalRect IsRect( const TreeNode & node ) const;
137
138   /* @brief Check node for a type
139    *
140    * @param child The optional child TreeNode
141    * @return Optional value
142    */
143   OptionalString IsString( OptionalChild child ) const;
144
145   /* @brief Check node for a type
146    *
147    * @param child The optional child TreeNode
148    * @return Optional value
149    */
150   OptionalFloat IsFloat( OptionalChild child ) const;
151
152   /* @brief Check node for a type
153    *
154    * @param child The optional child TreeNode
155    * @return Optional value
156    */
157   OptionalBoolean IsBoolean( OptionalChild child ) const;
158
159   /* @brief Check node for a type
160    *
161    * @param child The optional child TreeNode
162    * @return Optional value
163    */
164   OptionalInteger IsInteger( OptionalChild child ) const;
165
166   /* @brief Check node for a type
167    *
168    * @param child The optional child TreeNode
169    * @return Optional value
170    */
171   OptionalVector2 IsVector2( OptionalChild child ) const;
172
173   /* @brief Check node for a type
174    *
175    * @param child The optional child TreeNode
176    * @return Optional value
177    */
178   OptionalVector3 IsVector3( OptionalChild child ) const;
179
180   /* @brief Check node for a type
181    *
182    * @param child The optional child TreeNode
183    * @return Optional value
184    */
185   OptionalVector4 IsVector4( OptionalChild child ) const;
186
187   /* @brief Check node for a type
188    *
189    * @param child The optional child TreeNode
190    * @return Optional value
191    */
192   OptionalMatrix IsMatrix( OptionalChild child ) const;
193
194   /* @brief Check node for a type
195    *
196    * @param child The optional child TreeNode
197    * @return Optional value
198    */
199   OptionalMatrix3 IsMatrix3( OptionalChild child ) const;
200
201   /* @brief Check node for a type
202    *
203    * @param child The optional child TreeNode
204    * @return Optional value
205    */
206   OptionalRect IsRect( OptionalChild child ) const;
207
208   /* @brief Check node for a type
209    *
210    * @param child The optional child TreeNode
211    * @return Optional value
212    */
213   bool IsMap( OptionalChild child, Property::Value& out ) const;
214
215   /* @brief Check node for a type
216    *
217    * @param child The optional child TreeNode
218    * @return Optional value
219    */
220   bool IsArray( OptionalChild child, Property::Value& out ) const;
221
222 private:
223   // Overriding map (overrides the default map). The map is not owned.
224   const PropertyValueMap* const mOverrideMap;
225
226   // Defautl map. The map is not owned.
227   const PropertyValueMap* const mDefaultMap;
228
229   // compiler
230   // Replacement & operation=( Replacement& replacement );
231   // Replacement( const Replacement& copy );
232
233   // Returns the string if the node has a full replacement ie IMAGES if node is "{IMAGES}"
234   OptionalString HasFullReplacement( const TreeNode & node ) const;
235
236   // Returns the property value for a full replacement from the maps
237   Property::Value GetFullReplacement( const std::string& replacementString ) const;
238
239 };
240
241 } // namespace Internal
242
243 } // namespace Toolkit
244
245 } // namespace Dali
246
247
248 #endif // header