mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Merge remote branch 'origin/topic/jsiwek/doc-framework'
This commit is contained in:
commit
e7bde27f2d
54 changed files with 4006 additions and 62 deletions
129
src/ID.cc
129
src/ID.cc
|
@ -607,6 +607,135 @@ void ID::DescribeExtended(ODesc* d) const
|
|||
}
|
||||
}
|
||||
|
||||
void ID::DescribeReSTShort(ODesc* d) const
|
||||
{
|
||||
if ( is_type )
|
||||
d->Add(":bro:type:`");
|
||||
else
|
||||
d->Add(":bro:id:`");
|
||||
|
||||
d->Add(name);
|
||||
d->Add("`");
|
||||
|
||||
if ( type )
|
||||
{
|
||||
d->Add(": ");
|
||||
d->Add(":bro:type:`");
|
||||
|
||||
if ( ! is_type && type->GetTypeID() )
|
||||
d->Add(type->GetTypeID());
|
||||
else
|
||||
{
|
||||
TypeTag t = type->Tag();
|
||||
|
||||
switch ( t ) {
|
||||
case TYPE_TABLE:
|
||||
d->Add(type->IsSet() ? "set" : type_name(t));
|
||||
break;
|
||||
|
||||
case TYPE_FUNC:
|
||||
d->Add(type->AsFuncType()->IsEvent() ? "event" : type_name(t));
|
||||
break;
|
||||
|
||||
default:
|
||||
d->Add(type_name(t));
|
||||
}
|
||||
}
|
||||
|
||||
d->Add("`");
|
||||
}
|
||||
|
||||
if ( attrs )
|
||||
{
|
||||
d->SP();
|
||||
attrs->DescribeReST(d);
|
||||
}
|
||||
}
|
||||
|
||||
void ID::DescribeReST(ODesc* d, bool is_role) const
|
||||
{
|
||||
if ( is_role )
|
||||
{
|
||||
if ( is_type )
|
||||
d->Add(":bro:type:`");
|
||||
else
|
||||
d->Add(":bro:id:`");
|
||||
d->Add(name);
|
||||
d->Add("`");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( is_type )
|
||||
d->Add(".. bro:type:: ");
|
||||
else
|
||||
d->Add(".. bro:id:: ");
|
||||
d->Add(name);
|
||||
}
|
||||
|
||||
d->PushIndent();
|
||||
d->NL();
|
||||
|
||||
if ( type )
|
||||
{
|
||||
d->Add(":Type: ");
|
||||
|
||||
if ( ! is_type && type->GetTypeID() )
|
||||
{
|
||||
d->Add(":bro:type:`");
|
||||
d->Add(type->GetTypeID());
|
||||
d->Add("`");
|
||||
}
|
||||
else
|
||||
type->DescribeReST(d);
|
||||
|
||||
d->NL();
|
||||
}
|
||||
|
||||
if ( attrs )
|
||||
{
|
||||
d->Add(":Attributes: ");
|
||||
attrs->DescribeReST(d);
|
||||
d->NL();
|
||||
}
|
||||
|
||||
if ( val && type &&
|
||||
type->Tag() != TYPE_FUNC &&
|
||||
type->InternalType() != TYPE_INTERNAL_VOID )
|
||||
{
|
||||
d->Add(":Default:");
|
||||
|
||||
if ( type->InternalType() == TYPE_INTERNAL_OTHER )
|
||||
{
|
||||
switch ( type->Tag() ) {
|
||||
case TYPE_TABLE:
|
||||
if ( val->AsTable()->Length() == 0 )
|
||||
{
|
||||
d->Add(" ``{}``");
|
||||
d->NL();
|
||||
break;
|
||||
}
|
||||
// Fall-through.
|
||||
|
||||
default:
|
||||
d->NL();
|
||||
d->NL();
|
||||
d->Add("::");
|
||||
d->NL();
|
||||
d->PushIndent();
|
||||
val->DescribeReST(d);
|
||||
d->PopIndent();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
d->SP();
|
||||
val->DescribeReST(d);
|
||||
d->NL();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void ID::UpdateValID()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue