本文整理汇总了C++中TBuf8::FormatList方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8::FormatList方法的具体用法?C++ TBuf8::FormatList怎么用?C++ TBuf8::FormatList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf8
的用法示例。
在下文中一共展示了TBuf8::FormatList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteFormat
void CDTSYLogger::WriteFormat(TRefByValue<const TDesC8> aFmt,...)
{
TBuf8<KGenericBufferSize> buf;
VA_LIST list;
VA_START(list,aFmt);
buf.FormatList(aFmt,list);
TChar tmpchar;
for(TInt i=0;i<buf.Length();i++)
{
tmpchar=buf[i];
if(!((tmpchar.IsPrint()) || (tmpchar=='\n') || (tmpchar=='\r') || (tmpchar=='\t')))
buf[i]='.';
}
#ifdef __EXE__
CDTSYLogger* context=aScriptLoggerContext;
#else
CDTSYLogger* context=(CDTSYLogger*) Dll::Tls();
#endif
if(context==NULL)
{
TRAPD(ret,context=CDTSYLogger::NewL());
if (ret==KErrNone)
{
#ifdef __EXE__
aScriptLoggerContext=context;
#else
Dll::SetTls(context);
#endif
}
else return;
}
if(context->iValid)
context->WriteRecord(buf);
}
示例2: fmt
// This is only an approximation. The semantics are not exactly the
// same, and hence we are using a different name.
//
// Note that this implementation is not general purpose, since the
// size of the internal buffer is limited.
extern "C" void g_string_append_printf_fix(GString *gs,
const gchar *format,
...)
{
static const int bufSize = 100;
TBuf8<bufSize> buf;
VA_LIST argp;
VA_START(argp, format);
TPtrC8 fmt((TUint8*)format); // like strlen for length
buf.FormatList(fmt, argp);
// may throw a GLib OOM error on Symbian
g_string_append(gs, (gchar*)buf.PtrZ());
#if 0
char buf[bufSize];
va_list argp;
va_start(argp, fmt);
// vsnprintf would be safer but itself buggy.
int ret = vsprintf(buf, fmt, argp);
va_end(argp); // any cleanup
if (ret >= 0 && ret < bufSize) {
// No error, and everything did fit.
g_string_append(gs, buf);
} else {
assert(ret < bufSize && "likely memory corruption");
}
#endif
}
示例3: WriteToLog
// ----------------------------------------------------------
// TXdmSettingsApi::WriteToLog
//
// ----------------------------------------------------------
//
void TXdmSettingsApi::WriteToLog( TRefByValue<const TDesC8> aFmt,... )
{
VA_LIST list;
VA_START( list, aFmt );
TBuf8<KXdmSettingsLogBufferMaxSize> buf;
buf.FormatList( aFmt, list );
RFileLogger::Write( KXdmSettingsLogDir, KXdmSettingsLogFile,
EFileLoggingModeAppend, buf );
}