本文整理汇总了C++中IsoString::AppendFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ IsoString::AppendFormat方法的具体用法?C++ IsoString::AppendFormat怎么用?C++ IsoString::AppendFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IsoString
的用法示例。
在下文中一共展示了IsoString::AppendFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToSource
IsoString Filter::ToSource() const
{
IsoString s;
if ( IsValid() )
{
if ( IsSeparable() )
{
s += "SeparableFilter {\n";
s += " name { " + Separable().Name().ToUTF8() + " }\n";
s += " row-vector { ";
SeparableFilter::coefficient_vector H = Separable().RowFilter();
for ( int i = 0; i < H.Length(); ++i )
s.AppendFormat( ( H[i] < 0 ) ? "%.6f " : " %.6f ", H[i] );
s += "}\n";
s += " col-vector { ";
SeparableFilter::coefficient_vector V = Separable().ColFilter();
for ( int i = 0; i < V.Length(); ++i )
s.AppendFormat( ( V[i] < 0 ) ? "%.6f " : " %.6f ", V[i] );
s += "}\n";
}
else
{
s += "KernelFilter {\n";
s += " name { " + Kernel().Name().ToUTF8() + " }\n";
s += " coefficients {\n";
KernelFilter::coefficient_matrix M = Kernel().Coefficients();
for ( int i = 0; i < M.Rows(); ++i )
{
s += " ";
for ( int j = 0; ; )
{
s.AppendFormat( ( M[i][j] < 0 ) ? "%.6f " : " %.6f ", M[i][j] );
if ( ++j == M.Cols() )
break;
s += ' ';
}
s += '\n';
}
s += " }\n";
}
s += "}\n";
}
return s;
}
示例2: CriticalSignalHandler
static void CriticalSignalHandler( int sig_num )
{
sigset_t x;
sigemptyset( &x );
sigaddset( &x, SIGSEGV );
sigaddset( &x, SIGBUS );
sigaddset( &x, SIGFPE );
sigaddset( &x, SIGILL );
sigaddset( &x, SIGPIPE );
//sigprocmask( SIG_UNBLOCK, &x, NULL );
pthread_sigmask( SIG_UNBLOCK, &x, NULL );
void* addrList[ STACK_DEPTH ];
size_t addrLen = backtrace( addrList, sizeof( addrList )/sizeof( void* ) );
char** symbolList = backtrace_symbols( addrList, addrLen );
IsoString details;
if ( symbolList != NULL )
{
if ( symbolList[0] != NULL )
{
details = STACK_TRACE_TITLE + IsoString().Format( STACK_TRACE_HEADER, sig_num, symbolList[0] );
for ( size_t i = 1; i < addrLen; ++i )
{
if ( symbolList[i] != NULL )
{
IsoString addrOffsetStr;
IsoString demangledFuncname = GetDemangledFunctionName( symbolList[i], addrOffsetStr );
details.AppendFormat( "%d: ", addrLen-i );
details += demangledFuncname;
if ( !addrOffsetStr.IsEmpty() )
{
details += "(+";
details += addrOffsetStr;
details += ')';
}
details += '\n';
}
}
details += STACK_TRACE_BOTTOM;
fprintf( stderr, "%s", details.c_str() );
}
// symbolList must be freed
free( symbolList );
}
switch ( sig_num )
{
case SIGSEGV:
throw EUnixSegmentationViolation( details );
case SIGBUS:
throw EUnixBusError( details );
case SIGFPE:
throw EUnixFloatingPointException( details );
case SIGILL:
throw EUnixIllegalInstructionException( details );
case SIGPIPE:
throw EUnixIBrokenPipeException( details );
default:
throw UnixSignalException( sig_num, details );
}
}