Rename _data → _profile.

This commit is contained in:
tastytea 2019-12-28 06:57:23 +01:00
parent 4168e77648
commit 74369d6ab5
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 12 additions and 12 deletions

View File

@ -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<string>("link");
}
if (guid == _data.last_guid)
if (guid == _profile.last_guid)
{
break;
}
bool skipthis{false};
string title{rssitem.get<string>("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<string>("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;
}

View File

@ -67,7 +67,7 @@ public:
private:
Config &_cfg;
ProfileData &_data;
ProfileData &_profile;
string _raw_doc;
void parse_rss(const pt::ptree &tree);