1 #ifndef DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT_H
2 #define DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/property-value.h>
25 #include <dali-toolkit/devel-api/builder/builder.h>
26 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
43 * Supports template replacement functionality
56 * Constructor with default and overriding map
58 * Make a deep copy of the tree.
59 * @param overrideMap The user overriding map
60 * @param defaultMap The default map to use
62 Replacement( const Property::Map& overrideMap, const Property::Map& defaultMap );
65 * Constructor with default map
67 * Make a deep copy of the tree.
68 * @param overrideMap The user overriding map
70 Replacement( const Property::Map& defaultMap );
72 /* @brief Check node for a type
74 * @param node The TreeNode to check
75 * @return Optional value
77 OptionalString IsString( const TreeNode& node ) const;
79 /* @brief Check node for a type
81 * @param node The TreeNode to check
82 * @return Optional value
84 OptionalBoolean IsBoolean( const TreeNode & node ) const;
86 /* @brief Check node for a type
88 * @param node The TreeNode to check
89 * @return Optional value
91 OptionalFloat IsFloat( const TreeNode & node ) const;
93 /* @brief Check node for a type
95 * @param node The TreeNode to check
96 * @return Optional value
98 OptionalInteger IsInteger( const TreeNode & node ) const;
100 /* @brief Check node for a type
102 * @param node The TreeNode to check
103 * @return Optional value
105 OptionalVector2 IsVector2( const TreeNode & node ) const;
107 /* @brief Check node for a type
109 * @param node The TreeNode to check
110 * @return Optional value
112 OptionalVector3 IsVector3( const TreeNode & node ) const;
114 /* @brief Check node for a type
116 * @param node The TreeNode to check
117 * @return Optional value
119 OptionalVector4 IsVector4( const TreeNode & node ) const;
121 /* @brief Check node for a type
123 * @param node The TreeNode to check
124 * @return Optional value
126 OptionalMatrix IsMatrix( const TreeNode & node ) const;
128 /* @brief Check node for a type
130 * @param node The TreeNode to check
131 * @return Optional value
133 OptionalMatrix3 IsMatrix3( const TreeNode & node ) const;
135 /* @brief Check node for a type
137 * @param node The TreeNode to check
138 * @return Optional value
140 OptionalRect IsRect( const TreeNode & node ) const;
142 /* @brief Check node for a type
144 * @param node The TreeNode to check
145 * @return Optional value
147 OptionalExtents IsExtents( const TreeNode & node ) const;
149 /* @brief Check node for a type
151 * @param child The optional child TreeNode
152 * @return Optional value
154 OptionalString IsString( OptionalChild child ) const;
156 /* @brief Check node for a type
158 * @param child The optional child TreeNode
159 * @return Optional value
161 OptionalFloat IsFloat( OptionalChild child ) const;
163 /* @brief Check node for a type
165 * @param child The optional child TreeNode
166 * @return Optional value
168 OptionalBoolean IsBoolean( OptionalChild child ) const;
170 /* @brief Check node for a type
172 * @param child The optional child TreeNode
173 * @return Optional value
175 OptionalInteger IsInteger( OptionalChild child ) const;
177 /* @brief Check node for a type
179 * @param child The optional child TreeNode
180 * @return Optional value
182 OptionalVector2 IsVector2( OptionalChild child ) const;
184 /* @brief Check node for a type
186 * @param child The optional child TreeNode
187 * @return Optional value
189 OptionalVector3 IsVector3( OptionalChild child ) const;
191 /* @brief Check node for a type
193 * @param child The optional child TreeNode
194 * @return Optional value
196 OptionalVector4 IsVector4( OptionalChild child ) const;
198 /* @brief Check node for a type
200 * @param child The optional child TreeNode
201 * @return Optional value
203 OptionalMatrix IsMatrix( OptionalChild child ) const;
205 /* @brief Check node for a type
207 * @param child The optional child TreeNode
208 * @return Optional value
210 OptionalMatrix3 IsMatrix3( OptionalChild child ) const;
212 /* @brief Check node for a type
214 * @param child The optional child TreeNode
215 * @return Optional value
217 OptionalRect IsRect( OptionalChild child ) const;
219 /* @brief Check node for a type
221 * @param child The optional child TreeNode
222 * @return Optional value
224 bool IsMap( OptionalChild child, Property::Value& out ) const;
226 /* @brief Check node for a type
228 * @param child The optional child TreeNode
229 * @return Optional value
231 bool IsArray( OptionalChild child, Property::Value& out ) const;
233 /* @brief Check node for a type
235 * @param child The optional child TreeNode
236 * @return Optional value
238 OptionalExtents IsExtents( OptionalChild child ) const;
241 // Overriding map (overrides the default map). The map is not owned.
242 const Property::Map* const mOverrideMap;
244 // Default map. The map is not owned.
245 const Property::Map* const mDefaultMap;
248 // Replacement & operation=( Replacement& replacement );
249 // Replacement( const Replacement& copy );
251 // Returns the string if the node has a full replacement ie IMAGES if node is "{IMAGES}"
252 OptionalString HasFullReplacement( const TreeNode & node ) const;
254 // Returns the property value for a full replacement from the maps
255 Property::Value GetFullReplacement( const std::string& replacementString ) const;
259 } // namespace Internal
261 } // namespace Toolkit
265 #endif // DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT_H