本文整理汇总了C++中CFile::IsKindOf方法的典型用法代码示例。如果您正苦于以下问题:C++ CFile::IsKindOf方法的具体用法?C++ CFile::IsKindOf怎么用?C++ CFile::IsKindOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::IsKindOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _AfxGetArchiveStream
LPSTREAM AFXAPI _AfxGetArchiveStream(CArchive& ar, CArchiveStream& stm)
{
// Obtain direct access to the archive's LPSTREAM.
ar.Flush();
CFile* pFile = ar.GetFile();
ASSERT(pFile != NULL);
LPSTREAM pstm;
if (pFile->IsKindOf(RUNTIME_CLASS(COleStreamFile)))
{
pstm = ((COleStreamFile*)pFile)->m_lpStream;
ASSERT(pstm != NULL);
}
else
{
ASSERT(stm.m_pArchive == NULL || stm.m_pArchive == &ar);
stm.m_pArchive = &ar;
pstm = &stm;
}
return pstm;
}
示例2: LoadScriptFile
int CBoxScript::LoadScriptFile(LPCTSTR pstrFile, CStringA& strScriptText, int nLineNo)
{
CFile* pFile;
CString strOldPath;
CBoxPath path;
int nIncludeFlagIndex;
if(!m_strBasePath.IsEmpty() && pstrFile[0] != _T('\\'))
path.Combine(m_strBasePath.Left(m_strBasePath.ReverseFind(_T('\\')) + 1), pstrFile);
else path.Combine(pstrFile);
for(nIncludeFlagIndex = 0; nIncludeFlagIndex < m_pHost->m_arrayFile.GetCount(); nIncludeFlagIndex ++)
{
if(!m_pHost->m_arrayFile[nIncludeFlagIndex].CompareNoCase(path.m_strPath))
{
if(m_arrayIncludeFlags[nIncludeFlagIndex] != 0)
{
SetParserError(nLineNo, m_strBasePath, CString("Cyclic Include \"") + path.m_strPath + _T("\""));
return 500;
}
m_arrayIncludeFlags[nIncludeFlagIndex] = 1;
break;
}
}
if(nIncludeFlagIndex == m_pHost->m_arrayFile.GetCount())
{
m_pHost->m_arrayFile.Add(path.m_strPath);
m_arrayIncludeFlags.Add(1);
}
strOldPath = m_strBasePath;
m_strBasePath = path.m_strPath;
if((pFile = g_pFile->Open(m_strBasePath)) && pFile != BOX_FOLDER)
{
int nSize;
char* strBuffer;
int iResult = 0;
nSize = (int)pFile->GetLength();
if(pFile->IsKindOf(RUNTIME_CLASS(CMemFile)))
{
m_nCacheFileCount ++;
if(nSize)
{
char *bufptr, *bufptr1;
pFile->GetBufferPtr(CFile::bufferRead, 0, (void**)&bufptr, (void**)&bufptr1);
iResult = ParseScriptText(bufptr, nSize, strScriptText, nIncludeFlagIndex);
}
}else
{
if (::GetFileType(pFile->m_hFile) != FILE_TYPE_DISK)
{
delete pFile;
m_arrayIncludeFlags[nIncludeFlagIndex] = 0;
m_strBasePath = strOldPath;
return 404;
}
m_nDiskFileCount ++;
if(nSize)
{
strBuffer = new char[nSize];
if(strBuffer == NULL)
{
delete pFile;
m_arrayIncludeFlags[nIncludeFlagIndex] = 0;
m_strBasePath = strOldPath;
return 500;
}
pFile->Read(strBuffer, nSize);
iResult = ParseScriptText(strBuffer, nSize, strScriptText, nIncludeFlagIndex);
delete strBuffer;
}
}
delete pFile;
if(iResult != 0)
{
m_arrayIncludeFlags[nIncludeFlagIndex] = 0;
m_strBasePath = strOldPath;
return iResult;
}
m_pHost->m_strScriptName = m_strBasePath;
m_arrayIncludeFlags[nIncludeFlagIndex] = 0;
m_strBasePath = strOldPath;
return 0;
}
if(!strOldPath.IsEmpty())
SetParserError(nLineNo, strOldPath, CString("Include File \"") + m_strBasePath + _T("\" not found."));
//.........这里部分代码省略.........