diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-05-18 22:21:33 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-05-18 22:21:33 +0200 |
| commit | 9f125fddff88bf62d36381f9d3f09e5240b033d5 (patch) | |
| tree | 586e3040791a634f58e3c0d04e7550490af732f6 /src/lib | |
| parent | c407bf65787162ea712595eecf9fbb409c7f0d1e (diff) | |
Cleanup: replace some list with vector.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cinema.cc | 5 | ||||
| -rw-r--r-- | src/lib/cinema.h | 8 | ||||
| -rw-r--r-- | src/lib/dkdm_recipient.h | 4 | ||||
| -rw-r--r-- | src/lib/emailer.cc | 6 | ||||
| -rw-r--r-- | src/lib/emailer.h | 12 | ||||
| -rw-r--r-- | src/lib/kdm_cli.cc | 10 | ||||
| -rw-r--r-- | src/lib/kdm_with_metadata.h | 6 | ||||
| -rw-r--r-- | src/lib/screen.cc | 2 | ||||
| -rw-r--r-- | src/lib/send_notification_email_job.cc | 6 |
9 files changed, 29 insertions, 30 deletions
diff --git a/src/lib/cinema.cc b/src/lib/cinema.cc index 57780fa7b..3b4b9d7b6 100644 --- a/src/lib/cinema.cc +++ b/src/lib/cinema.cc @@ -91,7 +91,10 @@ Cinema::add_screen (shared_ptr<Screen> s) void Cinema::remove_screen (shared_ptr<Screen> s) { - _screens.remove (s); + auto iter = std::find(_screens.begin(), _screens.end(), s); + if (iter != _screens.end()) { + _screens.erase(iter); + } } void diff --git a/src/lib/cinema.h b/src/lib/cinema.h index c17454db9..6c202a7bf 100644 --- a/src/lib/cinema.h +++ b/src/lib/cinema.h @@ -44,7 +44,7 @@ namespace dcpomatic { class Cinema : public std::enable_shared_from_this<Cinema> { public: - Cinema (std::string const & name_, std::list<std::string> const & e, std::string notes_, int utc_offset_hour, int utc_offset_minute) + Cinema(std::string const & name_, std::vector<std::string> const & e, std::string notes_, int utc_offset_hour, int utc_offset_minute) : name (name_) , emails (e) , notes (notes_) @@ -65,7 +65,7 @@ public: void set_utc_offset_minute (int m); std::string name; - std::list<std::string> emails; + std::vector<std::string> emails; std::string notes; int utc_offset_hour () const { @@ -76,12 +76,12 @@ public: return _utc_offset_minute; } - std::list<std::shared_ptr<dcpomatic::Screen>> screens () const { + std::vector<std::shared_ptr<dcpomatic::Screen>> screens() const { return _screens; } private: - std::list<std::shared_ptr<dcpomatic::Screen>> _screens; + std::vector<std::shared_ptr<dcpomatic::Screen>> _screens; /** Offset such that the equivalent time in UTC can be determined by subtracting the offset from the local time. */ diff --git a/src/lib/dkdm_recipient.h b/src/lib/dkdm_recipient.h index 6e9e4dfb1..7a0fa0185 100644 --- a/src/lib/dkdm_recipient.h +++ b/src/lib/dkdm_recipient.h @@ -33,7 +33,7 @@ public: std::string const& name_, std::string const& notes_, boost::optional<dcp::Certificate> recipient_, - std::list<std::string> emails_, + std::vector<std::string> emails_, int utc_offset_hour_, int utc_offset_minute_ ) @@ -49,7 +49,7 @@ public: void as_xml (xmlpp::Element *) const override; - std::list<std::string> emails; + std::vector<std::string> emails; int utc_offset_hour; int utc_offset_minute; }; diff --git a/src/lib/emailer.cc b/src/lib/emailer.cc index e21bbfe2d..f580e3c56 100644 --- a/src/lib/emailer.cc +++ b/src/lib/emailer.cc @@ -31,15 +31,15 @@ using std::cout; -using std::list; using std::min; using std::pair; using std::shared_ptr; using std::string; +using std::vector; using dcp::ArrayData; -Emailer::Emailer (string from, list<string> to, string subject, string body) +Emailer::Emailer(string from, vector<string> to, string subject, string body) : _from (from) , _to (to) , _subject (subject) @@ -247,7 +247,7 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str string -Emailer::address_list (list<string> addresses) +Emailer::address_list(vector<string> addresses) { string o; for (auto i: addresses) { diff --git a/src/lib/emailer.h b/src/lib/emailer.h index ef41b0320..78942ad1e 100644 --- a/src/lib/emailer.h +++ b/src/lib/emailer.h @@ -26,7 +26,7 @@ class Emailer { public: - Emailer (std::string from, std::list<std::string> to, std::string subject, std::string body); + Emailer(std::string from, std::vector<std::string> to, std::string subject, std::string body); void add_cc (std::string cc); void add_bcc (std::string bcc); @@ -46,7 +46,7 @@ public: return _email; } - static std::string address_list (std::list<std::string> addresses); + static std::string address_list(std::vector<std::string> addresses); private: @@ -54,11 +54,11 @@ private: static std::string encode_rfc1342 (std::string subject); std::string _from; - std::list<std::string> _to; + std::vector<std::string> _to; std::string _subject; std::string _body; - std::list<std::string> _cc; - std::list<std::string> _bcc; + std::vector<std::string> _cc; + std::vector<std::string> _bcc; struct Attachment { boost::filesystem::path file; @@ -66,7 +66,7 @@ private: std::string mime_type; }; - std::list<Attachment> _attachments; + std::vector<Attachment> _attachments; std::string _email; size_t _offset; std::string _notes; diff --git a/src/lib/kdm_cli.cc b/src/lib/kdm_cli.cc index 925626119..05a59142f 100644 --- a/src/lib/kdm_cli.cc +++ b/src/lib/kdm_cli.cc @@ -203,7 +203,7 @@ find_cinema (string cinema_name) static void from_film ( - list<shared_ptr<Screen>> screens, + vector<shared_ptr<Screen>> screens, boost::filesystem::path film_dir, bool verbose, boost::filesystem::path output, @@ -346,7 +346,7 @@ kdm_from_dkdm ( static void from_dkdm ( - list<shared_ptr<Screen>> screens, + vector<shared_ptr<Screen>> screens, dcp::DecryptedKDM dkdm, bool verbose, boost::filesystem::path output, @@ -396,7 +396,7 @@ from_dkdm ( name_values['e'] = end.date() + " " + end.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); - kdms.push_back (make_shared<KDMWithMetadata>(name_values, i->cinema.get(), i->cinema ? i->cinema->emails : list<string>(), kdm)); + kdms.push_back(make_shared<KDMWithMetadata>(name_values, i->cinema.get(), i->cinema ? i->cinema->emails : vector<string>(), kdm)); } write_files (kdms, zip, output, container_name_format, filename_format, verbose, out); if (email) { @@ -441,7 +441,7 @@ try shared_ptr<Cinema> cinema; optional<boost::filesystem::path> certificate; optional<string> screen; - list<shared_ptr<Screen>> screens; + vector<shared_ptr<Screen>> screens; optional<dcp::EncryptedKDM> dkdm; optional<boost::posix_time::ptime> valid_from; optional<boost::posix_time::ptime> valid_to; @@ -552,7 +552,7 @@ try (for lookup) and by creating a Cinema which the next Screen will be added to. */ cinema_name = optarg; - cinema = make_shared<Cinema>(optarg, list<string>(), "", 0, 0); + cinema = make_shared<Cinema>(optarg, vector<string>(), "", 0, 0); break; case 'S': /* Similarly, this could be the name of a new (temporary) screen or the name of a screen diff --git a/src/lib/kdm_with_metadata.h b/src/lib/kdm_with_metadata.h index df9f04125..fbeeffbc1 100644 --- a/src/lib/kdm_with_metadata.h +++ b/src/lib/kdm_with_metadata.h @@ -33,7 +33,7 @@ class Cinema; class KDMWithMetadata { public: - KDMWithMetadata (dcp::NameFormat::Map const& name_values, void const* group, std::list<std::string> emails, dcp::EncryptedKDM kdm) + KDMWithMetadata(dcp::NameFormat::Map const& name_values, void const* group, std::vector<std::string> emails, dcp::EncryptedKDM kdm) : _name_values (name_values) , _group (group) , _emails (emails) @@ -58,14 +58,14 @@ public: return _group; } - std::list<std::string> emails () const { + std::vector<std::string> emails() const { return _emails; } private: dcp::NameFormat::Map _name_values; void const* _group; - std::list<std::string> _emails; + std::vector<std::string> _emails; dcp::EncryptedKDM _kdm; }; diff --git a/src/lib/screen.cc b/src/lib/screen.cc index dbf013111..097ff80b8 100644 --- a/src/lib/screen.cc +++ b/src/lib/screen.cc @@ -116,6 +116,6 @@ kdm_for_screen ( name_values['e'] = end.date() + " " + end.time_of_day(true, false); name_values['i'] = kdm.cpl_id(); - return make_shared<KDMWithMetadata>(name_values, cinema.get(), cinema ? cinema->emails : list<string>(), kdm); + return make_shared<KDMWithMetadata>(name_values, cinema.get(), cinema ? cinema->emails : vector<string>(), kdm); } diff --git a/src/lib/send_notification_email_job.cc b/src/lib/send_notification_email_job.cc index c4d5a6518..2dd1f63f2 100644 --- a/src/lib/send_notification_email_job.cc +++ b/src/lib/send_notification_email_job.cc @@ -24,13 +24,11 @@ #include "config.h" #include "emailer.h" #include "compose.hpp" -#include <list> #include "i18n.h" using std::string; -using std::list; using std::shared_ptr; @@ -73,9 +71,7 @@ SendNotificationEmailJob::run () } set_progress_unknown (); - list<string> to; - to.push_back (config->notification_to()); - Emailer email (config->notification_from(), to, config->notification_subject(), _body); + Emailer email (config->notification_from(), { config->notification_to() }, config->notification_subject(), _body); for (auto i: config->notification_cc()) { email.add_cc (i); } |
