summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis van der Schagt <dennisschagt@gmail.com>2024-10-05 10:07:03 +0200
committerDennis van der Schagt <dennisschagt@gmail.com>2024-10-05 10:21:03 +0200
commit380cb8dce354808a8a2812f0ce144b567feed6ec (patch)
treed0ee8685e94a753fec769fdb1052576f8f212398
parent8cff36ab9a968f022a9ad7cf9f040d9a2902b1c4 (diff)
ItemRenderer: Pass RssItem by reference instead of shared_ptr
-rw-r--r--include/controller.h7
-rw-r--r--include/itemrenderer.h9
-rw-r--r--include/itemviewformaction.h2
-rw-r--r--src/controller.cpp7
-rw-r--r--src/itemlistformaction.cpp4
-rw-r--r--src/itemrenderer.cpp48
-rw-r--r--src/itemviewformaction.cpp18
-rw-r--r--src/view.cpp2
-rw-r--r--test/controller.cpp6
-rw-r--r--test/itemrenderer.cpp54
10 files changed, 77 insertions, 80 deletions
diff --git a/include/controller.h b/include/controller.h
index dc6abf7a..b682026b 100644
--- a/include/controller.h
+++ b/include/controller.h
@@ -62,10 +62,9 @@ public:
return &feedcontainer;
}
- void write_item(std::shared_ptr<RssItem> item,
- const std::string& filename);
- void write_item(std::shared_ptr<RssItem> item, std::ostream& ostr);
- std::string write_temporary_item(std::shared_ptr<RssItem> item);
+ void write_item(RssItem& item, const std::string& filename);
+ void write_item(RssItem& item, std::ostream& ostr);
+ std::string write_temporary_item(RssItem& item);
void update_config();
diff --git a/include/itemrenderer.h b/include/itemrenderer.h
index de82b8c8..078eb358 100644
--- a/include/itemrenderer.h
+++ b/include/itemrenderer.h
@@ -1,7 +1,6 @@
#ifndef NEWSBOAT_ITEMRENDERER_H_
#define NEWSBOAT_ITEMRENDERER_H_
-#include <memory>
#include <string>
#include <vector>
@@ -23,7 +22,7 @@ enum class OutputFormat {
/// \brief Returns feed's title of the item, or some replacement value if
/// the title isn't available.
-std::string get_feedtitle(std::shared_ptr<RssItem> item);
+std::string get_feedtitle(RssItem& item);
/// \brief Splits text into lines marked as wrappable
void render_plaintext(const std::string& source,
@@ -35,7 +34,7 @@ void render_plaintext(const std::string& source,
/// wrapped at the width specified by the `text-width` setting.
std::string to_plain_text(
ConfigContainer& cfg,
- std::shared_ptr<RssItem> item);
+ RssItem& item);
/// \brief Returns RssItem as STFL list.
///
@@ -47,7 +46,7 @@ std::string to_plain_text(
/// users open the links by their number).
std::pair<std::string, size_t> to_stfl_list(
ConfigContainer& cfg,
- std::shared_ptr<RssItem> item,
+ RssItem& item,
unsigned int text_width,
unsigned int window_width,
RegexManager* rxman,
@@ -60,7 +59,7 @@ std::pair<std::string, size_t> to_stfl_list(
/// where URLs are wrapped. \a rxman rules for \a location are used to
/// highlight the resulting text.
std::pair<std::string, size_t> source_to_stfl_list(
- std::shared_ptr<RssItem> item,
+ RssItem& item,
unsigned int text_width,
unsigned int window_width,
RegexManager* rxman,
diff --git a/include/itemviewformaction.h b/include/itemviewformaction.h
index 3d0b593a..dc4ffe44 100644
--- a/include/itemviewformaction.h
+++ b/include/itemviewformaction.h
@@ -68,7 +68,7 @@ private:
bool open_link_in_browser(const std::string& link, const std::string& type,
const std::string& title, bool interactive) const;
- void update_head(const std::shared_ptr<RssItem>& item);
+ void update_head(RssItem& item);
void set_head(const std::string& s,
const std::string& feedtitle,
unsigned int unread,
diff --git a/src/controller.cpp b/src/controller.cpp
index 96f5f0c6..534a2271 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -924,7 +924,7 @@ int Controller::execute_commands(const std::vector<std::string>& cmds)
return EXIT_SUCCESS;
}
-std::string Controller::write_temporary_item(std::shared_ptr<RssItem> item)
+std::string Controller::write_temporary_item(RssItem& item)
{
char filename[_POSIX_PATH_MAX];
char* tmpdir = getenv("TMPDIR");
@@ -948,8 +948,7 @@ std::string Controller::write_temporary_item(std::shared_ptr<RssItem> item)
}
}
-void Controller::write_item(std::shared_ptr<RssItem> item,
- const std::string& filename)
+void Controller::write_item(RssItem& item, const std::string& filename)
{
const std::string save_path = cfg.get_configvalue("save-path");
auto spath = save_path.back() == '/' ? save_path : save_path + "/";
@@ -975,7 +974,7 @@ void Controller::write_item(std::shared_ptr<RssItem> item,
write_item(item, f);
}
-void Controller::write_item(std::shared_ptr<RssItem> item, std::ostream& ostr)
+void Controller::write_item(RssItem& item, std::ostream& ostr)
{
ostr << item_renderer::to_plain_text(cfg, item) << std::endl;
}
diff --git a/src/itemlistformaction.cpp b/src/itemlistformaction.cpp
index 9e74939a..7c64fb21 100644
--- a/src/itemlistformaction.cpp
+++ b/src/itemlistformaction.cpp
@@ -928,7 +928,7 @@ void ItemListFormAction::finished_qna(Operation op)
std::string cmd = qna_responses[0];
std::ostringstream ostr;
v.get_ctrl()->write_item(
- visible_items[itempos].first, ostr);
+ *visible_items[itempos].first, ostr);
v.push_empty_formaction();
Stfl::reset();
FILE* f = popen(cmd.c_str(), "w");
@@ -1473,7 +1473,7 @@ void ItemListFormAction::save_article(const nonstd::optional<std::string>& filen
v.get_statusline().show_error(_("Aborted saving."));
} else {
try {
- v.get_ctrl()->write_item(item, filename.value());
+ v.get_ctrl()->write_item(*item, filename.value());
v.get_statusline().show_message(strprintf::fmt(
_("Saved article to %s"), filename.value()));
} catch (...) {
diff --git a/src/itemrenderer.cpp b/src/itemrenderer.cpp
index 84ab3780..7049765e 100644
--- a/src/itemrenderer.cpp
+++ b/src/itemrenderer.cpp
@@ -25,9 +25,9 @@ bool should_render_as_html(const std::string mime_type)
return (html_mime_types.count(mime_type) >= 1);
}
-std::string item_renderer::get_feedtitle(std::shared_ptr<RssItem> item)
+std::string item_renderer::get_feedtitle(RssItem& item)
{
- const std::shared_ptr<RssFeed> feedptr = item->get_feedptr();
+ const std::shared_ptr<RssFeed> feedptr = item.get_feedptr();
if (!feedptr) {
return {};
@@ -47,7 +47,7 @@ std::string item_renderer::get_feedtitle(std::shared_ptr<RssItem> item)
}
void prepare_header(
- std::shared_ptr<RssItem> item,
+ RssItem& item,
std::vector<std::pair<LineType, std::string>>& lines,
Links& /*links*/, bool raw = false)
{
@@ -72,27 +72,27 @@ void prepare_header(
const std::string feedtitle = item_renderer::get_feedtitle(item);
add_line(stfl_quote_if_needed(feedtitle), _("Feed: "), LineType::wrappable);
- add_line(stfl_quote_if_needed(utils::utf8_to_locale(item->title())),
+ add_line(stfl_quote_if_needed(utils::utf8_to_locale(item.title())),
_("Title: "), LineType::wrappable);
- add_line(stfl_quote_if_needed(utils::utf8_to_locale(item->author())),
+ add_line(stfl_quote_if_needed(utils::utf8_to_locale(item.author())),
_("Author: "), LineType::wrappable);
- add_line(item->pubDate(), _("Date: "), LineType::wrappable);
- add_line(item->link(), _("Link: "), LineType::softwrappable);
- add_line(item->flags(), _("Flags: "), LineType::wrappable);
+ add_line(item.pubDate(), _("Date: "), LineType::wrappable);
+ add_line(item.link(), _("Link: "), LineType::softwrappable);
+ add_line(item.flags(), _("Flags: "), LineType::wrappable);
- const bool could_be_podcast = item->enclosure_type().empty()
- || utils::is_valid_podcast_type(item->enclosure_type());
+ const bool could_be_podcast = item.enclosure_type().empty()
+ || utils::is_valid_podcast_type(item.enclosure_type());
- if (!item->enclosure_url().empty() && could_be_podcast) {
+ if (!item.enclosure_url().empty() && could_be_podcast) {
auto dlurl = strprintf::fmt(
"%s%s",
_("Podcast Download URL: "),
- utils::censor_url(item->enclosure_url()));
- if (!item->enclosure_type().empty()) {
+ utils::censor_url(item.enclosure_url()));
+ if (!item.enclosure_type().empty()) {
dlurl.append(
strprintf::fmt(" (%s%s)",
_("type: "),
- item->enclosure_type()));
+ item.enclosure_type()));
}
lines.push_back(std::make_pair(LineType::softwrappable, dlurl));
}
@@ -230,16 +230,16 @@ void render_links_summary(std::vector<std::pair<LineType, std::string>>& lines,
std::string item_renderer::to_plain_text(
ConfigContainer& cfg,
- std::shared_ptr<RssItem> item)
+ RssItem& item)
{
std::vector<std::pair<LineType, std::string>> lines;
Links links;
- const auto item_description = item->description();
+ const auto item_description = item.description();
prepare_header(item, lines, links, true);
- prepare_enclosure(*item, lines, links, true);
+ prepare_enclosure(item, lines, links, true);
- const auto base = get_item_base_link(*item);
+ const auto base = get_item_base_link(item);
const auto body = utils::utf8_to_locale(item_description.text);
if (should_render_as_html(item_description.mime)) {
@@ -263,7 +263,7 @@ std::string item_renderer::to_plain_text(
std::pair<std::string, size_t> item_renderer::to_stfl_list(
ConfigContainer& cfg,
- std::shared_ptr<RssItem> item,
+ RssItem& item,
unsigned int text_width,
unsigned int window_width,
RegexManager* rxman,
@@ -271,12 +271,12 @@ std::pair<std::string, size_t> item_renderer::to_stfl_list(
Links& links)
{
std::vector<std::pair<LineType, std::string>> lines;
- const auto item_description = item->description();
+ const auto item_description = item.description();
prepare_header(item, lines, links);
- prepare_enclosure(*item, lines, links, false);
+ prepare_enclosure(item, lines, links, false);
- const std::string baseurl = get_item_base_link(*item);
+ const std::string baseurl = get_item_base_link(item);
const auto body = utils::utf8_to_locale(item_description.text);
if (should_render_as_html(item_description.mime)) {
@@ -316,7 +316,7 @@ void render_source(
}
std::pair<std::string, size_t> item_renderer::source_to_stfl_list(
- std::shared_ptr<RssItem> item,
+ RssItem& item,
unsigned int text_width,
unsigned int window_width,
RegexManager* rxman,
@@ -327,7 +327,7 @@ std::pair<std::string, size_t> item_renderer::source_to_stfl_list(
prepare_header(item, lines, links);
render_source(lines, utils::quote_for_stfl(utils::utf8_to_locale(
- item->description().text)));
+ item.description().text)));
TextFormatter txtfmt;
txtfmt.add_lines(lines);
diff --git a/src/itemviewformaction.cpp b/src/itemviewformaction.cpp
index be5c2345..46d3fe84 100644
--- a/src/itemviewformaction.cpp
+++ b/src/itemviewformaction.cpp
@@ -65,17 +65,17 @@ void ItemViewFormAction::init()
item = feed->get_item_by_guid(guid);
}
-void ItemViewFormAction::update_head(const std::shared_ptr<RssItem>& item)
+void ItemViewFormAction::update_head(RssItem& item)
{
const std::string feedtitle = item_renderer::get_feedtitle(item);
unsigned int unread_item_count = feed->unread_item_count();
// we need to subtract because the current item isn't yet marked
// as read
- if (item->unread()) {
+ if (item.unread()) {
unread_item_count--;
}
- set_head(utils::utf8_to_locale(item->title()),
+ set_head(utils::utf8_to_locale(item.title()),
feedtitle,
unread_item_count,
feed->total_item_count());
@@ -96,7 +96,7 @@ void ItemViewFormAction::prepare()
recalculate_widget_dimensions();
}
- update_head(item);
+ update_head(*item);
const unsigned int window_width = textview.get_width();
@@ -113,7 +113,7 @@ void ItemViewFormAction::prepare()
if (show_source) {
std::tie(formatted_text, num_lines) =
item_renderer::source_to_stfl_list(
- item,
+ *item,
text_width,
window_width,
&rxman,
@@ -132,7 +132,7 @@ void ItemViewFormAction::prepare()
// cfg can't be nullptr because that's a long-lived object
// created at the very start of the program.
*cfg,
- item,
+ *item,
text_width,
window_width,
&rxman,
@@ -213,7 +213,7 @@ bool ItemViewFormAction::process_operation(Operation op,
v.get_statusline().show_error(_("Aborted saving."));
} else {
try {
- v.get_ctrl()->write_item(item, filename.value());
+ v.get_ctrl()->write_item(*item, filename.value());
v.get_statusline().show_message(strprintf::fmt(
_("Saved article to %s."), filename.value()));
} catch (...) {
@@ -634,7 +634,7 @@ void ItemViewFormAction::handle_save(const std::string& filename_param)
} else {
try {
v.get_ctrl()->write_item(
- item, filename);
+ *item, filename);
v.get_statusline().show_message(strprintf::fmt(
_("Saved article to %s"),
filename));
@@ -664,7 +664,7 @@ void ItemViewFormAction::finished_qna(Operation op)
case OP_PIPE_TO: {
std::string cmd = qna_responses[0];
std::ostringstream ostr;
- v.get_ctrl()->write_item(feed->get_item_by_guid(guid), ostr);
+ v.get_ctrl()->write_item(*feed->get_item_by_guid(guid), ostr);
v.push_empty_formaction();
Stfl::reset();
FILE* f = popen(cmd.c_str(), "w");
diff --git a/src/view.cpp b/src/view.cpp
index 4ea8b5bd..a92d9c7f 100644
--- a/src/view.cpp
+++ b/src/view.cpp
@@ -541,7 +541,7 @@ void View::push_itemview(std::shared_ptr<RssFeed> f,
current_formaction = formaction_stack_size() - 1;
} else {
std::shared_ptr<RssItem> item = f->get_item_by_guid(guid);
- std::string filename = get_ctrl()->write_temporary_item(item);
+ std::string filename = get_ctrl()->write_temporary_item(*item);
open_in_pager(filename);
try {
bool old_unread = item->unread();
diff --git a/test/controller.cpp b/test/controller.cpp
index 13f9a24d..586f4782 100644
--- a/test/controller.cpp
+++ b/test/controller.cpp
@@ -33,10 +33,10 @@ TEST_CASE("write_item correctly parses path", "[Controller]")
Cache rsscache(":memory:", cfg);
- auto item = std::make_shared<RssItem>(&rsscache);
- item->set_title("title");
+ RssItem item(&rsscache);
+ item.set_title("title");
const auto description = "First line.\nSecond one.\nAnd finally the third";
- item->set_description(description, "text/plain");
+ item.set_description(description, "text/plain");
c.write_item(item, tmp.get_path() + name);
c.write_item(item, "~/" + name);
diff --git a/test/itemrenderer.cpp b/test/itemrenderer.cpp
index f6139e10..bf044fdd 100644
--- a/test/itemrenderer.cpp
+++ b/test/itemrenderer.cpp
@@ -77,7 +77,7 @@ TEST_CASE("item_renderer::to_plain_text() produces a rendered representation "
SECTION("Item without an enclosure") {
item->set_description(ITEM_DESCRIPTON, "text/html");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -96,7 +96,7 @@ TEST_CASE("item_renderer::to_plain_text() produces a rendered representation "
item->set_description(ITEM_DESCRIPTON, "text/html");
item->set_enclosure_url(ITEM_PODCAST_ENCLOSURE_URL);
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -117,7 +117,7 @@ TEST_CASE("item_renderer::to_plain_text() produces a rendered representation "
item->set_enclosure_url(ITEM_PODCAST_ENCLOSURE_URL);
item->set_enclosure_type(ITEM_PODCAST_ENCLOSURE_TYPE);
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -139,7 +139,7 @@ TEST_CASE("item_renderer::to_plain_text() produces a rendered representation "
item->set_enclosure_url(ITEM_IMAGE_ENCLOSURE_URL);
item->set_enclosure_type(ITEM_IMAGE_ENCLOSURE_TYPE);
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -164,7 +164,7 @@ TEST_CASE("item_renderer::to_plain_text() produces a rendered representation "
ITEM_DESCRIPTON +
"<p>See also <a href='https://example.com'>this site</a>.</p>", "text/html");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -189,7 +189,7 @@ TEST_CASE("item_renderer::to_plain_text() produces a rendered representation "
item->set_enclosure_url("https://example.com/test.png");
item->set_enclosure_type("image/png");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -241,7 +241,7 @@ TEST_CASE("item_renderer::to_plain_text() renders text to the width specified "
" \n";
SECTION("If `text-width` is not set, text is rendered in 80 columns") {
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = header +
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque nisl \n"
@@ -256,7 +256,7 @@ TEST_CASE("item_renderer::to_plain_text() renders text to the width specified "
SECTION("If `text-width` is set to zero, text is rendered in 80 columns") {
cfg.set_configvalue("text-width", "0");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = header +
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque nisl \n"
@@ -271,7 +271,7 @@ TEST_CASE("item_renderer::to_plain_text() renders text to the width specified "
SECTION("Text is rendered in 37 columns") {
cfg.set_configvalue("text-width", "37");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = header +
"Lorem ipsum dolor sit amet, \n"
@@ -288,7 +288,7 @@ TEST_CASE("item_renderer::to_plain_text() renders text to the width specified "
SECTION("Text is rendered in 120 columns") {
cfg.set_configvalue("text-width", "120");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = header +
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
@@ -308,7 +308,7 @@ TEST_CASE("item_renderer::to_plain_text() renders text to the width specified "
"&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" // 10 characters
"Lorem ipsum dolor sit amet", "text/html");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = header +
"<<<<<<<<<<>>>>>>>>>>Lorem ipsum dolor\n"
@@ -347,7 +347,7 @@ TEST_CASE("to_plain_text() does not escape '<' and '>' in header and body",
" \n" +
"<test>\n";
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
REQUIRE(result == expected);
}
@@ -370,7 +370,7 @@ TEST_CASE("Empty fields are not rendered", "[item_renderer]")
SECTION("Item without a feed title") {
item->get_feedptr()->set_title("");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Title: " + ITEM_TITLE + '\n' +
@@ -386,7 +386,7 @@ TEST_CASE("Empty fields are not rendered", "[item_renderer]")
SECTION("Item without a title") {
item->set_title("");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -402,7 +402,7 @@ TEST_CASE("Empty fields are not rendered", "[item_renderer]")
SECTION("Item without an author") {
item->set_author("");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -418,7 +418,7 @@ TEST_CASE("Empty fields are not rendered", "[item_renderer]")
SECTION("Item without a link") {
item->set_link("");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -434,7 +434,7 @@ TEST_CASE("Empty fields are not rendered", "[item_renderer]")
SECTION("Item without an enclosure") {
item->set_description(ITEM_DESCRIPTON, "text/html");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -452,7 +452,7 @@ TEST_CASE("Empty fields are not rendered", "[item_renderer]")
SECTION("Item without flags") {
item->set_flags("");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -490,7 +490,7 @@ TEST_CASE("item_renderer::to_plain_text honours `html-renderer` setting",
SECTION("internal renderer") {
cfg.set_configvalue("html-renderer", "internal");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -513,7 +513,7 @@ TEST_CASE("item_renderer::to_plain_text honours `html-renderer` setting",
SECTION("/bin/cat as a renderer") {
cfg.set_configvalue("html-renderer", "/bin/cat");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -539,7 +539,7 @@ TEST_CASE("item_renderer::to_plain_text honours `html-renderer` setting",
SECTION("internal renderer") {
cfg.set_configvalue("html-renderer", "internal");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -564,7 +564,7 @@ TEST_CASE("item_renderer::to_plain_text honours `html-renderer` setting",
SECTION("/bin/cat as a renderer") {
cfg.set_configvalue("html-renderer", "/bin/cat");
- const auto result = item_renderer::to_plain_text(cfg, item);
+ const auto result = item_renderer::to_plain_text(cfg, *item);
const auto expected = std::string() +
"Feed: " + FEED_TITLE + '\n' +
@@ -595,7 +595,7 @@ TEST_CASE("item_renderer::get_feedtitle() returns item's feed title without "
std::tie(item, feed) = create_test_item(&rsscache);
const auto check = [&]() {
- const auto result = item_renderer::get_feedtitle(item);
+ const auto result = item_renderer::get_feedtitle(*item);
REQUIRE(result == "Welcome, lovely strangers!");
};
@@ -626,7 +626,7 @@ TEST_CASE("item_renderer::get_feedtitle() returns item's feed self-link "
feed->set_title("");
feed->set_link(feedlink);
- const auto result = item_renderer::get_feedtitle(item);
+ const auto result = item_renderer::get_feedtitle(*item);
REQUIRE(result == feedlink);
}
@@ -647,7 +647,7 @@ TEST_CASE("item_renderer::get_feedtitle() returns item's feed URL "
feed->set_title("");
feed->set_link("");
- const auto result = item_renderer::get_feedtitle(item);
+ const auto result = item_renderer::get_feedtitle(*item);
REQUIRE(result == feedurl);
}
@@ -685,7 +685,7 @@ TEST_CASE("Functions used for rendering articles escape '<' into `<>` for use wi
"}";
Links links;
- const auto result = item_renderer::to_stfl_list(cfg, item, 80, 80, &rxman,
+ const auto result = item_renderer::to_stfl_list(cfg, *item, 80, 80, &rxman,
"article", links);
REQUIRE(result.first == expected);
}
@@ -704,7 +704,7 @@ TEST_CASE("Functions used for rendering articles escape '<' into `<>` for use wi
"}";
Links links;
- const auto result = item_renderer::source_to_stfl_list(item, 80, 80, &rxman,
+ const auto result = item_renderer::source_to_stfl_list(*item, 80, 80, &rxman,
"article");
REQUIRE(result.first == expected);
}