mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Changing BroDocObj wrapper class to wrap ID instead of BroObj.
This commit is contained in:
parent
1c962cbb89
commit
1310f2387c
2 changed files with 17 additions and 25 deletions
|
@ -1,15 +1,12 @@
|
|||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "Obj.h"
|
||||
#include "ID.h"
|
||||
#include "BroDocObj.h"
|
||||
|
||||
BroDocObj::BroDocObj(const BroObj* obj,
|
||||
std::list<std::string>*& reST,
|
||||
bool exported)
|
||||
BroDocObj::BroDocObj(const ID* id, std::list<std::string>*& reST)
|
||||
{
|
||||
broObj = obj;
|
||||
isExported = exported;
|
||||
broID = id;
|
||||
reST_doc_strings = reST;
|
||||
reST = 0;
|
||||
}
|
||||
|
@ -30,6 +27,6 @@ void BroDocObj::WriteReST(FILE* file) const
|
|||
}
|
||||
|
||||
ODesc desc;
|
||||
broObj->Describe(&desc);
|
||||
broID->DescribeExtended(&desc);
|
||||
fprintf(file, "%s\n", desc.Description());
|
||||
}
|
||||
|
|
|
@ -5,19 +5,18 @@
|
|||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "Obj.h"
|
||||
#include "ID.h"
|
||||
|
||||
class BroDocObj {
|
||||
public:
|
||||
/**
|
||||
* BroDocObj constructor
|
||||
* @param obj a pointer to a BroObj that is to be documented
|
||||
* @param id a pointer to an identifier that is to be documented
|
||||
* @param reST a reference to a pointer of a list of strings that
|
||||
represent the reST documentation for the BroObj. The pointer
|
||||
represent the reST documentation for the ID. The pointer
|
||||
will be set to 0 after this constructor finishes.
|
||||
* @param exported whether the BroObj is declared in an export section
|
||||
*/
|
||||
BroDocObj(const BroObj* obj, std::list<std::string>*& reST, bool exported);
|
||||
BroDocObj(const ID* id, std::list<std::string>*& reST);
|
||||
|
||||
/**
|
||||
* BroDocObj destructor
|
||||
|
@ -36,35 +35,31 @@ public:
|
|||
* the reST as written into new reST before being written out.
|
||||
* This allows for additional custom markup or macros when writing
|
||||
* pure reST might be inconvenient.
|
||||
* 2) a reST friendly description of the BroObj
|
||||
* Could be implemented similar to the virtual BroObj::Describe(ODesc)
|
||||
* E.g. all subclasses will now need to implement a reSTDescribe(ODesc)
|
||||
* so that they can describe themselves in terms of the custom reST
|
||||
* directives/roles that we'll later teach to Sphinx via a "bro domain".
|
||||
* ID's should be able to implement the reSTDescribe(ODesc) function
|
||||
* such that their namespace and attributes are output as well.
|
||||
* 2) a reST friendly description of the ID
|
||||
* Could be implemented similar to the ID::DescribeExtended(ODesc)
|
||||
* expect with new directives/roles that we'll later teach to Sphinx
|
||||
* via a "bro domain".
|
||||
* @param The (already opened) file to write the reST to.
|
||||
*/
|
||||
void WriteReST(FILE* file) const;
|
||||
|
||||
/**
|
||||
* Check whether this documentation is part of the public API
|
||||
* (The BroObj declaration was while in an export section).
|
||||
* @return true if the BroObj was declared in an export section, else false
|
||||
* (The declaration was while in an export section).
|
||||
* @return true if the ID was declared in an export section, else false
|
||||
*/
|
||||
bool IsPublicAPI() const { return isExported; }
|
||||
bool IsPublicAPI() const { return broID->IsExport(); }
|
||||
|
||||
/**
|
||||
* Return whether this object has documentation (## comments)
|
||||
* @return true if the BroObj has comments associated with it
|
||||
* @return true if the ID has comments associated with it
|
||||
*/
|
||||
bool HasDocumentation() const { return reST_doc_strings &&
|
||||
reST_doc_strings->size() > 0; }
|
||||
|
||||
protected:
|
||||
std::list<std::string>* reST_doc_strings;
|
||||
const BroObj* broObj;
|
||||
bool isExported;
|
||||
const ID* broID;
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue