Revise enum documentation autogeneration.

This adds a new subclass of EnumType, CommentedEnumType, and removes
any previous changes to EnumType that were done to support the
autodoc framework.

Dummy CommentedEnumType and ID's are constructed in parallel with the
real EnumType ID's during parsing and passed on to the autodoc framework.

This allows the generated documentation to track enum redefs, with
a special case being the "Notice" enum type.
This commit is contained in:
Jon Siwek 2011-03-15 14:51:50 -05:00
parent b1dc5d3a1c
commit f67c0892e5
7 changed files with 107 additions and 56 deletions

View file

@ -40,6 +40,7 @@ BroDoc::BroDoc(const std::string& sourcename)
else
fprintf(stdout, "Created reST document: %s\n", reST_filename.c_str());
#endif
notices = 0;
}
BroDoc::~BroDoc()
@ -50,9 +51,10 @@ BroDoc::~BroDoc()
FreeBroDocObjPtrList(options);
FreeBroDocObjPtrList(state_vars);
FreeBroDocObjPtrList(types);
FreeBroDocObjPtrList(notices);
FreeBroDocObjPtrList(events);
FreeBroDocObjPtrList(functions);
FreeBroDocObjPtrList(redefs);
if ( notices ) delete notices;
}
void BroDoc::SetPacketFilter(const std::string& s)
@ -90,6 +92,10 @@ void BroDoc::WriteDocFile() const
WriteStringList(" :bro:script: `%s`\n",
" :bro:script: `%s`\n\n", imports);
WriteSectionHeading("Notices", '-');
if ( notices )
notices->WriteReST(reST_file);
WriteSectionHeading("Port Analysis", '-');
WriteStringList("%s", port_analysis);
@ -100,15 +106,16 @@ void BroDoc::WriteDocFile() const
WriteBroDocObjList(options, true, "Options", '~');
WriteBroDocObjList(state_vars, true, "State Variables", '~');
WriteBroDocObjList(types, true, "Types", '~');
WriteBroDocObjList(notices, true, "Notices", '~');
WriteBroDocObjList(events, true, "Events", '~');
WriteBroDocObjList(functions, true, "Functions", '~');
WriteBroDocObjList(redefs, true, "Redefinitions", '~');
WriteSectionHeading("Private Interface", '-');
WriteBroDocObjList(state_vars, false, "State Variables", '~');
WriteBroDocObjList(types, false, "Types", '~');
WriteBroDocObjList(events, false, "Events", '~');
WriteBroDocObjList(functions, false, "Functions", '~');
WriteBroDocObjList(redefs, false, "Redefinitions", '~');
}
void BroDoc::WriteStringList(const char* format,