本文整理汇总了C++中Statement::ApplyIndent方法的典型用法代码示例。如果您正苦于以下问题:C++ Statement::ApplyIndent方法的具体用法?C++ Statement::ApplyIndent怎么用?C++ Statement::ApplyIndent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::ApplyIndent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintString
void Log::PrintString(const tchar_t* string, Stream stream, Level level, Color color, int indent, tchar_t* output, uint32_t outputSize)
{
Helium::MutexScopeLock mutex (g_Mutex);
// check trace files
bool trace = false;
M_OutputFile::iterator itr = g_TraceFiles.begin();
M_OutputFile::iterator end = g_TraceFiles.end();
for( ; itr != end; ++itr )
{
if ( ( (*itr).second.m_StreamType & stream ) == stream
&& ( (*itr).second.m_ThreadId == -1 || (*itr).second.m_ThreadId == GetCurrentThreadID() ) )
{
trace = true;
}
}
// determine if we should be displayed
bool display = ( g_Streams & stream ) == stream && level <= g_Level;
// check for nothing to do
if ( trace || display || output )
{
if ( indent < 0 )
{
indent = g_Indent;
}
// the statement
Statement statement ( string, stream, level, indent );
// construct the print statement
PrintingArgs args ( statement );
// is this statement to be output via normal channels
if ( display )
{
// raise the printing event
g_PrintingEvent.Raise( args );
}
// only process this string if it was not handled by a handler
if ( !args.m_Skip )
{
// apply indentation
statement.m_String.clear();
statement.ApplyIndent( string, statement.m_String );
// output to screen window
if ( display )
{
// deduce the color if we were told to do so
if ( color == Colors::Auto )
{
color = GetStreamColor( stream );
}
// print the statement to the window
Helium::PrintString((Helium::ConsoleColor)color, stream == Streams::Error ? stderr : stdout, statement.m_String);
// raise the printed event
g_PrintedEvent.Raise( PrintedArgs (statement) );
}
// send the text to the debugger, if no debugger nothing happens
OutputDebugString(statement.m_String.c_str());
// output to trace file(s)
static bool stampNewLine = true;
itr = g_TraceFiles.begin();
end = g_TraceFiles.end();
for( ; itr != end; ++itr )
{
if ( ( (*itr).second.m_StreamType & stream ) == stream
&& ( (*itr).second.m_ThreadId == -1 || (*itr).second.m_ThreadId == GetCurrentThreadID() ) )
{
Redirect( (*itr).first, statement.m_String.c_str(), stampNewLine );
}
}
// update stampNewLine
if ( !statement.m_String.empty() )
{
stampNewLine = ( *statement.m_String.rbegin() == '\n' ) ? true : false ;
}
// output to buffer
if (output && outputSize > 0)
{
_tcsncpy( output, statement.m_String.c_str(), outputSize - 1 );
}
}
}
}