-#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.
*/
// EXTERNAL INCLUDES
-#include <utility> // pair
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
#include <iterator>
-#include <dali/public-api/common/dali-common.h>
+#include <string>
+#include <utility> // 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:
/*
/*
* 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;
/*
/*
* 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*();
- /*
- * pointer semantics
- */
- KeyNodePair operator->();
private:
TreeNode* mNode;
};
* @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
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(const std::string& name) const;
+ 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* 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;
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