64 std::unique_ptr<BaseNode> child)
66 child->setParent(
this);
67 children.push_back(std::move(child));
73 if (children.size() > index)
75 children.erase(children.begin() + index);
85 const size_t& index)
const 91 return children[index].get();
107 return children.size();
119 std::vector<std::unique_ptr<BaseNode>> children;
123 class DataNode :
public BaseNode
131 std::unique_ptr<T> data);
147 std::unique_ptr<T> data);
150 const std::string& name,
151 const std::string& value);
156 std::map<std::string, std::string> attributes_;
157 std::unique_ptr<T> data_;
172 std::unique_ptr<T> data)
175 , data_(std::move(data))
193 return std::move(data_);
198 std::unique_ptr<T> data)
200 data_ = std::move(data);
205 const std::string& name,
206 const std::string& value)
208 attributes_[name] = value;
220 #endif // !_XML_TREE_
DataNode & operator=(const DataNode &)=delete
void setParent(BaseNode *parent)
Definition: XMLTree.h:99
virtual ~BaseNode()=default
DataNode(NodeType type)
Definition: XMLTree.h:161
virtual ~DataNode()
Definition: XMLTree.h:180
BaseNode & operator=(const BaseNode &)=delete
T * get() const
Definition: XMLTree.h:185
const std::map< std::string, std::string > & getAttributes()
Definition: XMLTree.h:212
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23
bool removeChild(const size_t &index)
Definition: XMLTree.h:70
BaseNode * getChild(const size_t &index) const
Definition: XMLTree.h:84
std::unique_ptr< T > getData()
Definition: XMLTree.h:191
std::vector< std::unique_ptr< BaseNode > > & getChildren()
Definition: XMLTree.h:110
size_t getNumChildren() const
Definition: XMLTree.h:105
void setData(std::unique_ptr< T > data)
Definition: XMLTree.h:197
NodeType getType() const
Definition: XMLTree.h:58
BaseNode * getParent() const
Definition: XMLTree.h:94
void addAttribute(const std::string &name, const std::string &value)
Definition: XMLTree.h:204
BaseNode(NodeType type)
Definition: XMLTree.h:39
NodeType
Definition: XMLTree.h:13
void addChild(std::unique_ptr< BaseNode > child)
Definition: XMLTree.h:63