X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fbuilder%2Ftree-node.h;h=6246b16703b698013f37950b0cfb1d947f9c113b;hb=bd126b5d480c08bf7a995b2c4532e80e76ec4ad2;hp=3e47aea2116d6744de8fe790830d5885212390f3;hpb=9d09b345fbdef7a0532f5b45ffe65754f87258c6;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/devel-api/builder/tree-node.h b/dali-toolkit/devel-api/builder/tree-node.h index 3e47aea..6246b16 100644 --- a/dali-toolkit/devel-api/builder/tree-node.h +++ b/dali-toolkit/devel-api/builder/tree-node.h @@ -1,8 +1,8 @@ -#ifndef __DALI_SCRIPT_TREE_NODE_H__ -#define __DALI_SCRIPT_TREE_NODE_H__ +#ifndef DALI_SCRIPT_TREE_NODE_H +#define DALI_SCRIPT_TREE_NODE_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,30 +19,27 @@ */ // EXTERNAL INCLUDES -#include // pair +#include #include -#include +#include +#include // pair namespace Dali { - namespace Toolkit { - namespace Internal DALI_INTERNAL { - class TreeNodeManipulator; -} // namespace Internal - +} // namespace DALI_INTERNAL /* * TreeNode describes a tree of nodes. * TreeNode does not own its string data which is held by a container eg JsonParser * Modification operations should be done through a container. */ -class DALI_IMPORT_API TreeNode +class DALI_TOOLKIT_API TreeNode { public: /* @@ -69,16 +66,16 @@ public: /* * Iterator to iterate through children */ - class ConstIterator + class DALI_TOOLKIT_API ConstIterator { public: - typedef KeyNodePair value_type; - typedef KeyNodePair *pointer; - typedef const KeyNodePair *const_pointer; - typedef KeyNodePair &reference; - typedef const KeyNodePair &const_reference; - typedef size_t size_type; - typedef std::ptrdiff_t difference_type; + typedef KeyNodePair value_type; + typedef KeyNodePair* pointer; + typedef const KeyNodePair* const_pointer; + typedef KeyNodePair& reference; + typedef const KeyNodePair& const_reference; + typedef size_t size_type; + typedef std::ptrdiff_t difference_type; typedef std::forward_iterator_tag iterator_category; /* @@ -89,22 +86,23 @@ public: /* * pre increment */ - ConstIterator& operator ++(); + ConstIterator& operator++(); /* * post increment */ - ConstIterator operator ++(int); + ConstIterator operator++(int); /* * != test */ - bool operator!=( const ConstIterator& rhs ) const; + bool operator!=(const ConstIterator& rhs) const; /* * pointer semantics */ KeyNodePair operator*(); + private: TreeNode* mNode; }; @@ -132,7 +130,7 @@ public: * @param childName The name of the child to find * @return the number of children in the found child */ - size_t Count(const std::string& childName) const; + size_t Count(std::string_view childName) const; /* * Get the nodes name @@ -182,18 +180,25 @@ public: bool HasSubstitution() const; /* - * Gets a child of the node - * @param name The name of the child + * Gets a child of the node (using case sensitive matching) + * @param name The name of the child. + * @return The child if found, else NULL + */ + const TreeNode* GetChild(std::string_view name) const; + + /* + * Gets a child of the node (using case insensitive matching) + * @param name The name of the child in lower case * @return The child if found, else NULL */ - const TreeNode* GetChild(const std::string& name) const; + const TreeNode* GetChildIgnoreCase(std::string_view name) const; /* * Recursively search for a child of the node * @param name The name of the child * @return The child if found, else NULL */ - const TreeNode* Find(const std::string& name) const; + const TreeNode* Find(std::string_view name) const; private: friend class Internal::TreeNodeManipulator; @@ -204,30 +209,29 @@ private: DALI_INTERNAL TreeNode(); // non copyable or assignable - DALI_INTERNAL TreeNode(TreeNode &); + DALI_INTERNAL TreeNode(TreeNode&); DALI_INTERNAL TreeNode& operator=(const TreeNode&); - const char* mName; ///< The nodes name (if any) + const char* mName; ///< The nodes name (if any) - TreeNode* mParent; ///< The nodes parent - TreeNode* mNextSibling; ///< The nodes next sibling - TreeNode* mFirstChild; ///< The nodes first child - TreeNode* mLastChild; ///< The nodes last child + TreeNode* mParent; ///< The nodes parent + TreeNode* mNextSibling; ///< The nodes next sibling + TreeNode* mFirstChild; ///< The nodes first child + TreeNode* mLastChild; ///< The nodes last child union { - const char* mStringValue; ///< The node string value - int mIntValue; ///< The node integer value - float mFloatValue; ///< The node float value + const char* mStringValue; ///< The node string value + int mIntValue; ///< The node integer value + float mFloatValue; ///< The node float value }; - NodeType mType; ///< The nodes type - bool mSubstituion; ///< String substitution flag - + NodeType mType; ///< The nodes type + bool mSubstituion; ///< String substitution flag }; } // namespace Toolkit } // namespace Dali -#endif // __DALI_SCRIPT_TREE_NODE_H__ +#endif // DALI_SCRIPT_TREE_NODE_H