本文整理汇总了C++中PART_LIB::SaveDocs方法的典型用法代码示例。如果您正苦于以下问题:C++ PART_LIB::SaveDocs方法的具体用法?C++ PART_LIB::SaveDocs怎么用?C++ PART_LIB::SaveDocs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PART_LIB
的用法示例。
在下文中一共展示了PART_LIB::SaveDocs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveActiveLibrary
//.........这里部分代码省略.........
// Verify the user has write privileges before attempting to
// save the library file.
if( !IsWritable( fn ) )
return false;
ClearMsgPanel();
wxFileName libFileName = fn;
wxFileName backupFileName = fn;
// Rename the old .lib file to .bak.
if( libFileName.FileExists() )
{
backupFileName.SetExt( wxT( "bak" ) );
if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( libFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
libFileName.MakeAbsolute();
msg = wxT( "Failed to rename old component library file " ) +
backupFileName.GetFullPath();
DisplayError( this, msg );
}
}
try
{
FILE_OUTPUTFORMATTER libFormatter( libFileName.GetFullPath() );
if( !lib->Save( libFormatter ) )
{
msg.Printf( _( "Error occurred while saving library file '%s'" ),
GetChars( fn.GetFullPath() ) );
AppendMsgPanel( _( "*** ERROR: ***" ), msg, RED );
DisplayError( this, msg );
return false;
}
}
catch( ... /* IO_ERROR ioe */ )
{
libFileName.MakeAbsolute();
msg.Printf( _( "Failed to create component library file '%s'" ),
GetChars( libFileName.GetFullPath() ) );
DisplayError( this, msg );
return false;
}
wxFileName docFileName = libFileName;
docFileName.SetExt( DOC_EXT );
// Rename .doc file to .bck.
if( docFileName.FileExists() )
{
backupFileName.SetExt( wxT( "bck" ) );
if( backupFileName.FileExists() )
wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( docFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{
msg = wxT( "Failed to save old library document file " ) +
backupFileName.GetFullPath();
DisplayError( this, msg );
}
}
try
{
FILE_OUTPUTFORMATTER docFormatter( docFileName.GetFullPath() );
if( !lib->SaveDocs( docFormatter ) )
{
msg.Printf( _( "Error occurred while saving library documentation file <%s>" ),
GetChars( docFileName.GetFullPath() ) );
AppendMsgPanel( _( "*** ERROR: ***" ), msg, RED );
DisplayError( this, msg );
return false;
}
}
catch( ... /* IO_ERROR ioe */ )
{
docFileName.MakeAbsolute();
msg.Printf( _( "Failed to create component document library file <%s>" ),
GetChars( docFileName.GetFullPath() ) );
DisplayError( this, msg );
return false;
}
msg.Printf( _( "Library file '%s' OK" ), GetChars( fn.GetFullName() ) );
fn.SetExt( DOC_EXT );
wxString msg1;
msg1.Printf( _( "Documentation file '%s' OK" ), GetChars( fn.GetFullPath() ) );
AppendMsgPanel( msg, msg1, BLUE );
return true;
}