Element.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <exml/internal/Node.hpp>
9 #include <vector>
11 
12 namespace exml {
13  namespace internal {
18  protected:
22  Element() { };
27  Element(const std::string& _value) :
28  exml::internal::AttributeList(_value) {
29 
30  };
31  public:
37  static ememory::SharedPtr<Element> create(const std::string& _value="");
38  protected:
39  std::vector<ememory::SharedPtr<exml::internal::Node>> m_listSub;
40  public:
45  size_t size() const {
46  return m_listSub.size();
47  };
57  void remove(const std::string& _nodeName);
63  enum nodeType getType(int32_t _id) const;
69  ememory::SharedPtr<Node> getNode(int32_t _id);
75  const ememory::SharedPtr<Node> getNode(int32_t _id) const;
81  ememory::SharedPtr<Element> getElement(int32_t _id); // TODO : DEPRECATED ... not use anymore ...
87  const ememory::SharedPtr<Element> getElement(int32_t _id) const;// TODO : DEPRECATED ... not use anymore ...
93  ememory::SharedPtr<Element> getNamed(const std::string& _name);
99  const ememory::SharedPtr<Element> getNamed(const std::string& _name) const;
104  std::string getText() const;
105  protected:
117  bool subParse(const std::string& _data,
118  int32_t& _pos,
119  bool _caseSensitive,
120  exml::FilePos& _filePos,
122  bool _mainNode=false);
123  public:
124  enum nodeType getType() const override {
125  return nodeType::element;
126  }
127  bool iParse(const std::string& _data, int32_t& _pos, bool _caseSensitive, exml::FilePos& _filePos, exml::internal::Document& _doc) override;
128  bool iGenerate(std::string& _data, int32_t _indent) const override;
131  void clear() override;
132  };
133  }
134 }
135 
void clear() override
clear the Node
std::vector< ememory::SharedPtr< exml::internal::Node > > m_listSub
List of subNodes.
Definition: Element.hpp:39
the <XXX> ... </XXX>
bool iGenerate(std::string &_data, int32_t _indent) const override
generate a string with the tree of the xml
size_t size() const
get the number of sub element in the node (can be exml::internal::Comment ; exml::internal::Element ;...
Definition: Element.hpp:45
std::string getText() const
get the internal data of the element (if the element has some sub node thay are converted in xml stri...
ememory::SharedPtr< exml::internal::Element > toElement() override
Cast the element in a Element if it is possible.
bool iParse(const std::string &_data, int32_t &_pos, bool _caseSensitive, exml::FilePos &_filePos, exml::internal::Document &_doc) override
parse the Current node [pure VIRUAL]
Element(const std::string &_value)
Constructor.
Definition: Element.hpp:27
ememory::SharedPtr< Node > getNode(int32_t _id)
get the Node pointer of the element id.
List of all attribute element in a node.
Definition: AttributeList.hpp:18
exml namespace containing all function for XML interpretor
Definition: Attribute.hpp:11
ememory::SharedPtr< Element > getNamed(const std::string &_name)
get an element with his name (work only with exml::internal::Element)
Basic document element of a document.
Definition: Document.hpp:16
Position in the file of the original data.
Definition: FilePos.hpp:14
enum nodeType getType() const override
get the node type.
Definition: Element.hpp:124
Element()
Constructor.
Definition: Element.hpp:22
ememory::SharedPtr< Element > getElement(int32_t _id)
get the element casted in Element (if the node is not an element return NULL).
bool subParse(const std::string &_data, int32_t &_pos, bool _caseSensitive, exml::FilePos &_filePos, exml::internal::Document &_doc, bool _mainNode=false)
Parse sub node string.
void append(const ememory::SharedPtr< exml::internal::Node > &_node)
add a node at the element (not exml::internal::Attribute (move in the attribute automaticly).
nodeType
Type of the XML elements.
Definition: nodeType.hpp:17
static ememory::SharedPtr< Element > create(const std::string &_value="")
factory of an exml::internal::Element
Basic element Node of an XML document <YYYYY>.
Definition: Element.hpp:17