本文整理汇总了C++中stlw::string::end方法的典型用法代码示例。如果您正苦于以下问题:C++ string::end方法的具体用法?C++ string::end怎么用?C++ string::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stlw::string
的用法示例。
在下文中一共展示了string::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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");
//.........这里部分代码省略.........