Node.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <ememory/memory.hpp>
9 #include <etk/types.hpp>
10 #include <etk/math/Vector2D.hpp>
11 #include <exml/FilePos.hpp>
12 #include <exml/internal/Node.hpp>
13 #include <exml/nodeType.hpp>
14 
18 namespace exml {
19  class Document;
20  class Attribute;
21  class Comment;
22  class Declaration;
23  class Element;
24  class Text;
25  class AttributeListData;
26  class ElementData;
30  class Node {
31  friend class exml::Element;
32  friend class exml::AttributeListData;
33  friend class exml::ElementData;
34  protected:
36  public:
41  Node(const ememory::SharedPtr<exml::internal::Node>& _internalNode);
45  Node();
46  public:
50  virtual ~Node() = default;
51  public:
57  bool exist() const;
62  exml::FilePos getPos() const;
67  virtual void setValue(std::string _value);
72  const std::string& getValue() const;
77  enum nodeType getType() const;
87  const exml::Document toDocument() const;
97  const exml::Attribute toAttribute() const;
107  const exml::Comment toComment() const;
117  const exml::Declaration toDeclaration() const;
127  const exml::Element toElement() const;
132  exml::Text toText();
137  const exml::Text toText() const;
142  bool isDocument() const;
147  bool isAttribute() const;
152  bool isComment() const;
157  bool isDeclaration() const;
162  bool isElement() const;
167  bool isText() const;
171  virtual void clear();
172  };
174  std::ostream& operator <<(std::ostream& _os, const exml::Node& _obj);
175 }
Basic document element of a document.
Definition: Document.hpp:15
exml::Attribute toAttribute()
Cast the element in a Attribute if it is possible.
enum nodeType getType() const
get the node type.
Basic element Node of an XML document <YYYYY>.
Definition: Element.hpp:20
Text node interface (internal data between two balise : <XXX> ALL here </XXX>.
Definition: Text.hpp:15
Comment node: <!– ... –>.
Definition: Comment.hpp:15
virtual void clear()
clear the Node
Node()
basic element of a xml structure
virtual void setValue(std::string _value)
set the value of the node.
const std::string & getValue() const
get the current element Value.
exml namespace containing all function for XML interpretor
Definition: Attribute.hpp:11
bool isDeclaration() const
check if the node is a exml::Declaration
virtual ~Node()=default
Virtualize destructor.
Basic main object of all xml elements.
Definition: Node.hpp:30
Single attribute element.
Definition: Attribute.hpp:19
Position in the file of the original data.
Definition: FilePos.hpp:14
exml::FilePos getPos() const
get the current position where the element is in the file
bool isText() const
check if the node is a exml::Text
Basic element Node of an XML document <YYYYY>.
Definition: Element.hpp:101
bool exist() const
Check if the element exit.
exml::Text toText()
Cast the element in a Text if it is possible.
ememory::SharedPtr< exml::internal::Node > m_data
internal reference on a node
Definition: Node.hpp:35
bool isComment() const
check if the node is a exml::Comment
bool isDocument() const
check if the node is a exml::Document
exml::Element toElement()
Cast the element in a Element if it is possible.
nodeType
Type of the XML elements.
Definition: nodeType.hpp:17
bool isAttribute() const
check if the node is a exml::Attribute
Abstract interface on all attributes elements.
Definition: AttributeList.hpp:17
exml::Document toDocument()
Cast the element in a Document if it is possible.
exml::Comment toComment()
Cast the element in a Comment if it is possible.
bool isElement() const
check if the node is a exml::Element
exml::Declaration toDeclaration()
Cast the element in a Declaration if it is possible.
Declaration node: <?XXXXXX ... >.
Definition: Declaration.hpp:15