blob: aaef47b2b8b1b482730d54afeb3cdefb6e179d26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/**
* @file FileManParser.hpp
* @brief FileManParser class definitions
* @author manzerbredes
* @date 11 Mars 2015
*
* Contain all definitions of FileManParser class.
*
*/
#ifndef __FileManParser__
#define __FileManParser__
//----- std -----
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
//----- class -----
#include "./FileManContainer/Website.hpp"
//----- libxml++ -----
#include <cstdlib>
#include <libxml++/libxml++.h>
/**
* @class FileManParser FileManParser.hpp "/ParserClass/FileManContainer/FileManParser.hpp"
* @brief Class for parser un xml file in a string.
* @author manzerbredes
*
* Parse string using libxml++ library.
*
*/
class FileManParser{
public:
//Constructor
FileManParser(std::string data);
/**
* @brief Get document in string
*
* @return a string that contain the document
*
* Return current document.
* To have an up-to-date document, please run updateParser() before.
*
*/
std::string getDocument();
/**
* @brief Write data in encrypted file.
*
* @return vector pointer that point to the vector of website in document
*
* You can modified this vector, and for apply change run updateParser()
*
*/
std::vector<Website>* getWebsites();
/**
* @brief Update the parser
*
* Apply all modifications you have made on the vector object (example std::vector<Website>* websites).
*
*/
void updateParser();
private:
/**
* @brief Instanciate websites vector
*
* Read the document and create all Website object and put them into
* the websites vector attribute.
*
*/
void initWebsites();
//Parser attributes
std::stringstream dataStream; ///< Contain the document you want to parse
xmlpp::DomParser parser; ///< Contain the parser
//Document attributes
xmlpp::Document* document; ///< Contain the document (generate by the parser and dataStream)
xmlpp::Node* rootNode; ///< Contain the root node of the document
//Website attributes
xmlpp::Node* websitesNode; ///< Contain the websites node of the document
std::vector<Website> *websites; ///< Contain all website of the document (you can modify it and run updateParser to apply all modifications).
};
#endif
|