From 45f7cc5d27b338dae1d36c211cc5720c82f3de35 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Fri, 20 Mar 2015 10:57:03 +0400 Subject: Change file architecture --- src/ParserClass/FileManParser.hpp | 114 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/ParserClass/FileManParser.hpp (limited to 'src/ParserClass/FileManParser.hpp') diff --git a/src/ParserClass/FileManParser.hpp b/src/ParserClass/FileManParser.hpp new file mode 100644 index 0000000..f0d01e5 --- /dev/null +++ b/src/ParserClass/FileManParser.hpp @@ -0,0 +1,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 +#include +#include +#include + +//----- class ----- +#include "Website.hpp" + +//----- libxml++ ----- +#include +#include + + + +/** + * @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* getWebsites(); + + + + /** + * @brief Update the parser + * + * Apply all modifications you have made on the vector object (example std::vector* 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 *websites; ///< Contain all website of the document (you can modify it and run updateParser to apply all modifications). + +}; + + +#endif -- cgit v1.2.3