Document.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
9 #include <vector>
10 #include <etk/types.hpp>
12 #include <ejson/internal/Array.hpp>
14 
15 namespace ejson {
16  namespace internal {
21  public:
25  Document();
31  public:
38  bool parse(const std::string& _data);
45  bool generate(std::string& _data);
52  bool load(const std::string& _file);
59  bool store(const std::string& _file);
60  private:
61  bool m_writeErrorWhenDetexted;
62  std::string m_comment;
63  std::string m_Line;
64  ejson::FilePos m_filePos;
65  public:
70  void setDisplayError(bool _value);
76  bool getDisplayError();
80  void displayError();
88  void createError(const std::string& _data,
89  size_t _pos,
90  const ejson::FilePos& _filePos,
91  const std::string& _comment);
92  public:
93  bool iParse(const std::string& _data,
94  size_t& _pos,
95  ejson::FilePos& _filePos,
96  ejson::internal::Document& _doc) override;
97  bool iGenerate(std::string& _data, size_t _indent) const override;
98  };
99  }
100 }
101 
110 #define EJSON_CREATE_ERROR(doc,data,pos,filePos,comment) \
111  do { \
112  EJSON_ERROR(comment); \
113  (doc).createError((data),(pos),(filePos),(comment)); \
114  } while (0)
115 
116 
117 
118 
bool iParse(const std::string &_data, size_t &_pos, ejson::FilePos &_filePos, ejson::internal::Document &_doc) override
parse the Current node [pure VIRUAL]
the element "..."
ejson namespace containing all function for JSON interpretor
Definition: Array.hpp:12
static ememory::SharedPtr< Document > create()
Create factory on the ejson::internal::Document.
bool getDisplayError()
Get the display of the error status.
bool store(const std::string &_file)
Store the Xml in the file.
Position in the file of the original data.
Definition: FilePos.hpp:14
bool generate(std::string &_data)
generate a string that contain the created XML
ejson Document internal data implementation.
Definition: Document.hpp:20
void createError(const std::string &_data, size_t _pos, const ejson::FilePos &_filePos, const std::string &_comment)
When parsing a subParser create an error that might be write later.
void displayError()
Display error detected.
bool load(const std::string &_file)
Load the file that might contain the xml.
ejson Object internal data implementation.
Definition: Object.hpp:18
void setDisplayError(bool _value)
Set the display of the error when detected.
bool parse(const std::string &_data)
parse a string that contain an XML
bool iGenerate(std::string &_data, size_t _indent) const override
generate a string with the tree of the json