Prettyfing Describe() for record types.

If a record type has a name and ODesc is set to short, we now print
the name instead of the full field list.
This commit is contained in:
Robin Sommer 2013-09-28 16:06:40 -07:00
parent dc52846b6f
commit 08c7dd3d71
2 changed files with 11 additions and 5 deletions

View file

@ -1038,10 +1038,16 @@ void RecordType::Describe(ODesc* d) const
{ {
if ( d->IsReadable() ) if ( d->IsReadable() )
{ {
d->AddSP("record {"); if ( d->IsShort() && GetTypeID() )
DescribeFields(d); d->Add(GetTypeID());
d->SP();
d->Add("}"); else
{
d->AddSP("record {");
DescribeFields(d);
d->SP();
d->Add("}");
}
} }
else else

View file

@ -314,9 +314,9 @@ void add_type(ID* id, BroType* t, attr_list* attr, int /* is_event */)
delete [] data; delete [] data;
} }
tnew->SetTypeID(copy_string(id->Name()));
} }
tnew->SetTypeID(copy_string(id->Name()));
id->SetType(tnew); id->SetType(tnew);
id->MakeType(); id->MakeType();