1 #ifndef __DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT__
2 #define __DALI_TOOLKIT_INTERNAL_BUILDER_REPLACEMENT__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 // http://floralicense.org/license/
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.
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>
39 * Supports template replacement functionality
52 * Constructor with default and overriding map
54 * Make a deep copy of the tree.
55 * @param overrideMap The user overriding map
56 * @param defaultMap The default map to use
58 Replacement( const PropertyValueMap& overrideMap, const PropertyValueMap& defaultMap );
61 * Constructor with default map
63 * Make a deep copy of the tree.
64 * @param overrideMap The user overriding map
66 Replacement( const PropertyValueMap& defaultMap );
68 /* @brief Check node for a type
70 * @param node The TreeNode to check
71 * @return Optional value
73 OptionalString IsString( const TreeNode& node ) const;
75 /* @brief Check node for a type
77 * @param node The TreeNode to check
78 * @return Optional value
80 OptionalBoolean IsBoolean( const TreeNode & node ) const;
82 /* @brief Check node for a type
84 * @param node The TreeNode to check
85 * @return Optional value
87 OptionalFloat IsFloat( const TreeNode & node ) const;
89 /* @brief Check node for a type
91 * @param node The TreeNode to check
92 * @return Optional value
94 OptionalInteger IsInteger( const TreeNode & node ) const;
96 /* @brief Check node for a type
98 * @param node The TreeNode to check
99 * @return Optional value
101 OptionalVector2 IsVector2( const TreeNode & node ) const;
103 /* @brief Check node for a type
105 * @param node The TreeNode to check
106 * @return Optional value
108 OptionalVector3 IsVector3( const TreeNode & node ) const;
110 /* @brief Check node for a type
112 * @param node The TreeNode to check
113 * @return Optional value
115 OptionalVector4 IsVector4( const TreeNode & node ) const;
117 /* @brief Check node for a type
119 * @param node The TreeNode to check
120 * @return Optional value
122 OptionalMatrix IsMatrix( const TreeNode & node ) const;
124 /* @brief Check node for a type
126 * @param node The TreeNode to check
127 * @return Optional value
129 OptionalMatrix3 IsMatrix3( const TreeNode & node ) const;
131 /* @brief Check node for a type
133 * @param node The TreeNode to check
134 * @return Optional value
136 OptionalRect IsRect( const TreeNode & node ) const;
138 /* @brief Check node for a type
140 * @param child The optional child TreeNode
141 * @return Optional value
143 OptionalString IsString( OptionalChild child ) const;
145 /* @brief Check node for a type
147 * @param child The optional child TreeNode
148 * @return Optional value
150 OptionalFloat IsFloat( OptionalChild child ) const;
152 /* @brief Check node for a type
154 * @param child The optional child TreeNode
155 * @return Optional value
157 OptionalBoolean IsBoolean( OptionalChild child ) const;
159 /* @brief Check node for a type
161 * @param child The optional child TreeNode
162 * @return Optional value
164 OptionalInteger IsInteger( OptionalChild child ) const;
166 /* @brief Check node for a type
168 * @param child The optional child TreeNode
169 * @return Optional value
171 OptionalVector2 IsVector2( OptionalChild child ) const;
173 /* @brief Check node for a type
175 * @param child The optional child TreeNode
176 * @return Optional value
178 OptionalVector3 IsVector3( OptionalChild child ) const;
180 /* @brief Check node for a type
182 * @param child The optional child TreeNode
183 * @return Optional value
185 OptionalVector4 IsVector4( OptionalChild child ) const;
187 /* @brief Check node for a type
189 * @param child The optional child TreeNode
190 * @return Optional value
192 OptionalMatrix IsMatrix( OptionalChild child ) const;
194 /* @brief Check node for a type
196 * @param child The optional child TreeNode
197 * @return Optional value
199 OptionalMatrix3 IsMatrix3( OptionalChild child ) const;
201 /* @brief Check node for a type
203 * @param child The optional child TreeNode
204 * @return Optional value
206 OptionalRect IsRect( OptionalChild child ) const;
208 /* @brief Check node for a type
210 * @param child The optional child TreeNode
211 * @return Optional value
213 bool IsMap( OptionalChild child, Property::Value& out ) const;
215 /* @brief Check node for a type
217 * @param child The optional child TreeNode
218 * @return Optional value
220 bool IsArray( OptionalChild child, Property::Value& out ) const;
223 // Overriding map (overrides the default map). The map is not owned.
224 const PropertyValueMap* const mOverrideMap;
226 // Defautl map. The map is not owned.
227 const PropertyValueMap* const mDefaultMap;
230 // Replacement & operation=( Replacement& replacement );
231 // Replacement( const Replacement& copy );
233 // Returns the string if the node has a full replacement ie IMAGES if node is "{IMAGES}"
234 OptionalString HasFullReplacement( const TreeNode & node ) const;
236 // Returns the property value for a full replacement from the maps
237 Property::Value GetFullReplacement( const std::string& replacementString ) const;
241 } // namespace Internal
243 } // namespace Toolkit