}
-/** Convert a content kind to a string which can be used in a
- * <ContentKind> node
- * @param kind ContentKind
- * @return string
- */
-string
-dcp::content_kind_to_string (ContentKind kind)
-{
- switch (kind) {
- case ContentKind::FEATURE:
- return "feature";
- case ContentKind::SHORT:
- return "short";
- case ContentKind::TRAILER:
- return "trailer";
- case ContentKind::TEST:
- return "test";
- case ContentKind::TRANSITIONAL:
- return "transitional";
- case ContentKind::RATING:
- return "rating";
- case ContentKind::TEASER:
- return "teaser";
- case ContentKind::POLICY:
- return "policy";
- case ContentKind::PUBLIC_SERVICE_ANNOUNCEMENT:
- return "psa";
- case ContentKind::ADVERTISEMENT:
- return "advertisement";
- case ContentKind::EPISODE:
- return "episode";
- case ContentKind::PROMO:
- return "promo";
- }
-
- DCP_ASSERT (false);
-}
-
-
-/** Convert a string from a <ContentKind> node to a libdcp ContentKind.
- * Reasonably tolerant about varying case
- * @param kind Content kind string
- * @return libdcp ContentKind
- */
-dcp::ContentKind
-dcp::content_kind_from_string (string kind)
-{
- transform (kind.begin(), kind.end(), kind.begin(), ::tolower);
-
- if (kind == "feature") {
- return ContentKind::FEATURE;
- } else if (kind == "short") {
- return ContentKind::SHORT;
- } else if (kind == "trailer") {
- return ContentKind::TRAILER;
- } else if (kind == "test") {
- return ContentKind::TEST;
- } else if (kind == "transitional") {
- return ContentKind::TRANSITIONAL;
- } else if (kind == "rating") {
- return ContentKind::RATING;
- } else if (kind == "teaser") {
- return ContentKind::TEASER;
- } else if (kind == "policy") {
- return ContentKind::POLICY;
- } else if (kind == "psa") {
- return ContentKind::PUBLIC_SERVICE_ANNOUNCEMENT;
- } else if (kind == "advertisement") {
- return ContentKind::ADVERTISEMENT;
- } else if (kind == "episode") {
- return ContentKind::EPISODE;
- } else if (kind == "promo") {
- return ContentKind::PROMO;
- }
-
- throw BadContentKindError (kind);
-}
-
-
string
dcp::marker_to_string (dcp::Marker m)
{