}
-ContentVersion
+optional<ContentVersion>
CPL::content_version () const
{
- DCP_ASSERT (!_content_versions.empty());
+ if (_content_versions.empty()) {
+ return optional<ContentVersion>();
+ }
+
return _content_versions[0];
}
return _content_kind;
}
- ContentVersion content_version () const;
+ boost::optional<ContentVersion> content_version () const;
std::vector<ContentVersion> content_versions () const {
return _content_versions;
using std::list;
using std::string;
+using boost::optional;
using boost::shared_ptr;
/** Test dcp::order::Font::take_intersection */
cpl->set_creator (creator);
cpl->set_issue_date (issue_date);
cpl->set_annotation_text (annotation_text);
- dcp::ContentVersion cv = cpl->content_version();
- cv.label_text = "foo";
- cpl->set_content_version (cv);
+ optional<dcp::ContentVersion> cv = cpl->content_version();
+ BOOST_REQUIRE (cv);
+ cv->label_text = "foo";
+ cpl->set_content_version (*cv);
dcp::DCP dcp ("build/test/write_interop_subtitle_test3");
dcp.add (cpl);