本文整理汇总了C++中XML_Node::GetLeafContentValue方法的典型用法代码示例。如果您正苦于以下问题:C++ XML_Node::GetLeafContentValue方法的具体用法?C++ XML_Node::GetLeafContentValue怎么用?C++ XML_Node::GetLeafContentValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML_Node
的用法示例。
在下文中一共展示了XML_Node::GetLeafContentValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: origXML
void P2_MetaHandler::UpdateFile ( bool doSafeUpdate )
{
if ( ! this->needsUpdate ) return;
this->needsUpdate = false; // Make sure only called once.
XMP_Assert ( this->parent->UsesLocalIO() );
// Update the internal legacy XML tree if we have one, and set the digest in the XMP.
bool updateLegacyXML = false;
P2_Clip* p2Clip = 0;
XML_NodePtr clipMetadata = 0;
if ( this->p2ClipManager.IsValidP2() )
{
p2Clip=this->p2ClipManager.GetManagedClip();
clipMetadata = p2Clip->GetClipMetadataNode();
if ( clipMetadata != 0 ) {
bool xmpFound;
std::string xmpValue;
XML_Node * xmlNode;
xmpFound = this->xmpObj.GetLocalizedText ( kXMP_NS_DC, "title", "", "x-default", 0, &xmpValue, 0 );
if ( xmpFound && p2Clip->GetClipContentNode()) {
xmlNode = this->ForceChildElement ( p2Clip->GetClipContentNode(), "ClipName", 3, false );
if ( xmpValue != xmlNode->GetLeafContentValue() ) {
xmlNode->SetLeafContentValue ( xmpValue.c_str() );
updateLegacyXML = true;
}
}
xmpFound = this->xmpObj.GetArrayItem ( kXMP_NS_DC, "creator", 1, &xmpValue, 0 );
if ( xmpFound ) {
xmlNode = this->ForceChildElement ( clipMetadata , "Access", 3, false );
// "Creator" must be first child of "Access" node else Panasonic P2 Viewer gives an error.
xmlNode = this->ForceChildElement ( xmlNode, "Creator", 4 , true);
if ( xmpValue != xmlNode->GetLeafContentValue() ) {
xmlNode->SetLeafContentValue ( xmpValue.c_str() );
updateLegacyXML = true;
}
}
}
// Half the startTimeCode frame number value in XML if require so
std::string xmpStartTimeCode;
bool isTimecodeExists = this->xmpObj.GetStructField(kXMP_NS_DM, "startTimecode", kXMP_NS_DM, "timeValue", &xmpStartTimeCode, 0);
if (isTimecodeExists)
{
std::string frameFormat;
this->xmpObj.GetStructField(kXMP_NS_DM, "startTimecode", kXMP_NS_DM, "timeFormat", &frameFormat, 0);
if (frameFormat == "50Timecode" || frameFormat == "5994DropTimecode" || frameFormat == "5994NonDropTimecode")
{
p2Clip = this->p2ClipManager.GetManagedClip();
XMP_StringPtr p2NS = p2Clip->GetP2RootNode()->ns.c_str();
XML_NodePtr legacyVideoContext = p2Clip->GetEssenceListNode();
if (legacyVideoContext != 0)
{
legacyVideoContext = legacyVideoContext->GetNamedElement(p2NS, "Video");
XML_NodePtr legacyProp = legacyVideoContext->GetNamedElement(p2NS, "StartTimecode");
if ((legacyProp != 0) && legacyProp->IsLeafContentNode())
{
AdjustTimeCode( xmpStartTimeCode, true );
if (xmpStartTimeCode != legacyProp->GetLeafContentValue())
{
legacyProp->SetLeafContentValue(xmpStartTimeCode.c_str());
updateLegacyXML = true;
}
}
}
}
}
std::string newDigest;
this->p2ClipManager.GetManagedClip()->CreateDigest ( &newDigest );
this->xmpObj.SetStructField ( kXMP_NS_XMP, "NativeDigests", kXMP_NS_XMP, "P2", newDigest.c_str(), kXMP_DeleteExisting );
}
this->xmpObj.SerializeToBuffer ( &this->xmpPacket, this->GetSerializeOptions() );
// -----------------------------------------------------------------------
// Update the XMP file first, don't let legacy XML failures block the XMP.
std::string xmpPath;
this->MakeClipFilePath ( &xmpPath, ".XMP" );
bool haveXMP = Host_IO::Exists ( xmpPath.c_str() );
if ( ! haveXMP ) {
XMP_Assert ( this->parent->ioRef == 0 );
Host_IO::Create ( xmpPath.c_str() );
this->parent->ioRef = XMPFiles_IO::New_XMPFiles_IO ( xmpPath.c_str(), Host_IO::openReadWrite );
if ( this->parent->ioRef == 0 ) XMP_Throw ( "Failure opening P2 XMP file", kXMPErr_ExternalFailure );
}
XMP_IO* xmpFile = this->parent->ioRef;
//.........这里部分代码省略.........