55 #if !defined(HAVE_CXX0X) || (defined(_MSC_VER) && _MSC_VER <= 1800) 58 : data_type_(std::move(other.data_type_))
59 , parent_(std::move(other.parent_))
60 , children(std::move(other.children))
67 data_type_ = std::move(other.data_type_);
68 parent_ = std::move(other.parent_);
69 children = std::move(other.children);
78 #endif // if !defined(HAVE_CXX0X) || (defined(_MSC_VER) && _MSC_VER <= 1800) 86 std::unique_ptr<BaseNode> child)
88 child->setParent(
this);
89 children.push_back(std::move(child));
95 if (children.size() > index)
97 children.erase(children.begin() + index);
107 const size_t& index)
const 109 if (children.empty())
113 return children[index].get();
129 return children.size();
141 std::vector<std::unique_ptr<BaseNode>> children;
145 class DataNode :
public BaseNode
153 std::unique_ptr<T> data);
164 #if !defined(HAVE_CXX0X) || (defined(_MSC_VER) && _MSC_VER <= 1800) 168 , attributes_(std::move(other.attributes_))
169 , data_(std::move(other.data_))
177 attributes_ = std::move(other.attributes_);
178 data_ = std::move(other.data_);
187 #endif // if !defined(HAVE_CXX0X) || (defined(_MSC_VER) && _MSC_VER <= 1800) 192 std::unique_ptr<T> data);
195 const std::string& name,
196 const std::string& value);
201 std::map<std::string, std::string> attributes_;
202 std::unique_ptr<T> data_;
217 std::unique_ptr<T> data)
220 , data_(std::move(data))
238 return std::move(data_);
243 std::unique_ptr<T> data)
245 data_ = std::move(data);
250 const std::string& name,
251 const std::string& value)
253 attributes_[name] = value;
265 #endif // !_XML_TREE_
DataNode & operator=(const DataNode &)=delete
DataNode(DataNode &&other)
Definition: XMLTree.h:165
void setParent(BaseNode *parent)
Definition: XMLTree.h:121
virtual ~BaseNode()=default
DataNode(NodeType type)
Definition: XMLTree.h:206
virtual ~DataNode()
Definition: XMLTree.h:225
BaseNode & operator=(const BaseNode &)=delete
T * get() const
Definition: XMLTree.h:230
Definition: XMLParser.h:42
const std::map< std::string, std::string > & getAttributes()
Definition: XMLTree.h:257
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23
bool removeChild(const size_t &index)
Definition: XMLTree.h:92
BaseNode * getChild(const size_t &index) const
Definition: XMLTree.h:106
std::unique_ptr< T > getData()
Definition: XMLTree.h:236
std::vector< std::unique_ptr< BaseNode > > & getChildren()
Definition: XMLTree.h:132
size_t getNumChildren() const
Definition: XMLTree.h:127
void setData(std::unique_ptr< T > data)
Definition: XMLTree.h:242
NodeType getType() const
Definition: XMLTree.h:80
BaseNode * getParent() const
Definition: XMLTree.h:116
void addAttribute(const std::string &name, const std::string &value)
Definition: XMLTree.h:249
BaseNode(NodeType type)
Definition: XMLTree.h:38
NodeType
Definition: XMLTree.h:13
BaseNode(BaseNode &&other)
Definition: XMLTree.h:56
void addChild(std::unique_ptr< BaseNode > child)
Definition: XMLTree.h:85