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


C++ CDataReader::getActiveLine方法代码示例

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


在下文中一共展示了CDataReader::getActiveLine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void			CLocalizationFormat::unserializeLine(void)
{
	CDataReader *pDataReader = CDataReader::getInstance();

	string strLine = *pDataReader->getActiveLine();
	strLine = CStringUtility::trim(strLine, " ");
	strLine = CStringUtility::trim(strLine, "\t");

	if (strLine == "")
	{
		// blank line
		return;
	}

	else if (strLine.c_str()[0] == '#')
	{
		// comment line
		return;
	}

	else
	{
		// remove comment from end of line
		string strComment = "";
		size_t uiCommentPosition = strLine.find('#');
		if (uiCommentPosition != string::npos)
		{
			strComment = strLine.substr(uiCommentPosition + 1);
			strLine = strLine.substr(0, uiCommentPosition);
		}

		uint32 uiFirstCommaPosition = strLine.find(',');
		if (uiFirstCommaPosition == string::npos)
		{
			// line does not have comma
			return;
		}

		string strInternalName = strLine.substr(0, uiFirstCommaPosition);
		string strLanguageText = strLine.substr(uiFirstCommaPosition + 1);

		strInternalName = CStringUtility::trim(strInternalName, " ");
		strInternalName = CStringUtility::trim(strInternalName, "\t");

		strLanguageText = CStringUtility::trim(strLanguageText, " ");
		strLanguageText = CStringUtility::trim(strLanguageText, "\t");

		if (strLanguageText == "")
		{
			// line does not have language text set
			return;
		}
		
		m_umapTranslatedText[strInternalName] = strLanguageText;
	}
}
开发者ID:X-Seti,项目名称:KGM,代码行数:56,代码来源:CLocalizationFormat.cpp

示例2: if

void					CDATLoaderFormat::unserializeLine(void)
{
	CDataReader *pDataReader = CDataReader::getInstance();
	string strLine = *pDataReader->getActiveLine();

	// remove comment from end of line
	string strComment = "";
	size_t uiCommentPosition = strLine.find('#');
	if (uiCommentPosition != string::npos)
	{
		strComment = strLine.substr(uiCommentPosition);
		strLine = strLine.substr(0, uiCommentPosition);
	}

	if (strLine == "")
	{
		// blank line
	}

	else if (CStringUtility::ltrim(strLine).c_str()[0] == '#')
	{
		// line is a comment
	}

	else
	{
		// parse line
		deque<string> deqTokens = CVectorUtility::convertVectorToDeque(CStringUtility::split(strLine, " "));

		CDATLoaderEntry *pDATLoaderEntry = new CDATLoaderEntry;
		pDATLoaderEntry->setEntryType(CDATLoaderManager::getDATEntryTypeFromString(deqTokens[0]));
		deqTokens.pop_front();
		pDATLoaderEntry->setEntryValues(deqTokens);
		addEntry(pDATLoaderEntry);
	}
}
开发者ID:X-Seti,项目名称:KGM,代码行数:36,代码来源:CDATLoaderFormat.cpp


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