Debugging output from doc-framework now only in debug mode.

Also a minor format fix for documenting empty string lists.
This commit is contained in:
Jon Siwek 2011-03-05 14:22:06 -06:00
parent 27996cf9e0
commit 0d7ffe998f
2 changed files with 10 additions and 2 deletions

View file

@ -8,8 +8,9 @@
BroDoc::BroDoc(const std::string& sourcename) BroDoc::BroDoc(const std::string& sourcename)
{ {
#ifdef DEBUG
fprintf(stdout, "Documenting source: %s\n", sourcename.c_str()); fprintf(stdout, "Documenting source: %s\n", sourcename.c_str());
#endif
source_filename = sourcename.substr(sourcename.find_last_of('/') + 1); source_filename = sourcename.substr(sourcename.find_last_of('/') + 1);
size_t ext_pos = source_filename.find_last_of('.'); size_t ext_pos = source_filename.find_last_of('.');
@ -35,8 +36,10 @@ BroDoc::BroDoc(const std::string& sourcename)
if ( ! reST_file ) if ( ! reST_file )
fprintf(stderr, "Failed to open %s", reST_filename.c_str()); fprintf(stderr, "Failed to open %s", reST_filename.c_str());
#ifdef DEBUG
else else
fprintf(stdout, "Created reST document: %s\n", reST_filename.c_str()); fprintf(stdout, "Created reST document: %s\n", reST_filename.c_str());
#endif
} }
BroDoc::~BroDoc() BroDoc::~BroDoc()
@ -104,7 +107,11 @@ void BroDoc::WriteStringList(const char* format,
const char* last_format, const char* last_format,
const std::list<std::string>& l) const const std::list<std::string>& l) const
{ {
if ( l.empty() ) return; if ( l.empty() )
{
WriteToDoc("\n");
return;
}
std::list<std::string>::const_iterator it; std::list<std::string>::const_iterator it;
std::list<std::string>::const_iterator last = l.end(); std::list<std::string>::const_iterator last = l.end();
last--; last--;

View file

@ -124,6 +124,7 @@ protected:
/** /**
* Writes out a list of strings to the reST document. * Writes out a list of strings to the reST document.
* If the list is empty, prints a newline character.
* @param format A printf style format string for elements of the list * @param format A printf style format string for elements of the list
* except for the last one in the list * except for the last one in the list
* @param last_format A printf style format string to use for the last * @param last_format A printf style format string to use for the last