Pass whole Config object to Document.
This commit is contained in:
parent
ed14492b46
commit
d08bb95fbd
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in New Issue
Block a user