formatting fixes after running make beautify plus a few manual formatting fixes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@11699 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-10-13 23:26:01 +00:00
commit 19d90026ef
17 changed files with 1805 additions and 1729 deletions

View file

@ -121,8 +121,8 @@ bool CompareDoxygenEntities::operator()(DoxygenEntity& first, DoxygenEntity& sec
return true; return true;
if (second.typeOfEntity.compare("since") == 0) if (second.typeOfEntity.compare("since") == 0)
return true; return true;
if(second.typeOfEntity.compare("deprecated")== 0 if (second.typeOfEntity.compare("deprecated") == 0)
)return true; return true;
return false; return false;
} }
if (first.typeOfEntity.compare("exception") == 0) { if (first.typeOfEntity.compare("exception") == 0) {
@ -189,5 +189,3 @@ bool CompareDoxygenEntities::operator()(DoxygenEntity& first, DoxygenEntity& sec
} }
return true; return true;
} }

View file

@ -61,4 +61,4 @@ struct CompareDoxygenEntities {
bool operator() (DoxygenEntity & first, DoxygenEntity & second); bool operator() (DoxygenEntity & first, DoxygenEntity & second);
}; };
#endif /*TOKENLIST_H_*/ #endif

View file

@ -2,12 +2,10 @@
#include "TokenList.h" #include "TokenList.h"
DoxygenParser::DoxygenParser() DoxygenParser::DoxygenParser() {
{
} }
DoxygenParser::~DoxygenParser() DoxygenParser::~DoxygenParser() {
{
} }
////////////////////////////////////////// //////////////////////////////////////////
@ -18,7 +16,8 @@ std::list <DoxygenEntity> parse(std::list<Token>::iterator endParsingIndex, Toke
////////////////////////////////////////// //////////////////////////////////////////
std::string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attention", std::string commandArray[] = {
"a", "addindex", "addtogroup", "anchor", "arg", "attention",
"author", "b", "brief", "bug", "c", "callgraph", "callergraph", "category", "author", "b", "brief", "bug", "c", "callgraph", "callergraph", "category",
"class", "code", "cond", "copybrief", "copydetails", "copydoc", "date", "def", "class", "code", "cond", "copybrief", "copydetails", "copydoc", "date", "def",
"defgroup", "deprecated", "details", "dir", "dontinclude", "dot", "dotfile", "e", "defgroup", "deprecated", "details", "dir", "dontinclude", "dot", "dotfile", "e",
@ -33,39 +32,62 @@ std::string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "a
"public", "publicsection", "ref", "relates", "relatesalso", "remarks", "return", "retval", "public", "publicsection", "ref", "relates", "relatesalso", "remarks", "return", "retval",
"sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage", "sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage",
"subsection", "subsubsection", "test", "throw", "throws", "todo", "tparam", "typedef", "union", "until", "subsection", "subsubsection", "test", "throw", "throws", "todo", "tparam", "typedef", "union", "until",
"var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "$", "@", "\\", "&", "~", "<", ">", "#", "%"};
"$", "@", "\\","&", "~", "<", ">", "#", "%"};
std::string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details", std::string sectionIndicators[] = {
"attention", "author", "brief", "bug", "cond", "date", "deprecated", "details",
"else", "elseif", "endcond", "endif", "exception", "if", "ifnot", "invariant", "note", "par", "param", "else", "elseif", "endcond", "endif", "exception", "if", "ifnot", "invariant", "note", "par", "param",
"tparam", "post" , "pre", "remarks", "return", "retval", "sa", "see", "since", "test", "throw", "throws", "todo", "tparam", "post", "pre", "remarks", "return", "retval", "sa", "see", "since", "test", "throw", "throws", "todo", "version", "warning", "xrefitem"};
"version", "warning", "xrefitem" };
/* All of the doxygen commands divided up by how they are parsed */ /* All of the doxygen commands divided up by how they are parsed */
std::string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"}; std::string simpleCommands[] = {
std::string ignoredSimpleCommands[] = {"nothing at the moment"}; "n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"};
std::string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package",
"relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; std::string ignoredSimpleCommands[] = {
std::string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"}; "nothing at the moment"};
std::string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"};
std::string ignoreCommandLines[] = {"nothing at the moment"}; std::string commandWords[] = {
std::string commandParagraph[] = {"partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno"};
std::string ignoredCommandWords[] = {
"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"};
std::string commandLines[] = {
"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"};
std::string ignoreCommandLines[] = {
"nothing at the moment"};
std::string commandParagraph[] = {
"partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant",
"deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"}; "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "author"};
std::string ignoreCommandParagraphs[] = {"nothing at the moment"};
std::string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", std::string ignoreCommandParagraphs[] = {
"verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; "nothing at the moment"};
std::string commandWordParagraphs[] = {"param", "tparam", "throw", "throws", "retval", "exception"};
std::string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"}; std::string commandEndCommands[] = {
std::string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"}; "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", "verbatim", "xmlonly", "cond", "if", "ifnot", "link"};
std::string commandOWords[] = {"dir", "file", "cond"};
std::string commandErrorThrowings[] = {"annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header", std::string commandWordParagraphs[] = {
"param", "tparam", "throw", "throws", "retval", "exception"};
std::string commandWordLines[] = {
"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"};
std::string commandWordOWordOWords[] = {
"category", "class", "protocol", "interface", "struct", "union"};
std::string commandOWords[] = {
"dir", "file", "cond"};
std::string commandErrorThrowings[] = {
"annotatedclassstd::list", "classhierarchy", "define", "functionindex", "header",
"headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected", "headerfilestd::list", "inherit", "l", "postheader", "private", "privatesection", "protected",
"protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly",
"endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endif"};
"endif"}; std::string commandUniques[] = {
std::string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", "subpage", "dotfile", "image", "addtogroup", "li"};
"subpage", "dotfile", "image", "addtogroup", "li"};
/* Changes a std::string to all lower case */ /* Changes a std::string to all lower case */
@ -219,7 +241,8 @@ std::list<Token>::iterator getOneLine(TokenList &tokList){
*/ */
std::string getStringTilCommand(TokenList & tokList) { std::string getStringTilCommand(TokenList & tokList) {
std::string description; std::string description;
if (tokList.peek().tokenType == 0) return ""; if (tokList.peek().tokenType == 0)
return "";
while (tokList.peek().tokenType == PLAINSTRING) { while (tokList.peek().tokenType == PLAINSTRING) {
Token currentToken = tokList.next(); Token currentToken = tokList.next();
if (currentToken.tokenType == PLAINSTRING) { if (currentToken.tokenType == PLAINSTRING) {
@ -236,7 +259,8 @@ std::string getStringTilCommand(TokenList &tokList){
std::string getStringTilEndCommand(std::string theCommand, TokenList & tokList) { std::string getStringTilEndCommand(std::string theCommand, TokenList & tokList) {
std::string description; std::string description;
if (tokList.peek().tokenType == 0) return ""; if (tokList.peek().tokenType == 0)
return "";
while (tokList.peek().tokenString.compare(theCommand) != 0) { while (tokList.peek().tokenString.compare(theCommand) != 0) {
Token currentToken = tokList.next(); Token currentToken = tokList.next();
description = description + currentToken.tokenString + " "; description = description + currentToken.tokenString + " ";
@ -263,8 +287,8 @@ std::list<Token>::iterator getEndOfParagraph(TokenList &tokList){
if (isSectionIndicator((*endOfParagraph).tokenString)) { if (isSectionIndicator((*endOfParagraph).tokenString)) {
return endOfParagraph; return endOfParagraph;
} } else
else endOfParagraph++; endOfParagraph++;
} else if ((*endOfParagraph).tokenType == PLAINSTRING) { } else if ((*endOfParagraph).tokenType == PLAINSTRING) {
endOfParagraph++; endOfParagraph++;
@ -284,13 +308,13 @@ std::list<Token>::iterator getEndOfSection(std::string theCommand, TokenList &to
std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy(); std::list < Token >::iterator endOfParagraph = tokList.iteratorCopy();
while (endOfParagraph != tokList.end()) { while (endOfParagraph != tokList.end()) {
if ((*endOfParagraph).tokenType == COMMAND) { if ((*endOfParagraph).tokenType == COMMAND) {
if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph; if (theCommand.compare((*endOfParagraph).tokenString) == 0)
else endOfParagraph++; return endOfParagraph;
} else
else if((* endOfParagraph).tokenType == PLAINSTRING) {
endOfParagraph++; endOfParagraph++;
} } else if ((*endOfParagraph).tokenType == PLAINSTRING) {
else if ((* endOfParagraph).tokenType == END_LINE){ endOfParagraph++;
} else if ((*endOfParagraph).tokenType == END_LINE) {
endOfParagraph++; endOfParagraph++;
if ((*endOfParagraph).tokenType == END_LINE) { if ((*endOfParagraph).tokenType == END_LINE) {
endOfParagraph++; endOfParagraph++;
@ -339,7 +363,8 @@ std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &t
* \n \\ \@ \& \$ \# \< \> \% * \n \\ \@ \& \$ \# \< \> \%
*/ */
int addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { int addSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
doxyList.push_back(DoxygenEntity(theCommand)); doxyList.push_back(DoxygenEntity(theCommand));
return 1; return 1;
} }
@ -350,7 +375,8 @@ int addSimpleCommand(std::string theCommand, std::list <DoxygenEntity> &doxyList
*/ */
int ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) { int ignoreSimpleCommand(std::string theCommand, std::list < DoxygenEntity > &doxyList) {
#pragma unused(doxyList) #pragma unused(doxyList)
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
return 1; return 1;
} }
@ -361,13 +387,13 @@ int ignoreSimpleCommand(std::string theCommand, std::list <DoxygenEntity> &doxyL
* "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"
*/ */
int addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { int addCommandWord(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (!name.empty()) { if (!name.empty()) {
doxyList.push_back(DoxygenEntity(theCommand, name)); doxyList.push_back(DoxygenEntity(theCommand, name));
return 1; return 1;
} } else
else
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
return 0; return 0;
} }
@ -489,7 +515,8 @@ int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::lis
* "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"
*/ */
int addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) { int addCommandWordLine(std::string theCommand, TokenList & tokList, std::list < DoxygenEntity > &doxyList) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (name.empty()) { if (name.empty()) {
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
@ -615,14 +642,14 @@ int addCommandUnique(std::string theCommand, TokenList &tokList, std::list <Doxy
std::list < DoxygenEntity > aNewList; std::list < DoxygenEntity > aNewList;
aNewList = parse(endOfLine, tokList); aNewList = parse(endOfLine, tokList);
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
} } else
else
doxyList.push_back(DoxygenEntity(theCommand)); doxyList.push_back(DoxygenEntity(theCommand));
return 1; return 1;
} }
// \weakgroup <name> [(title)] // \weakgroup <name> [(title)]
else if (theCommand.compare("weakgroup") == 0) { else if (theCommand.compare("weakgroup") == 0) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
std::string name = getNextWord(tokList); std::string name = getNextWord(tokList);
if (name.empty()) { if (name.empty()) {
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
@ -692,7 +719,8 @@ int addCommand(std::string commandString, TokenList &tokList,std::list <DoxygenE
std::string theCommand = StringToLower(commandString); std::string theCommand = StringToLower(commandString);
if (theCommand.compare("plainstd::string") == 0) { if (theCommand.compare("plainstd::string") == 0) {
std::string nextPhrase = getStringTilCommand(tokList); std::string nextPhrase = getStringTilCommand(tokList);
if (noisy) cout << "Parsing plain std::string :" << nextPhrase << endl; if (noisy)
cout << "Parsing plain std::string :" << nextPhrase << endl;
doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase)); doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase));
return 1; return 1;
} }
@ -755,20 +783,18 @@ std::list<DoxygenEntity> parse(std::list<Token>::iterator endParsingIndex, Token
cout << "Parsing for phrase starting in:" << currToken.toString() << endl; cout << "Parsing for phrase starting in:" << currToken.toString() << endl;
if (currToken.tokenType == END_LINE) { if (currToken.tokenType == END_LINE) {
tokList.next(); tokList.next();
} } else if (currToken.tokenType == COMMAND) {
else if(currToken.tokenType == COMMAND){
currCommand = findCommand(currToken.tokenString); currCommand = findCommand(currToken.tokenString);
if (currCommand < 0) { if (currCommand < 0) {
if (noisy) if (noisy)
cout << "Unidentified Command " << currToken.tokenString << endl; cout << "Unidentified Command " << currToken.tokenString << endl;
tokList.next(); tokList.next();
addCommand(std::string("plainstd::string"), tokList, aNewList); addCommand(std::string("plainstd::string"), tokList, aNewList);
} } else {
else { tokList.next(); tokList.next();
addCommand(currToken.tokenString, tokList, aNewList); addCommand(currToken.tokenString, tokList, aNewList);
} }
} } else if (currToken.tokenType == PLAINSTRING) {
else if (currToken.tokenType == PLAINSTRING){
addCommand(std::string("plainstd::string"), tokList, aNewList); addCommand(std::string("plainstd::string"), tokList, aNewList);
} }
break; break;
@ -790,8 +816,7 @@ std::list<DoxygenEntity> parseRoot(std::list<Token>::iterator endParsingIndex, T
if (currToken.tokenType == END_LINE) { if (currToken.tokenType == END_LINE) {
tokList.next(); tokList.next();
} } else if (currToken.tokenType == COMMAND) {
else if(currToken.tokenType == COMMAND){
currCommand = findCommand(currToken.tokenString); currCommand = findCommand(currToken.tokenString);
if (currCommand < 0) { if (currCommand < 0) {
if (noisy) { if (noisy) {
@ -803,8 +828,7 @@ std::list<DoxygenEntity> parseRoot(std::list<Token>::iterator endParsingIndex, T
tokList.next(); tokList.next();
addCommand(currToken.tokenString, tokList, aNewList); addCommand(currToken.tokenString, tokList, aNewList);
} }
} } else if (currToken.tokenType == PLAINSTRING) {
else if (currToken.tokenType == PLAINSTRING){
addCommand(std::string("partofdescription"), tokList, aNewList); addCommand(std::string("partofdescription"), tokList, aNewList);
} }
} }

View file

@ -3,12 +3,11 @@
#include <string> #include <string>
#include <list> #include <list>
#include "DoxygenEntity.h" #include "DoxygenEntity.h"
class DoxygenParser class DoxygenParser {
{
public: public:
DoxygenParser(); DoxygenParser();
virtual ~DoxygenParser(); virtual ~DoxygenParser();
std::list < DoxygenEntity > createTree(std::string doxygen); std::list < DoxygenEntity > createTree(std::string doxygen);
}; };
#endif /*DOXYGENPARSER_H_*/ #endif

View file

@ -28,14 +28,13 @@ enum DocumentationFormat {
* A class to translate doxygen comments attacted to parser nodes * A class to translate doxygen comments attacted to parser nodes
* into alternative formats for use in code generated for target languages. * into alternative formats for use in code generated for target languages.
*/ */
class DoxygenTranslator class DoxygenTranslator {
{
public: public:
/* /*
* Virtual destructor. * Virtual destructor.
*/ */
virtual ~DoxygenTranslator(){} virtual ~ DoxygenTranslator() {
}
/* /*
* Return the documentation for a given node formated for the correct * Return the documentation for a given node formated for the correct
* documentation system. * documentation system.
@ -62,4 +61,4 @@ protected:
void printTree(std::list < DoxygenEntity > &entityList); void printTree(std::list < DoxygenEntity > &entityList);
}; };
#endif /*DOXYGENTRANSLATOR_H_*/ #endif

View file

@ -1,7 +1,5 @@
/* The main class for translating blobs of Doxygen for SWIG /* The main class for translating blobs of Doxygen for SWIG
* by Cheryl Foil, mentor Olly Betts, for Google's Summer of Code Program * by Cheryl Foil, mentor Olly Betts, for Google's Summer of Code Program
* Currently the spacing/format on this is a bit goofy in places, due to shuffling code
* between 2 editors! Apologies for anyone combing through it :)
*/ */
//TODO DOH instead of STL? //TODO DOH instead of STL?
//TODO Most commands are not fully implemented //TODO Most commands are not fully implemented
@ -67,38 +65,50 @@ string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attent
"sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage", "sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage",
"subsection", "subsubsection", "test", "throw", "todo", "tparam", "typedef", "union", "until", "subsection", "subsubsection", "test", "throw", "todo", "tparam", "typedef", "union", "until",
"var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem", "var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem",
"$", "@", "//","&", "~", "<", ">", "#", "%"}; "$", "@", "//", "&", "~", "<", ">", "#", "%"
};
string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details", string sectionIndicators[] = { "attention", "author", "brief", "bug", "cond", "date", "deprecated", "details",
"else", "elseif", "endcond", "endif", "exception", "if", "ifnot", "invariant", "note", "par", "param", "else", "elseif", "endcond", "endif", "exception", "if", "ifnot", "invariant", "note", "par", "param",
"tparam", "post", "pre", "remarks", "return", "retval", "sa", "see", "since", "test", "throw", "todo", "tparam", "post", "pre", "remarks", "return", "retval", "sa", "see", "since", "test", "throw", "todo",
"version", "warning", "xrefitem" }; "version", "warning", "xrefitem"
};
/* All of the doxygen commands divided up by how they are parsed */ /* All of the doxygen commands divided up by how they are parsed */
string simpleCommands[] = { "n", "$", "@", "//", "&", "~", "<", ">", "#", "%" }; string simpleCommands[] = { "n", "$", "@", "//", "&", "~", "<", ">", "#", "%" };
string ignoredSimpleCommands[] = { "nothing at the moment" }; string ignoredSimpleCommands[] = { "nothing at the moment" };
string commandWords[] = { "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package", string commandWords[] = { "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package",
"relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"}; "relates", "namespace", "relatesalso", "anchor", "dontinclude", "include", "includelineno"
};
string ignoredCommandWords[] = { "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" }; string ignoredCommandWords[] = { "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" };
string commandLines[] = { "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" }; string commandLines[] = { "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" };
string ignoreCommandLines[] = { "nothing at the moment" }; string ignoreCommandLines[] = { "nothing at the moment" };
string commandParagraph[] = { "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant", string commandParagraph[] = { "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant",
"deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"}; "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"
};
string ignoreCommandParagraphs[] = { "nothing at the moment" }; string ignoreCommandParagraphs[] = { "nothing at the moment" };
string commandEndCommands[] = { "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly", string commandEndCommands[] = { "code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly",
"verbatim", "xmlonly", "cond", "if", "ifnot", "link"}; "verbatim", "xmlonly", "cond", "if", "ifnot", "link"
};
string commandWordParagraphs[] = { "param", "tparam", "throw", "retval", "exception" }; string commandWordParagraphs[] = { "param", "tparam", "throw", "retval", "exception" };
string commandWordLines[] = { "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" }; string commandWordLines[] = { "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" };
string commandWordOWordOWords[] = { "category", "class", "protocol", "interface", "struct", "union" }; string commandWordOWordOWords[] = { "category", "class", "protocol", "interface", "struct", "union" };
string commandOWords[] = { "dir", "file", "cond" }; string commandOWords[] = { "dir", "file", "cond" };
string commandErrorThrowings[] = { "annotatedclasslist", "classhierarchy", "define", "functionindex", "header", string commandErrorThrowings[] = { "annotatedclasslist", "classhierarchy", "define", "functionindex", "header",
"headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected", "headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected",
"protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly", "protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly",
"endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond", "endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond",
"endif"}; "endif"
};
string commandUniques[] = { "xrefitem", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref", string commandUniques[] = { "xrefitem", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref",
"subpage", "dotfile", "image", "addtogroup", "li"}; "subpage", "dotfile", "image", "addtogroup", "li"
};
//int startIndex = 0; //int startIndex = 0;
int isNewLine = 0; int isNewLine = 0;
@ -114,11 +124,10 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload
/* General (untested) assist methods */ /* General (untested) assist methods */
string StringToLower(string stringToConvert) string StringToLower(string stringToConvert)
{//change each element of the string to lower case
for(unsigned int i=0;i<stringToConvert.length();i++)
{ {
//change each element of the string to lower case
for (unsigned int i = 0; i < stringToConvert.length(); i++) {
stringToConvert[i] = tolower(stringToConvert[i]); stringToConvert[i] = tolower(stringToConvert[i]);
} }
return stringToConvert; //return the converted string return stringToConvert; //return the converted string
@ -143,50 +152,80 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload
//cout << " Looking for command " << theCommand << endl; //cout << " Looking for command " << theCommand << endl;
int i = 0; int i = 0;
for (i = 0; i < sizeof(simpleCommands) / sizeof(*simpleCommands); i++) { for (i = 0; i < sizeof(simpleCommands) / sizeof(*simpleCommands); i++) {
if(smallString.compare(simpleCommands[i]) == 0){return SIMPLECOMMAND ;} if (smallString.compare(simpleCommands[i]) == 0) {
return SIMPLECOMMAND;
}
} }
for (i = 0; i < sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands); i++) { for (i = 0; i < sizeof(ignoredSimpleCommands) / sizeof(*ignoredSimpleCommands); i++) {
if(smallString.compare(ignoredSimpleCommands[i]) == 0){return IGNOREDSIMPLECOMMAND;} if (smallString.compare(ignoredSimpleCommands[i]) == 0) {
return IGNOREDSIMPLECOMMAND;
}
} }
for (i = 0; i < sizeof(commandWords) / sizeof(*commandWords); i++) { for (i = 0; i < sizeof(commandWords) / sizeof(*commandWords); i++) {
if(smallString.compare( commandWords[i]) == 0){return COMMANDWORD;} if (smallString.compare(commandWords[i]) == 0) {
return COMMANDWORD;
}
} }
for (i = 0; i < sizeof(ignoredCommandWords) / sizeof(*ignoredCommandWords); i++) { for (i = 0; i < sizeof(ignoredCommandWords) / sizeof(*ignoredCommandWords); i++) {
if(smallString.compare( ignoredCommandWords[i]) == 0){return IGNOREDCOMMANDWORD;} if (smallString.compare(ignoredCommandWords[i]) == 0) {
return IGNOREDCOMMANDWORD;
}
} }
for (i = 0; i < sizeof(commandLines) / sizeof(*commandLines); i++) { for (i = 0; i < sizeof(commandLines) / sizeof(*commandLines); i++) {
if(smallString.compare( commandLines[i]) == 0){return COMMANDLINE;} if (smallString.compare(commandLines[i]) == 0) {
return COMMANDLINE;
}
} }
for (i = 0; i < sizeof(ignoreCommandLines) / sizeof(*ignoreCommandLines); i++) { for (i = 0; i < sizeof(ignoreCommandLines) / sizeof(*ignoreCommandLines); i++) {
if(smallString.compare( ignoreCommandLines[i]) == 0){return IGNOREDCOMMANDLINE;} if (smallString.compare(ignoreCommandLines[i]) == 0) {
return IGNOREDCOMMANDLINE;
}
} }
for (i = 0; i < sizeof(commandParagraph) / sizeof(*commandParagraph); i++) { for (i = 0; i < sizeof(commandParagraph) / sizeof(*commandParagraph); i++) {
if(smallString.compare( commandParagraph[i]) == 0){return COMMANDPARAGRAPH;} if (smallString.compare(commandParagraph[i]) == 0) {
return COMMANDPARAGRAPH;
}
} }
/* IgnoreCommandParagraph */ /* IgnoreCommandParagraph */
for (i = 0; i < sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); i++) { for (i = 0; i < sizeof(ignoreCommandParagraphs) / sizeof(*ignoreCommandParagraphs); i++) {
if(smallString.compare( ignoreCommandParagraphs[i]) == 0){return IGNORECOMMANDPARAGRAPH;} if (smallString.compare(ignoreCommandParagraphs[i]) == 0) {
return IGNORECOMMANDPARAGRAPH;
}
} }
for (i = 0; i < sizeof(commandEndCommands) / sizeof(*commandEndCommands); i++) { for (i = 0; i < sizeof(commandEndCommands) / sizeof(*commandEndCommands); i++) {
if(smallString.compare( commandEndCommands[i]) == 0){return COMMANDENDCOMMAND ;} if (smallString.compare(commandEndCommands[i]) == 0) {
return COMMANDENDCOMMAND;
}
} }
for (i = 0; i < sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); i++) { for (i = 0; i < sizeof(commandWordParagraphs) / sizeof(*commandWordParagraphs); i++) {
if(smallString.compare( commandWordParagraphs[i]) == 0){return COMMANDWORDPARAGRAPH;} if (smallString.compare(commandWordParagraphs[i]) == 0) {
return COMMANDWORDPARAGRAPH;
}
} }
for (i = 0; i < sizeof(commandWordLines) / sizeof(*commandWordLines); i++) { for (i = 0; i < sizeof(commandWordLines) / sizeof(*commandWordLines); i++) {
if(smallString.compare( commandWordLines[i]) == 0){return COMMANDWORDLINE ;} if (smallString.compare(commandWordLines[i]) == 0) {
return COMMANDWORDLINE;
}
} }
for (i = 0; i < sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords); i++) { for (i = 0; i < sizeof(commandWordOWordOWords) / sizeof(*commandWordOWordOWords); i++) {
if(smallString.compare( commandWordOWordOWords[i]) == 0){return COMMANDWORDOWORDWORD;} if (smallString.compare(commandWordOWordOWords[i]) == 0) {
return COMMANDWORDOWORDWORD;
}
} }
for (i = 0; i < sizeof(commandOWords) / sizeof(*commandOWords); i++) { for (i = 0; i < sizeof(commandOWords) / sizeof(*commandOWords); i++) {
if(smallString.compare( commandOWords[i]) == 0){return COMMANDOWORD;} if (smallString.compare(commandOWords[i]) == 0) {
return COMMANDOWORD;
}
} }
for (i = 0; i < sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); i++) { for (i = 0; i < sizeof(commandErrorThrowings) / sizeof(*commandErrorThrowings); i++) {
if(smallString.compare( commandErrorThrowings[i]) == 0){return COMMANDERRORTHROW;} if (smallString.compare(commandErrorThrowings[i]) == 0) {
return COMMANDERRORTHROW;
}
} }
for (i = 0; i < sizeof(commandUniques) / sizeof(*commandUniques); i++) { for (i = 0; i < sizeof(commandUniques) / sizeof(*commandUniques); i++) {
if(smallString.compare( commandUniques[i]) == 0){return COMMANDUNIQUE;} if (smallString.compare(commandUniques[i]) == 0) {
return COMMANDUNIQUE;
}
} }
return 0; return 0;
@ -240,7 +279,10 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload
while (startIndex < doxygenString.length() && (doxygenString[startIndex] == '/' || doxygenString[startIndex] == ' ' while (startIndex < doxygenString.length() && (doxygenString[startIndex] == '/' || doxygenString[startIndex] == ' '
|| doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\n' || doxygenString[startIndex] == '\t' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\n' || doxygenString[startIndex] == '\t'
|| doxygenString[startIndex] == '!')) { || doxygenString[startIndex] == '!')) {
if(doxygenString[startIndex]== '\n'){ startInd = startIndex; return nextWord;} if (doxygenString[startIndex] == '\n') {
startInd = startIndex;
return nextWord;
}
startIndex++; startIndex++;
//cout << "Start Index" << startIndex << endl; //cout << "Start Index" << startIndex << endl;
} }
@ -264,9 +306,9 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload
string getOneLine(int &startInd, string doxygenString) { string getOneLine(int &startInd, string doxygenString) {
int startIndex = startInd; int startIndex = startInd;
while (doxygenString[startIndex] == '/' || doxygenString[startIndex] == ' ' while (doxygenString[startIndex] == '/' || doxygenString[startIndex] == ' '
|| doxygenString[startIndex] == '*' || doxygenString[startIndex]== '\n' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\n' || doxygenString[startIndex] == '!' || doxygenString[startIndex] == '\t') {
|| doxygenString[startIndex] == '!' || doxygenString[startIndex] == '\t'){ if (doxygenString[startIndex] == '\n')
if(doxygenString[startIndex]== '\n') return ""; return "";
startIndex++; startIndex++;
} }
@ -276,16 +318,19 @@ string commandUniques[] = {"xrefitem", "ingroup", "par", "headerfile", "overload
//cout << doxygenString[endIndex] << "End Index: " << endIndex << endl; //cout << doxygenString[endIndex] << "End Index: " << endIndex << endl;
} }
string returnedLine = doxygenString.substr(startIndex, endIndex - startIndex); string returnedLine = doxygenString.substr(startIndex, endIndex - startIndex);
if (doxygenString[endIndex] == '\n' && (endIndex < doxygenString.length())) endIndex++; if (doxygenString[endIndex] == '\n' && (endIndex < doxygenString.length()))
endIndex++;
startInd = endIndex; startInd = endIndex;
return returnedLine; return returnedLine;
} }
/* Returns a properly formatted (all doxygen *, //! etc removed) /* Returns a properly formatted (all doxygen *, //! etc removed)
* up til ANY command or end of paragraph is encountered. Has all the same issues as * up til ANY command or end of paragraph is encountered. Has all the same issues as
* getStringTilEndOfParagraph formatting wise. * getStringTilEndOfParagraph formatting wise.
*/ */
string getStringTilCommand(int &startInd, string doxygenString) { string getStringTilCommand(int &startInd, string doxygenString) {
if (startInd >= doxygenString.length()) return ""; if (startInd >= doxygenString.length())
return "";
int startIndex = startInd; int startIndex = startInd;
int endIndex = startInd; int endIndex = startInd;
string description; string description;
@ -298,32 +343,31 @@ string getStringTilCommand(int &startInd, string doxygenString){
if (endIndex >= doxygenString.length()) { if (endIndex >= doxygenString.length()) {
finalIndex = endIndex; finalIndex = endIndex;
keepLooping = 0; keepLooping = 0;
} } else if (doxygenString[endIndex] == '\n') {
else if (doxygenString[endIndex] == '\n'){
//cout << "1 "; //cout << "1 ";
counter = endIndex; counter = endIndex;
if (keepLooping && endIndex < doxygenString.length() - 1) { if (keepLooping && endIndex < doxygenString.length() - 1) {
counter++; counter++;
//cout << "Counter :" << counter << endl; //cout << "Counter :" << counter << endl;
while (keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' || while (keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' ||
doxygenString[counter] == '*'|| doxygenString[counter] == '\n'|| doxygenString[counter] == '/' doxygenString[counter] == '*' || doxygenString[counter] == '\n'
|| doxygenString[counter] == '!' || doxygenString[startIndex] == '\t') ){ || doxygenString[counter] == '/' || doxygenString[counter] == '!'
|| doxygenString[startIndex] == '\t')) {
if (doxygenString[counter] == '\n') { if (doxygenString[counter] == '\n') {
//cout << "Blank line found" << endl; //cout << "Blank line found" << endl;
keepLooping = 0; keepLooping = 0;
finalIndex = counter;} finalIndex = counter;
else{ counter++;} } else {
counter++;
}
} }
} }
//endIndex = counter; //endIndex = counter;
} } else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@') {
else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){
finalIndex = endIndex; finalIndex = endIndex;
keepLooping = 0; keepLooping = 0;
} } else if (endIndex < doxygenString.length() - 2 && string("**/").compare(doxygenString.substr(endIndex, endIndex + 2)) == 0) {
else if(endIndex < doxygenString.length() -2
&& string("**/").compare(doxygenString.substr(endIndex , endIndex + 2)) == 0){
finalIndex = endIndex; finalIndex = endIndex;
//cout << "3 "; //cout << "3 ";
keepLooping = 0; keepLooping = 0;
@ -335,7 +379,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
} }
//cout << "Done with EndIndex" << endl; //cout << "Done with EndIndex" << endl;
while (doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' while (doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' '
|| doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t') startIndex++; || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t')
startIndex++;
for (int i = startIndex; i < endIndex; i++) { for (int i = startIndex; i < endIndex; i++) {
@ -362,7 +407,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
*/ */
//TODO fix getStringTilEndOfParagraph to be more forgiving, work on ' ' characters //TODO fix getStringTilEndOfParagraph to be more forgiving, work on ' ' characters
string getStringTilEndOfParagraph(int &startInd, string doxygenString) { string getStringTilEndOfParagraph(int &startInd, string doxygenString) {
if (startInd >= doxygenString.length()) return ""; if (startInd >= doxygenString.length())
return "";
int startIndex = startInd; int startIndex = startInd;
int endIndex = startInd; int endIndex = startInd;
string description; string description;
@ -375,21 +421,23 @@ string getStringTilCommand(int &startInd, string doxygenString){
if (endIndex >= doxygenString.length()) { if (endIndex >= doxygenString.length()) {
finalIndex = endIndex; finalIndex = endIndex;
keepLooping = 0; keepLooping = 0;
} } else if (doxygenString[endIndex] == '\n') {
else if (doxygenString[endIndex] == '\n'){
//cout << "1 "; //cout << "1 ";
counter = endIndex; counter = endIndex;
if (keepLooping && endIndex < doxygenString.length() - 1) { if (keepLooping && endIndex < doxygenString.length() - 1) {
counter++; counter++;
//cout << "Counter :" << counter << endl; //cout << "Counter :" << counter << endl;
while (keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' || while (keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' ||
doxygenString[counter] == '*'|| doxygenString[startIndex] == '\t' || doxygenString[counter] == '\n'|| doxygenString[counter] == '/' doxygenString[counter] == '*' || doxygenString[startIndex] == '\t'
|| doxygenString[counter] == '\n' || doxygenString[counter] == '/'
|| doxygenString[counter] == '!')) { || doxygenString[counter] == '!')) {
if (doxygenString[counter] == '\n') { if (doxygenString[counter] == '\n') {
//cout << "Blank line found" << endl; //cout << "Blank line found" << endl;
keepLooping = 0; keepLooping = 0;
finalIndex = counter;} finalIndex = counter;
else{ counter++;} } else {
counter++;
}
} }
} }
@ -401,10 +449,9 @@ string getStringTilCommand(int &startInd, string doxygenString){
if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) { if (isSectionIndicator(getNextWord(spareIndex, doxygenString))) {
keepLooping = 0; keepLooping = 0;
finalIndex = endIndex;} finalIndex = endIndex;
} }
else if(endIndex < doxygenString.length() - 1 } else if (endIndex < doxygenString.length() - 1 && string("*/").compare(doxygenString.substr(endIndex, endIndex + 1)) == 0) {
&& string("*/").compare(doxygenString.substr(endIndex , endIndex + 1)) == 0){
keepLooping = 0; keepLooping = 0;
finalIndex = endIndex; finalIndex = endIndex;
} }
@ -414,7 +461,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
} }
//cout << "Done with EndIndex" << endl; //cout << "Done with EndIndex" << endl;
while (doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '\t' while (doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' || doxygenString[startIndex] == '\t'
|| doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*') startIndex++; || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*')
startIndex++;
for (int i = startIndex; i < endIndex; i++) { for (int i = startIndex; i < endIndex; i++) {
@ -460,7 +508,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
*/ */
string getStringTilAnyCommand(string theCommand, int &startInd, string doxygenString) { string getStringTilAnyCommand(string theCommand, int &startInd, string doxygenString) {
if (startInd >= doxygenString.length()) return ""; if (startInd >= doxygenString.length())
return "";
int startIndex = startInd; int startIndex = startInd;
int endIndex = startInd; int endIndex = startInd;
string description; string description;
@ -473,34 +522,34 @@ string getStringTilCommand(int &startInd, string doxygenString){
if (endIndex >= theCommand.length()) { if (endIndex >= theCommand.length()) {
finalIndex = endIndex; finalIndex = endIndex;
keepLooping = 0; keepLooping = 0;
} } else if (doxygenString[endIndex] == '\n') {
else if (doxygenString[endIndex] == '\n'){
//cout << "1 "; //cout << "1 ";
counter = endIndex; counter = endIndex;
if (keepLooping && endIndex < doxygenString.length() - 1) { if (keepLooping && endIndex < doxygenString.length() - 1) {
counter++; counter++;
//cout << "Counter :" << counter << endl; //cout << "Counter :" << counter << endl;
while (keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' || while (keepLooping && endIndex < doxygenString.length() && (doxygenString[counter] == ' ' ||
doxygenString[counter] == '*'|| doxygenString[counter] == '\n'|| doxygenString[counter] == '/' doxygenString[counter] == '*' || doxygenString[counter] == '\n'
|| doxygenString[counter] == '!' || doxygenString[startIndex] == '\t') ){ || doxygenString[counter] == '/' || doxygenString[counter] == '!'
|| doxygenString[startIndex] == '\t')) {
if (doxygenString[counter] == '\n') { if (doxygenString[counter] == '\n') {
//cout << "Blank line found" << endl; //cout << "Blank line found" << endl;
keepLooping = 0; keepLooping = 0;
finalIndex = counter;} finalIndex = counter;
else{ counter++;} } else {
counter++;
}
} }
} }
//endIndex = counter; //endIndex = counter;
} } else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@') {
else if (doxygenString[endIndex] == '\\' || doxygenString[endIndex] == '@'){
//cout << "2 "; //cout << "2 ";
spareIndex = endIndex; spareIndex = endIndex;
if (endIndex + theCommand.length() < theCommand.length() if (endIndex + theCommand.length() < theCommand.length()
&& theCommand.compare(doxygenString.substr(endIndex, theCommand.length())) == 0) keepLooping = 0; && theCommand.compare(doxygenString.substr(endIndex, theCommand.length())) == 0)
} keepLooping = 0;
else if(endIndex < doxygenString.length() - 1 } else if (endIndex < doxygenString.length() - 1 && string("*/").compare(doxygenString.substr(endIndex, endIndex + 1)) == 0) {
&& string("*/").compare(doxygenString.substr(endIndex , endIndex + 1)) == 0){
//cout << "3 "; //cout << "3 ";
keepLooping = 0; keepLooping = 0;
} }
@ -511,7 +560,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
} }
//cout << "Done with EndIndex" << endl; //cout << "Done with EndIndex" << endl;
while (doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' ' while (doxygenString[startIndex] == '!' || doxygenString[startIndex] == ' '
|| doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t') startIndex++; || doxygenString[startIndex] == '/' || doxygenString[startIndex] == '*' || doxygenString[startIndex] == '\t')
startIndex++;
for (int i = startIndex; i < endIndex; i++) { for (int i = startIndex; i < endIndex; i++) {
@ -556,18 +606,22 @@ string getStringTilCommand(int &startInd, string doxygenString){
while (startIndex < endIndex) { while (startIndex < endIndex) {
savedIndex = startIndex; savedIndex = startIndex;
currWord = getNextWord(startIndex, doxygenString); currWord = getNextWord(startIndex, doxygenString);
if(noisy) cout << "Parsing for phrase starting in:" << currWord << endl; if (noisy)
cout << "Parsing for phrase starting in:" << currWord << endl;
if (currWord == "") { if (currWord == "") {
if (startIndex < endIndex) startIndex++; if (startIndex < endIndex)
} startIndex++;
else if(currWord[0] == '\\' || currWord[0] == '@'){ } else if (currWord[0] == '\\' || currWord[0] == '@') {
currWord = currWord.substr(1, currWord.length() - 1); currWord = currWord.substr(1, currWord.length() - 1);
currCommand = findCommand(currWord); currCommand = findCommand(currWord);
if (currCommand < 0 ){ if(noisy) cout << "BAD COMMAND: " << currWord << endl;} if (currCommand < 0) {
//cout << "Command: " << currWord << " " << currCommand << endl; if (noisy)
else addCommand(currWord, startIndex, aNewList, doxygenString); cout << "BAD COMMAND: " << currWord << endl;
} }
else{ //cout << "Command: " << currWord << " " << currCommand << endl;
else
addCommand(currWord, startIndex, aNewList, doxygenString);
} else {
startIndex = savedIndex; startIndex = savedIndex;
addCommand(string("plainstd::string"), startIndex, aNewList, doxygenString); addCommand(string("plainstd::string"), startIndex, aNewList, doxygenString);
@ -584,7 +638,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
*/ */
int addSimpleCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int addSimpleCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
doxyList.push_back(DoxygenEntity(theCommand)); doxyList.push_back(DoxygenEntity(theCommand));
return 1; return 1;
} }
@ -595,7 +650,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
*/ */
int ignoreSimpleCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int ignoreSimpleCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
return 1; return 1;
} }
@ -606,27 +662,30 @@ string getStringTilCommand(int &startInd, string doxygenString){
* "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno" * "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"
*/ */
int addCommandWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int addCommandWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
string name = getNextWord(startInd, doxygenString); string name = getNextWord(startInd, doxygenString);
if (!name.empty()) { if (!name.empty()) {
doxyList.push_back(DoxygenEntity(theCommand, name)); doxyList.push_back(DoxygenEntity(theCommand, name));
return 1; return 1;
} } else
else cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
return 0; return 0;
} }
/* NOT INCLUDED CommandWord /* NOT INCLUDED CommandWord
* Format: @command <word> * Format: @command <word>
* Commands with a single WORD after then such as @b * Commands with a single WORD after then such as @b
* "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude" * "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"
*/ */
int ignoreCommandWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int ignoreCommandWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
string name = getNextWord(startInd, doxygenString); string name = getNextWord(startInd, doxygenString);
if (!name.empty()) { if (!name.empty()) {
return 1; return 1;
} } else
else cout << "WARNING: No word followed " << theCommand << " command." << endl; cout << "WARNING: No word followed " << theCommand << " command." << endl;
return 0; return 0;
} }
@ -636,7 +695,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
* "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property" * "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"
*/ */
int addCommandLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int addCommandLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
string line = getOneLine(startInd, doxygenString); string line = getOneLine(startInd, doxygenString);
if (!line.empty()) { if (!line.empty()) {
int placement = 0; int placement = 0;
@ -644,8 +704,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
aNewList = parse(placement, line); aNewList = parse(placement, line);
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} } else
else cout << "No line followed " << theCommand << " command. Not added" << endl; cout << "No line followed " << theCommand << " command. Not added" << endl;
return 0; return 0;
} }
@ -655,12 +715,13 @@ string getStringTilCommand(int &startInd, string doxygenString){
* *
*/ */
int ignoreCommandLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int ignoreCommandLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
string line = getOneLine(startInd, doxygenString); string line = getOneLine(startInd, doxygenString);
if (!line.empty()) { if (!line.empty()) {
return 1; return 1;
} } else
else cout << "WARNING: No line followed " << theCommand << " command." << endl; cout << "WARNING: No line followed " << theCommand << " command." << endl;
return 0; return 0;
} }
@ -671,7 +732,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
* "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author" * "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"
*/ */
int addCommandParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int addCommandParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString);
if (!restOfParagraph.empty()) { if (!restOfParagraph.empty()) {
int placement = 0; int placement = 0;
@ -679,24 +741,27 @@ string getStringTilCommand(int &startInd, string doxygenString){
aNewList = parse(placement, restOfParagraph); aNewList = parse(placement, restOfParagraph);
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} } else
else cout << "No line followed " << theCommand << " command. Not added" << endl; cout << "No line followed " << theCommand << " command. Not added" << endl;
return 0; return 0;
} }
/* CommandParagraph /* CommandParagraph
* Format: @command {paragraph} * Format: @command {paragraph}
* Commands with a single LINE after then such as @var * Commands with a single LINE after then such as @var
* *
*/ */
int ignoreCommandParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int ignoreCommandParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString); string restOfParagraph = getStringTilEndOfParagraph(startInd, doxygenString);
if (!restOfParagraph.empty()) { if (!restOfParagraph.empty()) {
return 1; return 1;
} } else
else cout << "WARNING: No line followed " << theCommand << " command." << endl; cout << "WARNING: No line followed " << theCommand << " command." << endl;
return 0; return 0;
} }
/* Command EndCommand /* Command EndCommand
* Format: @command and ends at @endcommand * Format: @command and ends at @endcommand
* Commands that take in a block of text such as @code * Commands that take in a block of text such as @code
@ -706,7 +771,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
*/ */
int ignoreCommandEndCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int ignoreCommandEndCommand(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Not Adding " << theCommand << endl; if (noisy)
cout << "Not Adding " << theCommand << endl;
return progressTilEndCommand("end" + theCommand, startInd, doxygenString); return progressTilEndCommand("end" + theCommand, startInd, doxygenString);
} }
@ -717,7 +783,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
* "param", "tparam", "throw", "retval", "exception" * "param", "tparam", "throw", "retval", "exception"
*/ */
int addCommandWordParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int addCommandWordParagraph(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
string name = getNextWord(startInd, doxygenString); string name = getNextWord(startInd, doxygenString);
if (name.empty()) { if (name.empty()) {
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
@ -731,17 +798,19 @@ string getStringTilCommand(int &startInd, string doxygenString){
aNewList.push_front(DoxygenEntity("plainstd::string", name)); aNewList.push_front(DoxygenEntity("plainstd::string", name));
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} } else
else cout << "No paragraph followed " << theCommand << " command. Not added" << endl; cout << "No paragraph followed " << theCommand << " command. Not added" << endl;
return 0; return 0;
} }
/* CommandWordLine /* CommandWordLine
* Format: @command <word> (line) * Format: @command <word> (line)
* Commands such as param * Commands such as param
* "page", "subsection", "subsubsection", "section", "paragraph", "defgroup" * "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"
*/ */
int addCommandWordLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int addCommandWordLine(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
string name = getNextWord(startInd, doxygenString); string name = getNextWord(startInd, doxygenString);
if (name.empty()) { if (name.empty()) {
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
@ -755,8 +824,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
aNewList.push_front(DoxygenEntity("plainstd::string", name)); aNewList.push_front(DoxygenEntity("plainstd::string", name));
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} } else
else cout << "No line followed " << theCommand << " command. Not added" << endl; cout << "No line followed " << theCommand << " command. Not added" << endl;
return 0; return 0;
} }
@ -766,7 +835,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
* "category", "class", "protocol", "interface", "struct", "union" * "category", "class", "protocol", "interface", "struct", "union"
*/ */
int addCommandWordOWordOWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int addCommandWordOWordOWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
string name = getNextWord(startInd, doxygenString); string name = getNextWord(startInd, doxygenString);
if (name.empty()) { if (name.empty()) {
cout << "No word followed " << theCommand << " command. Not added" << endl; cout << "No word followed " << theCommand << " command. Not added" << endl;
@ -776,8 +846,10 @@ string getStringTilCommand(int &startInd, string doxygenString){
string headername = getNextWord(startInd, doxygenString); string headername = getNextWord(startInd, doxygenString);
list < DoxygenEntity > aNewList; list < DoxygenEntity > aNewList;
aNewList.push_back(DoxygenEntity("plainstd::string", name)); aNewList.push_back(DoxygenEntity("plainstd::string", name));
if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headerfile)); if (!headerfile.empty())
if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername)); aNewList.push_back(DoxygenEntity("plainstd::string", headerfile));
if (!headername.empty())
aNewList.push_back(DoxygenEntity("plainstd::string", headername));
doxyList.push_back(DoxygenEntity(theCommand, aNewList)); doxyList.push_back(DoxygenEntity(theCommand, aNewList));
return 1; return 1;
} }
@ -788,7 +860,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
* "dir", "file", "cond" * "dir", "file", "cond"
*/ */
int addCommandOWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) { int addCommandOWord(string theCommand, int &startInd, list < DoxygenEntity > &doxyList, string doxygenString) {
if (noisy) cout << "Parsing " << theCommand << endl; if (noisy)
cout << "Parsing " << theCommand << endl;
string name = getNextWord(startInd, doxygenString); string name = getNextWord(startInd, doxygenString);
doxyList.push_back(DoxygenEntity(theCommand, name)); doxyList.push_back(DoxygenEntity(theCommand, name));
return 1; return 1;
@ -808,7 +881,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
if (theCommand.compare("plainstd::string") == 0) { if (theCommand.compare("plainstd::string") == 0) {
string nextPhrase = getStringTilCommand(startInd, doxygenString); string nextPhrase = getStringTilCommand(startInd, doxygenString);
if (noisy) cout << "Parsing plain string :" << nextPhrase << endl; if (noisy)
cout << "Parsing plain string :" << nextPhrase << endl;
doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase)); doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase));
return 1; return 1;
} }
@ -887,7 +961,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
doxCommentFile.open(exampleNames[i].c_str()); doxCommentFile.open(exampleNames[i].c_str());
doxCommentFile >> doxygenString; doxCommentFile >> doxygenString;
while (getline(doxCommentFile, line)) { while (getline(doxCommentFile, line)) {
doxygenString += line + "\n";} doxygenString += line + "\n";
}
doxCommentFile.close(); doxCommentFile.close();
placement = 0; placement = 0;
cout << "---RAW CODE---" << endl << doxygenString << endl << endl; cout << "---RAW CODE---" << endl << doxygenString << endl << endl;
@ -905,10 +980,13 @@ string getStringTilCommand(int &startInd, string doxygenString){
/* Returns a parse tree for a string */ /* Returns a parse tree for a string */
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
//weirdTest(); //weirdTest();
if(testCodeCrawlingFunctions) testCCF(); if (testCodeCrawlingFunctions)
if(runExamples) doRunExamples(); testCCF();
if (runExamples)
doRunExamples();
if (demonstrateParsing) { if (demonstrateParsing) {
string doxygenString = "//! A normal member taking two arguments and returning an integer value.\n/*!\n \\param a an integer argument. \\param s a constant character pointer\n \\return The test results\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */"; string doxygenString =
"//! A normal member taking two arguments and returning an integer value.\n/*!\n \\param a an integer argument. \\param s a constant character pointer\n \\return The test results\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */";
//string doxygenString = " /** This is a small sentence.\n *\n@param x this is a parameter. \n \n This is a line with a @b bold letter \n * \n @brief small @b description. \n\n * **/"; //string doxygenString = " /** This is a small sentence.\n *\n@param x this is a parameter. \n \n This is a line with a @b bold letter \n * \n @brief small @b description. \n\n * **/";
//string doxygenString = "This is a description."; //string doxygenString = "This is a description.";
int placement = 0; int placement = 0;
@ -917,7 +995,8 @@ string getStringTilCommand(int &startInd, string doxygenString){
cout << "---THE TREE---" << endl; cout << "---THE TREE---" << endl;
printTree(); printTree();
} }
string doxygenString2 = "//! A normal member taking two arguments and returning an integer value.\n/*!\n \\param a an integer argument. \\param s a constant character pointer\n\n\n\n \\return The test results\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */"; string doxygenString2 =
"//! A normal member taking two arguments and returning an integer value.\n/*!\n \\param a an integer argument. \\param s a constant character pointer\n\n\n\n \\return The test results\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */";
TokenList tokList = TokenList(doxygenString2); TokenList tokList = TokenList(doxygenString2);
tokList.printList(); tokList.printList();
return 1; return 1;

View file

@ -1,11 +1,10 @@
#ifndef DOXYGENTRANSWTOKENIZER_H_ #ifndef DOXYGENTRANSWTOKENIZER_H_
#define DOXYGENTRANSWTOKENIZER_H_ #define DOXYGENTRANSWTOKENIZER_H_
class DoxygenTransWTokenizer class DoxygenTransWTokenizer {
{
public: public:
DoxygenTransWTokenizer(); DoxygenTransWTokenizer();
virtual ~DoxygenTransWTokenizer(); virtual ~DoxygenTransWTokenizer();
}; };
#endif /*DOXYGENTRANSWTOKENIZER_H_*/ #endif

View file

@ -141,4 +141,4 @@
#define POUND_COMMAND 236 /* \# */ #define POUND_COMMAND 236 /* \# */
#define PERCENT_COMMAND 237 /* \% */ #define PERCENT_COMMAND 237 /* \% */
#endif /*TRANSLATOR_H_*/ #endif

View file

@ -22,7 +22,8 @@ std::string JavaDocConverter::formatCommand(std::string unformattedLine, int ind
i = unformattedLine.find(" ", i); i = unformattedLine.find(" ", i);
if (i > 0 && i + 1 < (int) unformattedLine.length()) { if (i > 0 && i + 1 < (int) unformattedLine.length()) {
if (!isFirstLine) for (int j = 0; j < indent; j++) { if (!isFirstLine)
for (int j = 0; j < indent; j++) {
formattedLines.append("\t"); formattedLines.append("\t");
} else { } else {
isFirstLine = 0; isFirstLine = 0;
@ -53,35 +54,25 @@ std::string JavaDocConverter::javaDocFormat(DoxygenEntity &doxygenEntity){
} }
if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0) { if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0) {
return doxygenEntity.data; return doxygenEntity.data;
} } else if (doxygenEntity.typeOfEntity.compare("b") == 0) {
else if (doxygenEntity.typeOfEntity.compare("b") == 0){
return "<b>" + doxygenEntity.data + "</b>"; return "<b>" + doxygenEntity.data + "</b>";
} } else if (doxygenEntity.typeOfEntity.compare("c") == 0) {
else if (doxygenEntity.typeOfEntity.compare("c") == 0){
return "<tt>" + doxygenEntity.data + "</tt>"; return "<tt>" + doxygenEntity.data + "</tt>";
} } else if (doxygenEntity.typeOfEntity.compare("@") == 0) {
else if (doxygenEntity.typeOfEntity.compare("@") == 0){
return "@"; return "@";
} } else if (doxygenEntity.typeOfEntity.compare("\\") == 0) {
else if (doxygenEntity.typeOfEntity.compare("\\") == 0){
return "\\"; return "\\";
} } else if (doxygenEntity.typeOfEntity.compare("<") == 0) {
else if (doxygenEntity.typeOfEntity.compare("<") == 0){
return "&lt;"; return "&lt;";
} } else if (doxygenEntity.typeOfEntity.compare(">") == 0) {
else if (doxygenEntity.typeOfEntity.compare(">") == 0){
return "&gt;"; return "&gt;";
} } else if (doxygenEntity.typeOfEntity.compare("&") == 0) {
else if (doxygenEntity.typeOfEntity.compare("&") == 0){
return "&amp;"; return "&amp;";
} } else if (doxygenEntity.typeOfEntity.compare("#") == 0) {
else if (doxygenEntity.typeOfEntity.compare("#") == 0){
return "#"; return "#";
} } else if (doxygenEntity.typeOfEntity.compare("%") == 0) {
else if (doxygenEntity.typeOfEntity.compare("%") == 0){
return "%"; return "%";
} } else if (doxygenEntity.typeOfEntity.compare("~") == 0) {
else if (doxygenEntity.typeOfEntity.compare("~") == 0){
return "~"; return "~";
} }
return ""; return "";
@ -110,8 +101,7 @@ std::string JavaDocConverter::translateEntity(DoxygenEntity &doxyEntity){
return formatCommand(std::string(translateSubtree(doxyEntity)), 0); return formatCommand(std::string(translateSubtree(doxyEntity)), 0);
} }
if ((doxyEntity.typeOfEntity.compare("brief") == 0) || if ((doxyEntity.typeOfEntity.compare("brief") == 0) || (doxyEntity.typeOfEntity.compare("details") == 0)) {
(doxyEntity.typeOfEntity.compare("details") == 0)) {
return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * "; return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";
} else if (doxyEntity.typeOfEntity.compare("plainstd::string") == 0 || } else if (doxyEntity.typeOfEntity.compare("plainstd::string") == 0 ||
@ -120,8 +110,7 @@ std::string JavaDocConverter::translateEntity(DoxygenEntity &doxyEntity){
return formatCommand(doxyEntity.data, 0) + "\n * "; return formatCommand(doxyEntity.data, 0) + "\n * ";
} else if (doxyEntity.typeOfEntity.compare("see") == 0) { } else if (doxyEntity.typeOfEntity.compare("see") == 0) {
return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2);
translateSubtree(doxyEntity)), 2);
} else if (doxyEntity.typeOfEntity.compare("return") == 0 } else if (doxyEntity.typeOfEntity.compare("return") == 0
|| doxyEntity.typeOfEntity.compare("author") == 0 || doxyEntity.typeOfEntity.compare("author") == 0

View file

@ -15,10 +15,10 @@
/* /*
* A class to translate doxygen comments into JavaDoc style comments. * A class to translate doxygen comments into JavaDoc style comments.
*/ */
class JavaDocConverter : public DoxygenTranslator class JavaDocConverter : public DoxygenTranslator {
{
public: public:
JavaDocConverter() : debug( false ){} JavaDocConverter() : debug(false) {
}
virtual bool getDocumentation(Node *node, String *&documentation); virtual bool getDocumentation(Node *node, String *&documentation);
protected: protected:
@ -31,4 +31,4 @@ private:
bool debug; bool debug;
}; };
#endif /*JAVADOCCONVERTER_H_*/ #endif

View file

@ -54,15 +54,13 @@ std::string PyDocConverter::justifyString(std::string documentString, int indent
std::ostringstream formattedString; std::ostringstream formattedString;
std::string currentLine; std::string currentLine;
for(std::string::iterator stringPosition = documentString.begin(); stringPosition != documentString.end(); ++stringPosition) for (std::string::iterator stringPosition = documentString.begin(); stringPosition != documentString.end(); ++stringPosition) {
{
if (currentLine.length() == 0) if (currentLine.length() == 0)
currentLine.resize(indent, ' '); currentLine.resize(indent, ' ');
currentLine += *stringPosition; currentLine += *stringPosition;
if(*stringPosition == ' ' && (int)currentLine.size() >= maxWidth || (stringPosition + 1) == documentString.end()) if (*stringPosition == ' ' && (int) currentLine.size() >= maxWidth || (stringPosition + 1) == documentString.end()) {
{
formattedString << currentLine << std::endl; formattedString << currentLine << std::endl;
currentLine = ""; currentLine = "";
} }
@ -125,8 +123,7 @@ std::string PyDocConverter::processEntityList(Node *n, std::list<DoxygenEntity>&
if (entityIterator->typeOfEntity.compare("param") == 0 && !inParamsSection) { if (entityIterator->typeOfEntity.compare("param") == 0 && !inParamsSection) {
inParamsSection = true; inParamsSection = true;
result += "\nArguments:\n"; result += "\nArguments:\n";
} } else if (entityIterator->typeOfEntity.compare("param") != 0 && inParamsSection)
else if(entityIterator->typeOfEntity.compare("param") != 0 && inParamsSection)
inParamsSection = false; inParamsSection = false;
result += translateEntity(n, *entityIterator); result += translateEntity(n, *entityIterator);
@ -167,8 +164,7 @@ bool PyDocConverter::getDocumentation(Node *n, String *&documentation){
concatDocString << allDocumentation[realOverloadCount] << std::endl; concatDocString << allDocumentation[realOverloadCount] << std::endl;
} }
pyDocString = concatDocString.str(); pyDocString = concatDocString.str();
} } else if (allDocumentation.size() == 1) {
else if (allDocumentation.size() == 1) {
pyDocString = *(allDocumentation.begin()); pyDocString = *(allDocumentation.begin());
} }
} }

View file

@ -19,8 +19,7 @@
#define DOC_STRING_LENGTH 64 // characters per line allowed #define DOC_STRING_LENGTH 64 // characters per line allowed
#define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type #define DOC_PARAM_STRING_LENGTH 30 // characters reserved for param name / type
class PyDocConverter : public DoxygenTranslator class PyDocConverter : public DoxygenTranslator {
{
public: public:
PyDocConverter(); PyDocConverter();
bool getDocumentation(Node *node, String *&documentation); bool getDocumentation(Node *node, String *&documentation);
@ -69,4 +68,4 @@ private:
bool debug; bool debug;
}; };
#endif /*PYDOCCONVERTER_H_*/ #endif

View file

@ -3,14 +3,12 @@
using namespace std; using namespace std;
Token::Token(int tType, string tString) Token::Token(int tType, string tString) {
{
tokenType = tType; tokenType = tType;
tokenString = tString; tokenString = tString;
} }
string Token::toString() string Token::toString() {
{
if (tokenType == END_LINE) { if (tokenType == END_LINE) {
return "{END OF LINE}"; return "{END OF LINE}";
} }
@ -26,4 +24,5 @@ string Token::toString()
return ""; return "";
} }
Token:: ~Token(){} Token::~Token() {
}

View file

@ -4,8 +4,7 @@
using namespace std; using namespace std;
class Token class Token {
{
public: public:
Token(int tType, string tString); Token(int tType, string tString);
~Token(); ~Token();
@ -15,4 +14,4 @@ public:
string toString(); string toString();
}; };
#endif /*TOKEN_H_*/ #endif

View file

@ -39,7 +39,8 @@ TokenList::TokenList(const std::string &doxygenStringConst){
continue; continue;
} }
break; break;
} while (true); */ } while (true);
*/
size_t currentIndex = 0; size_t currentIndex = 0;
size_t nextIndex = 0; size_t nextIndex = 0;
@ -52,18 +53,16 @@ TokenList::TokenList(const std::string &doxygenStringConst){
m_tokenList.push_back(Token(END_LINE, currentWord)); m_tokenList.push_back(Token(END_LINE, currentWord));
currentIndex++; currentIndex++;
} }
// skip WS, except \n // skip WS, except \n
while(currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' while (currentIndex < doxygenString.length() && (doxygenString[currentIndex] == ' ' || doxygenString[currentIndex] == '\t'))
|| doxygenString[currentIndex]== '\t')) currentIndex ++; currentIndex++;
if (currentIndex < doxygenString.length()) { if (currentIndex < doxygenString.length()) {
nextIndex = currentIndex; nextIndex = currentIndex;
// skip non WS // skip non WS
while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' while (nextIndex < doxygenString.length() && (doxygenString[nextIndex] != ' ' && doxygenString[nextIndex] != '\t' && doxygenString[nextIndex] != '\n'))
&& doxygenString[nextIndex] != '\t' && doxygenString[nextIndex]!= '\n'))
nextIndex++; nextIndex++;
// now we have a token // now we have a token
@ -81,16 +80,14 @@ TokenList::TokenList(const std::string &doxygenStringConst){
m_tokenList.push_back(Token(END_LINE, currentWord)); m_tokenList.push_back(Token(END_LINE, currentWord));
} } else if (currentWord[0] == '*' || currentWord[0] == '/' || currentWord[0] == '!') {
else if (currentWord[0] == '*' || currentWord[0] == '/' ||currentWord[0] == '!'){
bool isPlainString = false; bool isPlainString = false;
if (currentWord.length() > 1) { if (currentWord.length() > 1) {
for (size_t i = 1; i < currentWord.length(); i++) { for (size_t i = 1; i < currentWord.length(); i++) {
if (currentWord[i] != '*' && currentWord[i] != '/' && if (currentWord[i] != '*' && currentWord[i] != '/' && currentWord[i] != '!') {
currentWord[i] != '!') {
isPlainString = true; isPlainString = true;
break; break;
} }
@ -118,8 +115,7 @@ Token TokenList::peek(){
if (m_tokenListIter != m_tokenList.end()) { if (m_tokenListIter != m_tokenList.end()) {
Token returnedToken = (*m_tokenListIter); Token returnedToken = (*m_tokenListIter);
return returnedToken; return returnedToken;
} } else
else
return Token(0, ""); return Token(0, "");
} }
@ -129,8 +125,7 @@ Token TokenList::next(){
Token returnedToken = (*m_tokenListIter); Token returnedToken = (*m_tokenListIter);
m_tokenListIter++; m_tokenListIter++;
return (returnedToken); return (returnedToken);
} } else
else
return Token(0, ""); return Token(0, "");
} }
@ -162,8 +157,9 @@ void TokenList::printList(){
while (p != m_tokenList.end()) { while (p != m_tokenList.end()) {
cout << (*p).toString() << " "; cout << (*p).toString() << " ";
b = i % TOKENSPERLINE; b = i % TOKENSPERLINE;
if (b == 0) cout << endl; if (b == 0)
p++; i++; cout << endl;
p++;
i++;
} }
} }

View file

@ -31,4 +31,4 @@ public:
void printList(); /* prints out the sequence of tokens */ void printList(); /* prints out the sequence of tokens */
}; };
#endif /*TOKENLIST_H_*/ #endif