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.
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 child The optional child TreeNode
145 * @return Optional value
147 OptionalString IsString( OptionalChild child ) const;
149 /* @brief Check node for a type
151 * @param child The optional child TreeNode
152 * @return Optional value
154 OptionalFloat IsFloat( OptionalChild child ) const;
156 /* @brief Check node for a type
158 * @param child The optional child TreeNode
159 * @return Optional value
161 OptionalBoolean IsBoolean( OptionalChild child ) const;
163 /* @brief Check node for a type
165 * @param child The optional child TreeNode
166 * @return Optional value
168 OptionalInteger IsInteger( OptionalChild child ) const;
170 /* @brief Check node for a type
172 * @param child The optional child TreeNode
173 * @return Optional value
175 OptionalVector2 IsVector2( OptionalChild child ) const;
177 /* @brief Check node for a type
179 * @param child The optional child TreeNode
180 * @return Optional value
182 OptionalVector3 IsVector3( OptionalChild child ) const;
184 /* @brief Check node for a type
186 * @param child The optional child TreeNode
187 * @return Optional value
189 OptionalVector4 IsVector4( OptionalChild child ) const;
191 /* @brief Check node for a type
193 * @param child The optional child TreeNode
194 * @return Optional value
196 OptionalMatrix IsMatrix( OptionalChild child ) const;
198 /* @brief Check node for a type
200 * @param child The optional child TreeNode
201 * @return Optional value
203 OptionalMatrix3 IsMatrix3( OptionalChild child ) const;
205 /* @brief Check node for a type
207 * @param child The optional child TreeNode
208 * @return Optional value
210 OptionalRect IsRect( OptionalChild child ) const;
212 /* @brief Check node for a type
214 * @param child The optional child TreeNode
215 * @return Optional value
217 bool IsMap( OptionalChild child, Property::Value& out ) const;
219 /* @brief Check node for a type
221 * @param child The optional child TreeNode
222 * @return Optional value
224 bool IsArray( OptionalChild child, Property::Value& out ) const;
227 // Overriding map (overrides the default map). The map is not owned.
228 const Property::Map* const mOverrideMap;
230 // Default map. The map is not owned.
231 const Property::Map* const mDefaultMap;
234 // Replacement & operation=( Replacement& replacement );
235 // Replacement( const Replacement& copy );
237 // Returns the string if the node has a full replacement ie IMAGES if node is "{IMAGES}"
238 OptionalString HasFullReplacement( const TreeNode & node ) const;
240 // Returns the property value for a full replacement from the maps
241 Property::Value GetFullReplacement( const std::string& replacementString ) const;
245 } // namespace Internal
247 } // namespace Toolkit