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


C++ string::begin方法代码示例

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


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

示例1: IterateString

static void IterateString(FILE * F, CCHAR_P szData, UINT_64 iDataLen, STLW::string & sResultString)
{
	STLW::string::iterator itsResultString = sResultString.begin();
	for(;;)
	{
		UINT_32 iUCS = 0;
		const INT_64 iCharLen = Unicode::UTF8ToWide(szData, iDataLen, iUCS);
		if (iCharLen <= 0) { break; }

		Unicode::WideToUTF8(iUCS, itsResultString);

		iDataLen -= iCharLen;
		fprintf(F, "0x%X ", iUCS);
	}
	fprintf(F, "\n");
}
开发者ID:CommunicoPublic,项目名称:iris,代码行数:16,代码来源:UnicodeTest.cpp

示例2: EscapeString

static STLW::string EscapeString(const STLW::string  & sSource)
{
	if (sSource.empty()) { return "\"\""; }
	STLW::string::const_iterator itsSource = sSource.begin();
	while (itsSource != sSource.end())
	{
		const UCHAR_8 ucTMP = *itsSource;
		if (!((ucTMP >= 'a' && ucTMP <= 'z') ||
		      (ucTMP >= 'A' && ucTMP <= 'Z') ||
		      (ucTMP >= '0' && ucTMP <= '9') ||
		       ucTMP == '.' || ucTMP == '_' || ucTMP == ':' || ucTMP == '*' ||
		       ucTMP == '[' || ucTMP == ']' || ucTMP == '\\' || ucTMP == '/' || ucTMP == '-'))
		{
			return '"' + sSource + '"';
		}
		++itsSource;
	}
return sSource;
}
开发者ID:CommunicoPublic,项目名称:iris,代码行数:19,代码来源:ConfigFileParserTest.cpp

示例3: oMutexLocker

//
// Write message to log file
//
IRIS::Logger::State ParametrizedLogger::ParametrizedLogger::WriteLog(const IRIS::LogPriority::LogPriorities  ePriority,
                                                                     CCHAR_P                                 szString,
                                                                     const UINT_32                           iStringLen)
{
	using namespace IRIS;
	MutexLocker oMutexLocker(oMutex);
/*
	# $timegm.unix      - current GMT unixtime, seconds
	# $timegm.ascii     - current GMT time, ascii representation [Wkd Mmm DD HH:MM:SS YYYY]
	# $time.unix        - current LOCAL unixtime, seconds
	# $time.ascii       - current LOCAL time, ascii representation
*/
	SystemVars::Time oTimeGM = SystemVars::GetTime();

	IRIS::DataBuffer & oDataBuffer = oLogWriter;

	struct tm oLocalTime;
	time_t iTime = oTimeGM.sec;
	localtime_r(&iTime, &oLocalTime);

	STLW::string::const_iterator itsLogFormat = sLogFormat.begin();
	STLW::stringstream sStream;
	for (;;)
	{
		STLW::string::const_iterator itsTMP = itsLogFormat;
		while(itsLogFormat != sLogFormat.end() && *itsLogFormat != '$') { ++itsLogFormat; }
		sStream << STLW::string(itsTMP, itsLogFormat);

		if (itsLogFormat == sLogFormat.end()) { break; }

		itsTMP = itsLogFormat++;
		while(itsLogFormat != sLogFormat.end())
		{
			const CHAR_8 chTMP = *itsLogFormat;
			if (!((chTMP >= 'a' && chTMP <= 'z') ||
			      (chTMP >= 'A' && chTMP <= 'Z') ||
			      (chTMP >= '0' && chTMP <= '9') ||
			       chTMP == '.' || chTMP == '_')) { break; }
			++itsLogFormat;
		}

		const STLW::string sParam(++itsTMP, itsLogFormat);
		if      (sParam == "message.str")  { sStream << STLW::string(szString, iStringLen); }
		else if (sParam == "timegm.unix")  { sStream << oTimeGM.sec << '.' << oTimeGM.nsec; }
		else if (sParam == "time.unix")
		{
#if defined(sun) || defined(_AIX)
			sStream << oTimeGM.sec + GetGMTOff(iTime, oLocalTime) << '.' << oTimeGM.nsec;
#else
			sStream << oTimeGM.sec + oLocalTime.tm_gmtoff << '.' << oTimeGM.nsec;
#endif
		}
		else if (sParam == "timegm.ascii") { sStream << FormatDate(oTimeGM.sec); }
		else if (sParam == "time.ascii")
		{
#if defined(sun) || defined(_AIX)
			sStream << FormatDate(oTimeGM.sec + GetGMTOff(iTime, oLocalTime));
#else
			sStream << FormatDate(oTimeGM.sec + oLocalTime.tm_gmtoff);
#endif
		}
		else if (sParam == "priority")     { sStream << LogPriority::GetPrintableState(ePriority); }
		else
		{
			if (pLoggerContext == NULL)
			{
				sStream << "-";
			}
			else
			{
				STLW::string sValue;
				pLoggerContext -> GetParam(sParam, sValue);
				sStream << sValue;
			}
		}
	}

	const STLW::string sResult = sStream.str();
	STLW::string::const_iterator itsResult = sResult.begin();
	for (;;)
	{
		STLW::string::const_iterator itsStart = itsResult;
		while (itsResult != sResult.end() && *itsResult >= ' ') { ++itsResult; }
		oDataBuffer.Append(itsStart, itsResult);
		if (itsResult == sResult.end()) { break; }

		const UCHAR_8 ucTMP = *itsResult;
		switch (ucTMP)
		{
			case '\n':
				oDataBuffer.Append("\\n");
				break;
			case '\r':
				oDataBuffer.Append("\\r");
				break;
			case '\t':
				oDataBuffer.Append("\\t");
//.........这里部分代码省略.........
开发者ID:CommunicoPublic,项目名称:iris,代码行数:101,代码来源:IrisFileLogger.cpp


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