Beautify doxygen source code

Just whitespace changes
This commit is contained in:
William S Fulton 2018-05-20 21:24:31 +01:00
commit 658eb26e19
11 changed files with 477 additions and 925 deletions

View file

@ -21,7 +21,9 @@ const char *sectionIndicators[] = {
"exception", "if", "ifnot", "invariant", "note", "par", "param", "exception", "if", "ifnot", "invariant", "note", "par", "param",
"tparam", "post", "pre", "remarks", "remark", "result", "return", "tparam", "post", "pre", "remarks", "remark", "result", "return",
"returns", "retval", "sa", "see", "since", "test", "throw", "throws", "returns", "retval", "sa", "see", "since", "test", "throw", "throws",
"todo", "version", "warning", "xrefitem"}; "todo", "version", "warning", "xrefitem"
};
const int sectionIndicatorsSize = sizeof(sectionIndicators) / sizeof(*sectionIndicators); const int sectionIndicatorsSize = sizeof(sectionIndicators) / sizeof(*sectionIndicators);
/* All of the doxygen commands divided up by how they are parsed */ /* All of the doxygen commands divided up by how they are parsed */
@ -31,7 +33,9 @@ const char *simpleCommands[] = {
"endcond", "endcond",
"callgraph", "callergraph", "showinitializer", "hideinitializer", "internal", "callgraph", "callergraph", "showinitializer", "hideinitializer", "internal",
"nosubgrouping", "public", "publicsection", "private", "privatesection", "nosubgrouping", "public", "publicsection", "private", "privatesection",
"protected", "protectedsection", "tableofcontents"}; "protected", "protectedsection", "tableofcontents"
};
const int simpleCommandsSize = sizeof(simpleCommands) / sizeof(*simpleCommands); const int simpleCommandsSize = sizeof(simpleCommands) / sizeof(*simpleCommands);
const char *commandWords[] = { const char *commandWords[] = {
@ -39,52 +43,72 @@ const char *commandWords[] = {
"namespace", "relatesalso", "anchor", "dontinclude", "include", "namespace", "relatesalso", "anchor", "dontinclude", "include",
"includelineno", "copydoc", "copybrief", "copydetails", "verbinclude", "includelineno", "copydoc", "copybrief", "copydetails", "verbinclude",
"htmlinclude", "extends", "implements", "memberof", "related", "relatedalso", "htmlinclude", "extends", "implements", "memberof", "related", "relatedalso",
"cite"}; "cite"
};
const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords); const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords);
const char *commandLines[] = { const char *commandLines[] = {
"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip",
"until", "property"}; "until", "property"
};
const int commandLinesSize = sizeof(commandLines) / sizeof(*commandLines); const int commandLinesSize = sizeof(commandLines) / sizeof(*commandLines);
const char *commandParagraph[] = { const char *commandParagraph[] = {
"partofdescription", "result", "return", "returns", "remarks", "remark", "partofdescription", "result", "return", "returns", "remarks", "remark",
"since", "test", "sa", "see", "pre", "post", "details", "invariant", "since", "test", "sa", "see", "pre", "post", "details", "invariant",
"deprecated", "date", "note", "warning", "version", "todo", "bug", "deprecated", "date", "note", "warning", "version", "todo", "bug",
"attention", "brief", "author", "authors", "copyright", "short"}; "attention", "brief", "author", "authors", "copyright", "short"
};
const int commandParagraphSize = sizeof(commandParagraph) / sizeof(*commandParagraph); const int commandParagraphSize = sizeof(commandParagraph) / sizeof(*commandParagraph);
const char *commandEndCommands[] = { const char *commandEndCommands[] = {
CMD_HTML_ONLY, "latexonly", "manonly", "xmlonly", "link", "rtfonly"}; CMD_HTML_ONLY, "latexonly", "manonly", "xmlonly", "link", "rtfonly"
};
const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands); const int commandEndCommandsSize = sizeof(commandEndCommands) / sizeof(*commandEndCommands);
const char *commandWordParagraphs[] = { const char *commandWordParagraphs[] = {
"param", "tparam", "throw", "throws", "retval", "exception", "example"}; "param", "tparam", "throw", "throws", "retval", "exception", "example"
};
const int commandWordParagraphsSize = sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); const int commandWordParagraphsSize = sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs);
const char *commandWordLines[] = { const char *commandWordLines[] = {
"page", "subsection", "subsubsection", "section", "paragraph", "defgroup", "page", "subsection", "subsubsection", "section", "paragraph", "defgroup",
"snippet", "mainpage"}; "snippet", "mainpage"
};
const int commandWordLinesSize = sizeof(commandWordLines) / sizeof(*commandWordLines); const int commandWordLinesSize = sizeof(commandWordLines) / sizeof(*commandWordLines);
const char *commandWordOWordOWords[] = { const char *commandWordOWordOWords[] = {
"category", "class", "protocol", "interface", "struct", "union"}; "category", "class", "protocol", "interface", "struct", "union"
};
const int commandWordOWordOWordsSize = sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords); const int commandWordOWordOWordsSize = sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords);
const char *commandOWords[] = { const char *commandOWords[] = {
"dir", "file", "cond"}; "dir", "file", "cond"
};
const int commandOWordsSize = sizeof(commandOWords) / sizeof(*commandOWords); const int commandOWordsSize = sizeof(commandOWords) / sizeof(*commandOWords);
const char *commandErrorThrowings[] = { const char *commandErrorThrowings[] = {
"annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header",
"headerfilestd::list", "inherit", "l", "postheader", "endcode", "enddot", "endmsc", "endhtmlonly", "headerfilestd::list", "inherit", "l", "postheader", "endcode", "enddot", "endmsc", "endhtmlonly",
"endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif", "else", "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif", "else",
"endrtfonly"}; "endrtfonly"
};
const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings);
const char *commandUniques[] = { const char *commandUniques[] = {
"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li", "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li",
"if", "ifnot", "elseif", "else", "mscfile", "code", CMD_VERBATIM, "f{", "f[", "f$", "dot", "msc"}; "if", "ifnot", "elseif", "else", "mscfile", "code", CMD_VERBATIM, "f{", "f[", "f$", "dot", "msc"
};
const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques); const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques);
// These HTML commands are transformed when producing output in other formats. // These HTML commands are transformed when producing output in other formats.
@ -103,27 +127,30 @@ const int commandHtmlSize = sizeof(commandHtml) / sizeof(*commandHtml);
// Only entities which are translatable to plain text are used here. Others // Only entities which are translatable to plain text are used here. Others
// are copied unchanged to output. // are copied unchanged to output.
const char *commandHtmlEntities[] = { "&copy", "&trade", "&reg", // (C), (TM), (R) const char *commandHtmlEntities[] = {
"&lt", // less-than symbol "&copy", // (C)
"&gt", // greater-than symbol "&trade", // (TM)
"&amp", // ampersand "&reg", // (R)
"&apos", // single quotation mark (straight) "&lt", // less-than symbol
"&quot", // double quotation mark (straight) "&gt", // greater-than symbol
"&lsquo", // left single quotation mark "&amp", // ampersand
"&rsquo", // right single quotation mark "&apos", // single quotation mark (straight)
"&ldquo", // left double quotation mark "&quot", // double quotation mark (straight)
"&rdquo", // right double quotation mark "&lsquo", // left single quotation mark
"&ndash", // n-dash (for numeric ranges, e.g. 2–8) "&rsquo", // right single quotation mark
"&mdash", // -- "&ldquo", // left double quotation mark
"&nbsp", // "&rdquo", // right double quotation mark
"&times", // x "&ndash", // n-dash (for numeric ranges, e.g. 2–8)
"&minus", // - "&mdash", // --
"&sdot", // . "&nbsp", //
"&sim", // ~ "&times", // x
"&le", // <= "&minus", // -
"&ge", // >= "&sdot", // .
"&larr", // <-- "&sim", // ~
"&rarr" // --> "&le", // <=
"&ge", // >=
"&larr", // <--
"&rarr" // -->
}; };
const int commandHtmlEntitiesSize = sizeof(commandHtmlEntities) / sizeof(*commandHtmlEntities); const int commandHtmlEntitiesSize = sizeof(commandHtmlEntities) / sizeof(*commandHtmlEntities);

View file

@ -16,10 +16,8 @@
using std::cout; using std::cout;
DoxygenEntity::DoxygenEntity(const std::string &typeEnt) : DoxygenEntity::DoxygenEntity(const std::string &typeEnt):typeOfEntity(typeEnt), isLeaf(true) {
typeOfEntity(typeEnt), }
isLeaf(true)
{}
/* Basic node for commands that have /* Basic node for commands that have
@ -27,23 +25,15 @@ DoxygenEntity::DoxygenEntity(const std::string &typeEnt) :
* example: \b word * example: \b word
* OR holding a std::string * OR holding a std::string
*/ */
DoxygenEntity::DoxygenEntity(const std::string &typeEnt, DoxygenEntity::DoxygenEntity(const std::string &typeEnt, const std::string &param1) : typeOfEntity(typeEnt), data(param1), isLeaf(true) {
const std::string &param1) : }
typeOfEntity(typeEnt),
data(param1),
isLeaf(true)
{}
/* Nonterminal node /* Nonterminal node
* contains * contains
*/ */
DoxygenEntity::DoxygenEntity(const std::string &typeEnt, DoxygenEntity::DoxygenEntity(const std::string &typeEnt, const DoxygenEntityList &entList) : typeOfEntity(typeEnt), isLeaf(false), entityList(entList) {
const DoxygenEntityList &entList) : }
typeOfEntity(typeEnt),
isLeaf(false),
entityList(entList)
{}
void DoxygenEntity::printEntity(int level) const { void DoxygenEntity::printEntity(int level) const {

View file

@ -20,7 +20,7 @@
class DoxygenEntity; class DoxygenEntity;
typedef std::list <DoxygenEntity> DoxygenEntityList; typedef std::list<DoxygenEntity> DoxygenEntityList;
typedef DoxygenEntityList::iterator DoxygenEntityListIt; typedef DoxygenEntityList::iterator DoxygenEntityListIt;
typedef DoxygenEntityList::const_iterator DoxygenEntityListCIt; typedef DoxygenEntityList::const_iterator DoxygenEntityListCIt;
@ -37,7 +37,7 @@ public:
DoxygenEntity(const std::string &typeEnt); DoxygenEntity(const std::string &typeEnt);
DoxygenEntity(const std::string &typeEnt, const std::string &param1); DoxygenEntity(const std::string &typeEnt, const std::string &param1);
DoxygenEntity(const std::string & typeEnt, const DoxygenEntityList &entList); DoxygenEntity(const std::string &typeEnt, const DoxygenEntityList &entList);
void printEntity(int level) const; void printEntity(int level) const;
}; };

File diff suppressed because it is too large Load diff

View file

@ -52,14 +52,12 @@ private:
class Token { class Token {
public: public:
DoxyCommandEnum m_tokenType; DoxyCommandEnum m_tokenType;
std::string m_tokenString; /* the data , such as param for @param */ std::string m_tokenString; /* the data , such as param for @param */
Token(DoxyCommandEnum tType, std::string tString) : Token(DoxyCommandEnum tType, std::string tString) : m_tokenType(tType), m_tokenString(tString) {
m_tokenType(tType), }
m_tokenString(tString) {}
std::string toString() const { std::string toString() const {
switch (m_tokenType) { switch (m_tokenType) {
case END_LINE: case END_LINE:
return "{END OF LINE}"; return "{END OF LINE}";
@ -96,7 +94,7 @@ private:
bool m_isVerbatimText; // used to handle \htmlonly and \verbatim commands bool m_isVerbatimText; // used to handle \htmlonly and \verbatim commands
bool m_isInQuotedString; bool m_isInQuotedString;
Node* m_node; Node *m_node;
std::string m_fileName; std::string m_fileName;
int m_fileLineNo; int m_fileLineNo;
@ -104,17 +102,17 @@ private:
* Return the end command for a command appearing in "ignore" feature or empty * Return the end command for a command appearing in "ignore" feature or empty
* string if this is a simple command and not a block one. * string if this is a simple command and not a block one.
*/ */
std::string getIgnoreFeatureEndCommand(const std::string& theCommand) const; std::string getIgnoreFeatureEndCommand(const std::string &theCommand) const;
/* /*
* Helper for getting the value of doxygen:ignore feature or its argument. * Helper for getting the value of doxygen:ignore feature or its argument.
*/ */
String* getIgnoreFeature(const std::string& theCommand, const char* argument = NULL) const; String *getIgnoreFeature(const std::string &theCommand, const char *argument = NULL) const;
/* /*
* Whether to print lots of debug info during parsing * Whether to print lots of debug info during parsing
*/ */
bool noisy; bool noisy;
/* /*
*Changes a std::string to all lower case *Changes a std::string to all lower case
@ -136,7 +134,7 @@ private:
/* /*
*prints the parse tree *prints the parse tree
*/ */
void printTree(const std::list <DoxygenEntity> &rootList); void printTree(const std::list<DoxygenEntity> &rootList);
/** /**
* Returns true if the next token is end of line token. This is important * Returns true if the next token is end of line token. This is important
@ -190,8 +188,7 @@ private:
* up til the command specified is encountered * up til the command specified is encountered
*/ */
//TODO check that this behaves properly for formulas //TODO check that this behaves properly for formulas
std::string getStringTilEndCommand(const std::string &theCommand, std::string getStringTilEndCommand(const std::string &theCommand, const TokenList &tokList);
const TokenList &tokList);
/* /*
* Returns the end of a Paragraph as an iterator- * Returns the end of a Paragraph as an iterator-
@ -205,8 +202,7 @@ private:
* encounter of the same command. Example of this behaviour is \arg. * encounter of the same command. Example of this behaviour is \arg.
* If no end is encountered, returns the last token of the std::list. * If no end is encountered, returns the last token of the std::list.
*/ */
TokenListCIt getEndOfSection(const std::string &theCommand, TokenListCIt getEndOfSection(const std::string &theCommand, const TokenList &tokList);
const TokenList &tokList);
/* /*
* This method is for returning the end of a specific form of doxygen command * This method is for returning the end of a specific form of doxygen command
@ -215,14 +211,12 @@ private:
* progressTilEndCommand("endcode", tokenList); * progressTilEndCommand("endcode", tokenList);
* If the end is never encountered, it returns the end of the std::list. * If the end is never encountered, it returns the end of the std::list.
*/ */
TokenListCIt getEndCommand(const std::string &theCommand, TokenListCIt getEndCommand(const std::string &theCommand, const TokenList &tokList);
const TokenList &tokList);
/* /*
* A special method for commands such as \arg that end at the end of a * A special method for commands such as \arg that end at the end of a
* paragraph OR when another \arg is encountered * paragraph OR when another \arg is encountered
//TODO getTilAnyCommand //TODO getTilAnyCommand
TokenListCIt getTilAnyCommand(const std::string &theCommand, TokenListCIt getTilAnyCommand(const std::string &theCommand, const TokenList &tokList);
const TokenList &tokList);
*/ */
/** /**
@ -241,8 +235,7 @@ private:
* Plain commands, such as newline etc, they contain no other data * Plain commands, such as newline etc, they contain no other data
* \n \\ \@ \& \$ \# \< \> \% * \n \\ \@ \& \$ \# \< \> \%
*/ */
void addSimpleCommand(const std::string &theCommand, void addSimpleCommand(const std::string &theCommand, DoxygenEntityList &doxyList);
DoxygenEntityList &doxyList);
/* /*
* CommandWord * CommandWord
* Format: @command <word> * Format: @command <word>
@ -251,9 +244,7 @@ private:
* "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include",
* "includelineno" * "includelineno"
*/ */
void addCommandWord(const std::string &theCommand, void addCommandWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* CommandLine * CommandLine
* Format: @command (line) * Format: @command (line)
@ -261,9 +252,7 @@ private:
* "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip",
* "until", "property" * "until", "property"
*/ */
void addCommandLine(const std::string &theCommand, void addCommandLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* CommandParagraph * CommandParagraph
* Format: @command {paragraph} * Format: @command {paragraph}
@ -272,9 +261,7 @@ private:
* "details", "invariant", "deprecated", "date", "note", "warning", * "details", "invariant", "deprecated", "date", "note", "warning",
* "version", "todo", "bug", "attention", "brief", "arg", "author" * "version", "todo", "bug", "attention", "brief", "arg", "author"
*/ */
void addCommandParagraph(const std::string &theCommand, void addCommandParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* Command EndCommand * Command EndCommand
* Format: @command and ends at @endcommand * Format: @command and ends at @endcommand
@ -284,95 +271,69 @@ private:
* "link" * "link"
* Returns 1 if success, 0 if the endcommand is never encountered. * Returns 1 if success, 0 if the endcommand is never encountered.
*/ */
void addCommandEndCommand(const std::string &theCommand, void addCommandEndCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList & tokList,
DoxygenEntityList &doxyList);
/* /*
* CommandWordParagraph * CommandWordParagraph
* Format: @command <word> {paragraph} * Format: @command <word> {paragraph}
* Commands such as param * Commands such as param
* "param", "tparam", "throw", "throws", "retval", "exception" * "param", "tparam", "throw", "throws", "retval", "exception"
*/ */
void addCommandWordParagraph(const std::string &theCommand, void addCommandWordParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList & tokList,
DoxygenEntityList &doxyList);
/* /*
* CommandWordLine * CommandWordLine
* Format: @command <word> (line) * Format: @command <word> (line)
* Commands such as param * Commands such as param
* "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"
*/ */
void addCommandWordLine(const std::string &theCommand, void addCommandWordLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* Command Word Optional Word Optional Word * Command Word Optional Word Optional Word
* Format: @command <word> [<header-file>] [<header-name>] * Format: @command <word> [<header-file>] [<header-name>]
* Commands such as class * Commands such as class
* "category", "class", "protocol", "interface", "struct", "union" * "category", "class", "protocol", "interface", "struct", "union"
*/ */
void addCommandWordOWordOWord(const std::string &theCommand, void addCommandWordOWordOWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* Command Optional Word * Command Optional Word
* Format: @command [<word>] * Format: @command [<word>]
* Commands such as dir * Commands such as dir
* "dir", "file", "cond" * "dir", "file", "cond"
*/ */
void addCommandOWord(const std::string &theCommand, void addCommandOWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* Commands that should not be encountered (such as PHP only) * Commands that should not be encountered (such as PHP only)
* goes til the end of line then returns * goes til the end of line then returns
*/ */
void addCommandErrorThrow(const std::string &theCommand, void addCommandErrorThrow(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
void addCommandHtml(const std::string &theCommand, void addCommandHtml(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
void addCommandHtmlEntity(const std::string &theCommand, void addCommandHtmlEntity(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
*Adds the unique commands- different process for each unique command *Adds the unique commands- different process for each unique command
*/ */
void addCommandUnique(const std::string &theCommand, void addCommandUnique(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* Replace the given command with its predefined alias expansion. * Replace the given command with its predefined alias expansion.
*/ */
void aliasCommand(const std::string& theCommand, void aliasCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* Simply ignore the given command, possibly with the word following it or * Simply ignore the given command, possibly with the word following it or
* until the matching end command. * until the matching end command.
*/ */
void ignoreCommand(const std::string& theCommand, void ignoreCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
/* /*
* The actual "meat" of the doxygen parser. Calls the correct addCommand...() * The actual "meat" of the doxygen parser. Calls the correct addCommand...()
* function. * function.
*/ */
void addCommand(const std::string &commandString, void addCommand(const std::string &commandString, const TokenList &tokList, DoxygenEntityList &doxyList);
const TokenList &tokList,
DoxygenEntityList &doxyList);
DoxygenEntityList parse(TokenListCIt endParsingIndex, DoxygenEntityList parse(TokenListCIt endParsingIndex, const TokenList &tokList, bool root = false);
const TokenList &tokList,
bool root = false);
/* /*
* Fill static doxygenCommands and sectionIndicators containers * Fill static doxygenCommands and sectionIndicators containers
@ -391,9 +352,7 @@ private:
/** Processes comment outside \htmlonly and \verbatim commands. */ /** Processes comment outside \htmlonly and \verbatim commands. */
size_t processNormalComment(size_t pos, const std::string &line); size_t processNormalComment(size_t pos, const std::string &line);
void tokenizeDoxygenComment(const std::string &doxygenComment, void tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine);
const std::string &fileName,
int fileLine);
void printList(); void printList();
void printListError(int warningType, const std::string &message); void printListError(int warningType, const std::string &message);
@ -407,8 +366,7 @@ private:
public: public:
DoxygenParser(bool noisy = false); DoxygenParser(bool noisy = false);
virtual ~DoxygenParser(); virtual ~DoxygenParser();
DoxygenEntityList createTree(Node* node, String* documentation); DoxygenEntityList createTree(Node *node, String *documentation);
}; };
#endif #endif

View file

@ -14,10 +14,8 @@
#include "DoxygenTranslator.h" #include "DoxygenTranslator.h"
DoxygenTranslator::DoxygenTranslator(int flags) : DoxygenTranslator::DoxygenTranslator(int flags) : m_flags(flags), parser((flags &debug_parser) != 0) {
m_flags(flags), }
parser((flags & debug_parser) != 0)
{}
DoxygenTranslator::~DoxygenTranslator() { DoxygenTranslator::~DoxygenTranslator() {

View file

@ -15,8 +15,8 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include "../../Modules/swigmod.h" #include "../../Modules/swigmod.h"
#define APPROX_LINE_LENGTH 64 //characters per line allowed #define APPROX_LINE_LENGTH 64 // characters per line allowed
#define TAB_SIZE 8 //current tab size in spaces #define TAB_SIZE 8 // current tab size in spaces
//TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag //TODO {@link} {@linkplain} {@docRoot}, and other useful doxy commands that are not a javadoc tag
// define static tables, they are filled in JavaDocConverter's constructor // define static tables, they are filled in JavaDocConverter's constructor
@ -26,8 +26,7 @@ using std::string;
using std::list; using std::list;
using std::vector; using std::vector;
void JavaDocConverter::fillStaticTables() void JavaDocConverter::fillStaticTables() {
{
if (tagHandlers.size()) // fill only once if (tagHandlers.size()) // fill only once
return; return;
@ -99,15 +98,13 @@ void JavaDocConverter::fillStaticTables()
tagHandlers["invariant"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["invariant"] = make_pair(&JavaDocConverter::handleParagraph, "");
tagHandlers["latexonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["latexonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
tagHandlers["manonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["manonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
tagHandlers["partofdescription"] = make_pair( tagHandlers["partofdescription"] = make_pair(&JavaDocConverter::handleParagraph, "");
&JavaDocConverter::handleParagraph, "");
tagHandlers["rtfonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["rtfonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
tagHandlers["short"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["short"] = make_pair(&JavaDocConverter::handleParagraph, "");
tagHandlers["xmlonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["xmlonly"] = make_pair(&JavaDocConverter::handleParagraph, "");
// these commands are kept as-is, they are supported by JavaDoc // these commands are kept as-is, they are supported by JavaDoc
tagHandlers["author"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["author"] = make_pair(&JavaDocConverter::handleTagSame, "");
tagHandlers["authors"] = make_pair(&JavaDocConverter::handleTagSame, tagHandlers["authors"] = make_pair(&JavaDocConverter::handleTagSame, "author");
"author");
tagHandlers["deprecated"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["deprecated"] = make_pair(&JavaDocConverter::handleTagSame, "");
tagHandlers["exception"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["exception"] = make_pair(&JavaDocConverter::handleTagSame, "");
tagHandlers["package"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["package"] = make_pair(&JavaDocConverter::handleTagSame, "");
@ -116,8 +113,7 @@ void JavaDocConverter::fillStaticTables()
tagHandlers["ref"] = make_pair(&JavaDocConverter::handleTagRef, ""); tagHandlers["ref"] = make_pair(&JavaDocConverter::handleTagRef, "");
tagHandlers["result"] = make_pair(&JavaDocConverter::handleTagSame, "return"); tagHandlers["result"] = make_pair(&JavaDocConverter::handleTagSame, "return");
tagHandlers["return"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["return"] = make_pair(&JavaDocConverter::handleTagSame, "");
tagHandlers["returns"] = make_pair(&JavaDocConverter::handleTagSame, tagHandlers["returns"] = make_pair(&JavaDocConverter::handleTagSame, "return");
"return");
//tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSame, ""); //tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSame, "");
//tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSame, "see"); //tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSame, "see");
tagHandlers["since"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["since"] = make_pair(&JavaDocConverter::handleTagSame, "");
@ -126,104 +122,77 @@ void JavaDocConverter::fillStaticTables()
tagHandlers["version"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["version"] = make_pair(&JavaDocConverter::handleTagSame, "");
// these commands have special handlers // these commands have special handlers
tagHandlers["code"] = make_pair(&JavaDocConverter::handleTagExtended, "code"); tagHandlers["code"] = make_pair(&JavaDocConverter::handleTagExtended, "code");
tagHandlers["cond"] = make_pair(&JavaDocConverter::handleTagMessage, tagHandlers["cond"] = make_pair(&JavaDocConverter::handleTagMessage, "Conditional comment: ");
"Conditional comment: "); tagHandlers["copyright"] = make_pair(&JavaDocConverter::handleTagMessage, "Copyright: ");
tagHandlers["copyright"] = make_pair(&JavaDocConverter::handleTagMessage,
"Copyright: ");
tagHandlers["else"] = make_pair(&JavaDocConverter::handleTagIf, "Else: "); tagHandlers["else"] = make_pair(&JavaDocConverter::handleTagIf, "Else: ");
tagHandlers["elseif"] = make_pair(&JavaDocConverter::handleTagIf, tagHandlers["elseif"] = make_pair(&JavaDocConverter::handleTagIf, "Else if: ");
"Else if: "); tagHandlers["endcond"] = make_pair(&JavaDocConverter::handleTagMessage, "End of conditional comment.");
tagHandlers["endcond"] = make_pair(&JavaDocConverter::handleTagMessage,
"End of conditional comment.");
// space in second arg prevents Javadoc to treat '@ example' as command. File name of // space in second arg prevents Javadoc to treat '@ example' as command. File name of
// example is still informative to user. // example is still informative to user.
tagHandlers["example"] = make_pair(&JavaDocConverter::handleTagSame, tagHandlers["example"] = make_pair(&JavaDocConverter::handleTagSame, " example");
" example");
tagHandlers["if"] = make_pair(&JavaDocConverter::handleTagIf, "If: "); tagHandlers["if"] = make_pair(&JavaDocConverter::handleTagIf, "If: ");
tagHandlers["ifnot"] = make_pair(&JavaDocConverter::handleTagIf, "If not: "); tagHandlers["ifnot"] = make_pair(&JavaDocConverter::handleTagIf, "If not: ");
tagHandlers["image"] = make_pair(&JavaDocConverter::handleTagImage, ""); tagHandlers["image"] = make_pair(&JavaDocConverter::handleTagImage, "");
tagHandlers["link"] = make_pair(&JavaDocConverter::handleTagLink, ""); tagHandlers["link"] = make_pair(&JavaDocConverter::handleTagLink, "");
tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSee, ""); tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSee, "");
tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSee, ""); tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSee, "");
tagHandlers["note"] = make_pair(&JavaDocConverter::handleTagMessage, tagHandlers["note"] = make_pair(&JavaDocConverter::handleTagMessage, "Note: ");
"Note: ");
tagHandlers["overload"] = make_pair(&JavaDocConverter::handleTagMessage, tagHandlers["overload"] = make_pair(&JavaDocConverter::handleTagMessage,
"This is an overloaded member function, provided for" "This is an overloaded member function, provided for"
" convenience. It differs from the above function only in what" " convenience. It differs from the above function only in what" " argument(s) it accepts.");
" argument(s) it accepts.");
tagHandlers["par"] = make_pair(&JavaDocConverter::handleTagPar, ""); tagHandlers["par"] = make_pair(&JavaDocConverter::handleTagPar, "");
tagHandlers["remark"] = make_pair(&JavaDocConverter::handleTagMessage, tagHandlers["remark"] = make_pair(&JavaDocConverter::handleTagMessage, "Remarks: ");
"Remarks: "); tagHandlers["remarks"] = make_pair(&JavaDocConverter::handleTagMessage, "Remarks: ");
tagHandlers["remarks"] = make_pair(&JavaDocConverter::handleTagMessage, tagHandlers["todo"] = make_pair(&JavaDocConverter::handleTagMessage, "TODO: ");
"Remarks: "); tagHandlers["verbatim"] = make_pair(&JavaDocConverter::handleTagExtended, "literal");
tagHandlers["todo"] = make_pair(&JavaDocConverter::handleTagMessage,
"TODO: ");
tagHandlers["verbatim"] = make_pair(&JavaDocConverter::handleTagExtended,
"literal");
// \f commands output literal Latex formula, which is still better than nothing. // \f commands output literal Latex formula, which is still better than nothing.
tagHandlers["f$"] = make_pair(&JavaDocConverter::handleTagVerbatim, ""); tagHandlers["f$"] = make_pair(&JavaDocConverter::handleTagVerbatim, "");
tagHandlers["f["] = make_pair(&JavaDocConverter::handleTagVerbatim, ""); tagHandlers["f["] = make_pair(&JavaDocConverter::handleTagVerbatim, "");
tagHandlers["f{"] = make_pair(&JavaDocConverter::handleTagVerbatim, ""); tagHandlers["f{"] = make_pair(&JavaDocConverter::handleTagVerbatim, "");
tagHandlers["warning"] = make_pair(&JavaDocConverter::handleTagMessage, tagHandlers["warning"] = make_pair(&JavaDocConverter::handleTagMessage, "Warning: ");
"Warning: ");
// this command just prints it's contents // this command just prints it's contents
// (it is internal command of swig's parser, contains plain text) // (it is internal command of swig's parser, contains plain text)
tagHandlers["plainstd::string"] = make_pair( tagHandlers["plainstd::string"] = make_pair(&JavaDocConverter::handlePlainString, "");
&JavaDocConverter::handlePlainString, ""); tagHandlers["plainstd::endl"] = make_pair(&JavaDocConverter::handleNewLine, "");
tagHandlers["plainstd::endl"] = make_pair(&JavaDocConverter::handleNewLine,
"");
tagHandlers["n"] = make_pair(&JavaDocConverter::handleNewLine, ""); tagHandlers["n"] = make_pair(&JavaDocConverter::handleNewLine, "");
// HTML tags // HTML tags
tagHandlers["<a"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<a"); tagHandlers["<a"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<a");
tagHandlers["<b"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<b"); tagHandlers["<b"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<b");
tagHandlers["<blockquote"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<blockquote"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<blockquote");
"<blockquote"); tagHandlers["<body"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<body");
tagHandlers["<body"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag,
"<body");
tagHandlers["<br"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<br"); tagHandlers["<br"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<br");
tagHandlers["<center"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<center"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<center");
"<center"); tagHandlers["<caption"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<caption");
tagHandlers["<caption"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<code"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<code");
"<caption");
tagHandlers["<code"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag,
"<code");
tagHandlers["<dd"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dd"); tagHandlers["<dd"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dd");
tagHandlers["<dfn"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dfn"); tagHandlers["<dfn"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dfn");
tagHandlers["<div"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<div"); tagHandlers["<div"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<div");
tagHandlers["<dl"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dl"); tagHandlers["<dl"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dl");
tagHandlers["<dt"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dt"); tagHandlers["<dt"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<dt");
tagHandlers["<em"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<em"); tagHandlers["<em"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<em");
tagHandlers["<form"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<form"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<form");
"<form");
tagHandlers["<hr"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<hr"); tagHandlers["<hr"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<hr");
tagHandlers["<h1"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h1"); tagHandlers["<h1"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h1");
tagHandlers["<h2"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h2"); tagHandlers["<h2"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h2");
tagHandlers["<h3"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h3"); tagHandlers["<h3"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<h3");
tagHandlers["<i"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<i"); tagHandlers["<i"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<i");
tagHandlers["<input"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<input"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<input");
"<input");
tagHandlers["<img"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<img"); tagHandlers["<img"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<img");
tagHandlers["<li"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<li"); tagHandlers["<li"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<li");
tagHandlers["<meta"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<meta"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<meta");
"<meta"); tagHandlers["<multicol"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<multicol");
tagHandlers["<multicol"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag,
"<multicol");
tagHandlers["<ol"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<ol"); tagHandlers["<ol"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<ol");
tagHandlers["<p"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<p"); tagHandlers["<p"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<p");
tagHandlers["<pre"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<pre"); tagHandlers["<pre"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<pre");
tagHandlers["<small"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<small"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<small");
"<small"); tagHandlers["<span"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<span");
tagHandlers["<span"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<strong"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<strong");
"<span");
tagHandlers["<strong"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag,
"<strong");
tagHandlers["<sub"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<sub"); tagHandlers["<sub"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<sub");
tagHandlers["<sup"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<sup"); tagHandlers["<sup"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<sup");
tagHandlers["<table"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, tagHandlers["<table"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<table");
"<table");
tagHandlers["<td"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<td"); tagHandlers["<td"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<td");
tagHandlers["<th"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<th"); tagHandlers["<th"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<th");
tagHandlers["<tr"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<tr"); tagHandlers["<tr"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<tr");
@ -233,50 +202,33 @@ void JavaDocConverter::fillStaticTables()
tagHandlers["<var"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<var"); tagHandlers["<var"] = make_pair(&JavaDocConverter::handleDoxyHtmlTag, "<var");
// HTML entities // HTML entities
tagHandlers["&copy"] = make_pair(&JavaDocConverter::handleHtmlEntity, tagHandlers["&copy"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&copy");
"&copy"); tagHandlers["&trade"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&trade");
tagHandlers["&trade"] = make_pair(&JavaDocConverter::handleHtmlEntity,
"&trade");
tagHandlers["&reg"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&reg"); tagHandlers["&reg"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&reg");
tagHandlers["&lt"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&lt"); tagHandlers["&lt"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&lt");
tagHandlers["&gt"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&gt"); tagHandlers["&gt"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&gt");
tagHandlers["&amp"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&amp"); tagHandlers["&amp"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&amp");
tagHandlers["&apos"] = make_pair(&JavaDocConverter::handleHtmlEntity, tagHandlers["&apos"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&apos");
"&apos"); tagHandlers["&quot"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&quot");
tagHandlers["&quot"] = make_pair(&JavaDocConverter::handleHtmlEntity, tagHandlers["&lsquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&lsquo");
"&quot"); tagHandlers["&rsquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&rsquo");
tagHandlers["&lsquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, tagHandlers["&ldquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&ldquo");
"&lsquo"); tagHandlers["&rdquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&rdquo");
tagHandlers["&rsquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, tagHandlers["&ndash"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&ndash");
"&rsquo"); tagHandlers["&mdash"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&mdash");
tagHandlers["&ldquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, tagHandlers["&nbsp"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&nbsp");
"&ldquo"); tagHandlers["&times"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&times");
tagHandlers["&rdquo"] = make_pair(&JavaDocConverter::handleHtmlEntity, tagHandlers["&minus"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&minus");
"&rdquo"); tagHandlers["&sdot"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&sdot");
tagHandlers["&ndash"] = make_pair(&JavaDocConverter::handleHtmlEntity,
"&ndash");
tagHandlers["&mdash"] = make_pair(&JavaDocConverter::handleHtmlEntity,
"&mdash");
tagHandlers["&nbsp"] = make_pair(&JavaDocConverter::handleHtmlEntity,
"&nbsp");
tagHandlers["&times"] = make_pair(&JavaDocConverter::handleHtmlEntity,
"&times");
tagHandlers["&minus"] = make_pair(&JavaDocConverter::handleHtmlEntity,
"&minus");
tagHandlers["&sdot"] = make_pair(&JavaDocConverter::handleHtmlEntity,
"&sdot");
tagHandlers["&sim"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&sim"); tagHandlers["&sim"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&sim");
tagHandlers["&le"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&le"); tagHandlers["&le"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&le");
tagHandlers["&ge"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&ge"); tagHandlers["&ge"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&ge");
tagHandlers["&larr"] = make_pair(&JavaDocConverter::handleHtmlEntity, tagHandlers["&larr"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&larr");
"&larr"); tagHandlers["&rarr"] = make_pair(&JavaDocConverter::handleHtmlEntity, "&rarr");
tagHandlers["&rarr"] = make_pair(&JavaDocConverter::handleHtmlEntity,
"&rarr");
} }
JavaDocConverter::JavaDocConverter(int flags) : JavaDocConverter::JavaDocConverter(int flags) :
DoxygenTranslator(flags) DoxygenTranslator(flags) {
{
fillStaticTables(); fillStaticTables();
} }
@ -288,11 +240,9 @@ JavaDocConverter::JavaDocConverter(int flags) :
* which results in short lines. To be useful, this function should have much * which results in short lines. To be useful, this function should have much
* better algorithm. * better algorithm.
*/ */
std::string JavaDocConverter::formatCommand(std::string unformattedLine, std::string JavaDocConverter::formatCommand(std::string unformattedLine, int indent) {
int indent)
{
std::string formattedLines; std::string formattedLines;
return unformattedLine; // currently disabled return unformattedLine; // currently disabled
int lastPosition = 0; int lastPosition = 0;
int i = 0; int i = 0;
int isFirstLine = 1; int isFirstLine = 1;
@ -310,12 +260,10 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine,
if (!isFirstLine) if (!isFirstLine)
for (int j = 0; j < indent; j++) { for (int j = 0; j < indent; j++) {
formattedLines.append("\t"); formattedLines.append("\t");
} } else {
else {
isFirstLine = 0; isFirstLine = 0;
} }
formattedLines.append( formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1));
unformattedLine.substr(lastPosition, i - lastPosition + 1));
formattedLines.append("\n *"); formattedLines.append("\n *");
} }
@ -326,9 +274,7 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine,
formattedLines.append("\t"); formattedLines.append("\t");
} }
} }
formattedLines.append( formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition));
unformattedLine.substr(lastPosition,
unformattedLine.length() - lastPosition));
} }
return formattedLines; return formattedLines;
@ -341,8 +287,7 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine,
* true - parameters are copied to output regardless of presence in * true - parameters are copied to output regardless of presence in
* function params list. * function params list.
*/ */
bool JavaDocConverter::paramExists(std::string param) bool JavaDocConverter::paramExists(std::string param) {
{
if (GetFlag(currentNode, "feature:doxygen:nostripparams")) { if (GetFlag(currentNode, "feature:doxygen:nostripparams")) {
return true; return true;
@ -352,7 +297,7 @@ bool JavaDocConverter::paramExists(std::string param)
for (Parm *p = plist; p;) { for (Parm *p = plist; p;) {
if (Getattr(p, "name") && Char (Getattr(p, "name")) == param) { if (Getattr(p, "name") && Char(Getattr(p, "name")) == param) {
return true; return true;
} }
/* doesn't seem to work always: in some cases (especially for 'self' parameters) /* doesn't seem to work always: in some cases (especially for 'self' parameters)
@ -367,16 +312,14 @@ bool JavaDocConverter::paramExists(std::string param)
return false; return false;
} }
std::string JavaDocConverter::translateSubtree(DoxygenEntity &doxygenEntity) std::string JavaDocConverter::translateSubtree(DoxygenEntity &doxygenEntity) {
{
std::string translatedComment; std::string translatedComment;
if (doxygenEntity.isLeaf) { if (doxygenEntity.isLeaf) {
return translatedComment; return translatedComment;
} }
for (DoxygenEntityListIt p = doxygenEntity.entityList.begin(); for (DoxygenEntityListIt p = doxygenEntity.entityList.begin(); p != doxygenEntity.entityList.end(); p++) {
p != doxygenEntity.entityList.end(); p++) {
translateEntity(*p, translatedComment); translateEntity(*p, translatedComment);
translateSubtree(*p); translateSubtree(*p);
@ -388,9 +331,7 @@ std::string JavaDocConverter::translateSubtree(DoxygenEntity &doxygenEntity)
/** /**
* Checks if a handler for the given tag exists, and calls it. * Checks if a handler for the given tag exists, and calls it.
*/ */
void JavaDocConverter::translateEntity(DoxygenEntity &tag, void JavaDocConverter::translateEntity(DoxygenEntity &tag, std::string &translatedComment) {
std::string &translatedComment)
{
std::map<std::string, std::pair<tagHandler, std::string> >::iterator it; std::map<std::string, std::pair<tagHandler, std::string> >::iterator it;
it = tagHandlers.find(tag.typeOfEntity); it = tagHandlers.find(tag.typeOfEntity);
@ -405,35 +346,24 @@ void JavaDocConverter::translateEntity(DoxygenEntity &tag,
} }
void JavaDocConverter::handleTagAnchor(DoxygenEntity& tag, void JavaDocConverter::handleTagAnchor(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string &)
{
translatedComment += "<a id=\"" + translateSubtree(tag) + "\"></a>"; translatedComment += "<a id=\"" + translateSubtree(tag) + "\"></a>";
} }
void JavaDocConverter::handleTagHtml(DoxygenEntity& tag, void JavaDocConverter::handleTagHtml(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
if (tag.entityList.size()) { // do not include empty tags if (tag.entityList.size()) { // do not include empty tags
std::string tagData = translateSubtree(tag); std::string tagData = translateSubtree(tag);
// wrap the thing, ignoring whitespace // wrap the thing, ignoring whitespace
size_t wsPos = tagData.find_last_not_of("\n\t "); size_t wsPos = tagData.find_last_not_of("\n\t ");
if (wsPos != std::string::npos) if (wsPos != std::string::npos)
translatedComment += "<" + arg + ">" + tagData.substr(0, wsPos + 1) + "</" translatedComment += "<" + arg + ">" + tagData.substr(0, wsPos + 1) + "</" + arg + ">" + tagData.substr(wsPos + 1);
+ arg + ">" + tagData.substr(wsPos + 1);
else else
translatedComment += "<" + arg + ">" + translateSubtree(tag) + "</" + arg translatedComment += "<" + arg + ">" + translateSubtree(tag) + "</" + arg + "> ";
+ "> ";
} }
} }
void JavaDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag, void JavaDocConverter::handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
std::string htmlTagArgs = tag.data; std::string htmlTagArgs = tag.data;
if (htmlTagArgs == "/") { if (htmlTagArgs == "/") {
// end html tag, for example "</ul> // end html tag, for example "</ul>
@ -443,18 +373,12 @@ void JavaDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag,
} }
} }
void JavaDocConverter::handleHtmlEntity(DoxygenEntity&, void JavaDocConverter::handleHtmlEntity(DoxygenEntity &, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
// html entities can be preserved for Java // html entities can be preserved for Java
translatedComment += arg + ';'; translatedComment += arg + ';';
} }
void JavaDocConverter::handleNewLine(DoxygenEntity&, void JavaDocConverter::handleNewLine(DoxygenEntity &, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
// <br> tag is added, because otherwise to much text is joined // <br> tag is added, because otherwise to much text is joined
// into same paragraph by javadoc. For example, doxy list: // into same paragraph by javadoc. For example, doxy list:
// - item one // - item one
@ -466,10 +390,7 @@ void JavaDocConverter::handleNewLine(DoxygenEntity&,
translatedComment += "<br>\n * "; translatedComment += "<br>\n * ";
} }
void JavaDocConverter::handleTagChar(DoxygenEntity& tag, void JavaDocConverter::handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
// escape it if we need to, else just print // escape it if we need to, else just print
if (arg.size()) if (arg.size())
translatedComment += arg; translatedComment += arg;
@ -478,57 +399,37 @@ void JavaDocConverter::handleTagChar(DoxygenEntity& tag,
} }
// handles tags which are the same in Doxygen and Javadoc. // handles tags which are the same in Doxygen and Javadoc.
void JavaDocConverter::handleTagSame(DoxygenEntity& tag, void JavaDocConverter::handleTagSame(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
if (arg.size()) if (arg.size())
tag.typeOfEntity = arg; tag.typeOfEntity = arg;
translatedComment += formatCommand( translatedComment += formatCommand(std::string("@" + tag.typeOfEntity + " " + translateSubtree(tag)), 2);
std::string("@" + tag.typeOfEntity + " " + translateSubtree(tag)), 2);
} }
void JavaDocConverter::handleParagraph(DoxygenEntity& tag, void JavaDocConverter::handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
translatedComment += formatCommand(translateSubtree(tag), 0); translatedComment += formatCommand(translateSubtree(tag), 0);
} }
void JavaDocConverter::handlePlainString(DoxygenEntity& tag, void JavaDocConverter::handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
translatedComment += tag.data; translatedComment += tag.data;
// if (tag.data.size() && tag.data[tag.data.size()-1] != ' ') // if (tag.data.size() && tag.data[tag.data.size()-1] != ' ')
// translatedComment += " "; // translatedComment += " ";
} }
void JavaDocConverter::handleTagVerbatim(DoxygenEntity& tag, void JavaDocConverter::handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
translatedComment += arg + " "; translatedComment += arg + " ";
for (DoxygenEntityListCIt it = tag.entityList.begin(); for (DoxygenEntityListCIt it = tag.entityList.begin(); it != tag.entityList.end(); it++) {
it != tag.entityList.end(); it++) {
translatedComment += it->data; translatedComment += it->data;
} }
} }
void JavaDocConverter::handleTagExtended(DoxygenEntity& tag, void JavaDocConverter::handleTagExtended(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
std::string dummy; std::string dummy;
translatedComment += "{@" + arg + " "; translatedComment += "{@" + arg + " ";
handleParagraph(tag, translatedComment, dummy); handleParagraph(tag, translatedComment, dummy);
translatedComment += "}"; translatedComment += "}";
} }
void JavaDocConverter::handleTagIf(DoxygenEntity& tag, void JavaDocConverter::handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
std::string dummy; std::string dummy;
translatedComment += arg; translatedComment += arg;
if (tag.entityList.size()) { if (tag.entityList.size()) {
@ -538,19 +439,13 @@ void JavaDocConverter::handleTagIf(DoxygenEntity& tag,
} }
} }
void JavaDocConverter::handleTagMessage(DoxygenEntity& tag, void JavaDocConverter::handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) {
std::string& translatedComment,
std::string &arg)
{
std::string dummy; std::string dummy;
translatedComment += formatCommand(arg, 0); translatedComment += formatCommand(arg, 0);
handleParagraph(tag, translatedComment, dummy); handleParagraph(tag, translatedComment, dummy);
} }
void JavaDocConverter::handleTagImage(DoxygenEntity& tag, void JavaDocConverter::handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
if (tag.entityList.size() < 2) if (tag.entityList.size() < 2)
return; return;
@ -577,10 +472,7 @@ void JavaDocConverter::handleTagImage(DoxygenEntity& tag,
translatedComment += "/>"; translatedComment += "/>";
} }
void JavaDocConverter::handleTagPar(DoxygenEntity& tag, void JavaDocConverter::handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
std::string dummy; std::string dummy;
translatedComment += "<p"; translatedComment += "<p";
if (tag.entityList.size()) { if (tag.entityList.size()) {
@ -593,10 +485,7 @@ void JavaDocConverter::handleTagPar(DoxygenEntity& tag,
} }
void JavaDocConverter::handleTagParam(DoxygenEntity& tag, void JavaDocConverter::handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
std::string dummy; std::string dummy;
if (!tag.entityList.size()) if (!tag.entityList.size())
@ -611,10 +500,7 @@ void JavaDocConverter::handleTagParam(DoxygenEntity& tag,
} }
void JavaDocConverter::handleTagRef(DoxygenEntity& tag, void JavaDocConverter::handleTagRef(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
std::string dummy; std::string dummy;
if (!tag.entityList.size()) if (!tag.entityList.size())
return; return;
@ -632,19 +518,17 @@ void JavaDocConverter::handleTagRef(DoxygenEntity& tag,
} }
string JavaDocConverter::convertLink(string linkObject) string JavaDocConverter::convertLink(string linkObject) {
{
if (GetFlag(currentNode, "feature:doxygen:nolinktranslate")) if (GetFlag(currentNode, "feature:doxygen:nolinktranslate"))
return linkObject; return linkObject;
// find the params in function in linkObject (if any) // find the params in function in linkObject (if any)
size_t lbracePos = linkObject.find('(', 0); size_t lbracePos = linkObject.find('(', 0);
size_t rbracePos = linkObject.find(')', 0); size_t rbracePos = linkObject.find(')', 0);
if (lbracePos == string::npos || rbracePos == string::npos if (lbracePos == string::npos || rbracePos == string::npos || lbracePos >= rbracePos)
|| lbracePos >= rbracePos)
return ""; return "";
string paramsStr = linkObject.substr(lbracePos + 1, string paramsStr = linkObject.substr(lbracePos + 1,
rbracePos - lbracePos - 1); rbracePos - lbracePos - 1);
// strip the params, to fill them later // strip the params, to fill them later
string additionalObject = linkObject.substr(rbracePos + 1, string::npos); string additionalObject = linkObject.substr(rbracePos + 1, string::npos);
linkObject = linkObject.substr(0, lbracePos); linkObject = linkObject.substr(0, lbracePos);
@ -679,7 +563,7 @@ string JavaDocConverter::convertLink(string linkObject)
SwigType_add_qualifier(swigType, "const"); SwigType_add_qualifier(swigType, "const");
// handle pointers, references and arrays // handle pointers, references and arrays
for (int j = (int) params[i].size() - 1; j >= 0; j--) { for (int j = (int)params[i].size() - 1; j >= 0; j--) {
// skip all the [...] blocks, write 'p.' for every of it // skip all the [...] blocks, write 'p.' for every of it
if (paramStr[j] == ']') { if (paramStr[j] == ']') {
while (j >= 0 && paramStr[j] != '[') while (j >= 0 && paramStr[j] != '[')
@ -699,8 +583,7 @@ string JavaDocConverter::convertLink(string linkObject)
typeNameStart = 0; typeNameStart = 0;
else else
typeNameStart++; typeNameStart++;
Append(swigType, Append(swigType, paramStr.substr(typeNameStart, j - typeNameStart + 1).c_str());
paramStr.substr(typeNameStart, j - typeNameStart + 1).c_str());
break; break;
} }
} }
@ -708,11 +591,10 @@ string JavaDocConverter::convertLink(string linkObject)
// make dummy param list, to lookup typemaps for it // make dummy param list, to lookup typemaps for it
Parm *dummyParam = NewParm(swigType, "", 0); Parm *dummyParam = NewParm(swigType, "", 0);
Swig_typemap_attach_parms("jstype", dummyParam, NULL); Swig_typemap_attach_parms("jstype", dummyParam, NULL);
Language::instance()->replaceSpecialVariables(0, Language::instance()->replaceSpecialVariables(0, Getattr(dummyParam, "tmap:jstype"), dummyParam);
Getattr(dummyParam, "tmap:jstype"), dummyParam);
//Swig_print(dummyParam, 1); //Swig_print(dummyParam, 1);
linkObject += Char (Getattr(dummyParam, "tmap:jstype")); linkObject += Char(Getattr(dummyParam, "tmap:jstype"));
if (i != params.size() - 1) if (i != params.size() - 1)
linkObject += ","; linkObject += ",";
@ -724,10 +606,7 @@ string JavaDocConverter::convertLink(string linkObject)
return linkObject + additionalObject; return linkObject + additionalObject;
} }
void JavaDocConverter::handleTagLink(DoxygenEntity& tag, void JavaDocConverter::handleTagLink(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
std::string dummy; std::string dummy;
if (!tag.entityList.size()) if (!tag.entityList.size())
return; return;
@ -743,10 +622,7 @@ void JavaDocConverter::handleTagLink(DoxygenEntity& tag,
translatedComment += "}"; translatedComment += "}";
} }
void JavaDocConverter::handleTagSee(DoxygenEntity& tag, void JavaDocConverter::handleTagSee(DoxygenEntity &tag, std::string &translatedComment, std::string &) {
std::string& translatedComment,
std::string&)
{
std::string dummy; std::string dummy;
if (!tag.entityList.size()) if (!tag.entityList.size())
return; return;
@ -762,7 +638,6 @@ void JavaDocConverter::handleTagSee(DoxygenEntity& tag,
// handleNewLine(*it, translatedComment, dummy); // handleNewLine(*it, translatedComment, dummy);
continue; continue;
} }
// restore entities which may be used in C++ type declaration // restore entities which may be used in C++ type declaration
if (it->typeOfEntity == "&amp") { if (it->typeOfEntity == "&amp") {
methodRef += '&'; methodRef += '&';
@ -779,8 +654,7 @@ void JavaDocConverter::handleTagSee(DoxygenEntity& tag,
size_t lbrace = methodRef.find('('); size_t lbrace = methodRef.find('(');
size_t dblColon = methodRef.find("::"); size_t dblColon = methodRef.find("::");
if (dblColon < lbrace) { if (dblColon < lbrace) {
methodRef = methodRef.substr(0, dblColon) + '#' methodRef = methodRef.substr(0, dblColon) + '#' + methodRef.substr(dblColon + 2);
+ methodRef.substr(dblColon + 2);
} }
translatedComment += "@see "; translatedComment += "@see ";
@ -808,8 +682,7 @@ void JavaDocConverter::handleTagSee(DoxygenEntity& tag,
|-endline |-endline
* *
*/ */
int JavaDocConverter::shiftEndlinesUpTree(DoxygenEntity &root, int level) int JavaDocConverter::shiftEndlinesUpTree(DoxygenEntity &root, int level) {
{
DoxygenEntityListIt it = root.entityList.begin(); DoxygenEntityListIt it = root.entityList.begin();
while (it != root.entityList.end()) { while (it != root.entityList.end()) {
// remove line endings // remove line endings
@ -828,7 +701,7 @@ int JavaDocConverter::shiftEndlinesUpTree(DoxygenEntity &root, int level)
int removedCount = 0; int removedCount = 0;
while (!root.entityList.empty() while (!root.entityList.empty()
&& root.entityList.rbegin()->typeOfEntity == "plainstd::endl") { && root.entityList.rbegin()->typeOfEntity == "plainstd::endl") {
root.entityList.pop_back(); root.entityList.pop_back();
removedCount++; removedCount++;
} }
@ -841,8 +714,7 @@ int JavaDocConverter::shiftEndlinesUpTree(DoxygenEntity &root, int level)
* to indentation of the first line. Indentation of non-empty lines is not * to indentation of the first line. Indentation of non-empty lines is not
* changed - garbage in garbage out. * changed - garbage in garbage out.
*/ */
std::string JavaDocConverter::indentAndInsertAsterisks(const string &doc) std::string JavaDocConverter::indentAndInsertAsterisks(const string &doc) {
{
size_t idx = doc.find('\n'); size_t idx = doc.find('\n');
size_t indent = 0; size_t indent = 0;
@ -857,10 +729,10 @@ std::string JavaDocConverter::indentAndInsertAsterisks(const string &doc)
} }
} }
if (indent == 0) { // we can't indent the first line less than 0 if (indent == 0) {
// we can't indent the first line less than 0
indent = 1; indent = 1;
} }
// Create the first line of Javadoc comment. // Create the first line of Javadoc comment.
string indentStr(indent - 1, ' '); string indentStr(indent - 1, ' ');
string translatedStr = indentStr + "/**"; string translatedStr = indentStr + "/**";
@ -881,13 +753,11 @@ std::string JavaDocConverter::indentAndInsertAsterisks(const string &doc)
// line without '*' found - is it empty? // line without '*' found - is it empty?
if (translatedStr[nonspaceIdx] != '\n') { if (translatedStr[nonspaceIdx] != '\n') {
// add '* ' to each line without it // add '* ' to each line without it
translatedStr = translatedStr.substr(0, nonspaceIdx) + "* " translatedStr = translatedStr.substr(0, nonspaceIdx) + "* " + translatedStr.substr(nonspaceIdx);
+ translatedStr.substr(nonspaceIdx);
//printf(translatedStr.c_str()); //printf(translatedStr.c_str());
} else { } else {
// we found empty line, replace it with indented '*' // we found empty line, replace it with indented '*'
translatedStr = translatedStr.substr(0, idx + 1) + indentStr + "* " translatedStr = translatedStr.substr(0, idx + 1) + indentStr + "* " + translatedStr.substr(nonspaceIdx);
+ translatedStr.substr(nonspaceIdx);
} }
} }
idx = translatedStr.find('\n', nonspaceIdx); idx = translatedStr.find('\n', nonspaceIdx);
@ -908,8 +778,7 @@ std::string JavaDocConverter::indentAndInsertAsterisks(const string &doc)
return translatedStr; return translatedStr;
} }
String *JavaDocConverter::makeDocumentation(Node *node) String *JavaDocConverter::makeDocumentation(Node *node) {
{
String *documentation = getDoxygenComment(node); String *documentation = getDoxygenComment(node);
@ -919,7 +788,7 @@ String *JavaDocConverter::makeDocumentation(Node *node)
if (GetFlag(node, "feature:doxygen:notranslate")) { if (GetFlag(node, "feature:doxygen:notranslate")) {
string doc = Char (documentation); string doc = Char(documentation);
string translatedStr = indentAndInsertAsterisks(doc); string translatedStr = indentAndInsertAsterisks(doc);
@ -936,7 +805,6 @@ String *JavaDocConverter::makeDocumentation(Node *node)
std::cout << "---RESORTED LIST---" << std::endl; std::cout << "---RESORTED LIST---" << std::endl;
printTree(entityList); printTree(entityList);
} }
// store the current node // store the current node
// (currently just to handle params) // (currently just to handle params)
currentNode = node; currentNode = node;
@ -949,13 +817,13 @@ String *JavaDocConverter::makeDocumentation(Node *node)
// strip line endings at the beginning // strip line endings at the beginning
while (!root.entityList.empty() while (!root.entityList.empty()
&& root.entityList.begin()->typeOfEntity == "plainstd::endl") { && root.entityList.begin()->typeOfEntity == "plainstd::endl") {
root.entityList.pop_front(); root.entityList.pop_front();
} }
// and at the end // and at the end
while (!root.entityList.empty() while (!root.entityList.empty()
&& root.entityList.rbegin()->typeOfEntity == "plainstd::endl") { && root.entityList.rbegin()->typeOfEntity == "plainstd::endl") {
root.entityList.pop_back(); root.entityList.pop_back();
} }
@ -971,8 +839,6 @@ String *JavaDocConverter::makeDocumentation(Node *node)
return NewString(javaDocString.c_str()); return NewString(javaDocString.c_str());
} }
void JavaDocConverter::addError(int warningType, const std::string &message) void JavaDocConverter::addError(int warningType, const std::string &message) {
{ Swig_warning(warningType, "", 0, "Doxygen parser warning: %s. \n", message.c_str());
Swig_warning(warningType, "", 0, "Doxygen parser warning: %s. \n",
message.c_str());
} }

View file

@ -30,15 +30,18 @@ protected:
* Used to properly format JavaDoc-style command * Used to properly format JavaDoc-style command
*/ */
std::string formatCommand(std::string unformattedLine, int indent); std::string formatCommand(std::string unformattedLine, int indent);
/* /*
* Translate every entity in a tree. * Translate every entity in a tree.
*/ */
std::string translateSubtree(DoxygenEntity & doxygenEntity); std::string translateSubtree(DoxygenEntity &doxygenEntity);
/* /*
* Translate one entity with the appropriate handler, according * Translate one entity with the appropriate handler, according
* to the tagHandlers * to the tagHandlers
*/ */
void translateEntity(DoxygenEntity &tag, std::string &translatedComment); void translateEntity(DoxygenEntity &tag, std::string &translatedComment);
/* /*
* Fix all endlines location, etc * Fix all endlines location, etc
*/ */
@ -53,18 +56,15 @@ protected:
* Typedef for the function that handles one tag * Typedef for the function that handles one tag
* arg - some string argument to easily pass it through lookup table * arg - some string argument to easily pass it through lookup table
*/ */
typedef void (JavaDocConverter::*tagHandler)(DoxygenEntity &tag, typedef void (JavaDocConverter::*tagHandler) (DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
std::string &translatedComment, std::string &arg);
/** /**
* Copies verbatim args of the tag to output, used for commands like \f$, ... * Copies verbatim args of the tag to output, used for commands like \f$, ...
*/ */
void handleTagVerbatim(DoxygenEntity& tag, std::string& translatedComment, std::string &arg); void handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/** Creates anchor link. */ /** Creates anchor link. */
void handleTagAnchor(DoxygenEntity& tag, void handleTagAnchor(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
std::string& translatedComment,
std::string &arg);
/* /*
* Wrap the command data with the html tag * Wrap the command data with the html tag
@ -73,80 +73,87 @@ protected:
void handleTagHtml(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagHtml(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* Handles HTML tags recognized by Doxygen, like <A ...>, <ul>, <table>, ... */ /* Handles HTML tags recognized by Doxygen, like <A ...>, <ul>, <table>, ... */
void handleDoxyHtmlTag(DoxygenEntity& tag, void handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
std::string& translatedComment,
std::string &arg);
/* Handles HTML entities recognized by Doxygen, like &lt;, &copy;, ... */ /* Handles HTML entities recognized by Doxygen, like &lt;, &copy;, ... */
void handleHtmlEntity(DoxygenEntity& tag, void handleHtmlEntity(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
std::string& translatedComment,
std::string &arg);
/* /*
* Just prints new line * Just prints new line
*/ */
void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Print the name of tag to the output, used for escape-commands * Print the name of tag to the output, used for escape-commands
* arg - html-escaped variant, if not provided the command data is used * arg - html-escaped variant, if not provided the command data is used
*/ */
void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Do not translate and print as-is * Do not translate and print as-is
* arg - the new tag name, if it needs to be renamed * arg - the new tag name, if it needs to be renamed
*/ */
void handleTagSame(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagSame(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Print only the content and strip original tag * Print only the content and strip original tag
*/ */
void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Print only data part of code * Print only data part of code
*/ */
void handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Print extended Javadoc command, like {@code ...} or {@literal ...} * Print extended Javadoc command, like {@code ...} or {@literal ...}
* arg - command name * arg - command name
*/ */
void handleTagExtended(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagExtended(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Print the if-elseif-else-endif section * Print the if-elseif-else-endif section
*/ */
void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Prints the specified message, than the contents of the tag * Prints the specified message, than the contents of the tag
* arg - message * arg - message
*/ */
void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Insert <img src=... /> tag if the 'format' field is specified as 'html' * Insert <img src=... /> tag if the 'format' field is specified as 'html'
*/ */
void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Insert <p alt='title'>...</p> * Insert <p alt='title'>...</p>
*/ */
void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Insert \@param command, if it is really a function param * Insert \@param command, if it is really a function param
*/ */
void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Writes link for \ref tag. * Writes link for \ref tag.
*/ */
void handleTagRef(DoxygenEntity& tag, std::string& translatedComment, void handleTagRef(DoxygenEntity &tag, std::string &translatedComment, std::string &);
std::string&);
/* /*
* Insert {@link...} command, and handle all the <link-object>s correctly * Insert {@link...} command, and handle all the <link-object>s correctly
* (like converting types of params, etc) * (like converting types of params, etc)
*/ */
void handleTagLink(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagLink(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
/* /*
* Insert @see command, and handle all the <link-object>s correctly * Insert @see command, and handle all the <link-object>s correctly
* (like converting types of params, etc) * (like converting types of params, etc)
*/ */
void handleTagSee(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); void handleTagSee(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
private: private:
Node *currentNode; Node *currentNode;
// this contains the handler pointer and one string argument // this contains the handler pointer and one string argument

View file

@ -28,18 +28,14 @@ using std::string;
// Helper class increasing the provided indent string in its ctor and decreasing // Helper class increasing the provided indent string in its ctor and decreasing
// it in its dtor. // it in its dtor.
class IndentGuard class IndentGuard {
{
public: public:
// One indent level. // One indent level.
static const char* Level() { return " "; } static const char *Level() {
return " ";
// Default ctor doesn't do anything and prevents the dtor from doing anything }
// too and should only be used when the guard needs to be initialized // Default ctor doesn't do anything and prevents the dtor from doing anything// too and should only be used when the guard needs to be initialized// conditionally as Init() can then be called after checking some condition.// Otherwise, prefer to use the non default ctor below.
// conditionally as Init() can then be called after checking some condition. IndentGuard() {
// Otherwise, prefer to use the non default ctor below.
IndentGuard()
{
m_initialized = false; m_initialized = false;
} }
@ -47,14 +43,12 @@ public:
// extra indent added to it in the dtor and the variable containing the indent // extra indent added to it in the dtor and the variable containing the indent
// to use, which must be used after every new line by the code actually // to use, which must be used after every new line by the code actually
// updating the output. // updating the output.
IndentGuard(string& output, string& indent) IndentGuard(string &output, string &indent) {
{
Init(output, indent); Init(output, indent);
} }
// Really initializes the object created using the default ctor. // Really initializes the object created using the default ctor.
void Init(string& output, string& indent) void Init(string &output, string &indent) {
{
m_output = &output; m_output = &output;
m_indent = &indent; m_indent = &indent;
@ -77,10 +71,11 @@ public:
// Get the indent for the first line of the paragraph, which is smaller than // Get the indent for the first line of the paragraph, which is smaller than
// the indent for the subsequent lines. // the indent for the subsequent lines.
string getFirstLineIndent() const { return string(m_firstLineIndent, ' '); } string getFirstLineIndent() const {
return string(m_firstLineIndent, ' ');
}
~IndentGuard() ~IndentGuard() {
{
if (!m_initialized) if (!m_initialized)
return; return;
@ -93,24 +88,23 @@ public:
if (m_output->length() > lenIndentLevel) { if (m_output->length() > lenIndentLevel) {
const size_t start = m_output->length() - lenIndentLevel; const size_t start = m_output->length() - lenIndentLevel;
if (m_output->compare(start, string::npos, Level()) == 0) if (m_output->compare(start, string::npos, Level()) == 0)
m_output->erase(start); m_output->erase(start);
} }
} }
private: private:
string* m_output; string *m_output;
string* m_indent; string *m_indent;
unsigned m_firstLineIndent; unsigned m_firstLineIndent;
bool m_initialized; bool m_initialized;
IndentGuard(const IndentGuard&); IndentGuard(const IndentGuard &);
IndentGuard& operator=(const IndentGuard&); IndentGuard &operator=(const IndentGuard &);
}; };
// Return the indent of the given multiline string, i.e. the maximal number of // Return the indent of the given multiline string, i.e. the maximal number of
// spaces present in the beginning of all its non-empty lines. // spaces present in the beginning of all its non-empty lines.
static size_t determineIndent(const string& s) static size_t determineIndent(const string &s) {
{
size_t minIndent = static_cast<size_t>(-1); size_t minIndent = static_cast<size_t>(-1);
for (size_t lineStart = 0; lineStart < s.length();) { for (size_t lineStart = 0; lineStart < s.length();) {
@ -136,8 +130,7 @@ static size_t determineIndent(const string& s)
return minIndent; return minIndent;
} }
static void trimWhitespace(string& s) static void trimWhitespace(string &s) {
{
const size_t lastNonSpace = s.find_last_not_of(' '); const size_t lastNonSpace = s.find_last_not_of(' ');
if (lastNonSpace == string::npos) if (lastNonSpace == string::npos)
s.clear(); s.clear();
@ -146,21 +139,16 @@ static void trimWhitespace(string& s)
} }
/* static */ /* static */
PyDocConverter::TagHandlersMap::mapped_type PyDocConverter::TagHandlersMap::mapped_type PyDocConverter::make_handler(tagHandler handler) {
PyDocConverter::make_handler(tagHandler handler)
{
return make_pair(handler, std::string()); return make_pair(handler, std::string());
} }
/* static */ /* static */
PyDocConverter::TagHandlersMap::mapped_type PyDocConverter::TagHandlersMap::mapped_type PyDocConverter::make_handler(tagHandler handler, const char *arg) {
PyDocConverter::make_handler(tagHandler handler, const char* arg)
{
return make_pair(handler, arg); return make_pair(handler, arg);
} }
void PyDocConverter::fillStaticTables() void PyDocConverter::fillStaticTables() {
{
if (tagHandlers.size()) // fill only once if (tagHandlers.size()) // fill only once
return; return;
@ -213,9 +201,7 @@ void PyDocConverter::fillStaticTables()
tagHandlers["details"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["details"] = make_handler(&PyDocConverter::handleParagraph);
tagHandlers["em"] = make_handler(&PyDocConverter::handleParagraph, " "); tagHandlers["em"] = make_handler(&PyDocConverter::handleParagraph, " ");
tagHandlers["example"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["example"] = make_handler(&PyDocConverter::handleParagraph);
tagHandlers["exception"] = tagHandlers["exception"] = tagHandlers["throw"] = tagHandlers["throws"] = make_handler(&PyDocConverter::handleTagException);
tagHandlers["throw"] =
tagHandlers["throws"] = make_handler(&PyDocConverter::handleTagException);
tagHandlers["htmlonly"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["htmlonly"] = make_handler(&PyDocConverter::handleParagraph);
tagHandlers["invariant"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["invariant"] = make_handler(&PyDocConverter::handleParagraph);
tagHandlers["latexonly"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["latexonly"] = make_handler(&PyDocConverter::handleParagraph);
@ -228,8 +214,7 @@ void PyDocConverter::fillStaticTables()
tagHandlers["remark"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["remark"] = make_handler(&PyDocConverter::handleParagraph);
tagHandlers["remarks"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["remarks"] = make_handler(&PyDocConverter::handleParagraph);
tagHandlers["sa"] = make_handler(&PyDocConverter::handleTagMessage, "See also: "); tagHandlers["sa"] = make_handler(&PyDocConverter::handleTagMessage, "See also: ");
tagHandlers["see"] = make_handler(&PyDocConverter::handleTagMessage, tagHandlers["see"] = make_handler(&PyDocConverter::handleTagMessage, "See also: ");
"See also: ");
tagHandlers["since"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["since"] = make_handler(&PyDocConverter::handleParagraph);
tagHandlers["short"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["short"] = make_handler(&PyDocConverter::handleParagraph);
tagHandlers["todo"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["todo"] = make_handler(&PyDocConverter::handleParagraph);
@ -239,27 +224,21 @@ void PyDocConverter::fillStaticTables()
tagHandlers["xmlonly"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["xmlonly"] = make_handler(&PyDocConverter::handleParagraph);
// these commands have special handlers // these commands have special handlers
tagHandlers["arg"] = make_handler(&PyDocConverter::handleTagMessage, "* "); tagHandlers["arg"] = make_handler(&PyDocConverter::handleTagMessage, "* ");
tagHandlers["cond"] = make_handler(&PyDocConverter::handleTagMessage, tagHandlers["cond"] = make_handler(&PyDocConverter::handleTagMessage, "Conditional comment: ");
"Conditional comment: ");
tagHandlers["else"] = make_handler(&PyDocConverter::handleTagIf, "Else: "); tagHandlers["else"] = make_handler(&PyDocConverter::handleTagIf, "Else: ");
tagHandlers["elseif"] = make_handler(&PyDocConverter::handleTagIf, "Else if: "); tagHandlers["elseif"] = make_handler(&PyDocConverter::handleTagIf, "Else if: ");
tagHandlers["endcond"] = make_handler(&PyDocConverter::handleTagMessage, tagHandlers["endcond"] = make_handler(&PyDocConverter::handleTagMessage, "End of conditional comment.");
"End of conditional comment.");
tagHandlers["if"] = make_handler(&PyDocConverter::handleTagIf, "If: "); tagHandlers["if"] = make_handler(&PyDocConverter::handleTagIf, "If: ");
tagHandlers["ifnot"] = make_handler(&PyDocConverter::handleTagIf, "If not: "); tagHandlers["ifnot"] = make_handler(&PyDocConverter::handleTagIf, "If not: ");
tagHandlers["image"] = make_handler(&PyDocConverter::handleTagImage); tagHandlers["image"] = make_handler(&PyDocConverter::handleTagImage);
tagHandlers["li"] = make_handler(&PyDocConverter::handleTagMessage, "* "); tagHandlers["li"] = make_handler(&PyDocConverter::handleTagMessage, "* ");
tagHandlers["overload"] = make_handler(&PyDocConverter::handleTagMessage, tagHandlers["overload"] = make_handler(&PyDocConverter::handleTagMessage,
"This is an overloaded member function, provided for" "This is an overloaded member function, provided for"
" convenience.\nIt differs from the above function only in what" " convenience.\nIt differs from the above function only in what" " argument(s) it accepts.");
" argument(s) it accepts.");
tagHandlers["par"] = make_handler(&PyDocConverter::handleTagPar); tagHandlers["par"] = make_handler(&PyDocConverter::handleTagPar);
tagHandlers["param"] = tagHandlers["param"] = tagHandlers["tparam"] = make_handler(&PyDocConverter::handleTagParam);
tagHandlers["tparam"] = make_handler(&PyDocConverter::handleTagParam);
tagHandlers["ref"] = make_handler(&PyDocConverter::handleTagRef); tagHandlers["ref"] = make_handler(&PyDocConverter::handleTagRef);
tagHandlers["result"] = tagHandlers["result"] = tagHandlers["return"] = tagHandlers["returns"] = make_handler(&PyDocConverter::handleTagReturn);
tagHandlers["return"] =
tagHandlers["returns"] = make_handler(&PyDocConverter::handleTagReturn);
// this command just prints it's contents // this command just prints it's contents
// (it is internal command of swig's parser, contains plain text) // (it is internal command of swig's parser, contains plain text)
@ -268,15 +247,12 @@ void PyDocConverter::fillStaticTables()
tagHandlers["n"] = make_handler(&PyDocConverter::handleNewLine); tagHandlers["n"] = make_handler(&PyDocConverter::handleNewLine);
// \f commands output literal Latex formula, which is still better than nothing. // \f commands output literal Latex formula, which is still better than nothing.
tagHandlers["f$"] = tagHandlers["f$"] = tagHandlers["f["] = tagHandlers["f{"] = make_handler(&PyDocConverter::handleMath);
tagHandlers["f["] =
tagHandlers["f{"] = make_handler(&PyDocConverter::handleMath);
// HTML tags // HTML tags
tagHandlers["<a"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_A); tagHandlers["<a"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_A);
tagHandlers["<b"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "**"); tagHandlers["<b"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "**");
tagHandlers["<blockquote"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_A, tagHandlers["<blockquote"] = make_handler(&PyDocConverter::handleDoxyHtmlTag_A, "Quote: ");
"Quote: ");
tagHandlers["<body"] = make_handler(&PyDocConverter::handleDoxyHtmlTag); tagHandlers["<body"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
tagHandlers["<br"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "\n"); tagHandlers["<br"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "\n");
@ -294,8 +270,7 @@ void PyDocConverter::fillStaticTables()
tagHandlers["<div"] = make_handler(&PyDocConverter::handleDoxyHtmlTag); tagHandlers["<div"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
tagHandlers["<em"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "**"); tagHandlers["<em"] = make_handler(&PyDocConverter::handleDoxyHtmlTag2, "**");
tagHandlers["<form"] = make_handler(&PyDocConverter::handleDoxyHtmlTag); tagHandlers["<form"] = make_handler(&PyDocConverter::handleDoxyHtmlTag);
tagHandlers["<hr"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, tagHandlers["<hr"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "--------------------------------------------------------------------\n");
"--------------------------------------------------------------------\n");
tagHandlers["<h1"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "# "); tagHandlers["<h1"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "# ");
tagHandlers["<h2"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "## "); tagHandlers["<h2"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "## ");
tagHandlers["<h3"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "### "); tagHandlers["<h3"] = make_handler(&PyDocConverter::handleDoxyHtmlTag, "### ");
@ -351,17 +326,13 @@ void PyDocConverter::fillStaticTables()
tagHandlers["&rarr"] = make_handler(&PyDocConverter::handleHtmlEntity, "-->"); tagHandlers["&rarr"] = make_handler(&PyDocConverter::handleHtmlEntity, "-->");
} }
PyDocConverter::PyDocConverter(int flags) : PyDocConverter::PyDocConverter(int flags):
DoxygenTranslator(flags), m_tableLineLen(0), m_prevRowIsTH( DoxygenTranslator(flags), m_tableLineLen(0), m_prevRowIsTH(false) {
false)
{
fillStaticTables(); fillStaticTables();
} }
// Return the type as it should appear in the output documentation. // Return the type as it should appear in the output documentation.
static static std::string getPyDocType(Node *n, const_String_or_char_ptr lname = "") {
std::string getPyDocType(Node* n, const_String_or_char_ptr lname = "")
{
std::string type; std::string type;
String *s = Swig_typemap_lookup("doctype", n, lname, 0); String *s = Swig_typemap_lookup("doctype", n, lname, 0);
@ -371,13 +342,13 @@ std::string getPyDocType(Node* n, const_String_or_char_ptr lname = "")
if (Language::classLookup(s)) { if (Language::classLookup(s)) {
// In Python C++ namespaces are flattened, so remove all but last component // In Python C++ namespaces are flattened, so remove all but last component
// of the name. // of the name.
String * const last = Swig_scopename_last(s); String *const last = Swig_scopename_last(s);
// We are not actually sure whether it's a documented class or not, but // We are not actually sure whether it's a documented class or not, but
// there doesn't seem to be any harm in making it a reference if it isn't, // there doesn't seem to be any harm in making it a reference if it isn't,
// while there is a lot of benefit in having a hyperlink if it is. // while there is a lot of benefit in having a hyperlink if it is.
type = ":py:class:`"; type = ":py:class:`";
type += Char (last); type += Char(last);
type += "`"; type += "`";
Delete(last); Delete(last);
@ -390,14 +361,13 @@ std::string getPyDocType(Node* n, const_String_or_char_ptr lname = "")
return type; return type;
} }
std::string PyDocConverter::getParamType(std::string param) std::string PyDocConverter::getParamType(std::string param) {
{
std::string type; std::string type;
ParmList *plist = CopyParmList(Getattr(currentNode, "parms")); ParmList *plist = CopyParmList(Getattr(currentNode, "parms"));
for (Parm *p = plist; p;p = nextSibling(p)) { for (Parm *p = plist; p; p = nextSibling(p)) {
String* pname = Getattr(p, "name"); String *pname = Getattr(p, "name");
if (Char (pname) != param) if (Char(pname) != param)
continue; continue;
type = getPyDocType(p, pname); type = getPyDocType(p, pname);
@ -407,8 +377,7 @@ std::string PyDocConverter::getParamType(std::string param)
return type; return type;
} }
std::string PyDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) std::string PyDocConverter::translateSubtree(DoxygenEntity &doxygenEntity) {
{
std::string translatedComment; std::string translatedComment;
if (doxygenEntity.isLeaf) if (doxygenEntity.isLeaf)
@ -433,28 +402,19 @@ std::string PyDocConverter::translateSubtree(DoxygenEntity & doxygenEntity)
return translatedComment; return translatedComment;
} }
void PyDocConverter::translateEntity(DoxygenEntity & doxyEntity, void PyDocConverter::translateEntity(DoxygenEntity &doxyEntity, std::string &translatedComment) {
std::string &translatedComment)
{
// check if we have needed handler and call it // check if we have needed handler and call it
std::map<std::string, std::pair<tagHandler, std::string> >::iterator it; std::map<std::string, std::pair<tagHandler, std::string> >::iterator it;
it = tagHandlers.find(doxyEntity.typeOfEntity); it = tagHandlers.find(doxyEntity.typeOfEntity);
if (it != tagHandlers.end()) if (it != tagHandlers.end())
(this->*(it->second.first))(doxyEntity, translatedComment, (this->*(it->second.first)) (doxyEntity, translatedComment, it->second.second);
it->second.second);
} }
void PyDocConverter::handleParagraph(DoxygenEntity& tag, void PyDocConverter::handleParagraph(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string&)
{
translatedComment += translateSubtree(tag); translatedComment += translateSubtree(tag);
} }
void PyDocConverter::handleMath(DoxygenEntity &tag, void PyDocConverter::handleMath(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string &translatedComment,
const std::string& arg)
{
IndentGuard indent; IndentGuard indent;
// Only \f$ is translated to inline formulae, \f[ and \f{ are for the block ones. // Only \f$ is translated to inline formulae, \f[ and \f{ are for the block ones.
@ -507,10 +467,7 @@ void PyDocConverter::handleMath(DoxygenEntity &tag,
} }
} }
void PyDocConverter::handleCode(DoxygenEntity &tag, void PyDocConverter::handleCode(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string &translatedComment,
const std::string &arg)
{
IndentGuard indent(translatedComment, m_indent); IndentGuard indent(translatedComment, m_indent);
trimWhitespace(translatedComment); trimWhitespace(translatedComment);
@ -552,43 +509,27 @@ void PyDocConverter::handleCode(DoxygenEntity &tag,
translatedComment += '\n'; translatedComment += '\n';
} }
void PyDocConverter::handlePlainString(DoxygenEntity& tag, void PyDocConverter::handlePlainString(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string&)
{
translatedComment += tag.data; translatedComment += tag.data;
} }
void PyDocConverter::handleTagVerbatim(DoxygenEntity& tag, void PyDocConverter::handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
translatedComment += arg + " "; translatedComment += arg + " ";
for (DoxygenEntityListCIt it = tag.entityList.begin(); for (DoxygenEntityListCIt it = tag.entityList.begin(); it != tag.entityList.end(); it++) {
it != tag.entityList.end(); it++) {
translatedComment += it->data; translatedComment += it->data;
} }
} }
void PyDocConverter::handleTagMessage(DoxygenEntity& tag, void PyDocConverter::handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
translatedComment += arg; translatedComment += arg;
handleParagraph(tag, translatedComment); handleParagraph(tag, translatedComment);
} }
void PyDocConverter::handleTagChar(DoxygenEntity& tag, void PyDocConverter::handleTagChar(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string&)
{
translatedComment += tag.typeOfEntity; translatedComment += tag.typeOfEntity;
} }
void PyDocConverter::handleTagIf(DoxygenEntity& tag, void PyDocConverter::handleTagIf(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
translatedComment += arg; translatedComment += arg;
if (tag.entityList.size()) { if (tag.entityList.size()) {
translatedComment += tag.entityList.begin()->data; translatedComment += tag.entityList.begin()->data;
@ -597,10 +538,7 @@ void PyDocConverter::handleTagIf(DoxygenEntity& tag,
} }
} }
void PyDocConverter::handleTagPar(DoxygenEntity& tag, void PyDocConverter::handleTagPar(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string&)
{
translatedComment += "Title: "; translatedComment += "Title: ";
if (tag.entityList.size()) if (tag.entityList.size())
translatedComment += tag.entityList.begin()->data; translatedComment += tag.entityList.begin()->data;
@ -608,10 +546,7 @@ void PyDocConverter::handleTagPar(DoxygenEntity& tag,
handleParagraph(tag, translatedComment); handleParagraph(tag, translatedComment);
} }
void PyDocConverter::handleTagImage(DoxygenEntity& tag, void PyDocConverter::handleTagImage(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string&)
{
if (tag.entityList.size() < 2) if (tag.entityList.size() < 2)
return; return;
tag.entityList.pop_front(); tag.entityList.pop_front();
@ -622,10 +557,7 @@ void PyDocConverter::handleTagImage(DoxygenEntity& tag,
translatedComment += "(" + tag.entityList.begin()->data + ")"; translatedComment += "(" + tag.entityList.begin()->data + ")";
} }
void PyDocConverter::handleTagParam(DoxygenEntity& tag, void PyDocConverter::handleTagParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string&)
{
if (tag.entityList.size() < 2) if (tag.entityList.size() < 2)
return; return;
@ -634,7 +566,7 @@ void PyDocConverter::handleTagParam(DoxygenEntity& tag,
DoxygenEntity paramNameEntity = *tag.entityList.begin(); DoxygenEntity paramNameEntity = *tag.entityList.begin();
tag.entityList.pop_front(); tag.entityList.pop_front();
const std::string& paramName = paramNameEntity.data; const std::string &paramName = paramNameEntity.data;
const std::string paramType = getParamType(paramName); const std::string paramType = getParamType(paramName);
if (!paramType.empty()) { if (!paramType.empty()) {
@ -648,10 +580,7 @@ void PyDocConverter::handleTagParam(DoxygenEntity& tag,
} }
void PyDocConverter::handleTagReturn(DoxygenEntity &tag, void PyDocConverter::handleTagReturn(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string &translatedComment,
const std::string &)
{
IndentGuard indent(translatedComment, m_indent); IndentGuard indent(translatedComment, m_indent);
const std::string pytype = getPyDocType(currentNode); const std::string pytype = getPyDocType(currentNode);
@ -667,10 +596,7 @@ void PyDocConverter::handleTagReturn(DoxygenEntity &tag,
} }
void PyDocConverter::handleTagException(DoxygenEntity &tag, void PyDocConverter::handleTagException(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string &translatedComment,
const std::string &)
{
IndentGuard indent(translatedComment, m_indent); IndentGuard indent(translatedComment, m_indent);
translatedComment += ":raises: "; translatedComment += ":raises: ";
@ -678,10 +604,7 @@ void PyDocConverter::handleTagException(DoxygenEntity &tag,
} }
void PyDocConverter::handleTagRef(DoxygenEntity& tag, void PyDocConverter::handleTagRef(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string&)
{
if (!tag.entityList.size()) if (!tag.entityList.size())
return; return;
@ -695,26 +618,19 @@ void PyDocConverter::handleTagRef(DoxygenEntity& tag,
} }
void PyDocConverter::handleTagWrap(DoxygenEntity& tag, void PyDocConverter::handleTagWrap(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
if (tag.entityList.size()) { // do not include empty tags if (tag.entityList.size()) { // do not include empty tags
std::string tagData = translateSubtree(tag); std::string tagData = translateSubtree(tag);
// wrap the thing, ignoring whitespace // wrap the thing, ignoring whitespace
size_t wsPos = tagData.find_last_not_of("\n\t "); size_t wsPos = tagData.find_last_not_of("\n\t ");
if (wsPos != std::string::npos && wsPos != tagData.size() - 1) if (wsPos != std::string::npos && wsPos != tagData.size() - 1)
translatedComment += arg + tagData.substr(0, wsPos + 1) + arg translatedComment += arg + tagData.substr(0, wsPos + 1) + arg + tagData.substr(wsPos + 1);
+ tagData.substr(wsPos + 1);
else else
translatedComment += arg + tagData + arg; translatedComment += arg + tagData + arg;
} }
} }
void PyDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag, void PyDocConverter::handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
std::string htmlTagArgs = tag.data; std::string htmlTagArgs = tag.data;
if (htmlTagArgs == "/") { if (htmlTagArgs == "/") {
// end html tag, for example "</ul> // end html tag, for example "</ul>
@ -724,10 +640,7 @@ void PyDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag,
} }
} }
void PyDocConverter::handleDoxyHtmlTagNoParam(DoxygenEntity& tag, void PyDocConverter::handleDoxyHtmlTagNoParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
std::string htmlTagArgs = tag.data; std::string htmlTagArgs = tag.data;
if (htmlTagArgs == "/") { if (htmlTagArgs == "/") {
// end html tag, for example "</ul> // end html tag, for example "</ul>
@ -736,10 +649,7 @@ void PyDocConverter::handleDoxyHtmlTagNoParam(DoxygenEntity& tag,
} }
} }
void PyDocConverter::handleDoxyHtmlTag_A(DoxygenEntity& tag, void PyDocConverter::handleDoxyHtmlTag_A(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
std::string htmlTagArgs = tag.data; std::string htmlTagArgs = tag.data;
if (htmlTagArgs == "/") { if (htmlTagArgs == "/") {
// end html tag, "</a> // end html tag, "</a>
@ -755,10 +665,7 @@ void PyDocConverter::handleDoxyHtmlTag_A(DoxygenEntity& tag,
} }
} }
void PyDocConverter::handleDoxyHtmlTag2(DoxygenEntity& tag, void PyDocConverter::handleDoxyHtmlTag2(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
std::string htmlTagArgs = tag.data; std::string htmlTagArgs = tag.data;
if (htmlTagArgs == "/") { if (htmlTagArgs == "/") {
// end html tag, for example "</em> // end html tag, for example "</em>
@ -768,18 +675,14 @@ void PyDocConverter::handleDoxyHtmlTag2(DoxygenEntity& tag,
} }
} }
void PyDocConverter::handleDoxyHtmlTag_tr(DoxygenEntity& tag, void PyDocConverter::handleDoxyHtmlTag_tr(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string &)
{
std::string htmlTagArgs = tag.data; std::string htmlTagArgs = tag.data;
size_t nlPos = translatedComment.rfind('\n'); size_t nlPos = translatedComment.rfind('\n');
if (htmlTagArgs == "/") { if (htmlTagArgs == "/") {
// end tag, </tr> appends vertical table line '|' // end tag, </tr> appends vertical table line '|'
translatedComment += '|'; translatedComment += '|';
if (nlPos != string::npos) { if (nlPos != string::npos) {
size_t startOfTableLinePos = translatedComment.find_first_not_of(" \t", size_t startOfTableLinePos = translatedComment.find_first_not_of(" \t", nlPos + 1);
nlPos + 1);
if (startOfTableLinePos != string::npos) { if (startOfTableLinePos != string::npos) {
m_tableLineLen = translatedComment.size() - startOfTableLinePos; m_tableLineLen = translatedComment.size() - startOfTableLinePos;
} }
@ -800,10 +703,7 @@ void PyDocConverter::handleDoxyHtmlTag_tr(DoxygenEntity& tag,
} }
} }
void PyDocConverter::handleDoxyHtmlTag_th(DoxygenEntity& tag, void PyDocConverter::handleDoxyHtmlTag_th(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string &)
{
std::string htmlTagArgs = tag.data; std::string htmlTagArgs = tag.data;
if (htmlTagArgs == "/") { if (htmlTagArgs == "/") {
// end tag, </th> is ignored // end tag, </th> is ignored
@ -813,10 +713,7 @@ void PyDocConverter::handleDoxyHtmlTag_th(DoxygenEntity& tag,
} }
} }
void PyDocConverter::handleDoxyHtmlTag_td(DoxygenEntity& tag, void PyDocConverter::handleDoxyHtmlTag_td(DoxygenEntity &tag, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string &)
{
std::string htmlTagArgs = tag.data; std::string htmlTagArgs = tag.data;
if (htmlTagArgs == "/") { if (htmlTagArgs == "/") {
// end tag, </td> is ignored // end tag, </td> is ignored
@ -825,18 +722,12 @@ void PyDocConverter::handleDoxyHtmlTag_td(DoxygenEntity& tag,
} }
} }
void PyDocConverter::handleHtmlEntity(DoxygenEntity&, void PyDocConverter::handleHtmlEntity(DoxygenEntity &, std::string &translatedComment, const std::string &arg) {
std::string& translatedComment,
const std::string &arg)
{
// html entities // html entities
translatedComment += arg; translatedComment += arg;
} }
void PyDocConverter::handleNewLine(DoxygenEntity&, void PyDocConverter::handleNewLine(DoxygenEntity &, std::string &translatedComment, const std::string &) {
std::string& translatedComment,
const std::string&)
{
trimWhitespace(translatedComment); trimWhitespace(translatedComment);
translatedComment += "\n"; translatedComment += "\n";
@ -844,8 +735,7 @@ void PyDocConverter::handleNewLine(DoxygenEntity&,
translatedComment += m_indent; translatedComment += m_indent;
} }
String *PyDocConverter::makeDocumentation(Node *n) String *PyDocConverter::makeDocumentation(Node *n) {
{
String *documentation; String *documentation;
std::string pyDocString; std::string pyDocString;
@ -873,7 +763,7 @@ String *PyDocConverter::makeDocumentation(Node *n)
String *comment = NewString(""); String *comment = NewString("");
Append(comment, documentation); Append(comment, documentation);
Replaceall(comment, "\n *", "\n"); Replaceall(comment, "\n *", "\n");
oneDoc = Char (comment); oneDoc = Char(comment);
Delete(comment); Delete(comment);
} else { } else {
std::list<DoxygenEntity> entityList = parser.createTree(n, documentation); std::list<DoxygenEntity> entityList = parser.createTree(n, documentation);
@ -898,12 +788,10 @@ String *PyDocConverter::makeDocumentation(Node *n)
if (allDocumentation.size() > 1) { if (allDocumentation.size() > 1) {
string indentStr; string indentStr;
if (minIndent != static_cast<size_t>(-1)) if (minIndent != static_cast<size_t>(-1))
indentStr.assign(minIndent, ' '); indentStr.assign(minIndent, ' ');
std::ostringstream concatDocString; std::ostringstream concatDocString;
for (size_t realOverloadCount = 0; for (size_t realOverloadCount = 0; realOverloadCount < allDocumentation.size(); realOverloadCount++) {
realOverloadCount < allDocumentation.size();
realOverloadCount++) {
if (realOverloadCount != 0) { if (realOverloadCount != 0) {
// separate it from the preceding one. // separate it from the preceding one.
concatDocString << "\n" << indentStr << "|\n\n"; concatDocString << "\n" << indentStr << "|\n\n";
@ -911,8 +799,7 @@ String *PyDocConverter::makeDocumentation(Node *n)
oneDoc = allDocumentation[realOverloadCount]; oneDoc = allDocumentation[realOverloadCount];
trimWhitespace(oneDoc); trimWhitespace(oneDoc);
concatDocString << indentStr << "*Overload " << (realOverloadCount + 1) << ":*\n" concatDocString << indentStr << "*Overload " << (realOverloadCount + 1) << ":*\n" << oneDoc;
<< oneDoc;
} }
pyDocString = concatDocString.str(); pyDocString = concatDocString.str();
} else if (allDocumentation.size() == 1) { } else if (allDocumentation.size() == 1) {
@ -927,7 +814,7 @@ String *PyDocConverter::makeDocumentation(Node *n)
String *comment = NewString(""); String *comment = NewString("");
Append(comment, documentation); Append(comment, documentation);
Replaceall(comment, "\n *", "\n"); Replaceall(comment, "\n *", "\n");
pyDocString = Char (comment); pyDocString = Char(comment);
Delete(comment); Delete(comment);
} else { } else {
std::list<DoxygenEntity> entityList = parser.createTree(n, documentation); std::list<DoxygenEntity> entityList = parser.createTree(n, documentation);

View file

@ -20,8 +20,8 @@
#include "DoxygenEntity.h" #include "DoxygenEntity.h"
#include "DoxygenTranslator.h" #include "DoxygenTranslator.h"
#define DOC_STRING_LENGTH 64 // characters per line allowed #define DOC_STRING_LENGTH 64 // characters per line allowed
#define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type #define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type
class PyDocConverter : public DoxygenTranslator { class PyDocConverter : public DoxygenTranslator {
public: public:
@ -39,42 +39,45 @@ protected:
* display. Prints title for every group of tags that have * display. Prints title for every group of tags that have
* a section title associated with them * a section title associated with them
*/ */
std::string translateSubtree(DoxygenEntity & doxygenEntity); std::string translateSubtree(DoxygenEntity &doxygenEntity);
/* /*
* Translate one entity with the appropriate handler, according * Translate one entity with the appropriate handler, according
* to the tagHandlers * to the tagHandlers
*/ */
void translateEntity(DoxygenEntity & doxyEntity, std::string &translatedComment); void translateEntity(DoxygenEntity &doxyEntity, std::string &translatedComment);
/* /*
* Typedef for the function that handles one tag * Typedef for the function that handles one tag
* arg - some string argument to easily pass it through lookup table * arg - some string argument to easily pass it through lookup table
*/ */
typedef void (PyDocConverter::*tagHandler)(DoxygenEntity &tag, typedef void (PyDocConverter::*tagHandler) (DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
std::string &translatedComment, const std::string &arg);
/* /*
* Wrap the command data with the some string * Wrap the command data with the some string
* arg - string to wrap with, like '_' or '*' * arg - string to wrap with, like '_' or '*'
*/ */
void handleTagWrap(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagWrap(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Just prints new line * Just prints new line
*/ */
void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Print the name of tag to the output, used for escape-commands * Print the name of tag to the output, used for escape-commands
*/ */
void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Format the contents of the \exception tag or its synonyms. * Format the contents of the \exception tag or its synonyms.
*/ */
void handleTagException(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagException(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Print only the content and strip original tag * Print only the content and strip original tag
*/ */
void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg = std::string());
const std::string &arg = std::string());
/* /*
* Handle one of the Doxygen formula-related tags. * Handle one of the Doxygen formula-related tags.
@ -94,78 +97,73 @@ protected:
/** /**
* Copies verbatim args of the tag to output, used for commands like \f$, ... * Copies verbatim args of the tag to output, used for commands like \f$, ...
*/ */
void handleTagVerbatim(DoxygenEntity& tag, void handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
std::string& translatedComment,
const std::string &arg);
/* /*
* Print the if-elseif-else-endif section * Print the if-elseif-else-endif section
*/ */
void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Prints the specified message, than the contents of the tag * Prints the specified message, than the contents of the tag
* arg - message * arg - message
*/ */
void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Insert 'Title: ...' * Insert 'Title: ...'
*/ */
void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Insert 'Image: ...' * Insert 'Image: ...'
*/ */
void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Format nice param description with type information * Format nice param description with type information
*/ */
void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Format the contents of the \return tag or its synonyms. * Format the contents of the \return tag or its synonyms.
*/ */
void handleTagReturn(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); void handleTagReturn(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* /*
* Writes text for \ref tag. * Writes text for \ref tag.
*/ */
void handleTagRef(DoxygenEntity& tag, std::string& translatedComment, const std::string &arg); void handleTagRef(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/* Handles HTML tags recognized by Doxygen, like <A ...>, <ul>, <table>, ... */ /* Handles HTML tags recognized by Doxygen, like <A ...>, <ul>, <table>, ... */
void handleDoxyHtmlTag(DoxygenEntity& tag, std::string& translatedComment, const std::string &arg); void handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
/** Does not output params of HTML tag, for example in <table border='1'> /** Does not output params of HTML tag, for example in <table border='1'>
* 'border=1' is not written to output. * 'border=1' is not written to output.
*/ */
void handleDoxyHtmlTagNoParam(DoxygenEntity& tag, void handleDoxyHtmlTagNoParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
std::string& translatedComment,
const std::string &arg);
/** Translates tag <a href = "url">text</a> to: text ("url"). */ /** Translates tag <a href = "url">text</a> to: text ("url"). */
void handleDoxyHtmlTag_A(DoxygenEntity& tag, void handleDoxyHtmlTag_A(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
std::string& translatedComment,
const std::string &arg);
/* /*
* Handles HTML tags, which are translated to markdown-like syntax, for example * Handles HTML tags, which are translated to markdown-like syntax, for example
* <i>text</i> --> _text_. Appends arg for start HTML tag and end HTML tag. * <i>text</i> --> _text_. Appends arg for start HTML tag and end HTML tag.
*/ */
void handleDoxyHtmlTag2(DoxygenEntity& tag, void handleDoxyHtmlTag2(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
std::string& translatedComment,
const std::string &arg);
/* Handles HTML table, tag <tr> */ /* Handles HTML table, tag <tr> */
void handleDoxyHtmlTag_tr(DoxygenEntity& tag, std::string& translatedComment, void handleDoxyHtmlTag_tr(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
const std::string &arg);
/* Handles HTML table, tag <th> */ /* Handles HTML table, tag <th> */
void handleDoxyHtmlTag_th(DoxygenEntity& tag, std::string& translatedComment, void handleDoxyHtmlTag_th(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
const std::string &arg);
/* Handles HTML table, tag <td> */ /* Handles HTML table, tag <td> */
void handleDoxyHtmlTag_td(DoxygenEntity& tag, std::string& translatedComment, void handleDoxyHtmlTag_td(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg);
const std::string &arg);
/* Handles HTML entities recognized by Doxygen, like &lt;, &copy;, ... */ /* Handles HTML entities recognized by Doxygen, like &lt;, &copy;, ... */
void handleHtmlEntity(DoxygenEntity&, std::string& translatedComment, const std::string &arg); void handleHtmlEntity(DoxygenEntity &, std::string &translatedComment, const std::string &arg);
/* /*
@ -184,7 +182,7 @@ private:
// this contains the handler pointer and one string argument // this contains the handler pointer and one string argument
typedef std::map<std::string, std::pair<tagHandler, std::string> > TagHandlersMap; typedef std::map<std::string, std::pair<tagHandler, std::string> >TagHandlersMap;
static TagHandlersMap tagHandlers; static TagHandlersMap tagHandlers;
// this contains the sections tittles, like 'Arguments:' or 'Notes:', that are printed only once // this contains the sections tittles, like 'Arguments:' or 'Notes:', that are printed only once
@ -192,7 +190,7 @@ private:
// Helper functions for fillStaticTables(): make a new tag handler object. // Helper functions for fillStaticTables(): make a new tag handler object.
TagHandlersMap::mapped_type make_handler(tagHandler handler); TagHandlersMap::mapped_type make_handler(tagHandler handler);
TagHandlersMap::mapped_type make_handler(tagHandler handler, const char* arg); TagHandlersMap::mapped_type make_handler(tagHandler handler, const char *arg);
void fillStaticTables(); void fillStaticTables();
}; };