From a482cc933299b015f4f108a3d7b19ee1fd9eb205 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 26 Aug 2023 23:34:19 +0200 Subject: Cleanup: use some lambdas. --- src/lib/dcp_content.cc | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 442b5bd40..8c268140e 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -664,11 +664,6 @@ DCPContent::can_reference (shared_ptr film, function c) -{ - return static_cast(c->video) && c->video->use(); -} bool DCPContent::can_reference_video (shared_ptr film, string& why_not) const @@ -694,14 +689,16 @@ DCPContent::can_reference_video (shared_ptr film, string& why_not) c } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (film, bind (&check_video, _1), _("it overlaps other video content; remove the other content."), why_not); + return can_reference( + film, + [](shared_ptr c) { + return static_cast(c->video) && c->video->use(); + }, + _("it overlaps other video content; remove the other content."), + why_not + ); } -static -bool check_audio (shared_ptr c) -{ - return static_cast(c->audio) && !c->audio->mapping().mapped_output_channels().empty(); -} bool DCPContent::can_reference_audio (shared_ptr film, string& why_not) const @@ -729,14 +726,15 @@ DCPContent::can_reference_audio (shared_ptr film, string& why_not) c } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (film, bind (&check_audio, _1), _("it overlaps other audio content; remove the other content."), why_not); + return can_reference( + film, [](shared_ptr c) { + return static_cast(c->audio) && !c->audio->mapping().mapped_output_channels().empty(); + }, + _("it overlaps other audio content; remove the other content."), + why_not + ); } -static -bool check_text (shared_ptr c) -{ - return !c->text.empty(); -} bool DCPContent::can_reference_text (shared_ptr film, TextType type, string& why_not) const @@ -787,7 +785,14 @@ DCPContent::can_reference_text (shared_ptr film, TextType type, stri } /// TRANSLATORS: this string will follow "Cannot reference this DCP: " - return can_reference (film, bind (&check_text, _1), _("it overlaps other text content; remove the other content."), why_not); + return can_reference( + film, + [](shared_ptr c) { + return !c->text.empty(); + }, + _("it overlaps other text content; remove the other content."), + why_not + ); } void -- cgit v1.2.3