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 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.
21 #include <dali/public-api/object/property-value.h>
22 #include <dali-toolkit/public-api/builder/builder.h>
23 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
40 * Supports template replacement functionality
53 * Constructor with default and overriding map
55 * Make a deep copy of the tree.
56 * @param overrideMap The user overriding map
57 * @param defaultMap The default map to use
59 Replacement( const PropertyValueMap& overrideMap, const PropertyValueMap& defaultMap );
62 * Constructor with default map
64 * Make a deep copy of the tree.
65 * @param overrideMap The user overriding map
67 Replacement( const PropertyValueMap& defaultMap );
69 /* @brief Check node for a type
71 * @param node The TreeNode to check
72 * @return Optional value
74 OptionalString IsString( const TreeNode& node ) const;
76 /* @brief Check node for a type
78 * @param node The TreeNode to check
79 * @return Optional value
81 OptionalBoolean IsBoolean( const TreeNode & node ) const;
83 /* @brief Check node for a type
85 * @param node The TreeNode to check
86 * @return Optional value
88 OptionalFloat IsFloat( const TreeNode & node ) const;
90 /* @brief Check node for a type
92 * @param node The TreeNode to check
93 * @return Optional value
95 OptionalInteger IsInteger( const TreeNode & node ) const;
97 /* @brief Check node for a type
99 * @param node The TreeNode to check
100 * @return Optional value
102 OptionalUnsignedInt IsUnsignedInteger( const TreeNode & node ) const;
104 /* @brief Check node for a type
106 * @param node The TreeNode to check
107 * @return Optional value
109 OptionalVector2 IsVector2( const TreeNode & node ) const;
111 /* @brief Check node for a type
113 * @param node The TreeNode to check
114 * @return Optional value
116 OptionalVector3 IsVector3( const TreeNode & node ) const;
118 /* @brief Check node for a type
120 * @param node The TreeNode to check
121 * @return Optional value
123 OptionalVector4 IsVector4( const TreeNode & node ) const;
125 /* @brief Check node for a type
127 * @param node The TreeNode to check
128 * @return Optional value
130 OptionalMatrix IsMatrix( const TreeNode & node ) const;
132 /* @brief Check node for a type
134 * @param node The TreeNode to check
135 * @return Optional value
137 OptionalMatrix3 IsMatrix3( const TreeNode & node ) const;
139 /* @brief Check node for a type
141 * @param node The TreeNode to check
142 * @return Optional value
144 OptionalRect IsRect( const TreeNode & node ) const;
146 /* @brief Check node for a type
148 * @param child The optional child TreeNode
149 * @return Optional value
151 OptionalString IsString( OptionalChild child ) const;
153 /* @brief Check node for a type
155 * @param child The optional child TreeNode
156 * @return Optional value
158 OptionalFloat IsFloat( OptionalChild child ) const;
160 /* @brief Check node for a type
162 * @param child The optional child TreeNode
163 * @return Optional value
165 OptionalBoolean IsBoolean( OptionalChild child ) const;
167 /* @brief Check node for a type
169 * @param child The optional child TreeNode
170 * @return Optional value
172 OptionalInteger IsInteger( OptionalChild child ) const;
174 /* @brief Check node for a type
176 * @param child The optional child TreeNode
177 * @return Optional value
179 OptionalVector2 IsVector2( OptionalChild child ) const;
181 /* @brief Check node for a type
183 * @param child The optional child TreeNode
184 * @return Optional value
186 OptionalVector3 IsVector3( OptionalChild child ) const;
188 /* @brief Check node for a type
190 * @param child The optional child TreeNode
191 * @return Optional value
193 OptionalVector4 IsVector4( OptionalChild child ) const;
195 /* @brief Check node for a type
197 * @param child The optional child TreeNode
198 * @return Optional value
200 OptionalMatrix IsMatrix( OptionalChild child ) const;
202 /* @brief Check node for a type
204 * @param child The optional child TreeNode
205 * @return Optional value
207 OptionalMatrix3 IsMatrix3( OptionalChild child ) const;
209 /* @brief Check node for a type
211 * @param child The optional child TreeNode
212 * @return Optional value
214 OptionalRect IsRect( OptionalChild child ) const;
216 /* @brief Check node for a type
218 * @param child The optional child TreeNode
219 * @return Optional value
221 bool IsMap( OptionalChild child, Property::Value& out ) const;
223 /* @brief Check node for a type
225 * @param child The optional child TreeNode
226 * @return Optional value
228 bool IsArray( OptionalChild child, Property::Value& out ) const;
231 // Overriding map (overrides the default map). The map is not owned.
232 const PropertyValueMap* const mOverrideMap;
234 // Defautl map. The map is not owned.
235 const PropertyValueMap* const mDefaultMap;
238 // Replacement & operation=( Replacement& replacement );
239 // Replacement( const Replacement& copy );
241 // Returns the string if the node has a full replacement ie IMAGES if node is "{IMAGES}"
242 OptionalString HasFullReplacement( const TreeNode & node ) const;
244 // Returns the property value for a full replacement from the maps
245 Property::Value GetFullReplacement( const std::string& replacementString ) const;
249 } // namespace Internal
251 } // namespace Toolkit