/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "dcp_content_type.h"
#include "dcpomatic_assert.h"
-#include <cassert>
+#include <boost/foreach.hpp>
#include "i18n.h"
_dcp_content_types.push_back (new DCPContentType (_("Policy"), dcp::POLICY, N_("POL")));
_dcp_content_types.push_back (new DCPContentType (_("Public Service Announcement"), dcp::PUBLIC_SERVICE_ANNOUNCEMENT, N_("PSA")));
_dcp_content_types.push_back (new DCPContentType (_("Advertisement"), dcp::ADVERTISEMENT, N_("ADV")));
+ _dcp_content_types.push_back (new DCPContentType (_("Episode"), dcp::EPISODE, N_("EPS")));
+ _dcp_content_types.push_back (new DCPContentType (_("Promo"), dcp::PROMO, N_("PRO")));
}
DCPContentType const *
DCPContentType::from_isdcf_name (string n)
{
- for (vector<DCPContentType const *>::const_iterator i = _dcp_content_types.begin(); i != _dcp_content_types.end(); ++i) {
- if ((*i)->isdcf_name() == n) {
- return *i;
+ BOOST_FOREACH (DCPContentType const * i, _dcp_content_types) {
+ if (i->isdcf_name() == n) {
+ return i;
}
}
return 0;
}
+DCPContentType const *
+DCPContentType::from_libdcp_kind (dcp::ContentKind kind)
+{
+ BOOST_FOREACH (DCPContentType const * i, _dcp_content_types) {
+ if (i->libdcp_kind() == kind) {
+ return i;
+ }
+ }
+
+ DCPOMATIC_ASSERT (false);
+ return 0;
+}
+
+
DCPContentType const *
DCPContentType::from_index (int n)
{