Merge remote branch 'origin/topic/jsiwek/doc-framework'

This commit is contained in:
Robin Sommer 2011-04-18 14:50:35 -07:00
commit e7bde27f2d
54 changed files with 4006 additions and 62 deletions

View file

@ -41,6 +41,7 @@ ODesc::ODesc(desc_type t, BroFile* arg_f)
want_quotes = 0;
do_flush = 1;
include_stats = 0;
indent_with_spaces = 0;
}
ODesc::~ODesc()
@ -67,6 +68,12 @@ void ODesc::PopIndent()
NL();
}
void ODesc::PopIndentNoNL()
{
if ( --indent_level < 0 )
internal_error("ODesc::PopIndent underflow");
}
void ODesc::Add(const char* s, int do_indent)
{
unsigned int n = strlen(s);
@ -179,8 +186,17 @@ void ODesc::AddBytes(const BroString* s)
void ODesc::Indent()
{
for ( int i = 0; i < indent_level; ++i )
Add("\t", 0);
if ( indent_with_spaces > 0 )
{
for ( int i = 0; i < indent_level; ++i )
for ( int j = 0; j < indent_with_spaces; ++j )
Add(" ", 0);
}
else
{
for ( int i = 0; i < indent_level; ++i )
Add("\t", 0);
}
}