summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-30 22:03:25 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-30 22:03:25 +0100
commit34a25d89b16a33b5f619ae0eaaa03c17f93980af (patch)
tree9a1778042b027bbf71256f7ce855157d913fb6c1 /src/util.cc
parent25771018926d71d9312f216238d6a33a8892a748 (diff)
Hacks.
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc
index 849b7d24..9b650fa4 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -86,3 +86,42 @@ libdcp::make_digest (string filename, sigc::signal1<void, float>* progress)
char digest[64];
return Kumu::base64encode (byte_buffer, 20, digest, 64);
}
+
+string
+libdcp::content_type_to_string (ContentType type)
+{
+ switch (type) {
+ case FEATURE:
+ return "feature";
+ case SHORT:
+ return "short";
+ case TRAILER:
+ return "trailer";
+ case TEST:
+ return "test";
+ case TRANSITIONAL:
+ return "transitional";
+ case RATING:
+ return "rating";
+ case TEASER:
+ return "teaser";
+ case POLICY:
+ return "policy";
+ case PUBLIC_SERVICE_ANNOUNCEMENT:
+ return "psa";
+ case ADVERTISEMENT:
+ return "advertisement";
+ }
+
+ assert (false);
+}
+
+bool
+libdcp::ends_with (string big, string little)
+{
+ if (little.size() > big.size()) {
+ return false;
+ }
+
+ return big.compare (big.length() - little.length(), little.length(), little) == 0;
+}