mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Include yield of vectors in Broxygen's type descriptions.
BIT-1217 #close
This commit is contained in:
parent
a7746afa0a
commit
3cea6ab1eb
6 changed files with 70 additions and 1 deletions
5
CHANGES
5
CHANGES
|
@ -1,4 +1,9 @@
|
|||
|
||||
2.3-12 | 2014-07-10 19:17:37 -0500
|
||||
|
||||
* Include yield of vectors in Broxygen's type descriptions.
|
||||
Addresses BIT-1217. (Jon Siwek)
|
||||
|
||||
2.3-11 | 2014-07-10 14:49:27 -0700
|
||||
|
||||
* Fixing DataSeries output. It was using a now illegal value as its
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
2.3-11
|
||||
2.3-12
|
||||
|
|
10
src/Type.cc
10
src/Type.cc
|
@ -1691,6 +1691,16 @@ void VectorType::Describe(ODesc* d) const
|
|||
yield_type->Describe(d);
|
||||
}
|
||||
|
||||
void VectorType::DescribeReST(ODesc* d, bool roles_only) const
|
||||
{
|
||||
d->Add(fmt(":bro:type:`%s` of ", type_name(Tag())));
|
||||
|
||||
if ( yield_type->GetName().empty() )
|
||||
yield_type->DescribeReST(d, roles_only);
|
||||
else
|
||||
d->Add(fmt(":bro:type:`%s`", yield_type->GetName().c_str()));
|
||||
}
|
||||
|
||||
BroType* base_type_no_ref(TypeTag tag)
|
||||
{
|
||||
static BroType* base_types[NUM_TYPES];
|
||||
|
|
|
@ -594,6 +594,7 @@ public:
|
|||
bool IsUnspecifiedVector() const;
|
||||
|
||||
void Describe(ODesc* d) const;
|
||||
void DescribeReST(ODesc* d, bool roles_only = false) const;
|
||||
|
||||
protected:
|
||||
VectorType() { yield_type = 0; }
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
.. bro:id:: test_vector0
|
||||
|
||||
:Type: :bro:type:`vector` of :bro:type:`string`
|
||||
:Default:
|
||||
|
||||
::
|
||||
|
||||
[]
|
||||
|
||||
Yield type is documented/cross-referenced for primitize types.
|
||||
|
||||
.. bro:id:: test_vector1
|
||||
|
||||
:Type: :bro:type:`vector` of :bro:type:`TestRecord`
|
||||
:Default:
|
||||
|
||||
::
|
||||
|
||||
[]
|
||||
|
||||
Yield type is documented/cross-referenced for composite types.
|
||||
|
||||
.. bro:id:: test_vector2
|
||||
|
||||
:Type: :bro:type:`vector` of :bro:type:`vector` of :bro:type:`TestRecord`
|
||||
:Default:
|
||||
|
||||
::
|
||||
|
||||
[]
|
||||
|
||||
Just showing an even fancier yield type.
|
||||
|
20
testing/btest/doc/broxygen/vectors.bro
Normal file
20
testing/btest/doc/broxygen/vectors.bro
Normal file
|
@ -0,0 +1,20 @@
|
|||
# @TEST-EXEC: bro -b -X broxygen.config %INPUT
|
||||
# @TEST-EXEC: btest-diff autogen-reST-vectors.rst
|
||||
|
||||
@TEST-START-FILE broxygen.config
|
||||
identifier test_vector* autogen-reST-vectors.rst
|
||||
@TEST-END-FILE
|
||||
|
||||
type TestRecord: record {
|
||||
field1: bool;
|
||||
field2: count;
|
||||
};
|
||||
|
||||
## Yield type is documented/cross-referenced for primitize types.
|
||||
global test_vector0: vector of string;
|
||||
|
||||
## Yield type is documented/cross-referenced for composite types.
|
||||
global test_vector1: vector of TestRecord;
|
||||
|
||||
## Just showing an even fancier yield type.
|
||||
global test_vector2: vector of vector of TestRecord;
|
Loading…
Add table
Add a link
Reference in a new issue