本文整理汇总了C++中PathName::IsValid方法的典型用法代码示例。如果您正苦于以下问题:C++ PathName::IsValid方法的具体用法?C++ PathName::IsValid怎么用?C++ PathName::IsValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathName
的用法示例。
在下文中一共展示了PathName::IsValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenThumbnailFile
BOOL SGThumbs::OpenThumbnailFile( CCDiskFile* pFile, const PathName& ThumbFileName ) const
{
ERROR3IF( pFile==NULL, "SGThumbs::OpenThumbnailFile passed a null ptr" );
TRACEUSER( "Martin", _T("Open thumb file: %s\n"), (const TCHAR *)ThumbFileName.GetPath() );
BOOL Found = FALSE;
if(!ThumbFileName.IsValid())
{
// either xarainfo\\<filename> or the actual clipart file
ERROR3("SGThumbs::OpenThumbnailFile received an invalid xarainfo\\<filename> file");
Error::ClearError();
return FALSE;
}
// Open file and check if it exists at the same time
if( !( Found = pFile->open( ThumbFileName, ios::in | ios::binary ) ) )
{
Found = FALSE;
Error::ClearError();
}
return Found;
}
示例2: Save
BOOL OpMenuSave::Save ( Filter *pFilter, CCLexFile *pFile )
{
// Check that the extension is ok according to this filter
// But only if the operation requires it
if (FixFileType())
{
PathName pth = pFile->GetPathName();
if (pth.IsValid()) EnsureFileTypeCorrectId(pFilter, pth);
}
// open the file and export into it
if (!SaveSpecificFile(pFilter, pFile))
{
FailAndExecute();
return FALSE;
}
// Success.
return TRUE;
}
示例3: GenerateHTMLStub
/*******************************************************************************************
> BOOL BitmapPreviewData::GenerateHTMLStub(BrowserPreviewOptions BrowserOptions)
Author: Stefan_Stoykov (Xara Group Ltd) <[email protected]>
Created: 24/6/97
Inputs: BrowserOptions - the options for generating the html page
Purpose: Generate a html file which includes our bitmap, together with some other optional
stuff. Used for browser preview.
*******************************************************************************************/
BOOL BitmapPreviewData::GenerateHTMLStub(BrowserPreviewOptions BrowserOptions)
{
PORTNOTE("other","Removed _R(IDD_TIMAPOPTIONS) - isn't wanted yet")
#ifndef EXCLUDE_FROM_XARALX
// sanity checks
// check for export options
ERROR3IF(m_pOptions == NULL, "BitmapPreviewData::GenerateHTMLStub - need export options");
if (m_pOptions == NULL) // we need export options
return FALSE;
// get the path for the exported bitmap from the options
PathName TempPath = m_pOptions->GetPathName();
// check for exported bitmap
ERROR3IF((m_pOptions->HasTempFile() == FALSE) || (TempPath.IsValid() == FALSE),
"BitmapPreviewData::GenerateHTMLStub - need exported bitmap");
if ((m_pOptions->HasTempFile() == FALSE) || (TempPath.IsValid() == FALSE))
return FALSE;
// delete the previous temp file, if any
if (m_pTempHTMLPath != NULL)
FileUtil::DeleteFile(m_pTempHTMLPath);
else
m_pTempHTMLPath = new PathName;
// safety check
if (m_pTempHTMLPath == NULL)
return FALSE;
// create a new temp file
if (FileUtil::GetTemporaryPathName( _T("htm"),m_pTempHTMLPath) == FALSE)
{
delete m_pTempHTMLPath;
m_pTempHTMLPath = NULL;
return FALSE;
}
// start creating the html page
// create a disk file
CCDiskFile TempDiskFile(1024, FALSE, TRUE);
// get path name to server, so we can find the logo bitmaps
CString str;
AfxGetModuleShortFileName(AfxGetInstanceHandle(), str);
String_256 strPathName(str.GetBuffer(0));
// create a path name object from the program name
PathName ProgramPath(strPathName);
try
{
// open it for reading
if (!TempDiskFile.open(*m_pTempHTMLPath, ios::out))
return FALSE;
// output header
String_256 s(_R(IDS_HTML_HEAD));
TempDiskFile.write(s);
// set the background attributes
switch (BrowserOptions.m_Background)
{
case BROWSER_BGR_DOC:
{
// set the background from the document page
if (!SetBackgroundFromPage(TempDiskFile, BrowserOptions.m_pSpread))
ERROR3("Setting the html background from the document page failed\n");
}
break;
case BROWSER_BGR_CHECKER:
{
// display the checkered bitmap as background
// get the checkered bitmap name
String_256 Checker(_R(IDS_HTML_CHECKER));
// set it in the path
ProgramPath.SetFileNameAndType(Checker);
// set the checkered bitmap as background image
s.MakeMsg(_R(IDS_CHECK_BACK), (TCHAR *)ProgramPath.GetWebAddress());
TempDiskFile.write(s);
}
break;
//.........这里部分代码省略.........