summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-30 23:47:57 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-30 23:47:57 +0100
commit9a9d4e014c16be88d72914a9480343445bc785a5 (patch)
tree1857fcdd8963d51ac50f1467d9ae81d4d9be5f8e /src/util.cc
parent34a25d89b16a33b5f619ae0eaaa03c17f93980af (diff)
Various.
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/util.cc b/src/util.cc
index 9b650fa4..7138a075 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -32,6 +32,7 @@
#include "AS_DCP.h"
#include "util.h"
#include "exceptions.h"
+#include "types.h"
using namespace std;
using namespace boost;
@@ -88,9 +89,9 @@ libdcp::make_digest (string filename, sigc::signal1<void, float>* progress)
}
string
-libdcp::content_type_to_string (ContentType type)
+libdcp::content_kind_to_string (ContentKind kind)
{
- switch (type) {
+ switch (kind) {
case FEATURE:
return "feature";
case SHORT:
@@ -115,6 +116,34 @@ libdcp::content_type_to_string (ContentType type)
assert (false);
}
+
+libdcp::ContentKind
+libdcp::content_kind_from_string (string type)
+{
+ if (type == "feature") {
+ return FEATURE;
+ } else if (type == "short") {
+ return SHORT;
+ } else if (type == "trailer") {
+ return TRAILER;
+ } else if (type == "test") {
+ return TEST;
+ } else if (type == "transitional") {
+ return TRANSITIONAL;
+ } else if (type == "rating") {
+ return RATING;
+ } else if (type == "teaser") {
+ return TEASER;
+ } else if (type == "policy") {
+ return POLICY;
+ } else if (type == "psa") {
+ return PUBLIC_SERVICE_ANNOUNCEMENT;
+ } else if (type == "advertisement") {
+ return ADVERTISEMENT;
+ }
+
+ assert (false);
+}
bool
libdcp::ends_with (string big, string little)