本文整理汇总了C++中CFileInfo::GetBaseName方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileInfo::GetBaseName方法的具体用法?C++ CFileInfo::GetBaseName怎么用?C++ CFileInfo::GetBaseName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileInfo
的用法示例。
在下文中一共展示了CFileInfo::GetBaseName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FilesEqual
// speed optimized and made unicode-compatible
inline bool CFilenameLayer::FilesEqual( CFileInfo & FileInfo1, CFileInfo & FileInfo2) const
{
switch ( m_FilenameMatchMode )
{
case IDC_MATCH_FILENAMES:
if ( m_CaseSensitive )
return _tcscmp( FileInfo1.GetName() , FileInfo2.GetName() ) == 0;
else
return _tcsicmp( FileInfo1.GetName() , FileInfo2.GetName() ) == 0;
break;
case IDC_MATCH_EXTENSIONS:
{
LPCTSTR pExtension1, pExtension2;
pExtension1 = FileInfo1.GetExtension();
pExtension2 = FileInfo2.GetExtension();
if ( pExtension1 == NULL || pExtension2 == NULL )
{
return ( pExtension1 == pExtension2 );
}
else
{
if ( m_CaseSensitive )
return _tcscmp( pExtension1 , pExtension2 ) == 0;
else
return _tcsicmp( pExtension1 , pExtension2 ) == 0;
}
}
break;
case IDC_MATCH_NOT_FILENAME:
if ( m_CaseSensitive )
return _tcscmp( FileInfo1.GetName() , FileInfo2.GetName() ) != 0;
else
return _tcsicmp( FileInfo1.GetName() , FileInfo2.GetName() ) != 0;
break;
case IDC_MATCH_NOT_EXTENSIONS:
{
LPCTSTR pExtension1, pExtension2;
pExtension1 = FileInfo1.GetExtension();
pExtension2 = FileInfo2.GetExtension();
if ( pExtension1 == NULL || pExtension2 == NULL )
{
return ( pExtension1 == pExtension2 );
}
else
{
if ( m_CaseSensitive )
return _tcscmp( pExtension1 , pExtension2 ) != 0;
else
return _tcsicmp( pExtension1 , pExtension2 ) != 0;
}
}
break;
case IDC_MATCH_WORDS:
{
CArray <CString, CString&> Words1;
CArray <CString, CString&> Words2;
CArray <CString, CString> IgnoreWords;
CString strMask;
CString TempStr = FileInfo1.GetBaseName();
int nPos = 0;
int nNextPos = 0;
int x, y;
nPos = 0;
nNextPos = 0;
// add file masks
while (nPos < TempStr.GetLength())
{
nNextPos = TempStr.Find( _T(" ") ,nPos);
if (nNextPos == -1) nNextPos = TempStr.GetLength();
strMask = TempStr.Mid(nPos, nNextPos-nPos);
strMask.TrimLeft();
strMask.TrimRight();
if ( !m_CaseSensitive ) strMask.MakeUpper();
if (strMask != "") Words1.Add(strMask);
nPos = nNextPos + 1;
}
//
TempStr = FileInfo2.GetBaseName();
nPos = 0;
nNextPos = 0;
// add file masks
while (nPos < TempStr.GetLength())
{
nNextPos = TempStr.Find( _T(" ") ,nPos);
if (nNextPos == -1) nNextPos = TempStr.GetLength();
strMask = TempStr.Mid(nPos, nNextPos-nPos);
strMask.TrimLeft();
//.........这里部分代码省略.........