}
_id = remove_urn_uuid (f.string_child ("Id"));
- _annotation_text = f.optional_string_child("AnnotationText").get_value_or("");
+ _annotation_text = f.optional_string_child("AnnotationText");
_issuer = f.optional_string_child("Issuer").get_value_or("");
_creator = f.optional_string_child("Creator").get_value_or("");
_issue_date = f.string_child ("IssueDate");
}
root->add_child("Id")->add_child_text ("urn:uuid:" + _id);
- root->add_child("AnnotationText")->add_child_text (_annotation_text);
+ if (_annotation_text) {
+ root->add_child("AnnotationText")->add_child_text (*_annotation_text);
+ }
root->add_child("IssueDate")->add_child_text (_issue_date);
root->add_child("Issuer")->add_child_text (_issuer);
root->add_child("Creator")->add_child_text (_creator);
}
if (_annotation_text != other_cpl->_annotation_text && !opt.cpl_annotation_texts_can_differ) {
- string const s = "CPL: annotation texts differ: " + _annotation_text + " vs " + other_cpl->_annotation_text + "\n";
+ string const s = "CPL: annotation texts differ: " + _annotation_text.get_value_or("") + " vs " + other_cpl->_annotation_text.get_value_or("") + "\n";
note (DCP_ERROR, s);
return false;
}
_issue_date = issue_date;
}
- /** @return contents of the <AnnotationText> node */
- std::string annotation_text () const {
+ /** @return contents of the <AnnotationText> node, if present */
+ boost::optional<std::string> annotation_text () const {
return _annotation_text;
}
std::string _issuer;
std::string _creator;
std::string _issue_date;
- std::string _annotation_text;
+ boost::optional<std::string> _annotation_text;
std::string _content_title_text; ///< <ContentTitleText>
ContentKind _content_kind; ///< <ContentKind>
std::vector<ContentVersion> _content_versions;
auto cpls = d.cpls ();
BOOST_CHECK_EQUAL (cpls.size(), 1);
- BOOST_CHECK_EQUAL (cpls.front()->annotation_text(), "A Test DCP");
- BOOST_CHECK_EQUAL (cpls.front()->content_kind(), dcp::FEATURE);
+ BOOST_REQUIRE (cpls[0]->annotation_text());
+ BOOST_CHECK_EQUAL (cpls[0]->annotation_text().get(), "A Test DCP");
+ BOOST_CHECK_EQUAL (cpls[0]->content_kind(), dcp::FEATURE);
BOOST_REQUIRE (d.standard());
BOOST_CHECK_EQUAL (d.standard(), dcp::SMPTE);
}
auto cpls = d.cpls ();
BOOST_CHECK_EQUAL (cpls.size(), 1);
- BOOST_CHECK_EQUAL (cpls.front()->annotation_text(), "Test_FTR-1_F-119_10_2K_20160524_IOP_OV");
- BOOST_CHECK_EQUAL (cpls.front()->content_kind(), dcp::FEATURE);
+ BOOST_REQUIRE (cpls[0]->annotation_text());
+ BOOST_CHECK_EQUAL (cpls[0]->annotation_text().get(), "Test_FTR-1_F-119_10_2K_20160524_IOP_OV");
+ BOOST_CHECK_EQUAL (cpls[0]->content_kind(), dcp::FEATURE);
BOOST_REQUIRE (d.standard());
BOOST_CHECK_EQUAL (d.standard(), dcp::INTEROP);
}
dcp::Time total_time;
BOOST_FOREACH (shared_ptr<CPL> i, cpls) {
- OUTPUT_CPL_NAME_ID(" CPL: %1 %2\n", i->annotation_text(), i->id());
+ OUTPUT_CPL_NAME_ID(" CPL: %1 %2\n", i->annotation_text().get_value_or(""), i->id());
int R = 1;
BOOST_FOREACH (shared_ptr<Reel> j, i->reels()) {