本文整理汇总了C++中XMP_IO::AbsorbTemp方法的典型用法代码示例。如果您正苦于以下问题:C++ XMP_IO::AbsorbTemp方法的具体用法?C++ XMP_IO::AbsorbTemp怎么用?C++ XMP_IO::AbsorbTemp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMP_IO
的用法示例。
在下文中一共展示了XMP_IO::AbsorbTemp方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateFile
void GIF_MetaHandler::UpdateFile ( bool doSafeUpdate )
{
IgnoreParam(doSafeUpdate);
XMP_Assert( !doSafeUpdate ); // This should only be called for "unsafe" updates.
if ( ! this->needsUpdate ) return;
XMP_IO * fileRef = this->parent->ioRef;
/*XMP_StringPtr packetStr = xmpPacket.c_str();*/
XMP_StringLen newPacketLength = (XMP_StringLen)xmpPacket.size();
if ( newPacketLength == XMPPacketLength )
{
this->SeekFile( fileRef, this->packetInfo.offset, kXMP_SeekFromStart );
fileRef->Write( this->xmpPacket.c_str(), newPacketLength );
}
else
{
XMP_IO* tempFile = fileRef->DeriveTemp();
if ( tempFile == 0 ) XMP_Throw( "Failure creating GIF temp file", kXMPErr_InternalFailure );
this->WriteTempFile( tempFile );
fileRef->AbsorbTemp();
}
this->needsUpdate = false;
} // GIF_MetaHandler::UpdateFile
示例2: SafeWriteFile
bool ASF_MetaHandler::SafeWriteFile()
{
XMP_IO* originalFile = this->parent->ioRef;
XMP_IO* tempFile = originalFile->DeriveTemp();
if ( tempFile == 0 ) XMP_Throw ( "Failure creating ASF temp file", kXMPErr_InternalFailure );
this->WriteTempFile ( tempFile );
originalFile->AbsorbTemp();
return true;
} // ASF_MetaHandler::SafeWriteFile
示例3: UpdateFile
void FLV_MetaHandler::UpdateFile ( bool doSafeUpdate )
{
if ( ! this->needsUpdate ) return;
XMP_Assert ( ! doSafeUpdate ); // This should only be called for "unsafe" updates.
XMP_AbortProc abortProc = this->parent->abortProc;
void * abortArg = this->parent->abortArg;
const bool checkAbort = (abortProc != 0);
XMP_IO* fileRef = this->parent->ioRef;
XMP_Uns64 fileSize = fileRef->Length();
// Make sure the XMP has a legacy digest if appropriate.
if ( ! this->onMetaData.empty() ) {
std::string newDigest;
this->MakeLegacyDigest ( &newDigest );
this->xmpObj.SetStructField ( kXMP_NS_XMP, "NativeDigests",
kXMP_NS_XMP, "FLV", newDigest.c_str(), kXMP_DeleteExisting );
try {
XMP_StringLen xmpLen = (XMP_StringLen)this->xmpPacket.size();
this->xmpObj.SerializeToBuffer ( &this->xmpPacket, (kXMP_UseCompactFormat | kXMP_ExactPacketLength), xmpLen );
} catch ( ... ) {
this->xmpObj.SerializeToBuffer ( &this->xmpPacket, kXMP_UseCompactFormat );
}
}
// Rewrite the packet in-place if it fits. Otherwise rewrite the whole file.
if ( this->xmpPacket.size() == (size_t)this->packetInfo.length ) {
XMP_ProgressTracker* progressTracker = this->parent->progressTracker;
if ( progressTracker != 0 ) progressTracker->BeginWork ( (float)this->xmpPacket.size() );
fileRef->Seek ( this->packetInfo.offset, kXMP_SeekFromStart );
fileRef->Write ( this->xmpPacket.data(), (XMP_Int32)this->xmpPacket.size() );
if ( progressTracker != 0 ) progressTracker->WorkComplete();
} else {
XMP_IO* tempRef = fileRef->DeriveTemp();
if ( tempRef == 0 ) XMP_Throw ( "Failure creating FLV temp file", kXMPErr_InternalFailure );
this->WriteTempFile ( tempRef );
fileRef->AbsorbTemp();
}
this->needsUpdate = false;
} // FLV_MetaHandler::UpdateFile
示例4: UpdateFile
void SVG_MetaHandler::UpdateFile( bool doSafeUpdate )
{
XMP_Assert( !doSafeUpdate ); // This should only be called for "unsafe" updates.
XMP_IO* sourceRef = this->parent->ioRef;
if ( sourceRef == NULL || svgNode == NULL )
return;
// Checking whether Title updation requires or not
std::string title;
XML_NodePtr titleNode = svgNode->GetNamedElement( svgNode->ns.c_str(), "title" );
(void) this->xmpObj.GetLocalizedText( kXMP_NS_DC, "title", "", "x-default", 0, &title, 0 );
if ( ( titleNode == NULL ) == ( title.empty() ) )
{
if ( titleNode != NULL && titleNode->content.size() == 1 && titleNode->content[ 0 ]->kind == kCDataNode && !XMP_LitMatch( titleNode->content[ 0 ]->value.c_str(), title.c_str() ) )
isTitleUpdateReq = true;
}
else
isTitleUpdateReq = true;
// Checking whether Description updation requires or not
std::string description;
XML_NodePtr descNode = svgNode->GetNamedElement( svgNode->ns.c_str(), "desc" );
( void ) this->xmpObj.GetLocalizedText( kXMP_NS_DC, "description", "", "x-default", 0, &description, 0 );
if ( ( descNode == NULL ) == ( description.empty() ) )
{
if ( descNode != NULL && descNode->content.size() == 1 && descNode->content[ 0 ]->kind == kCDataNode && !XMP_LitMatch( descNode->content[ 0 ]->value.c_str(), description.c_str() ) )
isDescUpdateReq = true;
}
else
isDescUpdateReq = true;
// If any updation is required then don't do inplace replace
bool isUpdateRequire = isTitleUpdateReq | isDescUpdateReq | (this->packetInfo.offset == kXMPFiles_UnknownOffset);
// Inplace Updation of XMP
if ( !isUpdateRequire && this->xmpPacket.size() == this->packetInfo.length )
{
sourceRef->Seek( this->packetInfo.offset, kXMP_SeekFromStart );
sourceRef->Write( this->xmpPacket.c_str(), static_cast< int >( this->xmpPacket.size() ) );
}
else
{
// Inplace is not possibe, So perform full updation
try
{
XMP_IO* tempRef = sourceRef->DeriveTemp();
this->WriteTempFile( tempRef );
}
catch ( ... )
{
sourceRef->DeleteTemp();
throw;
}
sourceRef->AbsorbTemp();
}
this->needsUpdate = false;
} // SVG_MetaHandler::UpdateFile