From 74369d6ab5f99655761f1849ae8011eae61e84a1 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 28 Dec 2019 06:57:23 +0100 Subject: [PATCH] =?UTF-8?q?Rename=20=5Fdata=20=E2=86=92=20=5Fprofile.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/document.cpp | 22 +++++++++++----------- src/document.hpp | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/document.cpp b/src/document.cpp index 51343e7..9716080 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -40,7 +40,7 @@ using std::move; Document::Document(Config &cfg) : _cfg{cfg} - , _data{cfg.data} + , _profile{cfg.data} { RestClient::init(); @@ -65,20 +65,20 @@ void Document::download(const string &uri) case 200: { _raw_doc = response.body; - BOOST_LOG_TRIVIAL(debug) << "Downloaded feed: " << _data.feedurl; + BOOST_LOG_TRIVIAL(debug) << "Downloaded feed: " << _profile.feedurl; break; } case 301: case 308: { - _data.feedurl = extract_location(response.headers); - if (_data.feedurl.empty()) + _profile.feedurl = extract_location(response.headers); + if (_profile.feedurl.empty()) { throw HTTPException{response.code}; } BOOST_LOG_TRIVIAL(debug) << "Feed has new location (permanent): " - << _data.feedurl; + << _profile.feedurl; _cfg.write(); download(); break; @@ -94,7 +94,7 @@ void Document::download(const string &uri) } BOOST_LOG_TRIVIAL(debug) << "Feed has new location (temporary): " - << _data.feedurl; + << _profile.feedurl; download(newuri); break; } @@ -111,7 +111,7 @@ void Document::download(const string &uri) void Document::download() { - download(_data.feedurl); + download(_profile.feedurl); } void Document::parse() @@ -140,14 +140,14 @@ void Document::parse_rss(const pt::ptree &tree) { guid = rssitem.get("link"); } - if (guid == _data.last_guid) + if (guid == _profile.last_guid) { break; } bool skipthis{false}; string title{rssitem.get("title")}; - for (const auto &skip : _data.skip) + for (const auto &skip : _profile.skip) { if (title.substr(0, skip.length()) == skip) { @@ -166,7 +166,7 @@ void Document::parse_rss(const pt::ptree &tree) { string desc {remove_html(rssitem.get("description"))}; - for (const auto &fix : _data.fixes) + for (const auto &fix : _profile.fixes) { desc = regex_replace(desc, regex{fix}, ""); } @@ -179,7 +179,7 @@ void Document::parse_rss(const pt::ptree &tree) BOOST_LOG_TRIVIAL(debug) << "Found GUID: " << item.guid; - if (_data.last_guid.empty()) + if (_profile.last_guid.empty()) { break; } diff --git a/src/document.hpp b/src/document.hpp index 0da2092..325015e 100644 --- a/src/document.hpp +++ b/src/document.hpp @@ -67,7 +67,7 @@ public: private: Config &_cfg; - ProfileData &_data; + ProfileData &_profile; string _raw_doc; void parse_rss(const pt::ptree &tree);