本文整理汇总了C++中UString::CompareNoCase方法的典型用法代码示例。如果您正苦于以下问题:C++ UString::CompareNoCase方法的具体用法?C++ UString::CompareNoCase怎么用?C++ UString::CompareNoCase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UString
的用法示例。
在下文中一共展示了UString::CompareNoCase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitName
bool InitName(const UString &name, bool newStyle)
{
_first = true;
_newStyle = newStyle;
int dotPos = name.ReverseFind('.');
UString basePart = name;
if (dotPos >= 0)
{
UString ext = name.Mid(dotPos + 1);
if (ext.CompareNoCase(L"rar") == 0)
{
_afterPart = name.Mid(dotPos);
basePart = name.Left(dotPos);
}
else if (ext.CompareNoCase(L"exe") == 0)
{
_afterPart = L".rar";
basePart = name.Left(dotPos);
}
else if (!_newStyle)
{
if (ext.CompareNoCase(L"000") == 0 ||
ext.CompareNoCase(L"001") == 0 ||
ext.CompareNoCase(L"r00") == 0 ||
ext.CompareNoCase(L"r01") == 0)
{
_afterPart.Empty();
_first = false;
_changedPart = ext;
_unchangedPart = name.Left(dotPos + 1);
return true;
}
}
}
if (!_newStyle)
{
_afterPart.Empty();
_unchangedPart = basePart + UString(L".");
_changedPart = L"r00";
return true;
}
int numLetters = 1;
if (basePart.Right(numLetters) == L"1" || basePart.Right(numLetters) == L"0")
{
while (numLetters < basePart.Length())
{
if (basePart[basePart.Length() - numLetters - 1] != '0')
break;
numLetters++;
}
}
else
return false;
_unchangedPart = basePart.Left(basePart.Length() - numLetters);
_changedPart = basePart.Right(numLetters);
return true;
}
示例2: MyCompare
int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
{
if (lpData == NULL)
return 0;
CPanel *panel = (CPanel*)lpData;
switch(panel->_sortID)
{
// if (panel->_sortIndex == 0)
case kpidName:
{
const UString name1 = panel->GetItemName((int)lParam1);
const UString name2 = panel->GetItemName((int)lParam2);
int res = name1.CompareNoCase(name2);
/*
if (res != 0 || !panel->_flatMode)
return res;
const UString prefix1 = panel->GetItemPrefix(lParam1);
const UString prefix2 = panel->GetItemPrefix(lParam2);
return res = prefix1.CompareNoCase(prefix2);
*/
return res;
}
case kpidNoProperty:
{
return MyCompare(lParam1, lParam2);
}
case kpidExtension:
{
const UString ext1 = GetExtension(panel->GetItemName((int)lParam1));
const UString ext2 = GetExtension(panel->GetItemName((int)lParam2));
return ext1.CompareNoCase(ext2);
}
}
/*
if (panel->_sortIndex == 1)
return MyCompare(file1.Size, file2.Size);
return ::CompareFileTime(&file1.MTime, &file2.MTime);
*/
// PROPID propID = panel->_properties[panel->_sortIndex].ID;
PROPID propID = panel->_sortID;
NCOM::CPropVariant propVariant1, propVariant2;
// Name must be first property
panel->_folder->GetProperty((UINT32)lParam1, propID, &propVariant1);
panel->_folder->GetProperty((UINT32)lParam2, propID, &propVariant2);
if (propVariant1.vt != propVariant2.vt)
return 0; // It means some BUG
if (propVariant1.vt == VT_BSTR)
{
return _wcsicmp(propVariant1.bstrVal, propVariant2.bstrVal);
}
return propVariant1.Compare(propVariant2);
// return 0;
}
示例3: StringToBool
bool StringToBool(const UString &s, bool &res)
{
if (s.IsEmpty() || s.CompareNoCase(L"ON") == 0 || s.Compare(L"+") == 0)
{
res = true;
return true;
}
if (s.CompareNoCase(L"OFF") == 0 || s.Compare(L"-") == 0)
{
res = false;
return true;
}
return false;
}
示例4: FindMethod
bool FindMethod(
#ifdef EXTERNAL_CODECS
ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs,
#endif
const UString &name,
CMethodId &methodId, UInt32 &numInStreams, UInt32 &numOutStreams)
{
UInt32 i;
for (i = 0; i < g_NumCodecs; i++)
{
const CCodecInfo &codec = *g_Codecs[i];
if (name.CompareNoCase(codec.Name) == 0)
{
methodId = codec.Id;
numInStreams = codec.NumInStreams;
numOutStreams = 1;
return true;
}
}
#ifdef EXTERNAL_CODECS
if (externalCodecs)
for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
{
const CCodecInfoEx &codec = (*externalCodecs)[i];
if (codec.Name.CompareNoCase(name) == 0)
{
methodId = codec.Id;
numInStreams = codec.NumInStreams;
numOutStreams = codec.NumOutStreams;
return true;
}
}
#endif
return false;
}
示例5: GetIconPath
static UString GetIconPath(const UString &filePath,
const CLSID &clsID, const UString &extension, Int32 &iconIndex)
{
CPluginLibrary library;
CMyComPtr<IFolderManager> folderManager;
CMyComPtr<IFolderFolder> folder;
if (filePath.IsEmpty())
folderManager = new CArchiveFolderManager;
else if (library.LoadAndCreateManager(filePath, clsID, &folderManager) != S_OK)
return UString();
CMyComBSTR extBSTR;
if (folderManager->GetExtensions(&extBSTR) != S_OK)
return UString();
const UString ext2 = (const wchar_t *)extBSTR;
UStringVector exts;
SplitString(ext2, exts);
for (int i = 0; i < exts.Size(); i++)
{
const UString &plugExt = exts[i];
if (extension.CompareNoCase((const wchar_t *)plugExt) == 0)
{
CMyComBSTR iconPathTemp;
if (folderManager->GetIconPath(plugExt, &iconPathTemp, &iconIndex) != S_OK)
break;
if (iconPathTemp != 0)
return (const wchar_t *)iconPathTemp;
}
}
return UString();
}
示例6: IsExeExt
static bool IsExeExt(const UString &ext)
{
for (int i = 0; i < sizeof(g_ExeExts) / sizeof(g_ExeExts[0]); i++)
if (ext.CompareNoCase(g_ExeExts[i]) == 0)
return true;
return false;
}
示例7: AddUniqueString
void AddUniqueString(UStringVector &list, const UString &s)
{
for (int i = 0; i < list.Size(); i++)
if (s.CompareNoCase(list[i]) == 0)
return;
list.Add(s);
}
示例8: FindName
int COpenCallbackImp::FindName(const UString &name)
{
for (int i = 0; i < FileNames.Size(); i++)
if (name.CompareNoCase(FileNames[i]) == 0)
return i;
return -1;
}
示例9: FindFormat
int CArchiveFolderManager::FindFormat(const UString &type)
{
for (int i = 0; i < _codecs->Formats.Size(); i++)
if (type.CompareNoCase(_codecs->Formats[i].Name) == 0)
return i;
return -1;
}
示例10: MyFileNameCompare
static inline int MyFileNameCompare(const UString &s1, const UString &s2)
{
return
#ifdef _WIN32
s1.CompareNoCase(s2);
#else
s1.Compare(s2);
#endif
}
示例11: FindIconIndex
int CCodecLib::FindIconIndex(const UString &ext) const
{
for (int i = 0; i < IconPairs.Size(); i++)
{
const CIconPair &pair = IconPairs[i];
if (ext.CompareNoCase(pair.Ext) == 0)
return pair.IconIndex;
}
return -1;
}
示例12: MyMoveFolder
HRESULT MyMoveFolder(
const UString &srcPath,
const UString &destPathSpec,
IFolderOperationsExtractCallback *callback,
UInt64 &completedSize)
{
UString destPath = destPathSpec;
int len = srcPath.Length();
if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0)
{
if (destPath.Length() == len || destPath[len] == WCHAR_PATH_SEPARATOR)
{
UString message = UString(L"can not move folder \'") +
destPath + UString(L"\' onto itself");
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
}
if (MyMoveFile(srcPath, destPath, callback, completedSize))
return S_OK;
if (!NDirectory::CreateComplexDirectory(destPath))
{
UString message = UString(L"can not create folder ") + destPath;
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
{
CEnumeratorW enumerator(CombinePath(srcPath, L"*"));
CFileInfoEx fi;
while (enumerator.Next(fi))
{
const UString srcPath2 = CombinePath(srcPath, fi.Name);
const UString destPath2 = CombinePath(destPath, fi.Name);
if (fi.IsDir())
{
RINOK(MyMoveFolder(srcPath2, destPath2, callback, completedSize));
}
else
{
RINOK(MyMoveFile(srcPath2, fi, destPath2, callback, completedSize));
}
}
}
if (!NDirectory::MyRemoveDirectory(srcPath))
{
UString message = UString(L"can not remove folder") + srcPath;
RINOK(callback->ShowMessage(message));
return E_ABORT;
}
return S_OK;
}
示例13: GetSubFolderNameForExtract
static UString GetSubFolderNameForExtract(const UString &archiveName)
{
int dotPos = archiveName.ReverseFind(L'.');
if (dotPos < 0)
return archiveName + UString(L"~");
const UString ext = archiveName.Mid(dotPos + 1);
UString res = archiveName.Left(dotPos);
res.TrimRight();
dotPos = res.ReverseFind(L'.');
if (dotPos > 0)
{
const UString ext2 = res.Mid(dotPos + 1);
if (ext.CompareNoCase(L"rar") == 0 &&
(ext2.CompareNoCase(L"part001") == 0 ||
ext2.CompareNoCase(L"part01") == 0 ||
ext2.CompareNoCase(L"part1") == 0) ||
IsItArcExt(ext2) && ext.CompareNoCase(L"001") == 0)
res = res.Left(dotPos);
res.TrimRight();
}
return GetCorrectFullFsPath(res);
}
示例14: FindIconIndex
bool CCodecIcons::FindIconIndex(const UString &ext, int &iconIndex) const
{
iconIndex = -1;
for (int i = 0; i < IconPairs.Size(); i++)
{
const CIconPair &pair = IconPairs[i];
if (ext.CompareNoCase(pair.Ext) == 0)
{
iconIndex = pair.IconIndex;
return true;
}
}
return false;
}
示例15: CreateCoder
HRESULT CCodecs::CreateCoder(const UString &name, bool encode, CMyComPtr<ICompressCoder> &coder) const
{
for (int i = 0; i < Codecs.Size(); i++)
{
const CDllCodecInfo &codec = Codecs[i];
if (encode && !codec.EncoderIsAssigned || !encode && !codec.DecoderIsAssigned)
continue;
const CCodecLib &lib = Libs[codec.LibIndex];
UString res;
NWindows::NCOM::CPropVariant prop;
RINOK(lib.GetMethodProperty(codec.CodecIndex, NMethodPropID::kName, &prop));
if (prop.vt == VT_BSTR)
res = prop.bstrVal;
else if (prop.vt != VT_EMPTY)
continue;
if (name.CompareNoCase(res) == 0)
return lib.CreateObject(encode ? &codec.Encoder : &codec.Decoder, &IID_ICompressCoder, (void **)&coder);
}
return CLASS_E_CLASSNOTAVAILABLE;
}