2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
22 #include "dali-toolkit/public-api/builder/tree-node.h"
23 #include "dali-toolkit/internal/builder/tree-node-manipulator.h"
38 mType(TreeNode::IS_NULL),
48 const char* TreeNode::GetName() const
53 TreeNode::NodeType TreeNode::GetType() const
58 const char* TreeNode::GetString() const
63 bool TreeNode::HasSubstitution() const
68 float TreeNode::GetFloat() const
73 int TreeNode::GetInteger() const
78 bool TreeNode::GetBoolean() const
80 return mIntValue == 1 ? true : false;
84 size_t TreeNode::Size() const
87 TreeNode* p = mFirstChild;
96 size_t TreeNode::Count(const std::string& childName) const
98 const TreeNode* c = GetChild(childName);
109 const TreeNode* TreeNode::GetChild(const std::string& childName) const
111 const TreeNode* p = mFirstChild;
114 if(p->mName && (std::string(p->mName) == childName) )
123 const TreeNode* TreeNode::Find(const std::string& childName) const
125 if(mName && std::string(mName) == childName)
131 return Internal::FindIt(childName, this);
135 TreeNode::ConstIterator TreeNode::CBegin() const
137 return ConstIterator(mFirstChild);
141 TreeNode::ConstIterator TreeNode::CEnd() const
143 return ConstIterator(NULL);
147 TreeNode::ConstIterator::ConstIterator(TreeNode* v) : mNode(v)
152 TreeNode::ConstIterator& TreeNode::ConstIterator::operator ++()
156 mNode = mNode->mNextSibling;
165 TreeNode::ConstIterator TreeNode::ConstIterator::operator ++(int)
167 TreeNode::ConstIterator ret(mNode);
171 mNode = mNode->mNextSibling;
180 TreeNode::KeyNodePair TreeNode::ConstIterator::operator *()
182 return KeyNodePair(mNode->mName, *mNode);
185 TreeNode::KeyNodePair TreeNode::ConstIterator::operator ->()
187 return KeyNodePair(mNode->mName, *mNode);
190 bool TreeNode::ConstIterator::operator!=( const TreeNode::ConstIterator& rhs ) const
192 return mNode != rhs.mNode;
195 } // namespace Toolkit