summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-05-18 22:21:33 +0200
committerCarl Hetherington <cth@carlh.net>2023-05-18 22:21:33 +0200
commit9f125fddff88bf62d36381f9d3f09e5240b033d5 (patch)
tree586e3040791a634f58e3c0d04e7550490af732f6 /src
parentc407bf65787162ea712595eecf9fbb409c7f0d1e (diff)
Cleanup: replace some list with vector.
Diffstat (limited to 'src')
-rw-r--r--src/lib/cinema.cc5
-rw-r--r--src/lib/cinema.h8
-rw-r--r--src/lib/dkdm_recipient.h4
-rw-r--r--src/lib/emailer.cc6
-rw-r--r--src/lib/emailer.h12
-rw-r--r--src/lib/kdm_cli.cc10
-rw-r--r--src/lib/kdm_with_metadata.h6
-rw-r--r--src/lib/screen.cc2
-rw-r--r--src/lib/send_notification_email_job.cc6
-rw-r--r--src/tools/dcpomatic.cc3
-rw-r--r--src/wx/cinema_dialog.cc16
-rw-r--r--src/wx/cinema_dialog.h5
-rw-r--r--src/wx/recipient_dialog.cc9
-rw-r--r--src/wx/recipient_dialog.h4
14 files changed, 40 insertions, 56 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);
}
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 3d944e780..d6b6bc2b7 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -1115,12 +1115,11 @@ private:
for (auto i: translations) {
body += i.first + "\n" + i.second + "\n\n";
}
- list<string> to = { "carl@dcpomatic.com" };
if (dialog.email().find("@") == string::npos) {
error_dialog (this, _("You must enter a valid email address when sending translations, "
"otherwise the DCP-o-matic maintainers cannot credit you or contact you with questions."));
} else {
- Emailer emailer(dialog.email(), to, "DCP-o-matic translations", body);
+ Emailer emailer(dialog.email(), { "carl@dcpomatic.com" }, "DCP-o-matic translations", body);
try {
emailer.send ("main.carlh.net", 2525, EmailProtocol::STARTTLS);
} catch (NetworkError& e) {
diff --git a/src/wx/cinema_dialog.cc b/src/wx/cinema_dialog.cc
index 8c7194c4a..84fde5f41 100644
--- a/src/wx/cinema_dialog.cc
+++ b/src/wx/cinema_dialog.cc
@@ -28,7 +28,6 @@
using std::back_inserter;
using std::copy;
using std::cout;
-using std::list;
using std::string;
using std::vector;
using boost::bind;
@@ -37,7 +36,7 @@ using namespace boost::placeholders;
#endif
-CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<string> emails, string notes, int utc_offset_hour, int utc_offset_minute)
+CinemaDialog::CinemaDialog(wxWindow* parent, wxString title, string name, vector<string> emails, string notes, int utc_offset_hour, int utc_offset_minute)
: wxDialog (parent, wxID_ANY, title)
{
auto overall_sizer = new wxBoxSizer (wxVERTICAL);
@@ -69,7 +68,7 @@ CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<
vector<EditableListColumn> columns;
columns.push_back (EditableListColumn(_("Address"), 500, true));
_email_list = new EditableList<string, EmailDialog> (
- this, columns, bind (&CinemaDialog::get_emails, this), bind (&CinemaDialog::set_emails, this, _1), [](string s, int) {
+ this, columns, bind(&CinemaDialog::emails, this), bind (&CinemaDialog::set_emails, this, _1), [](string s, int) {
return s;
}, EditableListTitle::INVISIBLE, EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
);
@@ -117,21 +116,12 @@ CinemaDialog::set_emails (vector<string> e)
vector<string>
-CinemaDialog::get_emails () const
+CinemaDialog::emails() const
{
return _emails;
}
-list<string>
-CinemaDialog::emails () const
-{
- list<string> e;
- copy (_emails.begin(), _emails.end(), back_inserter(e));
- return e;
-}
-
-
int
CinemaDialog::utc_offset_hour () const
{
diff --git a/src/wx/cinema_dialog.h b/src/wx/cinema_dialog.h
index a878e6055..0b8362843 100644
--- a/src/wx/cinema_dialog.h
+++ b/src/wx/cinema_dialog.h
@@ -37,7 +37,7 @@ public:
wxWindow *,
wxString,
std::string name = "",
- std::list<std::string> emails = std::list<std::string> (),
+ std::vector<std::string> emails = std::vector<std::string>(),
std::string notes = "",
int utc_offset_hour = 0,
int utc_offset_minute = 0
@@ -45,12 +45,11 @@ public:
std::string name () const;
std::string notes () const;
- std::list<std::string> emails () const;
+ std::vector<std::string> emails () const;
int utc_offset_hour () const;
int utc_offset_minute () const;
private:
- std::vector<std::string> get_emails () const;
void set_emails (std::vector<std::string>);
wxTextCtrl* _name;
diff --git a/src/wx/recipient_dialog.cc b/src/wx/recipient_dialog.cc
index b685f884a..b166f265d 100644
--- a/src/wx/recipient_dialog.cc
+++ b/src/wx/recipient_dialog.cc
@@ -38,7 +38,6 @@ LIBDCP_ENABLE_WARNINGS
using std::cout;
-using std::list;
using std::string;
using std::vector;
using boost::bind;
@@ -56,7 +55,7 @@ column (string s)
RecipientDialog::RecipientDialog (
- wxWindow* parent, wxString title, string name, string notes, list<string> emails, int utc_offset_hour, int utc_offset_minute, optional<dcp::Certificate> recipient
+ wxWindow* parent, wxString title, string name, string notes, vector<string> emails, int utc_offset_hour, int utc_offset_minute, optional<dcp::Certificate> recipient
)
: wxDialog (parent, wxID_ANY, title)
, _recipient (recipient)
@@ -233,12 +232,10 @@ RecipientDialog::set_emails (vector<string> e)
}
-list<string>
+vector<string>
RecipientDialog::emails () const
{
- list<string> e;
- copy (_emails.begin(), _emails.end(), back_inserter(e));
- return e;
+ return _emails;
}
diff --git a/src/wx/recipient_dialog.h b/src/wx/recipient_dialog.h
index 2ed6d3f31..a46e67af5 100644
--- a/src/wx/recipient_dialog.h
+++ b/src/wx/recipient_dialog.h
@@ -43,7 +43,7 @@ public:
wxString,
std::string name = "",
std::string notes = "",
- std::list<std::string> emails = std::list<std::string>(),
+ std::vector<std::string> emails = std::vector<std::string>(),
int utc_offset_hour = 0,
int utc_offset_minute = 0,
boost::optional<dcp::Certificate> c = boost::optional<dcp::Certificate>()
@@ -52,7 +52,7 @@ public:
std::string name () const;
std::string notes () const;
boost::optional<dcp::Certificate> recipient () const;
- std::list<std::string> emails () const;
+ std::vector<std::string> emails () const;
int utc_offset_hour () const;
int utc_offset_minute () const;