本文整理汇总了C++中CvString::find_last_of方法的典型用法代码示例。如果您正苦于以下问题:C++ CvString::find_last_of方法的具体用法?C++ CvString::find_last_of怎么用?C++ CvString::find_last_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvString
的用法示例。
在下文中一共展示了CvString::find_last_of方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isExcludedFile
bool CvXMLLoadUtilityModTools::isExcludedFile(const char* szLocationName)
{
CvString szLocationNameStripDot = szLocationName;
CvString szLocationNameStripTemp = szLocationName;
string::size_type posDot = szLocationNameStripDot.find_last_of('.');
if(posDot != string::npos)
{
//force lowercase for comparison
int length = szLocationNameStripDot.size();
for (int i = 0; i < length; ++i)
{
szLocationNameStripTemp[length - (i + 1)] = tolower(szLocationNameStripDot[i]);
}
string::size_type posDot = szLocationNameStripTemp.find_last_of('.');
//delete everything after first dir
szLocationNameStripTemp.erase(posDot);
//compare
if ( szLocationNameStripTemp == "mht" ) //if its a thema file, force static linking
{
#ifdef _DEBUG
CvXMLLoadUtility* p_szLogWrite = new CvXMLLoadUtility;
p_szLogWrite->XmlArtTagVerification("You are now loading an alternative theme: %s", szLocationName);
SAFE_DELETE(p_szLogWrite);
#endif
return true;
}
}
return false;
}
示例2: writeThm
void CvXMLLoadUtilityModTools::writeThm(const char* szTextVal)
{
CvString tszTextVal = szTextVal;
int posCut;
string::size_type posBackSlash = tszTextVal.find_last_of('\\');
string::size_type posSlashForw = tszTextVal.find_last_of('/');
if (posBackSlash > posSlashForw)
{
posCut = posBackSlash;
}
else
{
posCut = posSlashForw;
}
if(posCut != string::npos)
{
tszTextVal.erase(posCut);
}
else
{
FAssertMsg(false, "Something went wrong with the Theme file");
}
FILE *pFile = fopen(szTextVal, "w");
if (pFile == NULL)
{
/*
#ifdef _DEBUG
CvString szPrint = GetProgramDir();
szPrint.append(szTextVal);
CvXMLLoadUtility* p_szLogWrite = new CvXMLLoadUtility;
p_szLogWrite->XmlArtTagVerification("Your Theme file: %s seems to be corrupted", szPrint.GetCString());
SAFE_DELETE(p_szLogWrite);
#endif
*/
}
//set the proper string to write to the Theme file
CvString szOutput = "resource_path\t";
szOutput.append("\"");
szOutput.append(tszTextVal);
szOutput.append("\";\n");
szOutput.append("\n");
szOutput.append("include\t");
szOutput.append("\"");
szOutput.append(tszTextVal);
szOutput.append("\\Themes\\Civ4\\Civ4Theme.thm");
szOutput.append("\";\n");
//write the file
fputs(szOutput, pFile);
fclose(pFile);
}
示例3: deleteFileName
CvString CvXMLLoadUtilityModTools::deleteFileName(const char* szDirName, const char szLocateChar)
{
CvString szDirNameStrip = szDirName;
string::size_type pos = szDirNameStrip.find_last_of(szLocateChar);
if(pos != string::npos)
{
szDirNameStrip.erase(pos + 1);
}
else
{
FAssertMsg(false, "Couldn't find the directory slash")
}
return szDirNameStrip;
}
示例4: GetProgramDir
// Fully based on CString
CvString CvXMLLoadUtilityModTools::GetProgramDir()
{
CvString szExeLocation = _pgmptr;
if ( szExeLocation == NULL)
{
FAssertMsg(false, "Not running Stdlib Compatible Operating System?");
}
string::size_type posDot = szExeLocation.find_last_of('\\');
if(posDot != string::npos)
{
szExeLocation.erase(posDot + 1);
}
return szExeLocation;
}