diff --git a/CHANGES b/CHANGES index 5d563ba5d9..6746b0e86a 100644 --- a/CHANGES +++ b/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 diff --git a/VERSION b/VERSION index 74aab76c2d..e6cb320816 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3-11 +2.3-12 diff --git a/src/Type.cc b/src/Type.cc index 00b3a5fd7b..cc8ed3cd73 100644 --- a/src/Type.cc +++ b/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]; diff --git a/src/Type.h b/src/Type.h index 8c168bd268..6e2465ef19 100644 --- a/src/Type.h +++ b/src/Type.h @@ -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; } diff --git a/testing/btest/Baseline/doc.broxygen.vectors/autogen-reST-vectors.rst b/testing/btest/Baseline/doc.broxygen.vectors/autogen-reST-vectors.rst new file mode 100644 index 0000000000..37eabb9419 --- /dev/null +++ b/testing/btest/Baseline/doc.broxygen.vectors/autogen-reST-vectors.rst @@ -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. + diff --git a/testing/btest/doc/broxygen/vectors.bro b/testing/btest/doc/broxygen/vectors.bro new file mode 100644 index 0000000000..62fb31d436 --- /dev/null +++ b/testing/btest/doc/broxygen/vectors.bro @@ -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;