Ocular Engine
BuilderNode.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_CORE_BUILDER_NODE__H__
19 #define __H__OCULAR_CORE_BUILDER_NODE__H__
20 
21 #include "Utilities/Types.hpp"
22 #include "Utilities/StringUtils.hpp"
23 
24 #include <string>
25 #include <vector>
26 #include <unordered_map>
27 
28 //------------------------------------------------------------------------------------------
29 
34 namespace Ocular
35 {
40  namespace Core
41  {
52  {
53  public:
54 
55  BuilderNode(BuilderNode* parent, std::string const& name, std::string const& type, std::string const& value);
56  ~BuilderNode();
57 
58  //--------------------------------------------------------------------
59 
63  std::string const& getName() const;
64 
68  std::string const& getValue() const;
69 
73  std::string const& getType() const;
74 
75  //--------------------------------------------------------------------
76 
80  BuilderNode const* getParent() const;
81 
92  BuilderNode* addChild(std::string const& name, std::string const& type, std::string const& value);
93 
100  BuilderNode const* getChild(std::string const& name) const;
101 
109  void findChildrenByName(std::vector<BuilderNode*>& children, std::string const& name) const;
110 
117  void findChildrenByType(std::vector<BuilderNode*>& children, std::string const& type) const;
118 
123  void getAllChildren(std::vector<BuilderNode*>& children) const;
124 
128  uint32_t getNumChildren() const;
129 
130  protected:
131 
132  private:
133 
134  BuilderNode* m_Parent;
135 
136  std::string m_Name;
137  std::string m_Value;
138  std::string m_Type;
139 
140  std::unordered_map<std::string, BuilderNode*> m_ChildMap;
141  };
142  }
146 }
151 //------------------------------------------------------------------------------------------
152 
153 #endif
void getAllChildren(std::vector< BuilderNode * > &children) const
Definition: BuilderNode.cpp:136
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
std::string const & getName() const
Definition: BuilderNode.cpp:51
void findChildrenByType(std::vector< BuilderNode * > &children, std::string const &type) const
Definition: BuilderNode.cpp:118
BuilderNode const * getParent() const
Definition: BuilderNode.cpp:66
Generic node system used for loading and saving SceneObjects and their components.
Definition: BuilderNode.hpp:51
void findChildrenByName(std::vector< BuilderNode * > &children, std::string const &name) const
Definition: BuilderNode.cpp:100
std::string const & getType() const
Definition: BuilderNode.cpp:61
uint32_t getNumChildren() const
Definition: BuilderNode.cpp:146
std::string const & getValue() const
Definition: BuilderNode.cpp:56
BuilderNode * addChild(std::string const &name, std::string const &type, std::string const &value)
Definition: BuilderNode.cpp:71
BuilderNode const * getChild(std::string const &name) const
Definition: BuilderNode.cpp:87