/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
This file is part of libdcp.
files in the program, then also delete it here.
*/
+
#include "common.h"
#include "dcp.h"
-using std::list;
-using boost::shared_ptr;
-using boost::dynamic_pointer_cast;
+
+using std::shared_ptr;
+using std::vector;
+
void
-dcp::filter_notes (list<dcp::VerificationNote>& notes, bool ignore_missing_assets)
+dcp::filter_notes (vector<dcp::VerificationNote>& notes, bool ignore_missing_assets)
{
- for (list<dcp::VerificationNote>::iterator i = notes.begin(); i != notes.end(); ) {
-
- list<dcp::VerificationNote>::iterator tmp = i;
- ++tmp;
+ if (!ignore_missing_assets) {
+ return;
+ }
- if (ignore_missing_assets && i->code() == dcp::VerificationNote::Code::MISSING_ASSET) {
- notes.erase (i);
- }
+ vector<dcp::VerificationNote> filtered;
+ std::copy_if (notes.begin(), notes.end(), std::back_inserter(filtered), [](dcp::VerificationNote const& i) {
+ return i.code() != dcp::VerificationNote::Code::MISSING_ASSET && i.code() != dcp::VerificationNote::Code::EXTERNAL_ASSET;
+ });
- i = tmp;
- }
+ notes = filtered;
}
+