AttributeList.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <exml/internal/Node.hpp>
9 #include <vector>
11 #include <utility>
12 
13 namespace exml {
14  namespace internal {
19  protected:
24  AttributeList(const std::string& _value="") :
25  exml::internal::Node(_value) {
26 
27  };
28  protected:
29  std::vector<ememory::SharedPtr<exml::internal::Attribute>> m_listAttribute;
30  public:
35  size_t sizeAttribute() const {
36  return m_listAttribute.size();
37  };
60  std::pair<std::string, std::string> getAttrPair(int32_t _id) const;
66  const std::string& getAttribute(const std::string& _name) const;
72  bool existAttribute(const std::string& _name) const;
78  void setAttribute(const std::string& _name, const std::string& _value);
85  bool removeAttribute(const std::string& _name);
86  public:
87  bool iGenerate(std::string& _data, int32_t _indent) const override;
88  void clear() override;
89  };
90  }
91 }
92 
ememory::SharedPtr< Attribute > getAttr(int32_t _id)
get attribute whith his ID
void appendAttribute(const ememory::SharedPtr< exml::internal::Attribute > &_attr)
add attribute on the List
std::vector< ememory::SharedPtr< exml::internal::Attribute > > m_listAttribute
list of all attribute
Definition: AttributeList.hpp:27
List of all attribute element in a node.
Definition: AttributeList.hpp:18
exml namespace containing all function for XML interpretor
Definition: Attribute.hpp:11
size_t sizeAttribute() const
get the number of attribute in the Node
Definition: AttributeList.hpp:35
void clear() override
clear the Node
std::pair< std::string, std::string > getAttrPair(int32_t _id) const
get attribute whith his ID
void setAttribute(const std::string &_name, const std::string &_value)
Set A new attribute or replace data of the previous one.
const std::string & getAttribute(const std::string &_name) const
get the attribute value with searching in the List with his name
Basic main object of all xml elements.
Definition: Node.hpp:43
AttributeList(const std::string &_value="")
Constructor.
Definition: AttributeList.hpp:24
bool iGenerate(std::string &_data, int32_t _indent) const override
generate a string with the tree of the xml
bool existAttribute(const std::string &_name) const
check if an attribute exist or not with his name.
bool removeAttribute(const std::string &_name)
Remove an attribute form the list.