当前位置: 首页>>代码示例>>C++>>正文


C++ CvString::erase方法代码示例

本文整理汇总了C++中CvString::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ CvString::erase方法的具体用法?C++ CvString::erase怎么用?C++ CvString::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CvString的用法示例。


在下文中一共展示了CvString::erase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例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);
}
开发者ID:,项目名称:,代码行数:56,代码来源:

示例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;
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例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;
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例5: isCommaFile


//.........这里部分代码省略.........
				}
			}
			else break;			
		}
		if (!bContinue )
		{
			szAppend = "," + szTempLocation;
		}
#endif

std::vector<CvString> vecButtonArtFile;
#if (DEBUG_IS_MODULAR_ART == 1)
	szButtonsString.getTokens(CvString(","), vecButtonArtFile);
	szDebugBuffer.Format(" Button art vector size after tokenizing by ',': %i", vecButtonArtFile.size());
	gDLL->logMsg("CvXMLLoadUtilityModTools_isCommaFile.log", szDebugBuffer.c_str());
#else
		// set Button Array
		// Array to hold the Button art files
		CvString szTempLocationSubstr;
		szTempLocation = *pszTextVal;
		while (true)
		{
			posComma = szTempLocation.find_first_of(',');
			if(posComma != string::npos) //Prevent Null pointer deletion
			{
				if (szTempLocation[0] == 44) // "," = 44 (ASCII)
				{
					szTempLocation = szTempLocation.substr(szTempLocation.find(",")+1);
				}
				szTempLocationSubstr = szTempLocation;
				posComma = szTempLocationSubstr.find_first_of(',');
				if(posComma != string::npos) //Prevent Null pointer deletion
				{
					szTempLocationSubstr.erase(posComma);
					if (!isdigit(szTempLocationSubstr[0]))
					{
						vecButtonArtFile.push_back(szTempLocationSubstr);
					}
					else break;
				}
				szTempLocation = szTempLocation.substr(szTempLocation.find(",")+1);
			}
			else if (szTempLocation.GetLength() >= 1)
			{
				if (!isdigit(szTempLocationSubstr[0]))
				{
					vecButtonArtFile.push_back(szTempLocationSubstr);
				}
				break;
			}
			else break;
		}		
#endif

		//Check if we need to modularize the files
		bool bNeedChange = false;
/************************************************************************************************/
/* Afforess	                  Start		 06/15/10                                               */
/*                                                                                              */
/*                                                                                              */
/************************************************************************************************/
		CvString m_szFolderPath = GC.getInitCore().getDLLPath() + "//";
/************************************************************************************************/
/* Afforess	                     END                                                            */
/************************************************************************************************/
开发者ID:,项目名称:,代码行数:66,代码来源:


注:本文中的CvString::erase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。