diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index ff2527ace..0be6a1851 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -21,7 +21,9 @@ const char *sectionIndicators[] = { "exception", "if", "ifnot", "invariant", "note", "par", "param", "tparam", "post", "pre", "remarks", "remark", "result", "return", "returns", "retval", "sa", "see", "since", "test", "throw", "throws", - "todo", "version", "warning", "xrefitem"}; + "todo", "version", "warning", "xrefitem" +}; + const int sectionIndicatorsSize = sizeof(sectionIndicators) / sizeof(*sectionIndicators); /* All of the doxygen commands divided up by how they are parsed */ @@ -31,7 +33,9 @@ const char *simpleCommands[] = { "endcond", "callgraph", "callergraph", "showinitializer", "hideinitializer", "internal", "nosubgrouping", "public", "publicsection", "private", "privatesection", - "protected", "protectedsection", "tableofcontents"}; + "protected", "protectedsection", "tableofcontents" +}; + const int simpleCommandsSize = sizeof(simpleCommands) / sizeof(*simpleCommands); const char *commandWords[] = { @@ -39,52 +43,72 @@ const char *commandWords[] = { "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno", "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude", "extends", "implements", "memberof", "related", "relatedalso", - "cite"}; + "cite" +}; + const int commandWordsSize = sizeof(commandWords) / sizeof(*commandWords); const char *commandLines[] = { "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", - "until", "property"}; + "until", "property" +}; + const int commandLinesSize = sizeof(commandLines) / sizeof(*commandLines); const char *commandParagraph[] = { "partofdescription", "result", "return", "returns", "remarks", "remark", "since", "test", "sa", "see", "pre", "post", "details", "invariant", "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 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 char *commandWordParagraphs[] = { - "param", "tparam", "throw", "throws", "retval", "exception", "example"}; + "param", "tparam", "throw", "throws", "retval", "exception", "example" +}; + const int commandWordParagraphsSize = sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); const char *commandWordLines[] = { "page", "subsection", "subsubsection", "section", "paragraph", "defgroup", - "snippet", "mainpage"}; + "snippet", "mainpage" +}; + const int commandWordLinesSize = sizeof(commandWordLines) / sizeof(*commandWordLines); const char *commandWordOWordOWords[] = { - "category", "class", "protocol", "interface", "struct", "union"}; + "category", "class", "protocol", "interface", "struct", "union" +}; + const int commandWordOWordOWordsSize = sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords); const char *commandOWords[] = { - "dir", "file", "cond"}; + "dir", "file", "cond" +}; + const int commandOWordsSize = sizeof(commandOWords) / sizeof(*commandOWords); const char *commandErrorThrowings[] = { "annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", "headerfilestd::list", "inherit", "l", "postheader", "endcode", "enddot", "endmsc", "endhtmlonly", "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endif", "else", - "endrtfonly"}; + "endrtfonly" +}; + const int commandErrorThrowingsSize = sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); const char *commandUniques[] = { "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); // 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 // are copied unchanged to output. -const char *commandHtmlEntities[] = { "©", "&trade", "®", // (C), (TM), (R) - "<", // less-than symbol - ">", // greater-than symbol - "&", // ampersand - "&apos", // single quotation mark (straight) - """, // double quotation mark (straight) - "&lsquo", // left single quotation mark - "&rsquo", // right single quotation mark - "&ldquo", // left double quotation mark - "&rdquo", // right double quotation mark - "&ndash", // n-dash (for numeric ranges, e.g. 2–8) - "&mdash", // -- - " ", // - "×", // x - "&minus", // - - "&sdot", // . - "&sim", // ~ - "&le", // <= - "&ge", // >= - "&larr", // <-- - "&rarr" // --> +const char *commandHtmlEntities[] = { + "©", // (C) + "&trade", // (TM) + "®", // (R) + "<", // less-than symbol + ">", // greater-than symbol + "&", // ampersand + "&apos", // single quotation mark (straight) + """, // double quotation mark (straight) + "&lsquo", // left single quotation mark + "&rsquo", // right single quotation mark + "&ldquo", // left double quotation mark + "&rdquo", // right double quotation mark + "&ndash", // n-dash (for numeric ranges, e.g. 2–8) + "&mdash", // -- + " ", // + "×", // x + "&minus", // - + "&sdot", // . + "&sim", // ~ + "&le", // <= + "&ge", // >= + "&larr", // <-- + "&rarr" // --> }; const int commandHtmlEntitiesSize = sizeof(commandHtmlEntities) / sizeof(*commandHtmlEntities); diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.cpp b/Source/DoxygenTranslator/src/DoxygenEntity.cpp index 9e761c32b..98329e84f 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.cpp +++ b/Source/DoxygenTranslator/src/DoxygenEntity.cpp @@ -16,10 +16,8 @@ using std::cout; -DoxygenEntity::DoxygenEntity(const std::string &typeEnt) : - typeOfEntity(typeEnt), - isLeaf(true) -{} +DoxygenEntity::DoxygenEntity(const std::string &typeEnt):typeOfEntity(typeEnt), isLeaf(true) { +} /* Basic node for commands that have @@ -27,23 +25,15 @@ DoxygenEntity::DoxygenEntity(const std::string &typeEnt) : * example: \b word * OR holding a std::string */ -DoxygenEntity::DoxygenEntity(const std::string &typeEnt, - const std::string ¶m1) : - typeOfEntity(typeEnt), - data(param1), - isLeaf(true) -{} +DoxygenEntity::DoxygenEntity(const std::string &typeEnt, const std::string ¶m1) : typeOfEntity(typeEnt), data(param1), isLeaf(true) { +} /* Nonterminal node * contains */ -DoxygenEntity::DoxygenEntity(const std::string &typeEnt, - const DoxygenEntityList &entList) : - typeOfEntity(typeEnt), - isLeaf(false), - entityList(entList) -{} +DoxygenEntity::DoxygenEntity(const std::string &typeEnt, const DoxygenEntityList &entList) : typeOfEntity(typeEnt), isLeaf(false), entityList(entList) { +} void DoxygenEntity::printEntity(int level) const { diff --git a/Source/DoxygenTranslator/src/DoxygenEntity.h b/Source/DoxygenTranslator/src/DoxygenEntity.h index d7df95e91..29a0e2076 100644 --- a/Source/DoxygenTranslator/src/DoxygenEntity.h +++ b/Source/DoxygenTranslator/src/DoxygenEntity.h @@ -20,7 +20,7 @@ class DoxygenEntity; -typedef std::list DoxygenEntityList; +typedef std::list DoxygenEntityList; typedef DoxygenEntityList::iterator DoxygenEntityListIt; typedef DoxygenEntityList::const_iterator DoxygenEntityListCIt; @@ -37,7 +37,7 @@ public: DoxygenEntity(const std::string &typeEnt); DoxygenEntity(const std::string &typeEnt, const std::string ¶m1); - DoxygenEntity(const std::string & typeEnt, const DoxygenEntityList &entList); + DoxygenEntity(const std::string &typeEnt, const DoxygenEntityList &entList); void printEntity(int level) const; }; diff --git a/Source/DoxygenTranslator/src/DoxygenParser.cpp b/Source/DoxygenTranslator/src/DoxygenParser.cpp index faed5b931..c14cdb9fd 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.cpp +++ b/Source/DoxygenTranslator/src/DoxygenParser.cpp @@ -25,10 +25,7 @@ using std::endl; // This constant defines the (only) characters valid inside a Doxygen "word". // It includes some unusual ones because of the commands such as \f[, \f{, \f], // \f} and \f$. -static const char* DOXYGEN_WORD_CHARS = "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789" - "$[]{}"; +static const char *DOXYGEN_WORD_CHARS = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" "$[]{}"; // Define static class members DoxygenParser::DoxyCommandsMap DoxygenParser::doxygenCommands; @@ -37,18 +34,14 @@ std::set DoxygenParser::doxygenSectionIndicators; const int TOKENSPERLINE = 8; //change this to change the printing behaviour of the token list const std::string END_HTML_TAG_MARK("/"); -DoxygenParser::DoxygenParser(bool noisy) : - noisy(noisy) -{ +DoxygenParser::DoxygenParser(bool noisy) : noisy(noisy) { fillTables(); } -DoxygenParser::~DoxygenParser() -{ +DoxygenParser::~DoxygenParser() { } -void DoxygenParser::fillTables() -{ +void DoxygenParser::fillTables() { // run it only once if (doxygenCommands.size()) return; @@ -98,8 +91,7 @@ void DoxygenParser::fillTables() doxygenSectionIndicators.insert(sectionIndicators[i]); } -std::string DoxygenParser::stringToLower(const std::string &stringToConvert) -{ +std::string DoxygenParser::stringToLower(const std::string &stringToConvert) { string result(stringToConvert.size(), ' '); @@ -110,17 +102,14 @@ std::string DoxygenParser::stringToLower(const std::string &stringToConvert) return result; } -bool DoxygenParser::isSectionIndicator(const std::string &smallString) -{ +bool DoxygenParser::isSectionIndicator(const std::string &smallString) { - std::set::iterator it = doxygenSectionIndicators.find( - stringToLower(smallString)); + std::set::iterator it = doxygenSectionIndicators.find(stringToLower(smallString)); return it != doxygenSectionIndicators.end(); } -void DoxygenParser::printTree(const DoxygenEntityList &rootList) -{ +void DoxygenParser::printTree(const DoxygenEntityList &rootList) { DoxygenEntityList::const_iterator p = rootList.begin(); while (p != rootList.end()) { (*p).printEntity(0); @@ -128,36 +117,29 @@ void DoxygenParser::printTree(const DoxygenEntityList &rootList) } } -DoxygenParser::DoxyCommandEnum -DoxygenParser::commandBelongs(const std::string &theCommand) -{ +DoxygenParser::DoxyCommandEnum DoxygenParser::commandBelongs(const std::string &theCommand) { DoxyCommandsMapIt it = doxygenCommands.find(stringToLower(theCommand)); if (it != doxygenCommands.end()) { return it->second; } - // Check if this command is defined as an alias. if (Getattr(m_node, ("feature:doxygen:alias:" + theCommand).c_str())) { return COMMAND_ALIAS; } - // Check if this command should be ignored. - if (String* const ignore = getIgnoreFeature(theCommand)) { + if (String *const ignore = getIgnoreFeature(theCommand)) { // Check that no value is specified for this feature ("1" is the implicit // one given to it by SWIG itself), we may use the value in the future, but // for now we only use the attributes. if (Strcmp(ignore, "1") != 0) { Swig_warning(WARN_PP_UNEXPECTED_TOKENS, m_fileName.c_str(), m_fileLineNo, - "Feature \"doxygen:ignore\" value ignored for Doxygen command \"%s\".\n", - theCommand.c_str()); + "Feature \"doxygen:ignore\" value ignored for Doxygen command \"%s\".\n", theCommand.c_str()); } - // Also ensure that the matching end command, if any, will be recognized. const string endCommand = getIgnoreFeatureEndCommand(theCommand); if (!endCommand.empty()) { - Setattr(m_node, ("feature:doxygen:ignore:" + endCommand).c_str(), - NewString("1")); + Setattr(m_node, ("feature:doxygen:ignore:" + endCommand).c_str(), NewString("1")); } return COMMAND_IGNORE; @@ -166,8 +148,7 @@ DoxygenParser::commandBelongs(const std::string &theCommand) return NONE; } -std::string DoxygenParser::trim(const std::string &text) -{ +std::string DoxygenParser::trim(const std::string &text) { size_t start = text.find_first_not_of(" \t"); size_t end = text.find_last_not_of(" \t"); @@ -177,8 +158,7 @@ std::string DoxygenParser::trim(const std::string &text) return text.substr(start, end - start + 1); } -bool DoxygenParser::isEndOfLine() -{ +bool DoxygenParser::isEndOfLine() { if (m_tokenListIt == m_tokenList.end()) { return false; } @@ -186,22 +166,19 @@ bool DoxygenParser::isEndOfLine() return nextToken.m_tokenType == END_LINE; } -void DoxygenParser::skipWhitespaceTokens() -{ +void DoxygenParser::skipWhitespaceTokens() { if (m_tokenListIt == m_tokenList.end()) { return; } while (m_tokenListIt != m_tokenList.end() - && (m_tokenListIt->m_tokenType == END_LINE - || trim(m_tokenListIt->m_tokenString).empty())) { + && (m_tokenListIt->m_tokenType == END_LINE || trim(m_tokenListIt->m_tokenString).empty())) { m_tokenListIt++; } } -std::string DoxygenParser::getNextToken() -{ +std::string DoxygenParser::getNextToken() { if (m_tokenListIt == m_tokenList.end()) { return ""; @@ -214,15 +191,14 @@ std::string DoxygenParser::getNextToken() return ""; } -std::string DoxygenParser::getNextWord() -{ +std::string DoxygenParser::getNextWord() { /* if (m_tokenListIt == m_tokenList.end()) { - return ""; - } + return ""; + } */ while (m_tokenListIt != m_tokenList.end() - && (m_tokenListIt->m_tokenType == PLAINSTRING)) { + && (m_tokenListIt->m_tokenType == PLAINSTRING)) { // handle quoted strings as words string token = m_tokenListIt->m_tokenString; if (token == "\"") { @@ -251,8 +227,7 @@ std::string DoxygenParser::getNextWord() return ""; } -DoxygenParser::TokenListCIt DoxygenParser::getOneLine(const TokenList &tokList) -{ +DoxygenParser::TokenListCIt DoxygenParser::getOneLine(const TokenList &tokList) { TokenListCIt endOfLineIt = m_tokenListIt; @@ -266,8 +241,7 @@ DoxygenParser::TokenListCIt DoxygenParser::getOneLine(const TokenList &tokList) return tokList.end(); } -std::string DoxygenParser::getStringTilCommand(const TokenList & tokList) -{ +std::string DoxygenParser::getStringTilCommand(const TokenList &tokList) { if (m_tokenListIt == tokList.end()) { return ""; @@ -284,9 +258,7 @@ std::string DoxygenParser::getStringTilCommand(const TokenList & tokList) return description; } -std::string DoxygenParser::getStringTilEndCommand( - const std::string & theCommand, const TokenList & tokList) -{ +std::string DoxygenParser::getStringTilEndCommand(const std::string &theCommand, const TokenList &tokList) { if (m_tokenListIt == tokList.end()) { return ""; @@ -307,15 +279,12 @@ std::string DoxygenParser::getStringTilEndCommand( m_tokenListIt++; } - printListError(WARN_DOXYGEN_COMMAND_EXPECTED, - theCommand + " command expected"); + printListError(WARN_DOXYGEN_COMMAND_EXPECTED, theCommand + " command expected"); return description; } -DoxygenParser::TokenListCIt DoxygenParser::getEndOfParagraph( - const TokenList & tokList) -{ +DoxygenParser::TokenListCIt DoxygenParser::getEndOfParagraph(const TokenList &tokList) { TokenListCIt endOfParagraph = m_tokenListIt; @@ -347,9 +316,7 @@ DoxygenParser::TokenListCIt DoxygenParser::getEndOfParagraph( return tokList.end(); } -DoxygenParser::TokenListCIt DoxygenParser::getEndOfSection( - const std::string & theCommand, const TokenList & tokList) -{ +DoxygenParser::TokenListCIt DoxygenParser::getEndOfSection(const std::string &theCommand, const TokenList &tokList) { TokenListCIt endOfParagraph = m_tokenListIt; @@ -372,9 +339,7 @@ DoxygenParser::TokenListCIt DoxygenParser::getEndOfSection( return tokList.end(); } -DoxygenParser::TokenListCIt DoxygenParser::getEndCommand( - const std::string & theCommand, const TokenList & tokList) -{ +DoxygenParser::TokenListCIt DoxygenParser::getEndCommand(const std::string &theCommand, const TokenList &tokList) { TokenListCIt endOfCommand = m_tokenListIt; @@ -390,29 +355,21 @@ DoxygenParser::TokenListCIt DoxygenParser::getEndCommand( return tokList.end(); } -void DoxygenParser::skipEndOfLine() -{ +void DoxygenParser::skipEndOfLine() { if (m_tokenListIt != m_tokenList.end() && m_tokenListIt->m_tokenType == END_LINE) { m_tokenListIt++; } } -void -DoxygenParser::addSimpleCommand(const std::string &theCommand, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addSimpleCommand(const std::string &theCommand, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; doxyList.push_back(DoxygenEntity(theCommand)); } -void -DoxygenParser::addCommandWord(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandWord(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -427,16 +384,11 @@ DoxygenParser::addCommandWord(const std::string &theCommand, aNewList.push_back(DoxygenEntity("plainstd::string", name)); doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } else { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); } } -void -DoxygenParser::addCommandLine(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; TokenListCIt endOfLine = getOneLine(tokList); @@ -445,11 +397,7 @@ DoxygenParser::addCommandLine(const std::string &theCommand, skipEndOfLine(); } -void -DoxygenParser::addCommandParagraph(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -459,11 +407,7 @@ DoxygenParser::addCommandParagraph(const std::string &theCommand, doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } -void -DoxygenParser::addCommandEndCommand(const std::string &theCommand, - const TokenList & tokList, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandEndCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; TokenListCIt endCommand = getEndCommand("end" + theCommand, tokList); @@ -477,19 +421,14 @@ DoxygenParser::addCommandEndCommand(const std::string &theCommand, doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } -void -DoxygenParser::addCommandWordParagraph(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandWordParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return; } TokenListCIt endOfParagraph = getEndOfParagraph(tokList); @@ -499,17 +438,12 @@ DoxygenParser::addCommandWordParagraph(const std::string &theCommand, doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } -void -DoxygenParser::addCommandWordLine(const std::string &theCommand, - const TokenList & tokList, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandWordLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return; } @@ -521,18 +455,13 @@ DoxygenParser::addCommandWordLine(const std::string &theCommand, //else cout << "No line followed " << theCommand << " command. Not added" << endl; } -void -DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return; } std::string headerfile = getNextWord(); @@ -546,11 +475,7 @@ DoxygenParser::addCommandWordOWordOWord(const std::string &theCommand, doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } -void -DoxygenParser::addCommandOWord(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandOWord(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -560,23 +485,14 @@ DoxygenParser::addCommandOWord(const std::string &theCommand, doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } -void -DoxygenParser::addCommandErrorThrow(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &) -{ +void DoxygenParser::addCommandErrorThrow(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &) { printListError(WARN_DOXYGEN_COMMAND_ERROR, - "Encountered: " + theCommand - + "\nThis command should not have been encountered. Behaviour past this may be unpredictable"); + "Encountered: " + theCommand + "\nThis command should not have been encountered. Behaviour past this may be unpredictable"); m_tokenListIt = getOneLine(tokList); } -void -DoxygenParser::addCommandHtml(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandHtml(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -584,11 +500,7 @@ DoxygenParser::addCommandHtml(const std::string &theCommand, doxyList.push_back(DoxygenEntity(theCommand, htmlTagArgs)); } -void -DoxygenParser::addCommandHtmlEntity(const std::string &theCommand, - const TokenList &, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandHtmlEntity(const std::string &theCommand, const TokenList &, DoxygenEntityList &doxyList) { if (noisy) cout << "Parsing " << theCommand << endl; @@ -596,11 +508,7 @@ DoxygenParser::addCommandHtmlEntity(const std::string &theCommand, doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } -void -DoxygenParser::addCommandUnique(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommandUnique(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) { static std::map endCommands; DoxygenEntityList aNewList; @@ -616,20 +524,17 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, cout << "Parsing " << theCommand << endl; std::string key = getNextWord(); if (key.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No key followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added"); return; } std::string heading = getNextWord(); if (key.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No heading followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No heading followed " + theCommand + " command. Not added"); return; } std::string title = getNextWord(); if (title.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No title followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No title followed " + theCommand + " command. Not added"); return; } TokenListCIt endOfParagraph = getEndOfParagraph(tokList); @@ -687,8 +592,7 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return; } DoxygenEntityList aNewList; @@ -705,8 +609,7 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No key followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No key followed " + theCommand + " command. Not added"); return; } DoxygenEntityList aNewList; @@ -719,13 +622,13 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, std::string refTitle = getNextWord(); // If title is following the ref tag, it must be quoted. Otherwise // doxy puts link on ref id. - if (refTitle.size() > 1 && refTitle[0] == '"') { - // remove quotes - refTitle = refTitle.substr(1, refTitle.size() - 2); - aNewList.push_back(DoxygenEntity("plainstd::string", refTitle)); + if (refTitle.size() > 1 && refTitle[0] == '"') { + // remove quotes + refTitle = refTitle.substr(1, refTitle.size() - 2); + aNewList.push_back(DoxygenEntity("plainstd::string", refTitle)); } else { - // no quoted string is following, so we have to restore iterator - m_tokenListIt = tmpIt; + // no quoted string is following, so we have to restore iterator + m_tokenListIt = tmpIt; } doxyList.push_back(DoxygenEntity(theCommand, aNewList)); } @@ -735,8 +638,7 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No name followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added"); return; } std::string text = getNextWord(); @@ -754,8 +656,7 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, // \f{env}{ ... \f} // \f$ ... \f$ else if (theCommand == "code" || theCommand == "verbatim" - || theCommand == "dot" || theCommand == "msc" || theCommand == "f[" - || theCommand == "f{" || theCommand == "f$") { + || theCommand == "dot" || theCommand == "msc" || theCommand == "f[" || theCommand == "f{" || theCommand == "f$") { if (!endCommands.size()) { // fill in static table of end commands endCommands["f["] = "f]"; @@ -784,8 +685,7 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, cout << "Parsing " << theCommand << endl; std::string file = getNextWord(); if (file.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No file followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No file followed " + theCommand + " command. Not added"); return; } std::string caption = getNextWord(); @@ -800,14 +700,12 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, cout << "Parsing " << theCommand << endl; std::string format = getNextWord(); if (format.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No format followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No format followed " + theCommand + " command. Not added"); return; } std::string file = getNextWord(); if (file.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No name followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No name followed " + theCommand + " command. Not added"); return; } std::string caption = getNextWord(); @@ -828,9 +726,7 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, cout << "Parsing " << theCommand << endl; std::string name = getNextWord(); if (name.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "There should be at least one word following the '" + theCommand - + "' command. Command ignored."); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "There should be at least one word following the '" + theCommand + "' command. Command ignored."); return; } DoxygenEntityList aNewList; @@ -843,20 +739,17 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, skipEndOfLine(); } // \if [\else ...] [\elseif ...] \endif - else if (theCommand == "if" || theCommand == "ifnot" || theCommand == "else" - || theCommand == "elseif") { + else if (theCommand == "if" || theCommand == "ifnot" || theCommand == "else" || theCommand == "elseif") { if (noisy) cout << "Parsing " << theCommand << endl; std::string cond; bool skipEndif = false; // if true then we skip endif after parsing block of code - bool needsCond = (theCommand == "if" || theCommand == "ifnot" - || theCommand == "elseif"); + bool needsCond = (theCommand == "if" || theCommand == "ifnot" || theCommand == "elseif"); if (needsCond) { cond = getNextWord(); if (cond.empty()) { - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "No word followed " + theCommand + " command. Not added"); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "No word followed " + theCommand + " command. Not added"); return; } } @@ -871,8 +764,7 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, nestedCounter++; else if (it->m_tokenString == "endif") nestedCounter--; - if (nestedCounter == 1 - && (it->m_tokenString == "else" || it->m_tokenString == "elseif")) { // else found + if (nestedCounter == 1 && (it->m_tokenString == "else" || it->m_tokenString == "elseif")) { // else found endCommand = it; break; } @@ -885,8 +777,7 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, } if (endCommand == tokList.end()) { - printListError(WARN_DOXYGEN_COMMAND_EXPECTED, - "No corresponding endif found"); + printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "No corresponding endif found"); return; } @@ -900,21 +791,15 @@ DoxygenParser::addCommandUnique(const std::string &theCommand, } } -void -DoxygenParser::aliasCommand(const std::string& theCommand, - const TokenList& /* tokList */, - DoxygenEntityList &doxyList) -{ - String* const alias = Getattr(m_node, ("feature:doxygen:alias:" + theCommand).c_str()); +void DoxygenParser::aliasCommand(const std::string &theCommand, const TokenList &/* tokList */ , DoxygenEntityList &doxyList) { + String *const alias = Getattr(m_node, ("feature:doxygen:alias:" + theCommand).c_str()); if (!alias) return; doxyList.push_back(DoxygenEntity("plainstd::string", Char(alias))); } -String* DoxygenParser::getIgnoreFeature(const std::string& theCommand, - const char* argument) const -{ +String *DoxygenParser::getIgnoreFeature(const std::string &theCommand, const char *argument) const { string feature_name = "feature:doxygen:ignore:" + theCommand; if (argument) { feature_name += ':'; @@ -924,13 +809,12 @@ String* DoxygenParser::getIgnoreFeature(const std::string& theCommand, return Getattr(m_node, feature_name.c_str()); } -string DoxygenParser::getIgnoreFeatureEndCommand(const std::string& theCommand) const -{ +string DoxygenParser::getIgnoreFeatureEndCommand(const std::string &theCommand) const { // We may be dealing either with a simple command or with the starting command // of a block, as indicated by the value of "range" starting with "end". string endCommand; - if (String* const range = getIgnoreFeature(theCommand, "range")) { - const char* const p = Char(range); + if (String *const range = getIgnoreFeature(theCommand, "range")) { + const char *const p = Char(range); if (strncmp(p, "end", 3) == 0) { if (p[3] == ':') { // Normally the end command name follows after the colon. @@ -946,11 +830,7 @@ string DoxygenParser::getIgnoreFeatureEndCommand(const std::string& theCommand) return endCommand; } -void -DoxygenParser::ignoreCommand(const std::string& theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::ignoreCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList) { const string endCommand = getIgnoreFeatureEndCommand(theCommand); if (!endCommand.empty()) { TokenListCIt itEnd = getEndCommand(endCommand, tokList); @@ -958,7 +838,6 @@ DoxygenParser::ignoreCommand(const std::string& theCommand, printListError(WARN_DOXYGEN_COMMAND_EXPECTED, "Expected " + endCommand); return; } - // If we ignore the command, also ignore any whitespace preceding it as we // want to avoid having lines consisting of whitespace only or trailing // whitespace in general (at least Python, with its pep8 tool, really @@ -966,16 +845,14 @@ DoxygenParser::ignoreCommand(const std::string& theCommand, if (!doxyList.empty()) { DoxygenEntityList::iterator i = doxyList.end(); --i; - if (i->typeOfEntity == "plainstd::string" && - i->data.find_first_not_of(" \t") == std::string::npos) { + if (i->typeOfEntity == "plainstd::string" && i->data.find_first_not_of(" \t") == std::string::npos) { doxyList.erase(i); } } - // Determine what to do with the part of the comment between the start and // end commands: by default, we simply throw it away, but "contents" // attribute may be used to change this. - if (String* const contents = getIgnoreFeature(theCommand, "contents")) { + if (String *const contents = getIgnoreFeature(theCommand, "contents")) { // Currently only "parse" is supported but we may need to add "copy" to // handle custom tags which contain text that is supposed to be copied // verbatim in the future. @@ -983,17 +860,14 @@ DoxygenParser::ignoreCommand(const std::string& theCommand, DoxygenEntityList aNewList = parse(itEnd, tokList); doxyList.splice(doxyList.end(), aNewList); } else { - Swig_error(m_fileName.c_str(), m_fileLineNo, - "Invalid \"doxygen:ignore\" feature \"contents\" attribute \"%s\".\n", - Char(contents) - ); + Swig_error(m_fileName.c_str(), m_fileLineNo, "Invalid \"doxygen:ignore\" feature \"contents\" attribute \"%s\".\n", Char(contents)); return; } } m_tokenListIt = itEnd; m_tokenListIt++; - } else if (String* const range = getIgnoreFeature(theCommand, "range")) { + } else if (String *const range = getIgnoreFeature(theCommand, "range")) { // Currently we only support "line" but, in principle, we should also // support "word" and "paragraph" for consistency with the built-in Doxygen // commands which can have either of these three ranges (which are indicated @@ -1004,20 +878,13 @@ DoxygenParser::ignoreCommand(const std::string& theCommand, m_tokenListIt = getOneLine(tokList); skipEndOfLine(); } else { - Swig_error(m_fileName.c_str(), m_fileLineNo, - "Invalid \"doxygen:ignore\" feature \"range\" attribute \"%s\".\n", - Char(range) - ); + Swig_error(m_fileName.c_str(), m_fileLineNo, "Invalid \"doxygen:ignore\" feature \"range\" attribute \"%s\".\n", Char(range)); return; } } } -void -DoxygenParser::addCommand(const std::string &commandString, - const TokenList &tokList, - DoxygenEntityList &doxyList) -{ +void DoxygenParser::addCommand(const std::string &commandString, const TokenList &tokList, DoxygenEntityList &doxyList) { string theCommand = stringToLower(commandString); @@ -1088,12 +955,9 @@ DoxygenParser::addCommand(const std::string &commandString, /** * This method converts TokenList to DoxygenEntryList. */ -DoxygenEntityList DoxygenParser::parse(TokenListCIt endParsingIndex, - const TokenList &tokList, bool root) -{ +DoxygenEntityList DoxygenParser::parse(TokenListCIt endParsingIndex, const TokenList &tokList, bool root) { // if we are root, than any strings should be added as 'partofdescription', else as 'plainstd::string' - std::string currPlainstringCommandType = - root ? "partofdescription" : "plainstd::string"; + std::string currPlainstringCommandType = root ? "partofdescription" : "plainstd::string"; DoxygenEntityList aNewList; while (m_tokenListIt != endParsingIndex) { @@ -1115,23 +979,17 @@ DoxygenEntityList DoxygenParser::parse(TokenListCIt endParsingIndex, if (endParsingIndex != tokList.end() && m_tokenListIt == tokList.end()) { // this could happen if we can't reach the original endParsingIndex - printListError(WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT, - "Unexpected end of comment encountered"); + printListError(WARN_DOXYGEN_UNEXPECTED_END_OF_COMMENT, "Unexpected end of comment encountered"); break; } } return aNewList; } -DoxygenEntityList DoxygenParser::createTree(Node* node, String* documentation) -{ +DoxygenEntityList DoxygenParser::createTree(Node *node, String *documentation) { m_node = node; - tokenizeDoxygenComment( - Char(documentation), - Char(Getfile(documentation)), - Getline(documentation) - ); + tokenizeDoxygenComment(Char(documentation), Char(Getfile(documentation)), Getline(documentation)); if (noisy) { cout << "---TOKEN LIST---" << endl; @@ -1151,9 +1009,7 @@ DoxygenEntityList DoxygenParser::createTree(Node* node, String* documentation) * Splits 'text' on 'separator' chars. Separator chars are not part of the * strings. */ -DoxygenParser::StringVector DoxygenParser::split(const std::string &text, - char separator) -{ +DoxygenParser::StringVector DoxygenParser::split(const std::string &text, char separator) { StringVector lines; size_t prevPos = 0, pos = 0; @@ -1170,8 +1026,7 @@ DoxygenParser::StringVector DoxygenParser::split(const std::string &text, * Returns true, if 'c' is one of doxygen comment block start * characters: *, /, or ! */ -bool DoxygenParser::isStartOfDoxyCommentChar(char c) -{ +bool DoxygenParser::isStartOfDoxyCommentChar(char c) { return (strchr("*/!", c) != NULL); } @@ -1180,9 +1035,7 @@ bool DoxygenParser::isStartOfDoxyCommentChar(char c) * Doxygen commands. In that case true is returned. If the command is not * recognized as a doxygen command, it is ignored and false is returned. */ -bool DoxygenParser::addDoxyCommand(DoxygenParser::TokenList &tokList, - const std::string &cmd) -{ +bool DoxygenParser::addDoxyCommand(DoxygenParser::TokenList &tokList, const std::string &cmd) { if (commandBelongs(cmd) != NONE) { tokList.push_back(Token(COMMAND, cmd)); return true; @@ -1213,17 +1066,14 @@ bool DoxygenParser::addDoxyCommand(DoxygenParser::TokenList &tokList, * done, Doxygen commands are ignored. It is used for commands \verbatim, * \htmlonly, \f$, \f[, and \f{. */ -size_t DoxygenParser::processVerbatimText(size_t pos, const std::string &line) -{ +size_t DoxygenParser::processVerbatimText(size_t pos, const std::string &line) { if (line[pos] == '\\' || line[pos] == '@') { // check for end commands pos++; - size_t endOfWordPos = line.find_first_not_of( DOXYGEN_WORD_CHARS, pos); + size_t endOfWordPos = line.find_first_not_of(DOXYGEN_WORD_CHARS, pos); string cmd = line.substr(pos, endOfWordPos - pos); - if (cmd == CMD_END_HTML_ONLY || cmd == CMD_END_VERBATIM - || cmd == CMD_END_LATEX_1 || cmd == CMD_END_LATEX_2 - || cmd == CMD_END_LATEX_3) { + if (cmd == CMD_END_HTML_ONLY || cmd == CMD_END_VERBATIM || cmd == CMD_END_LATEX_1 || cmd == CMD_END_LATEX_2 || cmd == CMD_END_LATEX_3) { m_isVerbatimText = false; addDoxyCommand(m_tokenList, cmd); @@ -1231,8 +1081,8 @@ size_t DoxygenParser::processVerbatimText(size_t pos, const std::string &line) } else { m_tokenList.push_back(Token(PLAINSTRING, - // include '\' or '@' - line.substr(pos - 1, endOfWordPos - pos + 1))); + // include '\' or '@' + line.substr(pos - 1, endOfWordPos - pos + 1))); } pos = endOfWordPos; @@ -1241,8 +1091,7 @@ size_t DoxygenParser::processVerbatimText(size_t pos, const std::string &line) // whitespaces are stored as plain strings size_t startOfPossibleEndCmd = line.find_first_of("\\@", pos); - m_tokenList.push_back( - Token(PLAINSTRING, line.substr(pos, startOfPossibleEndCmd - pos))); + m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, startOfPossibleEndCmd - pos))); pos = startOfPossibleEndCmd; } @@ -1253,8 +1102,7 @@ size_t DoxygenParser::processVerbatimText(size_t pos, const std::string &line) * Processes doxy commands for escaped characters: \$ \@ \\ \& \~ \< \> \# \% \" \. \:: * Handling this separately supports documentation text like \@someText. */ -bool DoxygenParser::processEscapedChars(size_t &pos, const std::string &line) -{ +bool DoxygenParser::processEscapedChars(size_t &pos, const std::string &line) { if ((pos + 1) < line.size()) { // \ and @ with trailing whitespace or quoted get to output as plain string @@ -1264,7 +1112,6 @@ bool DoxygenParser::processEscapedChars(size_t &pos, const std::string &line) pos++; return true; } - // these chars can be escaped for doxygen string escapedChars = "$@\\&~<>#%\"."; if (escapedChars.find(line[pos + 1]) != string::npos) { @@ -1273,8 +1120,7 @@ bool DoxygenParser::processEscapedChars(size_t &pos, const std::string &line) pos += 2; return true; - } else if ((pos + 2) < line.size() && line[pos + 1] == ':' - && line[pos + 2] == ':') { + } else if ((pos + 2) < line.size() && line[pos + 1] == ':' && line[pos + 2] == ':') { // add command \:: - handling this separately supports documentation // text like \::someText @@ -1289,16 +1135,14 @@ bool DoxygenParser::processEscapedChars(size_t &pos, const std::string &line) /* * Processes word doxygen commands, like \arg, \c, \b, \return, ... */ -void DoxygenParser::processWordCommands(size_t &pos, const std::string &line) -{ +void DoxygenParser::processWordCommands(size_t &pos, const std::string &line) { pos++; size_t endOfWordPos = line.find_first_not_of(DOXYGEN_WORD_CHARS, pos); string cmd = line.substr(pos, endOfWordPos - pos); addDoxyCommand(m_tokenList, cmd); - if (cmd == CMD_HTML_ONLY || cmd == CMD_VERBATIM || cmd == CMD_LATEX_1 - || cmd == CMD_LATEX_2 || cmd == CMD_LATEX_3) { + if (cmd == CMD_HTML_ONLY || cmd == CMD_VERBATIM || cmd == CMD_LATEX_1 || cmd == CMD_LATEX_2 || cmd == CMD_LATEX_3) { m_isVerbatimText = true; @@ -1312,8 +1156,7 @@ void DoxygenParser::processWordCommands(size_t &pos, const std::string &line) pos = endOfWordPos; } -void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) -{ +void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) { bool isEndHtmlTag = false; pos++; if (line.size() > pos && line[pos] == '/') { @@ -1329,24 +1172,21 @@ void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) // prepend '<' to distinguish HTML tags from doxygen commands if (!cmd.empty() && addDoxyCommand(m_tokenList, '<' + cmd)) { // it is a valid HTML command - if (line[pos] != '>') { // it should be HTML tag with args, - // for example , , ... + if (line[pos] != '>') { + // it should be HTML tag with args, + // for example , , ... if (isEndHtmlTag) { m_tokenListIt = m_tokenList.end(); - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "Illegal end HTML tag without '>' found! Tag: " + cmd); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "Illegal end HTML tag without '>' found! Tag: " + cmd); } endHtmlPos = line.find(">", pos); if (endHtmlPos == string::npos) { m_tokenListIt = m_tokenList.end(); - printListError(WARN_DOXYGEN_COMMAND_ERROR, - "HTML tag without '>' found! Tag: " + cmd); + printListError(WARN_DOXYGEN_COMMAND_ERROR, "HTML tag without '>' found! Tag: " + cmd); } - // add args of HTML command, like link URL, image URL, ... - m_tokenList.push_back( - Token(PLAINSTRING, line.substr(pos, endHtmlPos - pos))); + m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, endHtmlPos - pos))); pos = endHtmlPos; } else { if (isEndHtmlTag) { @@ -1368,10 +1208,8 @@ void DoxygenParser::processHtmlTags(size_t &pos, const std::string &line) } } -void DoxygenParser::processHtmlEntities(size_t &pos, const std::string &line) -{ - size_t endOfWordPos = line.find_first_not_of("abcdefghijklmnopqrstuvwxyz", - pos + 1); +void DoxygenParser::processHtmlEntities(size_t &pos, const std::string &line) { + size_t endOfWordPos = line.find_first_not_of("abcdefghijklmnopqrstuvwxyz", pos + 1); if (endOfWordPos != string::npos) { @@ -1379,14 +1217,11 @@ void DoxygenParser::processHtmlEntities(size_t &pos, const std::string &line) // if entity is not recognized by Doxygen (not in the list of // commands) nothing is added (here and in Doxygen). addDoxyCommand(m_tokenList, line.substr(pos, endOfWordPos - pos)); - endOfWordPos++; // skip ';' - + endOfWordPos++; // skip ';' } else { - // it is not an entity - add entity for ampersand and the rest of string addDoxyCommand(m_tokenList, "&"); - m_tokenList.push_back( - Token(PLAINSTRING, line.substr(pos + 1, endOfWordPos - pos - 1))); + m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos + 1, endOfWordPos - pos - 1))); } } pos = endOfWordPos; @@ -1395,8 +1230,7 @@ void DoxygenParser::processHtmlEntities(size_t &pos, const std::string &line) /* * This method processes normal comment, which has to be tokenized. */ -size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) -{ +size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) { switch (line[pos]) { case '\\': case '@': @@ -1407,14 +1241,14 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) processWordCommands(pos, line); break; - case ' ': // whitespace - case '\t': { - // whitespaces are stored as plain strings - size_t startOfNextWordPos = line.find_first_not_of(" \t", pos + 1); - m_tokenList.push_back( - Token(PLAINSTRING, line.substr(pos, startOfNextWordPos - pos))); - pos = startOfNextWordPos; - } + case ' ': // whitespace + case '\t': + { + // whitespaces are stored as plain strings + size_t startOfNextWordPos = line.find_first_not_of(" \t", pos + 1); + m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, startOfNextWordPos - pos))); + pos = startOfNextWordPos; + } break; case '<': @@ -1434,8 +1268,7 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) break; default: m_tokenListIt = m_tokenList.end(); - printListError(WARN_DOXYGEN_COMMAND_ERROR, - std::string("Unknown special character: ") + line[pos]); + printListError(WARN_DOXYGEN_COMMAND_ERROR, std::string("Unknown special character: ") + line[pos]); } return pos; @@ -1445,10 +1278,7 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) * This is the main method, which tokenizes Doxygen comment to words and * doxygen commands. */ -void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment, - const std::string &fileName, - int fileLine) -{ +void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine) { m_isVerbatimText = false; m_isInQuotedString = false; m_tokenList.clear(); @@ -1477,7 +1307,6 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment, m_tokenList.push_back(Token(END_LINE, "\n")); continue; } - // skip sequences of '*', '/', and '!' of any length bool isStartOfCommentLineCharFound = false; while (pos < line.size() && isStartOfDoxyCommentChar(line[pos])) { @@ -1489,7 +1318,6 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment, m_tokenList.push_back(Token(END_LINE, "\n")); continue; } - // if 'isStartOfCommentLineCharFound' then preserve leading spaces, so // ' * comment' gets translated to ' * comment', not ' * comment' // This is important to keep formatting for comments translated to Python. @@ -1500,7 +1328,6 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment, continue; } } - // line[pos] may be ' \t' or start of word, it there was no '*', '/' or '!' // at beginning of the line. Make sure it points to start of the first word // in the line. @@ -1512,13 +1339,11 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment, } if (firstWordPos > pos) { - m_tokenList.push_back( - Token(PLAINSTRING, line.substr(pos, firstWordPos - pos))); + m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, firstWordPos - pos))); pos = firstWordPos; } } else { - m_tokenList.push_back( - Token(PLAINSTRING, line.substr(0, pos))); + m_tokenList.push_back(Token(PLAINSTRING, line.substr(0, pos))); } while (pos != string::npos) { @@ -1572,12 +1397,10 @@ void DoxygenParser::tokenizeDoxygenComment(const std::string &doxygenComment, m_tokenListIt = m_tokenList.begin(); } -void DoxygenParser::printList() -{ +void DoxygenParser::printList() { int tokNo = 0; - for (TokenListCIt it = m_tokenList.begin(); it != m_tokenList.end(); - it++, tokNo++) { + for (TokenListCIt it = m_tokenList.begin(); it != m_tokenList.end(); it++, tokNo++) { cout << it->toString() << " "; @@ -1587,8 +1410,7 @@ void DoxygenParser::printList() } } -void DoxygenParser::printListError(int warningType, const std::string &message) -{ +void DoxygenParser::printListError(int warningType, const std::string &message) { int curLine = m_fileLineNo; for (TokenListCIt it = m_tokenList.begin(); it != m_tokenListIt; it++) { if (it->m_tokenType == END_LINE) { @@ -1596,6 +1418,5 @@ void DoxygenParser::printListError(int warningType, const std::string &message) } } - Swig_warning(warningType, m_fileName.c_str(), curLine, - "Doxygen parser warning: %s.\n", message.c_str()); + Swig_warning(warningType, m_fileName.c_str(), curLine, "Doxygen parser warning: %s.\n", message.c_str()); } diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 82550465d..35204e670 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -52,14 +52,12 @@ private: class Token { public: DoxyCommandEnum m_tokenType; - std::string m_tokenString; /* the data , such as param for @param */ - - Token(DoxyCommandEnum tType, std::string tString) : - m_tokenType(tType), - m_tokenString(tString) {} + std::string m_tokenString; /* the data , such as param for @param */ + Token(DoxyCommandEnum tType, std::string tString) : m_tokenType(tType), m_tokenString(tString) { + } + std::string toString() const { - switch (m_tokenType) { case END_LINE: return "{END OF LINE}"; @@ -96,7 +94,7 @@ private: bool m_isVerbatimText; // used to handle \htmlonly and \verbatim commands bool m_isInQuotedString; - Node* m_node; + Node *m_node; std::string m_fileName; int m_fileLineNo; @@ -104,17 +102,17 @@ private: * 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. */ - 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. */ - 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 - */ - bool noisy; + /* + * Whether to print lots of debug info during parsing + */ + bool noisy; /* *Changes a std::string to all lower case @@ -136,7 +134,7 @@ private: /* *prints the parse tree */ - void printTree(const std::list &rootList); + void printTree(const std::list &rootList); /** * 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 */ //TODO check that this behaves properly for formulas - std::string getStringTilEndCommand(const std::string &theCommand, - const TokenList &tokList); + std::string getStringTilEndCommand(const std::string &theCommand, const TokenList &tokList); /* * 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. * If no end is encountered, returns the last token of the std::list. */ - TokenListCIt getEndOfSection(const std::string &theCommand, - const TokenList &tokList); + TokenListCIt getEndOfSection(const std::string &theCommand, const TokenList &tokList); /* * This method is for returning the end of a specific form of doxygen command @@ -215,14 +211,12 @@ private: * progressTilEndCommand("endcode", tokenList); * If the end is never encountered, it returns the end of the std::list. */ - TokenListCIt getEndCommand(const std::string &theCommand, - const TokenList &tokList); + TokenListCIt getEndCommand(const std::string &theCommand, const TokenList &tokList); /* * A special method for commands such as \arg that end at the end of a * paragraph OR when another \arg is encountered //TODO getTilAnyCommand - TokenListCIt getTilAnyCommand(const std::string &theCommand, - const TokenList &tokList); + TokenListCIt getTilAnyCommand(const std::string &theCommand, const TokenList &tokList); */ /** @@ -241,8 +235,7 @@ private: * Plain commands, such as newline etc, they contain no other data * \n \\ \@ \& \$ \# \< \> \% */ - void addSimpleCommand(const std::string &theCommand, - DoxygenEntityList &doxyList); + void addSimpleCommand(const std::string &theCommand, DoxygenEntityList &doxyList); /* * CommandWord * Format: @command @@ -251,9 +244,7 @@ private: * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", * "includelineno" */ - void addCommandWord(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * CommandLine * Format: @command (line) @@ -261,9 +252,7 @@ private: * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", * "until", "property" */ - void addCommandLine(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * CommandParagraph * Format: @command {paragraph} @@ -272,9 +261,7 @@ private: * "details", "invariant", "deprecated", "date", "note", "warning", * "version", "todo", "bug", "attention", "brief", "arg", "author" */ - void addCommandParagraph(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * Command EndCommand * Format: @command and ends at @endcommand @@ -284,96 +271,70 @@ private: * "link" * Returns 1 if success, 0 if the endcommand is never encountered. */ - void addCommandEndCommand(const std::string &theCommand, - const TokenList & tokList, - DoxygenEntityList &doxyList); + void addCommandEndCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * CommandWordParagraph * Format: @command {paragraph} * Commands such as param * "param", "tparam", "throw", "throws", "retval", "exception" */ - void addCommandWordParagraph(const std::string &theCommand, - const TokenList & tokList, - DoxygenEntityList &doxyList); + void addCommandWordParagraph(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * CommandWordLine * Format: @command (line) * Commands such as param * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" */ - void addCommandWordLine(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandWordLine(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * Command Word Optional Word Optional Word * Format: @command [] [] * Commands such as class * "category", "class", "protocol", "interface", "struct", "union" */ - void addCommandWordOWordOWord(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandWordOWordOWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * Command Optional Word * Format: @command [] * Commands such as dir * "dir", "file", "cond" */ - void addCommandOWord(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandOWord(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * Commands that should not be encountered (such as PHP only) * goes til the end of line then returns */ - void addCommandErrorThrow(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandErrorThrow(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); - void addCommandHtml(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandHtml(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); - void addCommandHtmlEntity(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandHtmlEntity(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* *Adds the unique commands- different process for each unique command */ - void addCommandUnique(const std::string &theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommandUnique(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * Replace the given command with its predefined alias expansion. */ - void aliasCommand(const std::string& theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void aliasCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * Simply ignore the given command, possibly with the word following it or * until the matching end command. */ - void ignoreCommand(const std::string& theCommand, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void ignoreCommand(const std::string &theCommand, const TokenList &tokList, DoxygenEntityList &doxyList); /* * The actual "meat" of the doxygen parser. Calls the correct addCommand...() * function. */ - void addCommand(const std::string &commandString, - const TokenList &tokList, - DoxygenEntityList &doxyList); + void addCommand(const std::string &commandString, const TokenList &tokList, DoxygenEntityList &doxyList); + + DoxygenEntityList parse(TokenListCIt endParsingIndex, const TokenList &tokList, bool root = false); - DoxygenEntityList parse(TokenListCIt endParsingIndex, - const TokenList &tokList, - bool root = false); - /* * Fill static doxygenCommands and sectionIndicators containers */ @@ -391,9 +352,7 @@ private: /** Processes comment outside \htmlonly and \verbatim commands. */ size_t processNormalComment(size_t pos, const std::string &line); - void tokenizeDoxygenComment(const std::string &doxygenComment, - const std::string &fileName, - int fileLine); + void tokenizeDoxygenComment(const std::string &doxygenComment, const std::string &fileName, int fileLine); void printList(); void printListError(int warningType, const std::string &message); @@ -407,8 +366,7 @@ private: public: DoxygenParser(bool noisy = false); virtual ~DoxygenParser(); - DoxygenEntityList createTree(Node* node, String* documentation); + DoxygenEntityList createTree(Node *node, String *documentation); }; #endif - diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp index 93314b19d..111822660 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.cpp +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.cpp @@ -14,10 +14,8 @@ #include "DoxygenTranslator.h" -DoxygenTranslator::DoxygenTranslator(int flags) : - m_flags(flags), - parser((flags & debug_parser) != 0) -{} +DoxygenTranslator::DoxygenTranslator(int flags) : m_flags(flags), parser((flags &debug_parser) != 0) { +} DoxygenTranslator::~DoxygenTranslator() { @@ -35,11 +33,11 @@ String *DoxygenTranslator::getDoxygenComment(Node *node) { String *DoxygenTranslator::getDocumentation(Node *node) { - + if (!hasDocumentation(node)) { return NewString(""); } - + return makeDocumentation(node); } diff --git a/Source/DoxygenTranslator/src/DoxygenTranslator.h b/Source/DoxygenTranslator/src/DoxygenTranslator.h index 7d908ee1f..ae7c211ba 100644 --- a/Source/DoxygenTranslator/src/DoxygenTranslator.h +++ b/Source/DoxygenTranslator/src/DoxygenTranslator.h @@ -78,12 +78,12 @@ protected: * Returns the documentation formatted for a target language. */ virtual String *makeDocumentation(Node *node) = 0; - + /* * Prints the details of a parsed entity list to stdout (for debugging). */ void printTree(const DoxygenEntityList &entityList); - + }; #endif diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index c2b47a796..90da0eb1a 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -15,8 +15,8 @@ #include #include #include "../../Modules/swigmod.h" -#define APPROX_LINE_LENGTH 64 //characters per line allowed -#define TAB_SIZE 8 //current tab size in spaces +#define APPROX_LINE_LENGTH 64 // characters per line allowed +#define TAB_SIZE 8 // current tab size in spaces //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 @@ -26,8 +26,7 @@ using std::string; using std::list; using std::vector; -void JavaDocConverter::fillStaticTables() -{ +void JavaDocConverter::fillStaticTables() { if (tagHandlers.size()) // fill only once return; @@ -99,15 +98,13 @@ void JavaDocConverter::fillStaticTables() tagHandlers["invariant"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["latexonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["manonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); - tagHandlers["partofdescription"] = make_pair( - &JavaDocConverter::handleParagraph, ""); + tagHandlers["partofdescription"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["rtfonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["short"] = make_pair(&JavaDocConverter::handleParagraph, ""); tagHandlers["xmlonly"] = make_pair(&JavaDocConverter::handleParagraph, ""); // these commands are kept as-is, they are supported by JavaDoc tagHandlers["author"] = make_pair(&JavaDocConverter::handleTagSame, ""); - tagHandlers["authors"] = make_pair(&JavaDocConverter::handleTagSame, - "author"); + tagHandlers["authors"] = make_pair(&JavaDocConverter::handleTagSame, "author"); tagHandlers["deprecated"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["exception"] = make_pair(&JavaDocConverter::handleTagSame, ""); tagHandlers["package"] = make_pair(&JavaDocConverter::handleTagSame, ""); @@ -116,8 +113,7 @@ void JavaDocConverter::fillStaticTables() tagHandlers["ref"] = make_pair(&JavaDocConverter::handleTagRef, ""); tagHandlers["result"] = make_pair(&JavaDocConverter::handleTagSame, "return"); tagHandlers["return"] = make_pair(&JavaDocConverter::handleTagSame, ""); - tagHandlers["returns"] = make_pair(&JavaDocConverter::handleTagSame, - "return"); + tagHandlers["returns"] = make_pair(&JavaDocConverter::handleTagSame, "return"); //tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSame, ""); //tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSame, "see"); tagHandlers["since"] = make_pair(&JavaDocConverter::handleTagSame, ""); @@ -126,104 +122,77 @@ void JavaDocConverter::fillStaticTables() tagHandlers["version"] = make_pair(&JavaDocConverter::handleTagSame, ""); // these commands have special handlers tagHandlers["code"] = make_pair(&JavaDocConverter::handleTagExtended, "code"); - tagHandlers["cond"] = make_pair(&JavaDocConverter::handleTagMessage, - "Conditional comment: "); - tagHandlers["copyright"] = make_pair(&JavaDocConverter::handleTagMessage, - "Copyright: "); + tagHandlers["cond"] = make_pair(&JavaDocConverter::handleTagMessage, "Conditional comment: "); + tagHandlers["copyright"] = make_pair(&JavaDocConverter::handleTagMessage, "Copyright: "); tagHandlers["else"] = make_pair(&JavaDocConverter::handleTagIf, "Else: "); - tagHandlers["elseif"] = make_pair(&JavaDocConverter::handleTagIf, - "Else if: "); - tagHandlers["endcond"] = make_pair(&JavaDocConverter::handleTagMessage, - "End of conditional comment."); + tagHandlers["elseif"] = make_pair(&JavaDocConverter::handleTagIf, "Else if: "); + tagHandlers["endcond"] = make_pair(&JavaDocConverter::handleTagMessage, "End of conditional comment."); // space in second arg prevents Javadoc to treat '@ example' as command. File name of // example is still informative to user. - tagHandlers["example"] = make_pair(&JavaDocConverter::handleTagSame, - " example"); + tagHandlers["example"] = make_pair(&JavaDocConverter::handleTagSame, " example"); tagHandlers["if"] = make_pair(&JavaDocConverter::handleTagIf, "If: "); tagHandlers["ifnot"] = make_pair(&JavaDocConverter::handleTagIf, "If not: "); tagHandlers["image"] = make_pair(&JavaDocConverter::handleTagImage, ""); tagHandlers["link"] = make_pair(&JavaDocConverter::handleTagLink, ""); tagHandlers["see"] = make_pair(&JavaDocConverter::handleTagSee, ""); tagHandlers["sa"] = make_pair(&JavaDocConverter::handleTagSee, ""); - tagHandlers["note"] = make_pair(&JavaDocConverter::handleTagMessage, - "Note: "); + tagHandlers["note"] = make_pair(&JavaDocConverter::handleTagMessage, "Note: "); tagHandlers["overload"] = make_pair(&JavaDocConverter::handleTagMessage, - "This is an overloaded member function, provided for" - " convenience. It differs from the above function only in what" - " argument(s) it accepts."); + "This is an overloaded member function, provided for" + " convenience. It differs from the above function only in what" " argument(s) it accepts."); tagHandlers["par"] = make_pair(&JavaDocConverter::handleTagPar, ""); - tagHandlers["remark"] = make_pair(&JavaDocConverter::handleTagMessage, - "Remarks: "); - tagHandlers["remarks"] = make_pair(&JavaDocConverter::handleTagMessage, - "Remarks: "); - tagHandlers["todo"] = make_pair(&JavaDocConverter::handleTagMessage, - "TODO: "); - tagHandlers["verbatim"] = make_pair(&JavaDocConverter::handleTagExtended, - "literal"); + tagHandlers["remark"] = make_pair(&JavaDocConverter::handleTagMessage, "Remarks: "); + tagHandlers["remarks"] = make_pair(&JavaDocConverter::handleTagMessage, "Remarks: "); + 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. tagHandlers["f$"] = make_pair(&JavaDocConverter::handleTagVerbatim, ""); tagHandlers["f["] = make_pair(&JavaDocConverter::handleTagVerbatim, ""); tagHandlers["f{"] = make_pair(&JavaDocConverter::handleTagVerbatim, ""); - tagHandlers["warning"] = make_pair(&JavaDocConverter::handleTagMessage, - "Warning: "); + tagHandlers["warning"] = make_pair(&JavaDocConverter::handleTagMessage, "Warning: "); // this command just prints it's contents // (it is internal command of swig's parser, contains plain text) - tagHandlers["plainstd::string"] = make_pair( - &JavaDocConverter::handlePlainString, ""); - tagHandlers["plainstd::endl"] = make_pair(&JavaDocConverter::handleNewLine, - ""); + tagHandlers["plainstd::string"] = make_pair(&JavaDocConverter::handlePlainString, ""); + tagHandlers["plainstd::endl"] = make_pair(&JavaDocConverter::handleNewLine, ""); tagHandlers["n"] = make_pair(&JavaDocConverter::handleNewLine, ""); // HTML tags tagHandlers[" >::iterator it; it = tagHandlers.find(tag.typeOfEntity); @@ -405,35 +346,24 @@ void JavaDocConverter::translateEntity(DoxygenEntity &tag, } -void JavaDocConverter::handleTagAnchor(DoxygenEntity& tag, - std::string& translatedComment, - std::string &) -{ +void JavaDocConverter::handleTagAnchor(DoxygenEntity &tag, std::string &translatedComment, std::string &) { translatedComment += ""; } -void JavaDocConverter::handleTagHtml(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleTagHtml(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) { if (tag.entityList.size()) { // do not include empty tags std::string tagData = translateSubtree(tag); // wrap the thing, ignoring whitespace size_t wsPos = tagData.find_last_not_of("\n\t "); if (wsPos != std::string::npos) - translatedComment += "<" + arg + ">" + tagData.substr(0, wsPos + 1) + "" + tagData.substr(wsPos + 1); + translatedComment += "<" + arg + ">" + tagData.substr(0, wsPos + 1) + "" + tagData.substr(wsPos + 1); else - translatedComment += "<" + arg + ">" + translateSubtree(tag) + " "; + translatedComment += "<" + arg + ">" + translateSubtree(tag) + " "; } } -void JavaDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) { std::string htmlTagArgs = tag.data; if (htmlTagArgs == "/") { // end html tag, for example " @@ -443,18 +373,12 @@ void JavaDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag, } } -void JavaDocConverter::handleHtmlEntity(DoxygenEntity&, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleHtmlEntity(DoxygenEntity &, std::string &translatedComment, std::string &arg) { // html entities can be preserved for Java translatedComment += arg + ';'; } -void JavaDocConverter::handleNewLine(DoxygenEntity&, - std::string& translatedComment, - std::string&) -{ +void JavaDocConverter::handleNewLine(DoxygenEntity &, std::string &translatedComment, std::string &) { //
tag is added, because otherwise to much text is joined // into same paragraph by javadoc. For example, doxy list: // - item one @@ -466,10 +390,7 @@ void JavaDocConverter::handleNewLine(DoxygenEntity&, translatedComment += "
\n * "; } -void JavaDocConverter::handleTagChar(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) { // escape it if we need to, else just print if (arg.size()) translatedComment += arg; @@ -478,57 +399,37 @@ void JavaDocConverter::handleTagChar(DoxygenEntity& tag, } // handles tags which are the same in Doxygen and Javadoc. -void JavaDocConverter::handleTagSame(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleTagSame(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) { if (arg.size()) tag.typeOfEntity = arg; - translatedComment += formatCommand( - std::string("@" + tag.typeOfEntity + " " + translateSubtree(tag)), 2); + translatedComment += formatCommand(std::string("@" + tag.typeOfEntity + " " + translateSubtree(tag)), 2); } -void JavaDocConverter::handleParagraph(DoxygenEntity& tag, - std::string& translatedComment, - std::string&) -{ +void JavaDocConverter::handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &) { translatedComment += formatCommand(translateSubtree(tag), 0); } -void JavaDocConverter::handlePlainString(DoxygenEntity& tag, - std::string& translatedComment, - std::string&) -{ +void JavaDocConverter::handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &) { translatedComment += tag.data; // if (tag.data.size() && tag.data[tag.data.size()-1] != ' ') - // translatedComment += " "; + // translatedComment += " "; } -void JavaDocConverter::handleTagVerbatim(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) { translatedComment += arg + " "; - for (DoxygenEntityListCIt it = tag.entityList.begin(); - it != tag.entityList.end(); it++) { + for (DoxygenEntityListCIt it = tag.entityList.begin(); it != tag.entityList.end(); it++) { translatedComment += it->data; } } -void JavaDocConverter::handleTagExtended(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleTagExtended(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) { std::string dummy; translatedComment += "{@" + arg + " "; handleParagraph(tag, translatedComment, dummy); translatedComment += "}"; } -void JavaDocConverter::handleTagIf(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) { std::string dummy; translatedComment += arg; if (tag.entityList.size()) { @@ -538,19 +439,13 @@ void JavaDocConverter::handleTagIf(DoxygenEntity& tag, } } -void JavaDocConverter::handleTagMessage(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg) -{ +void JavaDocConverter::handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg) { std::string dummy; translatedComment += formatCommand(arg, 0); handleParagraph(tag, translatedComment, dummy); } -void JavaDocConverter::handleTagImage(DoxygenEntity& tag, - std::string& translatedComment, - std::string&) -{ +void JavaDocConverter::handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &) { if (tag.entityList.size() < 2) return; @@ -577,10 +472,7 @@ void JavaDocConverter::handleTagImage(DoxygenEntity& tag, translatedComment += "/>"; } -void JavaDocConverter::handleTagPar(DoxygenEntity& tag, - std::string& translatedComment, - std::string&) -{ +void JavaDocConverter::handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &) { std::string dummy; translatedComment += "= rbracePos) + if (lbracePos == string::npos || rbracePos == string::npos || lbracePos >= rbracePos) return ""; string paramsStr = linkObject.substr(lbracePos + 1, - rbracePos - lbracePos - 1); + rbracePos - lbracePos - 1); // strip the params, to fill them later string additionalObject = linkObject.substr(rbracePos + 1, string::npos); linkObject = linkObject.substr(0, lbracePos); @@ -679,7 +563,7 @@ string JavaDocConverter::convertLink(string linkObject) SwigType_add_qualifier(swigType, "const"); // 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 if (paramStr[j] == ']') { while (j >= 0 && paramStr[j] != '[') @@ -699,8 +583,7 @@ string JavaDocConverter::convertLink(string linkObject) typeNameStart = 0; else typeNameStart++; - Append(swigType, - paramStr.substr(typeNameStart, j - typeNameStart + 1).c_str()); + Append(swigType, paramStr.substr(typeNameStart, j - typeNameStart + 1).c_str()); break; } } @@ -708,11 +591,10 @@ string JavaDocConverter::convertLink(string linkObject) // make dummy param list, to lookup typemaps for it Parm *dummyParam = NewParm(swigType, "", 0); Swig_typemap_attach_parms("jstype", dummyParam, NULL); - Language::instance()->replaceSpecialVariables(0, - Getattr(dummyParam, "tmap:jstype"), dummyParam); + Language::instance()->replaceSpecialVariables(0, Getattr(dummyParam, "tmap:jstype"), dummyParam); //Swig_print(dummyParam, 1); - linkObject += Char (Getattr(dummyParam, "tmap:jstype")); + linkObject += Char(Getattr(dummyParam, "tmap:jstype")); if (i != params.size() - 1) linkObject += ","; @@ -724,10 +606,7 @@ string JavaDocConverter::convertLink(string linkObject) return linkObject + additionalObject; } -void JavaDocConverter::handleTagLink(DoxygenEntity& tag, - std::string& translatedComment, - std::string&) -{ +void JavaDocConverter::handleTagLink(DoxygenEntity &tag, std::string &translatedComment, std::string &) { std::string dummy; if (!tag.entityList.size()) return; @@ -743,10 +622,7 @@ void JavaDocConverter::handleTagLink(DoxygenEntity& tag, translatedComment += "}"; } -void JavaDocConverter::handleTagSee(DoxygenEntity& tag, - std::string& translatedComment, - std::string&) -{ +void JavaDocConverter::handleTagSee(DoxygenEntity &tag, std::string &translatedComment, std::string &) { std::string dummy; if (!tag.entityList.size()) return; @@ -762,7 +638,6 @@ void JavaDocConverter::handleTagSee(DoxygenEntity& tag, // handleNewLine(*it, translatedComment, dummy); continue; } - // restore entities which may be used in C++ type declaration if (it->typeOfEntity == "&") { methodRef += '&'; @@ -779,8 +654,7 @@ void JavaDocConverter::handleTagSee(DoxygenEntity& tag, size_t lbrace = methodRef.find('('); size_t dblColon = methodRef.find("::"); if (dblColon < lbrace) { - methodRef = methodRef.substr(0, dblColon) + '#' - + methodRef.substr(dblColon + 2); + methodRef = methodRef.substr(0, dblColon) + '#' + methodRef.substr(dblColon + 2); } translatedComment += "@see "; @@ -808,8 +682,7 @@ void JavaDocConverter::handleTagSee(DoxygenEntity& tag, |-endline * */ -int JavaDocConverter::shiftEndlinesUpTree(DoxygenEntity &root, int level) -{ +int JavaDocConverter::shiftEndlinesUpTree(DoxygenEntity &root, int level) { DoxygenEntityListIt it = root.entityList.begin(); while (it != root.entityList.end()) { // remove line endings @@ -828,7 +701,7 @@ int JavaDocConverter::shiftEndlinesUpTree(DoxygenEntity &root, int level) int removedCount = 0; while (!root.entityList.empty() - && root.entityList.rbegin()->typeOfEntity == "plainstd::endl") { + && root.entityList.rbegin()->typeOfEntity == "plainstd::endl") { root.entityList.pop_back(); 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 * 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 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; } - // Create the first line of Javadoc comment. string indentStr(indent - 1, ' '); string translatedStr = indentStr + "/**"; @@ -881,13 +753,11 @@ std::string JavaDocConverter::indentAndInsertAsterisks(const string &doc) // line without '*' found - is it empty? if (translatedStr[nonspaceIdx] != '\n') { // add '* ' to each line without it - translatedStr = translatedStr.substr(0, nonspaceIdx) + "* " - + translatedStr.substr(nonspaceIdx); + translatedStr = translatedStr.substr(0, nonspaceIdx) + "* " + translatedStr.substr(nonspaceIdx); //printf(translatedStr.c_str()); } else { // we found empty line, replace it with indented '*' - translatedStr = translatedStr.substr(0, idx + 1) + indentStr + "* " - + translatedStr.substr(nonspaceIdx); + translatedStr = translatedStr.substr(0, idx + 1) + indentStr + "* " + translatedStr.substr(nonspaceIdx); } } idx = translatedStr.find('\n', nonspaceIdx); @@ -908,8 +778,7 @@ std::string JavaDocConverter::indentAndInsertAsterisks(const string &doc) return translatedStr; } -String *JavaDocConverter::makeDocumentation(Node *node) -{ +String *JavaDocConverter::makeDocumentation(Node *node) { String *documentation = getDoxygenComment(node); @@ -919,7 +788,7 @@ String *JavaDocConverter::makeDocumentation(Node *node) if (GetFlag(node, "feature:doxygen:notranslate")) { - string doc = Char (documentation); + string doc = Char(documentation); string translatedStr = indentAndInsertAsterisks(doc); @@ -936,7 +805,6 @@ String *JavaDocConverter::makeDocumentation(Node *node) std::cout << "---RESORTED LIST---" << std::endl; printTree(entityList); } - // store the current node // (currently just to handle params) currentNode = node; @@ -949,13 +817,13 @@ String *JavaDocConverter::makeDocumentation(Node *node) // strip line endings at the beginning while (!root.entityList.empty() - && root.entityList.begin()->typeOfEntity == "plainstd::endl") { + && root.entityList.begin()->typeOfEntity == "plainstd::endl") { root.entityList.pop_front(); } // and at the end while (!root.entityList.empty() - && root.entityList.rbegin()->typeOfEntity == "plainstd::endl") { + && root.entityList.rbegin()->typeOfEntity == "plainstd::endl") { root.entityList.pop_back(); } @@ -971,8 +839,6 @@ String *JavaDocConverter::makeDocumentation(Node *node) return NewString(javaDocString.c_str()); } -void JavaDocConverter::addError(int warningType, const std::string &message) -{ - Swig_warning(warningType, "", 0, "Doxygen parser warning: %s. \n", - message.c_str()); +void JavaDocConverter::addError(int warningType, const std::string &message) { + Swig_warning(warningType, "", 0, "Doxygen parser warning: %s. \n", message.c_str()); } diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.h b/Source/DoxygenTranslator/src/JavaDocConverter.h index eff00590c..df579e625 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.h +++ b/Source/DoxygenTranslator/src/JavaDocConverter.h @@ -30,20 +30,23 @@ protected: * Used to properly format JavaDoc-style command */ std::string formatCommand(std::string unformattedLine, int indent); + /* * Translate every entity in a tree. */ - std::string translateSubtree(DoxygenEntity & doxygenEntity); + std::string translateSubtree(DoxygenEntity &doxygenEntity); + /* * Translate one entity with the appropriate handler, according * to the tagHandlers */ void translateEntity(DoxygenEntity &tag, std::string &translatedComment); + /* * Fix all endlines location, etc */ int shiftEndlinesUpTree(DoxygenEntity &root, int level = 0); - + /* * Convert params in link-objects and references */ @@ -53,18 +56,15 @@ protected: * Typedef for the function that handles one tag * arg - some string argument to easily pass it through lookup table */ - typedef void (JavaDocConverter::*tagHandler)(DoxygenEntity &tag, - std::string &translatedComment, std::string &arg); + typedef void (JavaDocConverter::*tagHandler) (DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /** * 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. */ - void handleTagAnchor(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg); + void handleTagAnchor(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Wrap the command data with the html tag @@ -73,80 +73,87 @@ protected: void handleTagHtml(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* Handles HTML tags recognized by Doxygen, like ,
    , , ... */ - void handleDoxyHtmlTag(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg); + void handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* Handles HTML entities recognized by Doxygen, like <, ©, ... */ - void handleHtmlEntity(DoxygenEntity& tag, - std::string& translatedComment, - std::string &arg); + void handleHtmlEntity(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); /* * Just prints new line */ void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Print the name of tag to the output, used for escape-commands * arg - html-escaped variant, if not provided the command data is used */ void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Do not translate and print as-is * arg - the new tag name, if it needs to be renamed */ void handleTagSame(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Print only the content and strip original tag */ void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Print only data part of code */ void handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Print extended Javadoc command, like {@code ...} or {@literal ...} * arg - command name */ void handleTagExtended(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Print the if-elseif-else-endif section */ void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Prints the specified message, than the contents of the tag * arg - message */ void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Insert tag if the 'format' field is specified as 'html' */ void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Insert

    ...

    */ void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Insert \@param command, if it is really a function param */ void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Writes link for \ref tag. */ - void handleTagRef(DoxygenEntity& tag, std::string& translatedComment, - std::string&); + void handleTagRef(DoxygenEntity &tag, std::string &translatedComment, std::string &); + /* * Insert {@link...} command, and handle all the s correctly * (like converting types of params, etc) */ void handleTagLink(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); + /* * Insert @see command, and handle all the s correctly * (like converting types of params, etc) */ void handleTagSee(DoxygenEntity &tag, std::string &translatedComment, std::string &arg); - private: Node *currentNode; // this contains the handler pointer and one string argument diff --git a/Source/DoxygenTranslator/src/PyDocConverter.cpp b/Source/DoxygenTranslator/src/PyDocConverter.cpp index 76431af54..b6aaa2d91 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.cpp +++ b/Source/DoxygenTranslator/src/PyDocConverter.cpp @@ -28,18 +28,14 @@ using std::string; // Helper class increasing the provided indent string in its ctor and decreasing // it in its dtor. -class IndentGuard -{ +class IndentGuard { public: // One indent level. - 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 - // conditionally as Init() can then be called after checking some condition. - // Otherwise, prefer to use the non default ctor below. - IndentGuard() - { + 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// conditionally as Init() can then be called after checking some condition.// Otherwise, prefer to use the non default ctor below. + IndentGuard() { m_initialized = false; } @@ -47,14 +43,12 @@ public: // 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 // updating the output. - IndentGuard(string& output, string& indent) - { + IndentGuard(string &output, string &indent) { Init(output, indent); } // 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_indent = &indent; @@ -77,10 +71,11 @@ public: // Get the indent for the first line of the paragraph, which is smaller than // the indent for the subsequent lines. - string getFirstLineIndent() const { return string(m_firstLineIndent, ' '); } - - ~IndentGuard() - { + string getFirstLineIndent() const { + return string(m_firstLineIndent, ' '); + } + + ~IndentGuard() { if (!m_initialized) return; @@ -93,24 +88,23 @@ public: if (m_output->length() > lenIndentLevel) { const size_t start = m_output->length() - lenIndentLevel; if (m_output->compare(start, string::npos, Level()) == 0) - m_output->erase(start); + m_output->erase(start); } } private: - string* m_output; - string* m_indent; + string *m_output; + string *m_indent; unsigned m_firstLineIndent; bool m_initialized; - IndentGuard(const IndentGuard&); - IndentGuard& operator=(const IndentGuard&); + IndentGuard(const IndentGuard &); + IndentGuard &operator=(const IndentGuard &); }; // 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. -static size_t determineIndent(const string& s) -{ +static size_t determineIndent(const string &s) { size_t minIndent = static_cast(-1); for (size_t lineStart = 0; lineStart < s.length();) { @@ -136,8 +130,7 @@ static size_t determineIndent(const string& s) return minIndent; } -static void trimWhitespace(string& s) -{ +static void trimWhitespace(string &s) { const size_t lastNonSpace = s.find_last_not_of(' '); if (lastNonSpace == string::npos) s.clear(); @@ -146,21 +139,16 @@ static void trimWhitespace(string& s) } /* static */ -PyDocConverter::TagHandlersMap::mapped_type -PyDocConverter::make_handler(tagHandler handler) -{ +PyDocConverter::TagHandlersMap::mapped_type PyDocConverter::make_handler(tagHandler handler) { return make_pair(handler, std::string()); } /* static */ -PyDocConverter::TagHandlersMap::mapped_type -PyDocConverter::make_handler(tagHandler handler, const char* arg) -{ +PyDocConverter::TagHandlersMap::mapped_type PyDocConverter::make_handler(tagHandler handler, const char *arg) { return make_pair(handler, arg); } -void PyDocConverter::fillStaticTables() -{ +void PyDocConverter::fillStaticTables() { if (tagHandlers.size()) // fill only once return; @@ -213,9 +201,7 @@ void PyDocConverter::fillStaticTables() tagHandlers["details"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["em"] = make_handler(&PyDocConverter::handleParagraph, " "); tagHandlers["example"] = make_handler(&PyDocConverter::handleParagraph); - tagHandlers["exception"] = - tagHandlers["throw"] = - tagHandlers["throws"] = make_handler(&PyDocConverter::handleTagException); + tagHandlers["exception"] = tagHandlers["throw"] = tagHandlers["throws"] = make_handler(&PyDocConverter::handleTagException); tagHandlers["htmlonly"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["invariant"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["latexonly"] = make_handler(&PyDocConverter::handleParagraph); @@ -228,8 +214,7 @@ void PyDocConverter::fillStaticTables() tagHandlers["remark"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["remarks"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["sa"] = make_handler(&PyDocConverter::handleTagMessage, "See also: "); - tagHandlers["see"] = make_handler(&PyDocConverter::handleTagMessage, - "See also: "); + tagHandlers["see"] = make_handler(&PyDocConverter::handleTagMessage, "See also: "); tagHandlers["since"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["short"] = make_handler(&PyDocConverter::handleParagraph); tagHandlers["todo"] = make_handler(&PyDocConverter::handleParagraph); @@ -239,27 +224,21 @@ void PyDocConverter::fillStaticTables() tagHandlers["xmlonly"] = make_handler(&PyDocConverter::handleParagraph); // these commands have special handlers tagHandlers["arg"] = make_handler(&PyDocConverter::handleTagMessage, "* "); - tagHandlers["cond"] = make_handler(&PyDocConverter::handleTagMessage, - "Conditional comment: "); + tagHandlers["cond"] = make_handler(&PyDocConverter::handleTagMessage, "Conditional comment: "); tagHandlers["else"] = make_handler(&PyDocConverter::handleTagIf, "Else: "); tagHandlers["elseif"] = make_handler(&PyDocConverter::handleTagIf, "Else if: "); - tagHandlers["endcond"] = make_handler(&PyDocConverter::handleTagMessage, - "End of conditional comment."); + tagHandlers["endcond"] = make_handler(&PyDocConverter::handleTagMessage, "End of conditional comment."); tagHandlers["if"] = make_handler(&PyDocConverter::handleTagIf, "If: "); tagHandlers["ifnot"] = make_handler(&PyDocConverter::handleTagIf, "If not: "); tagHandlers["image"] = make_handler(&PyDocConverter::handleTagImage); tagHandlers["li"] = make_handler(&PyDocConverter::handleTagMessage, "* "); tagHandlers["overload"] = make_handler(&PyDocConverter::handleTagMessage, - "This is an overloaded member function, provided for" - " convenience.\nIt differs from the above function only in what" - " argument(s) it accepts."); + "This is an overloaded member function, provided for" + " convenience.\nIt differs from the above function only in what" " argument(s) it accepts."); tagHandlers["par"] = make_handler(&PyDocConverter::handleTagPar); - tagHandlers["param"] = - tagHandlers["tparam"] = make_handler(&PyDocConverter::handleTagParam); + tagHandlers["param"] = tagHandlers["tparam"] = make_handler(&PyDocConverter::handleTagParam); tagHandlers["ref"] = make_handler(&PyDocConverter::handleTagRef); - tagHandlers["result"] = - tagHandlers["return"] = - tagHandlers["returns"] = make_handler(&PyDocConverter::handleTagReturn); + tagHandlers["result"] = tagHandlers["return"] = tagHandlers["returns"] = make_handler(&PyDocConverter::handleTagReturn); // this command just prints it's contents // (it is internal command of swig's parser, contains plain text) @@ -268,15 +247,12 @@ void PyDocConverter::fillStaticTables() tagHandlers["n"] = make_handler(&PyDocConverter::handleNewLine); // \f commands output literal Latex formula, which is still better than nothing. - tagHandlers["f$"] = - tagHandlers["f["] = - tagHandlers["f{"] = make_handler(&PyDocConverter::handleMath); + tagHandlers["f$"] = tagHandlers["f["] = tagHandlers["f{"] = make_handler(&PyDocConverter::handleMath); // HTML tags tagHandlers[""); } -PyDocConverter::PyDocConverter(int flags) : - DoxygenTranslator(flags), m_tableLineLen(0), m_prevRowIsTH( - false) -{ +PyDocConverter::PyDocConverter(int flags): +DoxygenTranslator(flags), m_tableLineLen(0), m_prevRowIsTH(false) { fillStaticTables(); } // Return the type as it should appear in the output documentation. -static -std::string getPyDocType(Node* n, const_String_or_char_ptr lname = "") -{ +static std::string getPyDocType(Node *n, const_String_or_char_ptr lname = "") { std::string type; 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)) { // In Python C++ namespaces are flattened, so remove all but last component // 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 // 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. type = ":py:class:`"; - type += Char (last); + type += Char(last); type += "`"; Delete(last); @@ -390,14 +361,13 @@ std::string getPyDocType(Node* n, const_String_or_char_ptr lname = "") return type; } -std::string PyDocConverter::getParamType(std::string param) -{ +std::string PyDocConverter::getParamType(std::string param) { std::string type; ParmList *plist = CopyParmList(Getattr(currentNode, "parms")); - for (Parm *p = plist; p;p = nextSibling(p)) { - String* pname = Getattr(p, "name"); - if (Char (pname) != param) + for (Parm *p = plist; p; p = nextSibling(p)) { + String *pname = Getattr(p, "name"); + if (Char(pname) != param) continue; type = getPyDocType(p, pname); @@ -407,8 +377,7 @@ std::string PyDocConverter::getParamType(std::string param) return type; } -std::string PyDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) -{ +std::string PyDocConverter::translateSubtree(DoxygenEntity &doxygenEntity) { std::string translatedComment; if (doxygenEntity.isLeaf) @@ -433,28 +402,19 @@ std::string PyDocConverter::translateSubtree(DoxygenEntity & doxygenEntity) return translatedComment; } -void PyDocConverter::translateEntity(DoxygenEntity & doxyEntity, - std::string &translatedComment) -{ +void PyDocConverter::translateEntity(DoxygenEntity &doxyEntity, std::string &translatedComment) { // check if we have needed handler and call it std::map >::iterator it; it = tagHandlers.find(doxyEntity.typeOfEntity); if (it != tagHandlers.end()) - (this->*(it->second.first))(doxyEntity, translatedComment, - it->second.second); + (this->*(it->second.first)) (doxyEntity, translatedComment, it->second.second); } -void PyDocConverter::handleParagraph(DoxygenEntity& tag, - std::string& translatedComment, - const std::string&) -{ +void PyDocConverter::handleParagraph(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { translatedComment += translateSubtree(tag); } -void PyDocConverter::handleMath(DoxygenEntity &tag, - std::string &translatedComment, - const std::string& arg) -{ +void PyDocConverter::handleMath(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { IndentGuard indent; // 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, - std::string &translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleCode(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { IndentGuard indent(translatedComment, m_indent); trimWhitespace(translatedComment); @@ -552,43 +509,27 @@ void PyDocConverter::handleCode(DoxygenEntity &tag, translatedComment += '\n'; } -void PyDocConverter::handlePlainString(DoxygenEntity& tag, - std::string& translatedComment, - const std::string&) -{ +void PyDocConverter::handlePlainString(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { translatedComment += tag.data; } -void PyDocConverter::handleTagVerbatim(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { translatedComment += arg + " "; - for (DoxygenEntityListCIt it = tag.entityList.begin(); - it != tag.entityList.end(); it++) { + for (DoxygenEntityListCIt it = tag.entityList.begin(); it != tag.entityList.end(); it++) { translatedComment += it->data; } } -void PyDocConverter::handleTagMessage(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { translatedComment += arg; handleParagraph(tag, translatedComment); } -void PyDocConverter::handleTagChar(DoxygenEntity& tag, - std::string& translatedComment, - const std::string&) -{ +void PyDocConverter::handleTagChar(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { translatedComment += tag.typeOfEntity; } -void PyDocConverter::handleTagIf(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleTagIf(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { translatedComment += arg; if (tag.entityList.size()) { translatedComment += tag.entityList.begin()->data; @@ -597,10 +538,7 @@ void PyDocConverter::handleTagIf(DoxygenEntity& tag, } } -void PyDocConverter::handleTagPar(DoxygenEntity& tag, - std::string& translatedComment, - const std::string&) -{ +void PyDocConverter::handleTagPar(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { translatedComment += "Title: "; if (tag.entityList.size()) translatedComment += tag.entityList.begin()->data; @@ -608,10 +546,7 @@ void PyDocConverter::handleTagPar(DoxygenEntity& tag, handleParagraph(tag, translatedComment); } -void PyDocConverter::handleTagImage(DoxygenEntity& tag, - std::string& translatedComment, - const std::string&) -{ +void PyDocConverter::handleTagImage(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { if (tag.entityList.size() < 2) return; tag.entityList.pop_front(); @@ -622,10 +557,7 @@ void PyDocConverter::handleTagImage(DoxygenEntity& tag, translatedComment += "(" + tag.entityList.begin()->data + ")"; } -void PyDocConverter::handleTagParam(DoxygenEntity& tag, - std::string& translatedComment, - const std::string&) -{ +void PyDocConverter::handleTagParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { if (tag.entityList.size() < 2) return; @@ -634,7 +566,7 @@ void PyDocConverter::handleTagParam(DoxygenEntity& tag, DoxygenEntity paramNameEntity = *tag.entityList.begin(); tag.entityList.pop_front(); - const std::string& paramName = paramNameEntity.data; + const std::string ¶mName = paramNameEntity.data; const std::string paramType = getParamType(paramName); if (!paramType.empty()) { @@ -648,10 +580,7 @@ void PyDocConverter::handleTagParam(DoxygenEntity& tag, } -void PyDocConverter::handleTagReturn(DoxygenEntity &tag, - std::string &translatedComment, - const std::string &) -{ +void PyDocConverter::handleTagReturn(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { IndentGuard indent(translatedComment, m_indent); const std::string pytype = getPyDocType(currentNode); @@ -667,10 +596,7 @@ void PyDocConverter::handleTagReturn(DoxygenEntity &tag, } -void PyDocConverter::handleTagException(DoxygenEntity &tag, - std::string &translatedComment, - const std::string &) -{ +void PyDocConverter::handleTagException(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { IndentGuard indent(translatedComment, m_indent); translatedComment += ":raises: "; @@ -678,10 +604,7 @@ void PyDocConverter::handleTagException(DoxygenEntity &tag, } -void PyDocConverter::handleTagRef(DoxygenEntity& tag, - std::string& translatedComment, - const std::string&) -{ +void PyDocConverter::handleTagRef(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { if (!tag.entityList.size()) return; @@ -695,26 +618,19 @@ void PyDocConverter::handleTagRef(DoxygenEntity& tag, } -void PyDocConverter::handleTagWrap(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleTagWrap(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { if (tag.entityList.size()) { // do not include empty tags std::string tagData = translateSubtree(tag); // wrap the thing, ignoring whitespace size_t wsPos = tagData.find_last_not_of("\n\t "); if (wsPos != std::string::npos && wsPos != tagData.size() - 1) - translatedComment += arg + tagData.substr(0, wsPos + 1) + arg - + tagData.substr(wsPos + 1); + translatedComment += arg + tagData.substr(0, wsPos + 1) + arg + tagData.substr(wsPos + 1); else translatedComment += arg + tagData + arg; } } -void PyDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleDoxyHtmlTag(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { std::string htmlTagArgs = tag.data; if (htmlTagArgs == "/") { // end html tag, for example " @@ -724,10 +640,7 @@ void PyDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag, } } -void PyDocConverter::handleDoxyHtmlTagNoParam(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleDoxyHtmlTagNoParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { std::string htmlTagArgs = tag.data; if (htmlTagArgs == "/") { // end html tag, for example " @@ -736,10 +649,7 @@ void PyDocConverter::handleDoxyHtmlTagNoParam(DoxygenEntity& tag, } } -void PyDocConverter::handleDoxyHtmlTag_A(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleDoxyHtmlTag_A(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { std::string htmlTagArgs = tag.data; if (htmlTagArgs == "/") { // end html tag, " @@ -755,10 +665,7 @@ void PyDocConverter::handleDoxyHtmlTag_A(DoxygenEntity& tag, } } -void PyDocConverter::handleDoxyHtmlTag2(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleDoxyHtmlTag2(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg) { std::string htmlTagArgs = tag.data; if (htmlTagArgs == "/") { // end html tag, for example " @@ -768,18 +675,14 @@ void PyDocConverter::handleDoxyHtmlTag2(DoxygenEntity& tag, } } -void PyDocConverter::handleDoxyHtmlTag_tr(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &) -{ +void PyDocConverter::handleDoxyHtmlTag_tr(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { std::string htmlTagArgs = tag.data; size_t nlPos = translatedComment.rfind('\n'); if (htmlTagArgs == "/") { // end tag, appends vertical table line '|' translatedComment += '|'; if (nlPos != string::npos) { - size_t startOfTableLinePos = translatedComment.find_first_not_of(" \t", - nlPos + 1); + size_t startOfTableLinePos = translatedComment.find_first_not_of(" \t", nlPos + 1); if (startOfTableLinePos != string::npos) { m_tableLineLen = translatedComment.size() - startOfTableLinePos; } @@ -800,10 +703,7 @@ void PyDocConverter::handleDoxyHtmlTag_tr(DoxygenEntity& tag, } } -void PyDocConverter::handleDoxyHtmlTag_th(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &) -{ +void PyDocConverter::handleDoxyHtmlTag_th(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { std::string htmlTagArgs = tag.data; if (htmlTagArgs == "/") { // end tag, is ignored @@ -813,10 +713,7 @@ void PyDocConverter::handleDoxyHtmlTag_th(DoxygenEntity& tag, } } -void PyDocConverter::handleDoxyHtmlTag_td(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &) -{ +void PyDocConverter::handleDoxyHtmlTag_td(DoxygenEntity &tag, std::string &translatedComment, const std::string &) { std::string htmlTagArgs = tag.data; if (htmlTagArgs == "/") { // end tag, is ignored @@ -825,18 +722,12 @@ void PyDocConverter::handleDoxyHtmlTag_td(DoxygenEntity& tag, } } -void PyDocConverter::handleHtmlEntity(DoxygenEntity&, - std::string& translatedComment, - const std::string &arg) -{ +void PyDocConverter::handleHtmlEntity(DoxygenEntity &, std::string &translatedComment, const std::string &arg) { // html entities translatedComment += arg; } -void PyDocConverter::handleNewLine(DoxygenEntity&, - std::string& translatedComment, - const std::string&) -{ +void PyDocConverter::handleNewLine(DoxygenEntity &, std::string &translatedComment, const std::string &) { trimWhitespace(translatedComment); translatedComment += "\n"; @@ -844,8 +735,7 @@ void PyDocConverter::handleNewLine(DoxygenEntity&, translatedComment += m_indent; } -String *PyDocConverter::makeDocumentation(Node *n) -{ +String *PyDocConverter::makeDocumentation(Node *n) { String *documentation; std::string pyDocString; @@ -873,7 +763,7 @@ String *PyDocConverter::makeDocumentation(Node *n) String *comment = NewString(""); Append(comment, documentation); Replaceall(comment, "\n *", "\n"); - oneDoc = Char (comment); + oneDoc = Char(comment); Delete(comment); } else { std::list entityList = parser.createTree(n, documentation); @@ -898,12 +788,10 @@ String *PyDocConverter::makeDocumentation(Node *n) if (allDocumentation.size() > 1) { string indentStr; if (minIndent != static_cast(-1)) - indentStr.assign(minIndent, ' '); + indentStr.assign(minIndent, ' '); std::ostringstream concatDocString; - for (size_t realOverloadCount = 0; - realOverloadCount < allDocumentation.size(); - realOverloadCount++) { + for (size_t realOverloadCount = 0; realOverloadCount < allDocumentation.size(); realOverloadCount++) { if (realOverloadCount != 0) { // separate it from the preceding one. concatDocString << "\n" << indentStr << "|\n\n"; @@ -911,8 +799,7 @@ String *PyDocConverter::makeDocumentation(Node *n) oneDoc = allDocumentation[realOverloadCount]; trimWhitespace(oneDoc); - concatDocString << indentStr << "*Overload " << (realOverloadCount + 1) << ":*\n" - << oneDoc; + concatDocString << indentStr << "*Overload " << (realOverloadCount + 1) << ":*\n" << oneDoc; } pyDocString = concatDocString.str(); } else if (allDocumentation.size() == 1) { @@ -927,7 +814,7 @@ String *PyDocConverter::makeDocumentation(Node *n) String *comment = NewString(""); Append(comment, documentation); Replaceall(comment, "\n *", "\n"); - pyDocString = Char (comment); + pyDocString = Char(comment); Delete(comment); } else { std::list entityList = parser.createTree(n, documentation); diff --git a/Source/DoxygenTranslator/src/PyDocConverter.h b/Source/DoxygenTranslator/src/PyDocConverter.h index 338b1fed9..b78d81ed3 100644 --- a/Source/DoxygenTranslator/src/PyDocConverter.h +++ b/Source/DoxygenTranslator/src/PyDocConverter.h @@ -20,8 +20,8 @@ #include "DoxygenEntity.h" #include "DoxygenTranslator.h" -#define DOC_STRING_LENGTH 64 // characters per line allowed -#define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type +#define DOC_STRING_LENGTH 64 // characters per line allowed +#define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type class PyDocConverter : public DoxygenTranslator { public: @@ -39,42 +39,45 @@ protected: * display. Prints title for every group of tags that have * a section title associated with them */ - std::string translateSubtree(DoxygenEntity & doxygenEntity); + std::string translateSubtree(DoxygenEntity &doxygenEntity); + /* * Translate one entity with the appropriate handler, according * 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 * arg - some string argument to easily pass it through lookup table */ - typedef void (PyDocConverter::*tagHandler)(DoxygenEntity &tag, - std::string &translatedComment, const std::string &arg); + typedef void (PyDocConverter::*tagHandler) (DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); /* * Wrap the command data with the some string * arg - string to wrap with, like '_' or '*' */ void handleTagWrap(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Just prints new line */ void handleNewLine(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Print the name of tag to the output, used for escape-commands */ void handleTagChar(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Format the contents of the \exception tag or its synonyms. */ void handleTagException(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Print only the content and strip original tag */ - void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, - const std::string &arg = std::string()); + void handleParagraph(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg = std::string()); /* * 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$, ... */ - void handleTagVerbatim(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg); + void handleTagVerbatim(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); /* * Print the if-elseif-else-endif section */ void handleTagIf(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Prints the specified message, than the contents of the tag * arg - message */ void handleTagMessage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Insert 'Title: ...' */ void handleTagPar(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Insert 'Image: ...' */ void handleTagImage(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Format nice param description with type information */ void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * Format the contents of the \return tag or its synonyms. */ void handleTagReturn(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); + /* * 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 ,
      ,
    , ... */ - 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
    * 'border=1' is not written to output. */ - void handleDoxyHtmlTagNoParam(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg); + void handleDoxyHtmlTagNoParam(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); /** Translates tag text to: text ("url"). */ - void handleDoxyHtmlTag_A(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg); + void handleDoxyHtmlTag_A(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); /* * Handles HTML tags, which are translated to markdown-like syntax, for example * text --> _text_. Appends arg for start HTML tag and end HTML tag. */ - void handleDoxyHtmlTag2(DoxygenEntity& tag, - std::string& translatedComment, - const std::string &arg); + void handleDoxyHtmlTag2(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); /* Handles HTML table, tag */ - void handleDoxyHtmlTag_tr(DoxygenEntity& tag, std::string& translatedComment, - const std::string &arg); + void handleDoxyHtmlTag_tr(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); /* Handles HTML table, tag
    */ - void handleDoxyHtmlTag_th(DoxygenEntity& tag, std::string& translatedComment, - const std::string &arg); + void handleDoxyHtmlTag_th(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); /* Handles HTML table, tag */ - void handleDoxyHtmlTag_td(DoxygenEntity& tag, std::string& translatedComment, - const std::string &arg); + void handleDoxyHtmlTag_td(DoxygenEntity &tag, std::string &translatedComment, const std::string &arg); /* Handles HTML entities recognized by Doxygen, like <, ©, ... */ - 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 - typedef std::map > TagHandlersMap; + typedef std::map >TagHandlersMap; static TagHandlersMap tagHandlers; // 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. 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(); };