2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
21 #include "dali-toolkit/public-api/builder/tree-node.h"
22 #include "dali-toolkit/internal/builder/tree-node-manipulator.h"
37 mType(TreeNode::IS_NULL),
47 const char* TreeNode::GetName() const
52 TreeNode::NodeType TreeNode::GetType() const
57 const char* TreeNode::GetString() const
62 bool TreeNode::HasSubstitution() const
67 float TreeNode::GetFloat() const
72 int TreeNode::GetInteger() const
77 bool TreeNode::GetBoolean() const
79 return mIntValue == 1 ? true : false;
83 size_t TreeNode::Size() const
86 TreeNode* p = mFirstChild;
95 size_t TreeNode::Count(const std::string& childName) const
97 const TreeNode* c = GetChild(childName);
108 const TreeNode* TreeNode::GetChild(const std::string& childName) const
110 const TreeNode* p = mFirstChild;
113 if(p->mName && (std::string(p->mName) == childName) )
122 const TreeNode* TreeNode::Find(const std::string& childName) const
124 if(mName && std::string(mName) == childName)
130 return Internal::FindIt(childName, this);
134 TreeNode::ConstIterator TreeNode::CBegin() const
136 return ConstIterator(mFirstChild);
140 TreeNode::ConstIterator TreeNode::CEnd() const
142 return ConstIterator(NULL);
146 TreeNode::ConstIterator::ConstIterator(TreeNode* v) : mNode(v)
151 TreeNode::ConstIterator& TreeNode::ConstIterator::operator ++()
155 mNode = mNode->mNextSibling;
164 TreeNode::ConstIterator TreeNode::ConstIterator::operator ++(int)
166 TreeNode::ConstIterator ret(mNode);
170 mNode = mNode->mNextSibling;
179 TreeNode::KeyNodePair TreeNode::ConstIterator::operator *()
181 return KeyNodePair(mNode->mName, *mNode);
184 TreeNode::KeyNodePair TreeNode::ConstIterator::operator ->()
186 return KeyNodePair(mNode->mName, *mNode);
189 bool TreeNode::ConstIterator::operator!=( const TreeNode::ConstIterator& rhs ) const
191 return mNode != rhs.mNode;
194 } // namespace Toolkit