diff --git a/src/document.cpp b/src/document.cpp index dc631a8..b811dcb 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -39,8 +39,9 @@ using std::istringstream; using std::string; using std::move; -Document::Document(const ProfileData &data) - : _data{data} +Document::Document(Config &cfg) + : _cfg{cfg} + , _data{cfg.data} { RestClient::init(); diff --git a/src/document.hpp b/src/document.hpp index b69267b..31b91e4 100644 --- a/src/document.hpp +++ b/src/document.hpp @@ -51,7 +51,7 @@ struct Item class Document { public: - explicit Document(const ProfileData &data); + explicit Document(Config &cfg); ~Document(); Document(const Document &other) = default; Document &operator=(const Document &other) = delete; @@ -64,7 +64,8 @@ public: void parse(); private: - const ProfileData &_data; + Config &_cfg; + ProfileData &_data; string _raw_doc; void parse_rss(const pt::ptree &tree); diff --git a/src/main.cpp b/src/main.cpp index 4da5a97..cb30232 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,8 +91,9 @@ int main(int argc, char *argv[]) try { Config cfg{profile.data()}; - Document doc{cfg.data}; + Document doc{cfg}; doc.parse(); + for (const auto &item : doc.new_items) { cout << "--\n" << item.description.substr(0, 200) << "\n";