Document.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
9 #include <vector>
10 
11 namespace exml {
12  namespace internal {
17  public:
21  Document();
27  private:
28  bool m_caseSensitive;
29  public:
34  // TODO: Naming error, it is insensitive ...
35  virtual void setCaseSensitive(bool _val) {
36  m_caseSensitive = _val;
37  };
42  virtual bool getCaseSensitive() const {
43  return m_caseSensitive;
44  };
45  public:
52  bool parse(const std::string& _data);
59  bool generate(std::string& _data);
66  bool load(const std::string& _file);
73  bool store(const std::string& _file);
77  void display();
78  private:
79  bool m_writeErrorWhenDetexted;
80  std::string m_comment;
81  std::string m_Line;
82  exml::FilePos m_filePos;
83  public:
88  void setDisplayError(bool _value);
94  bool getDisplayError();
98  void displayError();
106  void createError(const std::string& _data, int32_t _pos, const exml::FilePos& _filePos, const std::string& _comment);
107  public:
108  enum nodeType getType() const override {
109  return nodeType::document;
110  }
111  bool iGenerate(std::string& _data, int32_t _indent) const override;
113  return ememory::staticPointerCast<exml::internal::Document>(sharedFromThis());
114  }
116  return ememory::staticPointerCast<exml::internal::Document>(sharedFromThis());
117  }
118  };
119  }
120 }
121 
130 #define CREATE_ERROR(doc,data,pos,filePos,comment) \
131  do { \
132  EXML_ERROR(comment); \
133  (doc).createError((data),(pos),(filePos),(comment)); \
134  } while (0)
void setDisplayError(bool _value)
Set the display of the error when detected.
ememory::SharedPtr< EMEMORY_TYPE > sharedFromThis()
all the file main access
ememory::SharedPtr< exml::internal::Document > toDocument() override
Cast the element in a Document if it is possible.
Definition: Document.hpp:112
static ememory::SharedPtr< exml::internal::Document > create()
Factory on a document.
exml namespace containing all function for XML interpretor
Definition: Attribute.hpp:11
bool iGenerate(std::string &_data, int32_t _indent) const override
generate a string with the tree of the xml
const ememory::SharedPtr< exml::internal::Document > toDocument() const override
Cast the element in a Document if it is possible.
Definition: Document.hpp:115
Document()
Constructor.
Basic document element of a document.
Definition: Document.hpp:16
Position in the file of the original data.
Definition: FilePos.hpp:14
void display()
Display the Document on console.
enum nodeType getType() const override
get the node type.
Definition: Document.hpp:108
virtual void setCaseSensitive(bool _val)
Enable or diasable the case sensitive (must be done before the call of parsing)
Definition: Document.hpp:35
bool store(const std::string &_file)
Store the Xml in the file.
nodeType
Type of the XML elements.
Definition: nodeType.hpp:17
virtual bool getCaseSensitive() const
get the status of case sensitive mode.
Definition: Document.hpp:42
bool getDisplayError()
Get the display of the error status.
bool generate(std::string &_data)
generate a string that contain the created XML
bool load(const std::string &_file)
Load the file that might contain the xml.
void createError(const std::string &_data, int32_t _pos, const exml::FilePos &_filePos, const std::string &_comment)
Create an error in the parsing (call by the syetm for error management)
void displayError()
Request display in log of the error.
bool parse(const std::string &_data)
parse a string that contain an XML
Basic element Node of an XML document <YYYYY>.
Definition: Element.hpp:17