Remove "using std" clause and use namespaces properly. Minor refactoring as well.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-cherylfoil@10839 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0db7edfa63
commit
d12b8bc06e
9 changed files with 638 additions and 657 deletions
|
|
@ -1,19 +1,24 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* python.cxx
|
||||
*
|
||||
* Part of the Doxygen comment translation module of SWIG.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#include "DoxygenEntity.h"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
/* Little data class for Doxygen Commands */
|
||||
|
||||
|
||||
/* Basic node for commands that have
|
||||
* nothing after them
|
||||
* example: \n
|
||||
/*
|
||||
* Basic node for commands that have nothing after them (eg: \n)
|
||||
*/
|
||||
string commandArray2[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attention",
|
||||
std::string DoxygenEntity::commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attention",
|
||||
"author", "b", "brief", "bug", "c", "callgraph", "callergraph", "category",
|
||||
"class", "code", "cond", "copybrief", "copydetails", "copydoc", "date", "def",
|
||||
"defgroup", "deprecated", "details", "dir", "dontinclude", "dot", "dotfile", "e",
|
||||
"else", "elseif", "em", "endcode", "endcond", "enddot", "endhtmlonly", "endif",
|
||||
"endlatexonly", "endlink", "endmanonly", "endmsc", "endverbatim", "endxmlonly",
|
||||
"std::endlatexonly", "std::endlink", "endmanonly", "endmsc", "endverbatim", "endxmlonly",
|
||||
"enum", "example", "exception", "f$", "f[", "f]", "f{", "f}", "file", "fn", "headerfile",
|
||||
"hideinitializer", "htmlinclude", "htmlonly", "if", "ifnot", "image", "include",
|
||||
"includelineno", "ingroup", "internal", "invariant", "interface", "latexonly", "li",
|
||||
|
|
@ -24,19 +29,9 @@ string commandArray2[] = {"a", "addindex", "addtogroup", "anchor", "arg", "atten
|
|||
"sa", "section", "see", "showinitializer", "since", "skip", "skipline", "struct", "subpage",
|
||||
"subsection", "subsubsection", "test", "throw", "todo", "tparam", "typedef", "union", "until",
|
||||
"var", "verbatim", "verbinclude", "version", "warning", "weakgroup", "xmlonly", "xrefitem",
|
||||
"$", "@", string(1, 92), "&", "~", "<", ">", "#", "%"};
|
||||
"$", "@", std::string(1, 92), "&", "~", "<", ">", "#", "%"};
|
||||
|
||||
string findCommand(int commandNum){
|
||||
|
||||
int arraySize = sizeof(commandArray2)/sizeof(*commandArray2);
|
||||
if (commandNum - 101 >= 0 && commandNum - 101 < arraySize){
|
||||
return commandArray2[commandNum - 101];
|
||||
}
|
||||
|
||||
return "" ;
|
||||
}
|
||||
|
||||
DoxygenEntity::DoxygenEntity(string typeEnt){
|
||||
DoxygenEntity::DoxygenEntity(std::string typeEnt){
|
||||
typeOfEntity = typeEnt;
|
||||
data = "";
|
||||
isLeaf = 1;
|
||||
|
|
@ -45,9 +40,9 @@ DoxygenEntity::DoxygenEntity(string typeEnt){
|
|||
/* Basic node for commands that have
|
||||
* only 1 thing after them
|
||||
* example: \b word
|
||||
* OR holding a string
|
||||
* OR holding a std::string
|
||||
*/
|
||||
DoxygenEntity::DoxygenEntity(string typeEnt, string param1){
|
||||
DoxygenEntity::DoxygenEntity(std::string typeEnt, std::string param1){
|
||||
typeOfEntity = typeEnt;
|
||||
data = param1;
|
||||
isLeaf = 1;
|
||||
|
|
@ -56,26 +51,25 @@ DoxygenEntity::DoxygenEntity(string typeEnt, string param1){
|
|||
/* Nonterminal node
|
||||
* contains
|
||||
*/
|
||||
DoxygenEntity::DoxygenEntity(string typeEnt, list <DoxygenEntity> &entList ){
|
||||
DoxygenEntity::DoxygenEntity(std::string typeEnt, std::list <DoxygenEntity> &entList ){
|
||||
typeOfEntity = typeEnt;
|
||||
data = "";
|
||||
isLeaf = 0;
|
||||
entityList = entList;
|
||||
}
|
||||
|
||||
|
||||
void DoxygenEntity::printEntity(int level){
|
||||
int thisLevel = level;
|
||||
if (isLeaf) {
|
||||
for (int i = 0; i < thisLevel; i++) {cout << "\t";}
|
||||
cout << "Node Command: " << typeOfEntity << " ";
|
||||
if (data.compare("") != 0) cout << "Node Data: " << data;
|
||||
cout << endl;
|
||||
for (int i = 0; i < thisLevel; i++) {std::cout << "\t";}
|
||||
std::cout << "Node Command: " << typeOfEntity << " ";
|
||||
if (data.compare("") != 0) std::cout << "Node Data: " << data;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
else{
|
||||
for (int i = 0; i < thisLevel; i++) {cout << "\t";}
|
||||
cout << "Node Command : " << typeOfEntity << endl;
|
||||
list<DoxygenEntity>::iterator p = entityList.begin();
|
||||
for (int i = 0; i < thisLevel; i++) {std::cout << "\t";}
|
||||
std::cout << "Node Command : " << typeOfEntity << std::endl;
|
||||
std::list<DoxygenEntity>::iterator p = entityList.begin();
|
||||
thisLevel++;
|
||||
while (p != entityList.end()){
|
||||
(*p).printEntity(thisLevel);
|
||||
|
|
@ -84,6 +78,122 @@ void DoxygenEntity::printEntity(int level){
|
|||
}
|
||||
}
|
||||
|
||||
DoxygenEntity::~DoxygenEntity()
|
||||
{
|
||||
bool CompareDoxygenEntities::operator()(DoxygenEntity& first, DoxygenEntity& second){
|
||||
if(first.typeOfEntity.compare("brief") == 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("brief") == 0)
|
||||
return false;
|
||||
if(first.typeOfEntity.compare("details") == 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("details") == 0)
|
||||
return false;
|
||||
if(first.typeOfEntity.compare("partofdescription") == 0)
|
||||
return true;
|
||||
if(first.typeOfEntity.compare("partofdescription") == 0)
|
||||
return false;
|
||||
if(first.typeOfEntity.compare("plainstd::string") == 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("plainstd::string") == 0)
|
||||
return false;
|
||||
if(first.typeOfEntity.compare("param") == 0){
|
||||
if(second.typeOfEntity.compare("param")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("return")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("exception")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("author")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("version")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("return")== 0){
|
||||
if(second.typeOfEntity.compare("return")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("exception")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("author")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("version")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0
|
||||
)return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("exception")== 0){
|
||||
if(second.typeOfEntity.compare("exception")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("author")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("version")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("author")== 0){
|
||||
if(second.typeOfEntity.compare("author")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("version")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("version")== 0){
|
||||
if(second.typeOfEntity.compare("version")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("see")== 0 || first.typeOfEntity.compare("sa")== 0){
|
||||
if(second.typeOfEntity.compare("see")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("sa")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("since")== 0){
|
||||
if(second.typeOfEntity.compare("since")== 0)
|
||||
return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("deprecated")== 0){
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,37 +1,40 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* See the LICENSE file for information on copyright, usage and redistribution
|
||||
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
||||
*
|
||||
* python.cxx
|
||||
*
|
||||
* Part of the Doxygen comment translation module of SWIG.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef DOXYGENENTITY_H_
|
||||
#define DOXYGENENTITY_H_
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class DoxygenEntity{
|
||||
|
||||
public:
|
||||
DoxygenEntity(string typeEnt);
|
||||
DoxygenEntity(string typeEnt, string param1);
|
||||
DoxygenEntity(string typeEnt, list <DoxygenEntity> &entList );
|
||||
~DoxygenEntity();
|
||||
void printEntity(int level);
|
||||
string typeOfEntity;
|
||||
list <DoxygenEntity> entityList;
|
||||
string data;
|
||||
int isLeaf;
|
||||
/*
|
||||
* Structure to represent a doxygen comment entry
|
||||
*/
|
||||
struct DoxygenEntity{
|
||||
DoxygenEntity(std::string typeEnt);
|
||||
DoxygenEntity(std::string typeEnt, std::string param1);
|
||||
DoxygenEntity(std::string typeEnt, std::list <DoxygenEntity> &entList );
|
||||
void printEntity(int level);
|
||||
std::string typeOfEntity;
|
||||
std::list <DoxygenEntity> entityList;
|
||||
std::string data;
|
||||
int isLeaf;
|
||||
static std::string commandArray[];
|
||||
};
|
||||
|
||||
struct find_entity {
|
||||
find_entity(string typeString) {
|
||||
typeOfEntity = typeString;
|
||||
}
|
||||
|
||||
bool operator()(DoxygenEntity& entity) {
|
||||
return entity.typeOfEntity == typeOfEntity;
|
||||
}
|
||||
|
||||
string typeOfEntity;
|
||||
/*
|
||||
* Functor that sorts entities by javaDoc standard order for commands.
|
||||
* NOTE: will not behave entirely properly until "First level" comments
|
||||
* such as brief descriptions are TAGGED as such
|
||||
*/
|
||||
struct CompareDoxygenEntities {
|
||||
bool operator()(DoxygenEntity& first, DoxygenEntity& second);
|
||||
};
|
||||
|
||||
|
||||
#endif /*TOKENLIST_H_*/
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
#define PARAGRAPH_END 102
|
||||
#define PLAINSTRING 103
|
||||
#define COMMAND 104
|
||||
using namespace std;
|
||||
|
||||
|
||||
DoxygenParser::DoxygenParser()
|
||||
{
|
||||
|
|
@ -32,13 +30,13 @@ DoxygenParser::~DoxygenParser()
|
|||
|
||||
//////////////////////////////////////////
|
||||
int noisy = 0; // set this to 1 for extra chatter from the parsing stage.
|
||||
int addCommand(string currCommand, TokenList &tokList, list <DoxygenEntity> &aNewList);
|
||||
list <DoxygenEntity> parse(list<Token>::iterator endParsingIndex, TokenList &tokList);
|
||||
int addCommand(std::string currCommand, TokenList &tokList, std::list <DoxygenEntity> &aNewList);
|
||||
std::list <DoxygenEntity> parse(std::list<Token>::iterator endParsingIndex, TokenList &tokList);
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
|
||||
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",
|
||||
"class", "code", "cond", "copybrief", "copydetails", "copydoc", "date", "def",
|
||||
"defgroup", "deprecated", "details", "dir", "dontinclude", "dot", "dotfile", "e",
|
||||
|
|
@ -57,49 +55,49 @@ string commandArray[] = {"a", "addindex", "addtogroup", "anchor", "arg", "attent
|
|||
"$", "@", "\\","&", "~", "<", ">", "#", "%"};
|
||||
|
||||
|
||||
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",
|
||||
"tparam", "post" , "pre", "remarks", "return", "retval", "sa", "see", "since", "test", "throw", "todo",
|
||||
"version", "warning", "xrefitem" };
|
||||
|
||||
/* All of the doxygen commands divided up by how they are parsed */
|
||||
string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"};
|
||||
string ignoredSimpleCommands[] = {"nothing at the moment"};
|
||||
string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package",
|
||||
std::string simpleCommands[] = {"n", "$", "@", "\\", "&", "~", "<", ">", "#", "%"};
|
||||
std::string ignoredSimpleCommands[] = {"nothing at the moment"};
|
||||
std::string commandWords[] = {"a", "b", "c", "e", "em", "p", "def", "enum", "example", "package",
|
||||
"relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"};
|
||||
string ignoredCommandWords[] = {"copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"};
|
||||
string commandLines[] = {"addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"};
|
||||
string ignoreCommandLines[] = {"nothing at the moment"};
|
||||
string commandParagraph[] = {"partofdescription", "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant",
|
||||
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"};
|
||||
string ignoreCommandParagraphs[] = {"nothing at the moment"};
|
||||
string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly",
|
||||
std::string ignoreCommandParagraphs[] = {"nothing at the moment"};
|
||||
std::string commandEndCommands[] = {"code", "dot", "msc", "f$", "f[", "f{environment}{", "htmlonly", "latexonly", "manonly",
|
||||
"verbatim", "xmlonly", "cond", "if", "ifnot", "link"};
|
||||
string commandWordParagraphs[] = {"param", "tparam", "throw", "retval", "exception"};
|
||||
string commandWordLines[] = {"page", "subsection", "subsubsection", "section", "paragraph", "defgroup"};
|
||||
string commandWordOWordOWords [] = {"category", "class", "protocol", "interface", "struct", "union"};
|
||||
string commandOWords[] = {"dir", "file", "cond"};
|
||||
string commandErrorThrowings[] = {"annotatedclasslist", "classhierarchy", "define", "functionindex", "header",
|
||||
"headerfilelist", "inherit", "l", "postheader", "private", "privatesection", "protected",
|
||||
std::string commandWordParagraphs[] = {"param", "tparam", "throw", "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",
|
||||
"protectedsection", "public", "publicsection", "endcode", "enddot", "endmsc", "endhtmlonly",
|
||||
"endlatexonly", "endmanonly", "endlink", "endverbatim", "endxmlonly", "f]", "f}", "endcond",
|
||||
"endif"};
|
||||
string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref",
|
||||
std::string commandUniques[] = {"xrefitem", "arg", "ingroup", "par", "headerfile", "overload", "weakgroup", "ref",
|
||||
"subpage", "dotfile", "image", "addtogroup", "li"};
|
||||
|
||||
|
||||
/* Changes a string to all lower case */
|
||||
string StringToLower(string stringToConvert){
|
||||
/* Changes a std::string to all lower case */
|
||||
std::string StringToLower(std::string stringToConvert){
|
||||
for(unsigned int i=0;i<stringToConvert.length();i++){
|
||||
stringToConvert[i] = tolower(stringToConvert[i]);
|
||||
}
|
||||
return stringToConvert; //return the converted string
|
||||
return stringToConvert; //return the converted std::string
|
||||
}
|
||||
|
||||
/* finds out if a command exists (is a possible command)
|
||||
* from the string array commandArray
|
||||
* from the std::string array commandArray
|
||||
* returns -1 if no match is found */
|
||||
int findCommand(string smallString){
|
||||
int findCommand(std::string smallString){
|
||||
smallString = StringToLower(smallString);
|
||||
int a;
|
||||
for (int i = 0; i < sizeof(commandArray)/sizeof(*commandArray); i++){
|
||||
|
|
@ -114,7 +112,7 @@ int findCommand(string smallString){
|
|||
* This is a helper method for finding the end of a paragraph
|
||||
* by Doxygen's terms
|
||||
*/
|
||||
int isSectionIndicator(string smallString){
|
||||
int isSectionIndicator(std::string smallString){
|
||||
smallString = StringToLower(smallString);
|
||||
for (int i = 0; i < sizeof( sectionIndicators)/sizeof(* sectionIndicators); i++){
|
||||
if( smallString.compare( sectionIndicators[i]) == 0){
|
||||
|
|
@ -125,8 +123,8 @@ int isSectionIndicator(string smallString){
|
|||
}
|
||||
|
||||
/* prints the parse tree */
|
||||
void printTree( list <DoxygenEntity> &rootList){
|
||||
list<DoxygenEntity>::iterator p = rootList.begin();
|
||||
void printTree( std::list <DoxygenEntity> &rootList){
|
||||
std::list<DoxygenEntity>::iterator p = rootList.begin();
|
||||
while (p != rootList.end()){
|
||||
(*p).printEntity(0);
|
||||
p++;
|
||||
|
|
@ -136,8 +134,8 @@ void printTree( list <DoxygenEntity> &rootList){
|
|||
/* Determines how a command should be handled (what group it belongs to
|
||||
* for parsing rules
|
||||
*/
|
||||
int commandBelongs(string theCommand){
|
||||
string smallString = StringToLower(theCommand);
|
||||
int commandBelongs(std::string theCommand){
|
||||
std::string smallString = StringToLower(theCommand);
|
||||
//cout << " Looking for command " << theCommand << endl;
|
||||
int i = 0;
|
||||
for ( i = 0; i < sizeof(simpleCommands)/sizeof(*simpleCommands); i++){
|
||||
|
|
@ -189,10 +187,10 @@ int commandBelongs(string theCommand){
|
|||
}
|
||||
|
||||
/* Returns the next word ON THE CURRENT LINE ONLY
|
||||
* if a new line is encountered, returns a blank string.
|
||||
* if a new line is encountered, returns a blank std::string.
|
||||
* Updates the index it is given if success.
|
||||
*/
|
||||
string getNextWord(TokenList &tokList){
|
||||
std::string getNextWord(TokenList &tokList){
|
||||
Token nextToken = tokList.peek();
|
||||
if (nextToken.tokenType == PLAINSTRING ){
|
||||
nextToken = tokList.next();
|
||||
|
|
@ -204,8 +202,8 @@ string getNextWord(TokenList &tokList){
|
|||
/* Returns the location of the end of the line as
|
||||
* an iterator.
|
||||
*/
|
||||
list<Token>::iterator getOneLine(TokenList &tokList){
|
||||
list<Token>::iterator endOfLine = tokList.iteratorCopy();
|
||||
std::list<Token>::iterator getOneLine(TokenList &tokList){
|
||||
std::list<Token>::iterator endOfLine = tokList.iteratorCopy();
|
||||
while(endOfLine!= tokList.end()){
|
||||
if ((* endOfLine).tokenType == END_LINE){
|
||||
//cout << "REACHED END" << endl;
|
||||
|
|
@ -219,11 +217,11 @@ list<Token>::iterator getOneLine(TokenList &tokList){
|
|||
return tokList.end();
|
||||
}
|
||||
|
||||
/* Returns a properly formatted string
|
||||
/* Returns a properly formatted std::string
|
||||
* up til ANY command or end of line is encountered.
|
||||
*/
|
||||
string getStringTilCommand(TokenList &tokList){
|
||||
string description;
|
||||
std::string getStringTilCommand(TokenList &tokList){
|
||||
std::string description;
|
||||
if (tokList.peek().tokenType == 0) return "";
|
||||
while(tokList.peek().tokenType == PLAINSTRING){
|
||||
Token currentToken = tokList.next();
|
||||
|
|
@ -234,13 +232,13 @@ string getStringTilCommand(TokenList &tokList){
|
|||
return description;
|
||||
}
|
||||
|
||||
/* Returns a properly formatted string
|
||||
/* Returns a properly formatted std::string
|
||||
* up til the command specified is encountered
|
||||
*/
|
||||
//TODO check that this behaves properly for formulas
|
||||
|
||||
string getStringTilEndCommand(string theCommand, TokenList &tokList){
|
||||
string description;
|
||||
std::string getStringTilEndCommand(std::string theCommand, TokenList &tokList){
|
||||
std::string description;
|
||||
if (tokList.peek().tokenType == 0) return "";
|
||||
while(tokList.peek().tokenString.compare(theCommand) != 0 ){
|
||||
Token currentToken = tokList.next();
|
||||
|
|
@ -253,8 +251,8 @@ string getStringTilEndCommand(string theCommand, TokenList &tokList){
|
|||
* Paragraph is defined in Doxygen to be a paragraph of text
|
||||
* seperate by either a structural command or a blank line
|
||||
*/
|
||||
list<Token>::iterator getEndOfParagraph(TokenList &tokList){
|
||||
list<Token>::iterator endOfParagraph = tokList.iteratorCopy();
|
||||
std::list<Token>::iterator getEndOfParagraph(TokenList &tokList){
|
||||
std::list<Token>::iterator endOfParagraph = tokList.iteratorCopy();
|
||||
while(endOfParagraph != tokList.end()){
|
||||
if ((* endOfParagraph).tokenType == END_LINE){
|
||||
endOfParagraph++;
|
||||
|
|
@ -278,10 +276,10 @@ list<Token>::iterator getEndOfParagraph(TokenList &tokList){
|
|||
|
||||
/* Returns the end of a section, defined as the first blank line OR first encounter of the same
|
||||
* command. Example of this behaviour is \arg
|
||||
* if no end is encountered, returns the last token of the list.
|
||||
* if no end is encountered, returns the last token of the std::list.
|
||||
*/
|
||||
list<Token>::iterator getEndOfSection(string theCommand, TokenList &tokList){
|
||||
list<Token>::iterator endOfParagraph = tokList.iteratorCopy();
|
||||
std::list<Token>::iterator getEndOfSection(std::string theCommand, TokenList &tokList){
|
||||
std::list<Token>::iterator endOfParagraph = tokList.iteratorCopy();
|
||||
while(endOfParagraph != tokList.end()){
|
||||
if ((* endOfParagraph).tokenType == COMMAND){
|
||||
if(theCommand.compare((*endOfParagraph).tokenString) == 0) return endOfParagraph;
|
||||
|
|
@ -305,10 +303,10 @@ list<Token>::iterator getEndOfSection(string theCommand, TokenList &tokList){
|
|||
* that begins with a \command and ends in \endcommand
|
||||
* such as \code and \endcode. The proper usage is
|
||||
* progressTilEndCommand("endcode", tokenList);
|
||||
* If the end is never encountered, it returns the end of the list.
|
||||
* If the end is never encountered, it returns the end of the std::list.
|
||||
*/
|
||||
list<Token>::iterator getEndCommand(string theCommand, TokenList &tokList){
|
||||
list<Token>::iterator endOfCommand = tokList.iteratorCopy();
|
||||
std::list<Token>::iterator getEndCommand(std::string theCommand, TokenList &tokList){
|
||||
std::list<Token>::iterator endOfCommand = tokList.iteratorCopy();
|
||||
while (endOfCommand!= tokList.end()){
|
||||
if ((*endOfCommand).tokenType == COMMAND){
|
||||
if (theCommand.compare((* endOfCommand).tokenString) == 0){
|
||||
|
|
@ -324,8 +322,8 @@ list<Token>::iterator getEndCommand(string theCommand, TokenList &tokList){
|
|||
/* A specialty method for commands such as \arg that end at the end of a paragraph OR when another \arg is encountered
|
||||
*/
|
||||
//TODO getTilAnyCommand
|
||||
list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
||||
list<Token>::iterator anIterator;
|
||||
std::list<Token>::iterator getTilAnyCommand(std::string theCommand, TokenList &tokList){
|
||||
std::list<Token>::iterator anIterator;
|
||||
return anIterator;
|
||||
}
|
||||
|
||||
|
|
@ -337,7 +335,7 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Plain commands, such as newline etc, they contain no other data
|
||||
* \n \\ \@ \& \$ \# \< \> \%
|
||||
*/
|
||||
int addSimpleCommand(string theCommand, list <DoxygenEntity> &doxyList){
|
||||
int addSimpleCommand(std::string theCommand, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
doxyList.push_back(DoxygenEntity(theCommand));
|
||||
return 1;
|
||||
|
|
@ -347,7 +345,7 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Format: @command
|
||||
* Plain commands, such as newline etc, they contain no other data
|
||||
*/
|
||||
int ignoreSimpleCommand(string theCommand, list <DoxygenEntity> &doxyList){
|
||||
int ignoreSimpleCommand(std::string theCommand, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -358,9 +356,9 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* "a", "b", "c", "e", "em", "p", "def", "enum", "example", "package",
|
||||
* "relates", "namespace", "relatesalso","anchor", "dontinclude", "include", "includelineno"
|
||||
*/
|
||||
int addCommandWord(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
string name = getNextWord(tokList);
|
||||
std::string name = getNextWord(tokList);
|
||||
if (!name.empty()){
|
||||
doxyList.push_back(DoxygenEntity(theCommand, name));
|
||||
return 1;
|
||||
|
|
@ -374,9 +372,9 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Commands with a single WORD after then such as @b
|
||||
* "copydoc", "copybrief", "copydetails", "verbinclude", "htmlinclude"
|
||||
*/
|
||||
int ignoreCommandWord(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int ignoreCommandWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
string name = getNextWord(tokList);
|
||||
std::string name = getNextWord(tokList);
|
||||
if (!name.empty()){
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -389,10 +387,10 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Commands with a single LINE after then such as @var
|
||||
* "addindex", "fn", "name", "line", "var", "skipline", "typedef", "skip", "until", "property"
|
||||
*/
|
||||
int addCommandLine(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
list <DoxygenEntity> aNewList;
|
||||
std::list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
aNewList = parse(endOfLine, tokList);
|
||||
doxyList.push_back( DoxygenEntity(theCommand, aNewList));
|
||||
return 1;
|
||||
|
|
@ -403,9 +401,9 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Commands with a single LINE after then such as @var
|
||||
*
|
||||
*/
|
||||
int ignoreCommandLine(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int ignoreCommandLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
std::list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
tokList.setIterator(endOfLine);
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -416,10 +414,10 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* "return", "remarks", "since", "test", "sa", "see", "pre", "post", "details", "invariant",
|
||||
* "deprecated", "date", "note", "warning", "version", "todo", "bug", "attention", "brief", "arg", "author"
|
||||
*/
|
||||
int addCommandParagraph(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
list <DoxygenEntity> aNewList;
|
||||
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
aNewList = parse(endOfParagraph, tokList);
|
||||
doxyList.push_back( DoxygenEntity(theCommand, aNewList));
|
||||
return 1;
|
||||
|
|
@ -430,9 +428,9 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Commands with a single LINE after then such as @var
|
||||
*
|
||||
*/
|
||||
int ignoreCommandParagraph(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int ignoreCommandParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
tokList.setIterator(endOfParagraph);
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -444,9 +442,9 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* "verbatim", "xmlonly", "cond", "if", "ifnot", "link"
|
||||
* Returns 1 if success, 0 if the endcommand is never encountered.
|
||||
*/
|
||||
int addCommandEndCommand(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandEndCommand(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
string description = getStringTilEndCommand( "end" + theCommand, tokList);
|
||||
std::string description = getStringTilEndCommand( "end" + theCommand, tokList);
|
||||
doxyList.push_back(DoxygenEntity(theCommand, description));
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -456,17 +454,17 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Commands such as param
|
||||
* "param", "tparam", "throw", "retval", "exception"
|
||||
*/
|
||||
int addCommandWordParagraph(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandWordParagraph(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
string name = getNextWord(tokList);
|
||||
std::string name = getNextWord(tokList);
|
||||
if (name.empty()){
|
||||
cout << "No word followed " << theCommand << " command. Not added" << endl;
|
||||
return 0;
|
||||
}
|
||||
list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
list <DoxygenEntity> aNewList;
|
||||
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
aNewList = parse(endOfParagraph, tokList);
|
||||
aNewList.push_front(DoxygenEntity("plainstring", name));
|
||||
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -476,17 +474,17 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Commands such as param
|
||||
* "page", "subsection", "subsubsection", "section", "paragraph", "defgroup"
|
||||
*/
|
||||
int addCommandWordLine(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandWordLine(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
string name = getNextWord(tokList);
|
||||
std::string name = getNextWord(tokList);
|
||||
if (name.empty()){
|
||||
cout << "No word followed " << theCommand << " command. Not added" << endl;
|
||||
return 0;
|
||||
}
|
||||
list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
list <DoxygenEntity> aNewList;
|
||||
std::list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
aNewList = parse(endOfLine, tokList);
|
||||
aNewList.push_front(DoxygenEntity("plainstring", name));
|
||||
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
return 1;
|
||||
|
||||
|
|
@ -498,19 +496,19 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Commands such as class
|
||||
* "category", "class", "protocol", "interface", "struct", "union"
|
||||
*/
|
||||
int addCommandWordOWordOWord(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandWordOWordOWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
string name = getNextWord(tokList);
|
||||
std::string name = getNextWord(tokList);
|
||||
if (name.empty()){
|
||||
cout << "No word followed " << theCommand << " command. Not added" << endl;
|
||||
return 0;
|
||||
}
|
||||
string headerfile = getNextWord(tokList);
|
||||
string headername = getNextWord(tokList);
|
||||
list <DoxygenEntity> aNewList;
|
||||
aNewList.push_back(DoxygenEntity("plainstring", name));
|
||||
if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstring", headerfile));
|
||||
if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstring", headername));
|
||||
std::string headerfile = getNextWord(tokList);
|
||||
std::string headername = getNextWord(tokList);
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
||||
if (!headerfile.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headerfile));
|
||||
if (!headername.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", headername));
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -520,9 +518,9 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
* Commands such as dir
|
||||
* "dir", "file", "cond"
|
||||
*/
|
||||
int addCommandOWord(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandOWord(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
string name = getNextWord(tokList);
|
||||
std::string name = getNextWord(tokList);
|
||||
doxyList.push_back(DoxygenEntity(theCommand, name));
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -530,47 +528,47 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
/* Commands that should not be encountered (such as PHP only)
|
||||
* goes til the end of line then returns
|
||||
*/
|
||||
int addCommandErrorThrow(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
int addCommandErrorThrow(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
cout << "Encountered :" << theCommand << endl;
|
||||
cout << "This command should not have been encountered. Behaviour past this may be unpredictable " << endl;
|
||||
list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
std::list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
tokList.setIterator(endOfLine);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Adds the unique commands- different process for each unique command */
|
||||
int addCommandUnique(string theCommand, TokenList &tokList, list <DoxygenEntity> &doxyList){
|
||||
list <DoxygenEntity> aNewList;
|
||||
int addCommandUnique(std::string theCommand, TokenList &tokList, std::list <DoxygenEntity> &doxyList){
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
if (theCommand.compare("arg") == 0 || theCommand.compare("li") == 0){
|
||||
list<Token>::iterator endOfSection = getEndOfSection(theCommand, tokList);
|
||||
list <DoxygenEntity> aNewList;
|
||||
std::list<Token>::iterator endOfSection = getEndOfSection(theCommand, tokList);
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
aNewList = parse(endOfSection, tokList);
|
||||
doxyList.push_back( DoxygenEntity(theCommand, aNewList));
|
||||
}
|
||||
// \xrefitem <key> "(heading)" "(list title)" {text}
|
||||
// \xrefitem <key> "(heading)" "(std::list title)" {text}
|
||||
else if (theCommand.compare("xrefitem") == 0){
|
||||
//TODO Implement xrefitem
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
tokList.setIterator(endOfParagraph);
|
||||
return 1;
|
||||
}
|
||||
// \ingroup (<groupname> [<groupname> <groupname>])
|
||||
else if (theCommand.compare("ingroup") == 0){
|
||||
string name = getNextWord(tokList);
|
||||
aNewList.push_back(DoxygenEntity("plainstring", name));
|
||||
std::string name = getNextWord(tokList);
|
||||
aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
||||
name = getNextWord(tokList);
|
||||
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name));
|
||||
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
||||
name = getNextWord(tokList);
|
||||
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name));
|
||||
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
return 1;
|
||||
}
|
||||
// \par [(paragraph title)] { paragraph }
|
||||
else if (theCommand.compare("par") == 0){
|
||||
list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
std::list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
aNewList = parse(endOfLine, tokList);
|
||||
list <DoxygenEntity> aNewList2;
|
||||
std::list <DoxygenEntity> aNewList2;
|
||||
aNewList2 = parse(endOfLine, tokList);
|
||||
aNewList.splice(aNewList.end(), aNewList2);
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
|
|
@ -578,19 +576,19 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
}
|
||||
// \headerfile <header-file> [<header-name>]
|
||||
else if (theCommand.compare("headerfile") == 0){
|
||||
list <DoxygenEntity> aNewList;
|
||||
string name = getNextWord(tokList);
|
||||
aNewList.push_back(DoxygenEntity("plainstring", name));
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
std::string name = getNextWord(tokList);
|
||||
aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
||||
name = getNextWord(tokList);
|
||||
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstring", name));
|
||||
if(!name.empty()) aNewList.push_back(DoxygenEntity("plainstd::string", name));
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
return 1;
|
||||
}
|
||||
// \overload [(function declaration)]
|
||||
else if (theCommand.compare("overload") == 0){
|
||||
list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
std::list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
if (endOfLine != tokList.current()){
|
||||
list <DoxygenEntity> aNewList;
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
aNewList = parse(endOfLine, tokList);
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
}
|
||||
|
|
@ -600,38 +598,38 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
// \weakgroup <name> [(title)]
|
||||
else if (theCommand.compare("weakgroup") == 0){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
string name = getNextWord(tokList);
|
||||
std::string name = getNextWord(tokList);
|
||||
if (name.empty()){
|
||||
cout << "No word followed " << theCommand << " command. Not added" << endl;
|
||||
return 0;
|
||||
}
|
||||
list <DoxygenEntity> aNewList;
|
||||
list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
std::list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
if (endOfLine != tokList.current()) {
|
||||
aNewList = parse(endOfLine, tokList);
|
||||
}
|
||||
aNewList.push_front(DoxygenEntity("plainstring", name));
|
||||
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
}
|
||||
// \ref <name> ["(text)"]
|
||||
else if (theCommand.compare("ref") == 0){
|
||||
//TODO Implement ref
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
tokList.setIterator(endOfParagraph);
|
||||
}
|
||||
// \subpage <name> ["(text)"]
|
||||
else if (theCommand.compare("subpage") == 0){
|
||||
//TODO implement subpage
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
tokList.setIterator(endOfParagraph);
|
||||
}
|
||||
// \dotfile <file> ["caption"]
|
||||
else if (theCommand.compare("dotfile") == 0){
|
||||
//TODO implement dotfile
|
||||
if (noisy) cout << "Not Adding " << theCommand << endl;
|
||||
list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
std::list<Token>::iterator endOfParagraph = getEndOfParagraph(tokList);
|
||||
tokList.setIterator(endOfParagraph);
|
||||
}
|
||||
// \image <format> <file> ["caption"] [<sizeindication>=<size>]
|
||||
|
|
@ -641,17 +639,17 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
// \addtogroup <name> [(title)]
|
||||
else if (theCommand.compare("addtogroup") == 0){
|
||||
if (noisy) cout << "Parsing " << theCommand << endl;
|
||||
string name = getNextWord(tokList);
|
||||
std::string name = getNextWord(tokList);
|
||||
if (name.empty()){
|
||||
cout << "No word followed " << theCommand << " command. Not added" << endl;
|
||||
return 0;
|
||||
}
|
||||
list <DoxygenEntity> aNewList;
|
||||
list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
std::list<Token>::iterator endOfLine = getOneLine(tokList);
|
||||
if (endOfLine != tokList.current()) {
|
||||
aNewList = parse(endOfLine, tokList);
|
||||
}
|
||||
aNewList.push_front(DoxygenEntity("plainstring", name));
|
||||
aNewList.push_front(DoxygenEntity("plainstd::string", name));
|
||||
doxyList.push_back(DoxygenEntity(theCommand, aNewList));
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -663,12 +661,12 @@ list<Token>::iterator getTilAnyCommand(string theCommand, TokenList &tokList){
|
|||
*/
|
||||
|
||||
|
||||
int addCommand(string commandString, TokenList &tokList,list <DoxygenEntity> &doxyList){
|
||||
string theCommand = StringToLower(commandString);
|
||||
if (theCommand.compare("plainstring") == 0){
|
||||
string nextPhrase = getStringTilCommand( tokList);
|
||||
if (noisy) cout << "Parsing plain string :" << nextPhrase << endl;
|
||||
doxyList.push_back(DoxygenEntity("plainstring", nextPhrase ));
|
||||
int addCommand(std::string commandString, TokenList &tokList,std::list <DoxygenEntity> &doxyList){
|
||||
std::string theCommand = StringToLower(commandString);
|
||||
if (theCommand.compare("plainstd::string") == 0){
|
||||
std::string nextPhrase = getStringTilCommand( tokList);
|
||||
if (noisy) cout << "Parsing plain std::string :" << nextPhrase << endl;
|
||||
doxyList.push_back(DoxygenEntity("plainstd::string", nextPhrase ));
|
||||
return 1;
|
||||
}
|
||||
int commandNumber = commandBelongs(theCommand);
|
||||
|
|
@ -721,8 +719,8 @@ int addCommand(string commandString, TokenList &tokList,list <DoxygenEntity> &do
|
|||
return 0;
|
||||
}
|
||||
|
||||
list<DoxygenEntity> parse(list<Token>::iterator endParsingIndex, TokenList &tokList){
|
||||
list <DoxygenEntity> aNewList;
|
||||
std::list<DoxygenEntity> parse(std::list<Token>::iterator endParsingIndex, TokenList &tokList){
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
int currCommand;
|
||||
while (tokList.current() != endParsingIndex){
|
||||
Token currToken = tokList.peek();
|
||||
|
|
@ -735,22 +733,22 @@ list<DoxygenEntity> parse(list<Token>::iterator endParsingIndex, TokenList &tokL
|
|||
if (currCommand < 0 ){
|
||||
if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl;
|
||||
tokList.next();
|
||||
addCommand(string("plainstring"), tokList, aNewList);}
|
||||
addCommand(std::string("plainstd::string"), tokList, aNewList);}
|
||||
//cout << "Command: " << currWord << " " << currCommand << endl;
|
||||
else { tokList.next();
|
||||
addCommand(currToken.tokenString, tokList, aNewList);
|
||||
}
|
||||
}
|
||||
else if (currToken.tokenType == PLAINSTRING){
|
||||
addCommand(string("plainstring"), tokList, aNewList);
|
||||
addCommand(std::string("plainstd::string"), tokList, aNewList);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
return aNewList;
|
||||
}
|
||||
|
||||
list<DoxygenEntity> parseRoot(list<Token>::iterator endParsingIndex, TokenList &tokList){
|
||||
list <DoxygenEntity> aNewList;
|
||||
std::list<DoxygenEntity> parseRoot(std::list<Token>::iterator endParsingIndex, TokenList &tokList){
|
||||
std::list <DoxygenEntity> aNewList;
|
||||
int currCommand;
|
||||
while (tokList.current() != endParsingIndex){
|
||||
Token currToken = tokList.peek();
|
||||
|
|
@ -763,26 +761,26 @@ list<DoxygenEntity> parseRoot(list<Token>::iterator endParsingIndex, TokenList &
|
|||
if (currCommand < 0 ){
|
||||
if(noisy) cout << "Unidentified Command " << currToken.tokenString << endl;
|
||||
tokList.next();
|
||||
addCommand(string("partofdescription"), tokList, aNewList);}
|
||||
addCommand(std::string("partofdescription"), tokList, aNewList);}
|
||||
//cout << "Command: " << currWord << " " << currCommand << endl;
|
||||
else { tokList.next();
|
||||
addCommand(currToken.tokenString, tokList, aNewList);
|
||||
}
|
||||
}
|
||||
else if (currToken.tokenType == PLAINSTRING){
|
||||
addCommand(string("partofdescription"), tokList, aNewList);
|
||||
addCommand(std::string("partofdescription"), tokList, aNewList);
|
||||
}
|
||||
}
|
||||
return aNewList;
|
||||
}
|
||||
|
||||
list<DoxygenEntity> DoxygenParser::createTree(string doxygenBlob){
|
||||
std::list<DoxygenEntity> DoxygenParser::createTree(std::string doxygenBlob){
|
||||
TokenList tokList = TokenList(doxygenBlob);
|
||||
if(noisy) {
|
||||
cout << "---TOKEN LIST---" << endl;
|
||||
tokList.printList();
|
||||
}
|
||||
list <DoxygenEntity> rootList;
|
||||
std::list <DoxygenEntity> rootList;
|
||||
rootList = parseRoot( tokList.end(), tokList);
|
||||
if(noisy) {
|
||||
cout << "PARSED LIST" << endl;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
class DoxygenParser
|
||||
{
|
||||
public:
|
||||
DoxygenParser();
|
||||
virtual ~DoxygenParser();
|
||||
list <DoxygenEntity> createTree(string doxygen);
|
||||
DoxygenParser();
|
||||
virtual ~DoxygenParser();
|
||||
std::list <DoxygenEntity> createTree(std::string doxygen);
|
||||
};
|
||||
|
||||
#endif /*DOXYGENPARSER_H_*/
|
||||
|
|
|
|||
|
|
@ -24,69 +24,20 @@ DoxygenTranslator::~DoxygenTranslator(){
|
|||
|
||||
char *DoxygenTranslator::convert(Node *n, char* doxygenBlob, char* option){
|
||||
|
||||
list <DoxygenEntity> rootList = doxyParse.createTree(string(doxygenBlob));
|
||||
std::list <DoxygenEntity> rootList = doxyParse.createTree(std::string(doxygenBlob));
|
||||
std::string returnedString;
|
||||
|
||||
if(strcmp(option, "JAVADOC") == 0)
|
||||
returnedString = jDC.convertToJavaDoc(n, rootList);
|
||||
else if(strcmp(option, "PYDOC") == 0)
|
||||
returnedString = pyDC.convertToPyDoc(n, rootList);
|
||||
else
|
||||
std::cout << "Option not current supported." << std::endl;
|
||||
|
||||
string returnedString;
|
||||
if(strcmp(option, "JAVADOC") == 0){
|
||||
returnedString = jDC.convertToJavaDoc(n, rootList);
|
||||
}
|
||||
else if(strcmp(option, "PYDOC") == 0){
|
||||
returnedString = pyDC.convertToPyDoc(n, rootList);
|
||||
}
|
||||
else cout << "Option not current supported.\n";
|
||||
char *nonConstString;
|
||||
nonConstString = (char *)malloc(returnedString.length() + 1);
|
||||
strcpy(nonConstString, returnedString.c_str());
|
||||
return nonConstString;
|
||||
char *nonConstString;
|
||||
nonConstString = (char *)malloc(returnedString.length() + 1);
|
||||
strcpy(nonConstString, returnedString.c_str());
|
||||
|
||||
return nonConstString;
|
||||
}
|
||||
|
||||
int testCommands(){
|
||||
string exampleArray[] = {
|
||||
"/**\n * Random Line \n * \\@ \n * Random Line After */",
|
||||
"/**\n * Random Line Before \n * \n * \\b bold \n * Random Line After */",
|
||||
"/**\n * Random Line \n * \n *\\copydoc bold \n * Random Line After */",
|
||||
"/**\n * Random Line \n * \n * \\addindex An Entire Line\n * \\addindex An Entire Line\n * Random Line After */",
|
||||
"/**\n * Random Line \n * \n * \\return An Entire Paragraph \n * Including This Line \n * \n * Random Line After */",
|
||||
"/**\n * Random Line \n * \n * \\return An Entire Paragraph \n * Including This Line \n * \\author Shouldn't be part of return */",
|
||||
"/**\n * Random Line \n * \n * \\code this should continue \n * until here \\endcode \n * Random Line After */",
|
||||
"/**\n * Random Line \n * \n * \\param singleword then the rest of \n * the description \n * \n * Random Line After */",
|
||||
"/**\n * Random Line \n * \n * \\page singleword this should go til here \n * but not this */",
|
||||
"/**\n * Random Line \n * \n * \\page singleword this should go til here \n * but not this */",
|
||||
"/**\n * Random Line \n * \n * \\category singleword \n * but not this */",
|
||||
"/**\n * Random Line \n * \n * \\category singleword oneword \n * but not this */",
|
||||
"/**\n * Random Line \n * \n * \\category singleword oneword twoword \n * but not this */",
|
||||
"/**\n * Random Line \n * \n * \\dir singleword \n * but not this */",
|
||||
"/**\n * Random Line \n * \n * \\dir \n * but not this */",
|
||||
"/**\n * Random Line \n * \n * \\fakecommand details \n * but not this */"
|
||||
};
|
||||
//string exampleArrayUniques = {};
|
||||
DoxygenTranslator dT = DoxygenTranslator();
|
||||
for (int i = 0; i < 16; i ++ ){
|
||||
//cout << "---ORIGINAL DOXYGEN--- " << endl << exampleArray[i] << endl;
|
||||
char *nonConstString = (char *)malloc(exampleArray[i].length()+1);
|
||||
strcpy(nonConstString, exampleArray[i].c_str());
|
||||
char * result = dT.convert(NULL, nonConstString, "JAVADOC");
|
||||
free(nonConstString);
|
||||
free(result);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//int main(int argc, char *argv[]){
|
||||
//string doxygenString1 = "//! \\brief a brief description \n\n A normal member taking two arguments and returning an \\b integer value. This is a very long description for the simple purpose of showing off formatting. Let's make it a bit longer just to be sure. \n/*!\n \\param a an \\b integer argument.\n \\return The test results\n \\param s a constant character pointer. Let's also make this a very long description! \n \\bug this command should, for now, be totally ignored\n \\author cheryl foil\n \\sa Test(), ~Test(), testMeToo() and publicVar()\n */";
|
||||
//cout << "---ORIGINAL DOXYGEN--- " << endl << doxygenString1 << endl;
|
||||
//char *nonConstString = (char *)malloc(doxygenString1.length()+1);
|
||||
//strcpy(nonConstString, doxygenString1.c_str());
|
||||
//DoxygenTranslator dT = DoxygenTranslator();
|
||||
//char *result = dT.convert("/**\n * \n * Random Line \n * \n * \\name An Entire Line \n * NOT This Line \n * \n * Random Line After */", "JAVADOC");
|
||||
//result = dT.convert(nonConstString, "JAVADOC");
|
||||
//cout << "End";
|
||||
//list <DoxygenEntity> rootList = doxyParse.createTree(doxygenString1);
|
||||
//JavaDocConverter jDC = JavaDocConverter();
|
||||
//jDC.convertToJavaDoc(rootList);
|
||||
//testCommands();
|
||||
//return 1;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,227 +12,152 @@ JavaDocConverter::~JavaDocConverter()
|
|||
{
|
||||
}
|
||||
|
||||
/* Sorts entities by javaDoc standard order for commands
|
||||
* NOTE: will not behave entirely properly until "First level" comments
|
||||
* such as brief descriptions are TAGGED as such
|
||||
*/
|
||||
bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second){
|
||||
if(first.typeOfEntity.compare("brief") == 0) return true;
|
||||
if(second.typeOfEntity.compare("brief") == 0) return false;
|
||||
if(first.typeOfEntity.compare("details") == 0) return true;
|
||||
if(second.typeOfEntity.compare("details") == 0) return false;
|
||||
if(first.typeOfEntity.compare("partofdescription") == 0) return true;
|
||||
if(first.typeOfEntity.compare("partofdescription") == 0) return false;
|
||||
if(first.typeOfEntity.compare("plainstring") == 0) return true;
|
||||
if(second.typeOfEntity.compare("plainstring") == 0) return false;
|
||||
if(first.typeOfEntity.compare("param") == 0){
|
||||
if(second.typeOfEntity.compare("param")== 0) return true;
|
||||
if(second.typeOfEntity.compare("return")== 0) return true;
|
||||
if(second.typeOfEntity.compare("exception")== 0) return true;
|
||||
if(second.typeOfEntity.compare("author")== 0) return true;
|
||||
if(second.typeOfEntity.compare("version")== 0)return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("return")== 0){
|
||||
if(second.typeOfEntity.compare("return")== 0) return true;
|
||||
if(second.typeOfEntity.compare("exception")== 0) return true;
|
||||
if(second.typeOfEntity.compare("author")== 0) return true;
|
||||
if(second.typeOfEntity.compare("version")== 0)return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
if(first.typeOfEntity.compare("exception")== 0){
|
||||
if(second.typeOfEntity.compare("exception")== 0) return true;
|
||||
if(second.typeOfEntity.compare("author")== 0) return true;
|
||||
if(second.typeOfEntity.compare("version")== 0)return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("author")== 0){
|
||||
if(second.typeOfEntity.compare("author")== 0) return true;
|
||||
if(second.typeOfEntity.compare("version")== 0)return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("version")== 0){
|
||||
if(second.typeOfEntity.compare("version")== 0)return true;
|
||||
if(second.typeOfEntity.compare("see")== 0)return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("see")== 0 || first.typeOfEntity.compare("sa")== 0){
|
||||
if(second.typeOfEntity.compare("see")== 0)return true;
|
||||
if(second.typeOfEntity.compare("sa")== 0)return true;
|
||||
if(second.typeOfEntity.compare("since")== 0)return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("since")== 0){
|
||||
if(second.typeOfEntity.compare("since")== 0) return true;
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)return true;
|
||||
return false;
|
||||
}
|
||||
if(first.typeOfEntity.compare("deprecated")== 0){
|
||||
if(second.typeOfEntity.compare("deprecated")== 0)return true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
void JavaDocConverter::printSortedTree(std::list<DoxygenEntity> &entityList){
|
||||
std::list<DoxygenEntity>::iterator p = entityList.begin();
|
||||
while (p != entityList.end()){
|
||||
(*p).printEntity(0);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
void JavaDocConverter::printSortedTree(list <DoxygenEntity> &entityList){
|
||||
list<DoxygenEntity>::iterator p = entityList.begin();
|
||||
while (p != entityList.end()){
|
||||
(*p).printEntity(0);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
string formatCommand(string unformattedLine, int indent){
|
||||
string formattedLines = "\n * ";
|
||||
int lastPosition = 0;
|
||||
int i = 0;
|
||||
int isFirstLine = 1;
|
||||
while (i != -1 && i < unformattedLine.length()){
|
||||
lastPosition = i;
|
||||
if (isFirstLine){
|
||||
i+=APPROX_LINE_LENGTH;
|
||||
}
|
||||
else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE;
|
||||
i = unformattedLine.find(" ", i);
|
||||
std::string formatCommand(std::string unformattedLine, int indent){
|
||||
std::string formattedLines = "\n * ";
|
||||
int lastPosition = 0;
|
||||
int i = 0;
|
||||
int isFirstLine = 1;
|
||||
while (i != -1 && i < unformattedLine.length()){
|
||||
lastPosition = i;
|
||||
if (isFirstLine){
|
||||
i+=APPROX_LINE_LENGTH;
|
||||
}
|
||||
else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE;
|
||||
i = unformattedLine.find(" ", i);
|
||||
|
||||
if (i > 0 && i + 1 < unformattedLine.length()){
|
||||
if (!isFirstLine) for (int j = 0; j < indent; j++) {
|
||||
formattedLines.append("\t");
|
||||
}
|
||||
else {
|
||||
isFirstLine = 0;
|
||||
}
|
||||
formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1));
|
||||
formattedLines.append("\n *");
|
||||
if (i > 0 && i + 1 < unformattedLine.length()){
|
||||
if (!isFirstLine) for (int j = 0; j < indent; j++) {
|
||||
formattedLines.append("\t");
|
||||
}
|
||||
else {
|
||||
isFirstLine = 0;
|
||||
}
|
||||
formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1));
|
||||
formattedLines.append("\n *");
|
||||
|
||||
}
|
||||
}
|
||||
if (lastPosition < unformattedLine.length()){
|
||||
if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}}
|
||||
formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lastPosition < unformattedLine.length()){
|
||||
if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}}
|
||||
formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition));
|
||||
}
|
||||
|
||||
return formattedLines;
|
||||
return formattedLines;
|
||||
}
|
||||
|
||||
/* Contains the conversions for tags
|
||||
* could probably be much more efficient...
|
||||
*/
|
||||
string javaDocFormat(DoxygenEntity &doxygenEntity){
|
||||
if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){
|
||||
return doxygenEntity.data;
|
||||
}
|
||||
if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){
|
||||
return doxygenEntity.data;
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("b") == 0){
|
||||
return "<b>" + doxygenEntity.data + "</b>";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("c") == 0){
|
||||
return "<tt>" + doxygenEntity.data + "</tt>";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("@") == 0){
|
||||
return "@";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("\\") == 0){
|
||||
return "\\";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("<") == 0){
|
||||
return "<";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare(">") == 0){
|
||||
return ">";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("&") == 0){
|
||||
return "&";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("#") == 0){
|
||||
return "#";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("%") == 0){
|
||||
return "%";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("~") == 0){
|
||||
return "~";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
string translateSubtree( DoxygenEntity &doxygenEntity){
|
||||
string returnedString;
|
||||
if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";}
|
||||
else {
|
||||
returnedString += javaDocFormat(doxygenEntity);
|
||||
list<DoxygenEntity>::iterator p = doxygenEntity.entityList.begin();
|
||||
while (p != doxygenEntity.entityList.end()){
|
||||
returnedString+= translateSubtree(*p);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return returnedString;
|
||||
}
|
||||
|
||||
string translateEntity(DoxygenEntity &doxyEntity){
|
||||
if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(string(translateSubtree(doxyEntity)), 0);
|
||||
if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){
|
||||
return formatCommand(string(translateSubtree(doxyEntity)), 0) + "\n * ";}
|
||||
else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0)
|
||||
return formatCommand(doxyEntity.data, 0) + "\n * ";
|
||||
else if(doxyEntity.typeOfEntity.compare("see") == 0){
|
||||
return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else if(doxyEntity.typeOfEntity.compare("return")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("author")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("param")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("since")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("version")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("exception") == 0
|
||||
|| doxyEntity.typeOfEntity.compare("deprecated") == 0){
|
||||
return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else if(doxyEntity.typeOfEntity.compare("sa")== 0){
|
||||
return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else return formatCommand(javaDocFormat(doxyEntity), 0 );
|
||||
return "";
|
||||
}
|
||||
|
||||
string JavaDocConverter:: convertToJavaDoc(Node *n, list <DoxygenEntity> entityList){
|
||||
|
||||
|
||||
entityList.sort(compare_DoxygenEntities);
|
||||
if(printSortedTree2){
|
||||
cout << "---RESORTED LIST---" << endl;
|
||||
printSortedTree(entityList);
|
||||
std::string javaDocFormat(DoxygenEntity &doxygenEntity){
|
||||
if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){
|
||||
return doxygenEntity.data;
|
||||
}
|
||||
if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){
|
||||
return doxygenEntity.data;
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("b") == 0){
|
||||
return "<b>" + doxygenEntity.data + "</b>";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("c") == 0){
|
||||
return "<tt>" + doxygenEntity.data + "</tt>";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("@") == 0){
|
||||
return "@";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("\\") == 0){
|
||||
return "\\";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("<") == 0){
|
||||
return "<";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare(">") == 0){
|
||||
return ">";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("&") == 0){
|
||||
return "&";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("#") == 0){
|
||||
return "#";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("%") == 0){
|
||||
return "%";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("~") == 0){
|
||||
return "~";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
string javaDocString = "/**";
|
||||
|
||||
list<DoxygenEntity>::iterator entityIterator = entityList.begin();
|
||||
while (entityIterator != entityList.end()){
|
||||
javaDocString += translateEntity(*entityIterator);
|
||||
entityIterator++;
|
||||
}
|
||||
std::string translateSubtree( DoxygenEntity &doxygenEntity){
|
||||
std::string returnedString;
|
||||
if (doxygenEntity.isLeaf){ return javaDocFormat(doxygenEntity) + " ";}
|
||||
else {
|
||||
returnedString += javaDocFormat(doxygenEntity);
|
||||
std::list<DoxygenEntity>::iterator p = doxygenEntity.entityList.begin();
|
||||
while (p != doxygenEntity.entityList.end()){
|
||||
returnedString+= translateSubtree(*p);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return returnedString;
|
||||
}
|
||||
|
||||
javaDocString += "\n */\n";
|
||||
if(printSortedTree2){
|
||||
cout << "\n---RESULT IN JAVADOC---" << endl;
|
||||
cout << javaDocString; }
|
||||
return javaDocString;
|
||||
std::string translateEntity(DoxygenEntity &doxyEntity){
|
||||
if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(std::string(translateSubtree(doxyEntity)), 0);
|
||||
if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){
|
||||
return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";}
|
||||
else if(doxyEntity.typeOfEntity.compare("plainstring")== 0 || doxyEntity.typeOfEntity.compare("deprecated")== 0 || doxyEntity.typeOfEntity.compare("brief")== 0)
|
||||
return formatCommand(doxyEntity.data, 0) + "\n * ";
|
||||
else if(doxyEntity.typeOfEntity.compare("see") == 0){
|
||||
return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else if(doxyEntity.typeOfEntity.compare("return")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("author")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("param")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("since")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("version")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("exception") == 0
|
||||
|| doxyEntity.typeOfEntity.compare("deprecated") == 0){
|
||||
return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else if(doxyEntity.typeOfEntity.compare("sa")== 0){
|
||||
return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else return formatCommand(javaDocFormat(doxyEntity), 0 );
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string JavaDocConverter:: convertToJavaDoc(Node *n, std::list <DoxygenEntity> entityList){
|
||||
#pragma unused(n)
|
||||
entityList.sort(CompareDoxygenEntities());
|
||||
|
||||
if(printSortedTree2){
|
||||
std::cout << "---RESORTED LIST---" << std::endl;
|
||||
printSortedTree(entityList);
|
||||
}
|
||||
|
||||
std::string javaDocString = "/**";
|
||||
|
||||
for(std::list<DoxygenEntity>::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();){
|
||||
javaDocString += translateEntity(*entityIterator);
|
||||
entityIterator++;
|
||||
}
|
||||
|
||||
javaDocString += "\n */\n";
|
||||
|
||||
if(printSortedTree2){
|
||||
std::cout << "\n---RESULT IN JAVADOC---" << std::endl;
|
||||
std::cout << javaDocString;
|
||||
}
|
||||
|
||||
return javaDocString;
|
||||
}
|
||||
|
|
@ -9,11 +9,10 @@
|
|||
class JavaDocConverter
|
||||
{
|
||||
public:
|
||||
|
||||
JavaDocConverter();
|
||||
string convertToJavaDoc(Node *n, list <DoxygenEntity> entityList);
|
||||
~JavaDocConverter();
|
||||
void printSortedTree(list <DoxygenEntity> &entityList);
|
||||
JavaDocConverter();
|
||||
std::string convertToJavaDoc(Node *n, std::list <DoxygenEntity> entityList);
|
||||
~JavaDocConverter();
|
||||
void printSortedTree(std::list <DoxygenEntity> &entityList);
|
||||
};
|
||||
|
||||
#endif /*JAVADOCCONVERTER_H_*/
|
||||
|
|
|
|||
|
|
@ -14,192 +14,188 @@ PyDocConverter::PyDocConverter()
|
|||
PyDocConverter::~PyDocConverter()
|
||||
{
|
||||
}
|
||||
|
||||
/* Sorts entities by pyDoc standard order for commands
|
||||
* NOTE: will not behave entirely properly until "First level" comments
|
||||
* such as brief descriptions are TAGGED as such
|
||||
*/
|
||||
bool compare_DoxygenEntities(DoxygenEntity first, DoxygenEntity second);
|
||||
|
||||
void PyDocConverter::printSortedTree(list <DoxygenEntity> &entityList){
|
||||
list<DoxygenEntity>::iterator p = entityList.begin();
|
||||
while (p != entityList.end()){
|
||||
(*p).printEntity(0);
|
||||
p++;
|
||||
}
|
||||
void PyDocConverter::printSortedTree(std::list <DoxygenEntity> &entityList){
|
||||
std::list<DoxygenEntity>::iterator p = entityList.begin();
|
||||
while (p != entityList.end()){
|
||||
(*p).printEntity(0);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) {
|
||||
string result;
|
||||
ParmList *plist = CopyParmList(Getattr(n, "parms"));
|
||||
Parm *p = NULL;
|
||||
|
||||
DoxygenEntity& paramNameEntity = *doxygenEntity.entityList.begin();
|
||||
DoxygenEntity& paramDescriptionEntity = *(++doxygenEntity.entityList.begin());
|
||||
|
||||
for (p = plist; p;) {
|
||||
if(Char(Getattr(p, "name")) == paramNameEntity.data) {
|
||||
std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0));
|
||||
std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0));
|
||||
|
||||
std::ostringstream parameterDocString;
|
||||
|
||||
parameterDocString << std::endl << name << " (" << type << "): ";
|
||||
parameterDocString << paramDescriptionEntity.data;
|
||||
|
||||
result = parameterDocString.str();
|
||||
break;
|
||||
}
|
||||
p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p);
|
||||
}
|
||||
std::string PyDocConverter::formatParam(Node *n, DoxygenEntity &doxygenEntity) {
|
||||
std::string result;
|
||||
ParmList *plist = CopyParmList(Getattr(n, "parms"));
|
||||
Parm *p = NULL;
|
||||
|
||||
DoxygenEntity& paramNameEntity = *doxygenEntity.entityList.begin();
|
||||
DoxygenEntity& paramDescriptionEntity = *(++doxygenEntity.entityList.begin());
|
||||
|
||||
for (p = plist; p;) {
|
||||
if(Char(Getattr(p, "name")) == paramNameEntity.data) {
|
||||
std::string name = Char(Swig_name_make(n, 0, Getattr(p, "name"), 0, 0));
|
||||
std::string type = Char(Swig_name_make(n, 0, Getattr(p, "type"), 0, 0));
|
||||
|
||||
std::ostringstream parameterDocString;
|
||||
|
||||
parameterDocString << std::endl << name << " (" << type << ") -- ";
|
||||
parameterDocString << paramDescriptionEntity.data;
|
||||
|
||||
result = parameterDocString.str();
|
||||
break;
|
||||
}
|
||||
p = Getattr(p, "tmap:in") ? Getattr(p, "tmap:in:next") : nextSibling(p);
|
||||
}
|
||||
|
||||
Delete(plist);
|
||||
return result;
|
||||
Delete(plist);
|
||||
return result;
|
||||
}
|
||||
|
||||
string PyDocConverter::formatCommand(string unformattedLine, int indent){
|
||||
string formattedLines = "\n";
|
||||
int lastPosition = 0;
|
||||
int i = 0;
|
||||
int isFirstLine = 1;
|
||||
while (i != -1 && i < unformattedLine.length()){
|
||||
lastPosition = i;
|
||||
if (isFirstLine){
|
||||
i+=APPROX_LINE_LENGTH;
|
||||
}
|
||||
else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE;
|
||||
i = unformattedLine.find(" ", i);
|
||||
std::string PyDocConverter::formatCommand(std::string unformattedLine, int indent){
|
||||
std::string formattedLines = "\n";
|
||||
int lastPosition = 0;
|
||||
signed int i = 0;
|
||||
bool isFirstLine = true;
|
||||
while (i != -1 && i < (int)unformattedLine.length()){
|
||||
lastPosition = i;
|
||||
if (isFirstLine){
|
||||
i+=APPROX_LINE_LENGTH;
|
||||
}
|
||||
else i+=APPROX_LINE_LENGTH - indent*TAB_SIZE;
|
||||
i = unformattedLine.find(" ", i);
|
||||
|
||||
if (i > 0 && i + 1 < unformattedLine.length()){
|
||||
if (!isFirstLine) for (int j = 0; j < indent; j++) {
|
||||
formattedLines.append("\t");
|
||||
}
|
||||
else {
|
||||
isFirstLine = 0;
|
||||
}
|
||||
formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1));
|
||||
formattedLines.append("\n");
|
||||
if (i > 0 && i + 1 < (int)unformattedLine.length()){
|
||||
if (!isFirstLine) for (int j = 0; j < indent; j++) {
|
||||
formattedLines.append("\t");
|
||||
}
|
||||
else {
|
||||
isFirstLine = false;
|
||||
}
|
||||
formattedLines.append(unformattedLine.substr(lastPosition, i - lastPosition + 1));
|
||||
formattedLines.append("\n");
|
||||
|
||||
}
|
||||
}
|
||||
if (lastPosition < unformattedLine.length()){
|
||||
if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}}
|
||||
formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lastPosition < (int)unformattedLine.length()){
|
||||
if (!isFirstLine) {for (int j = 0; j < indent; j++) {formattedLines.append("\t");}}
|
||||
formattedLines.append(unformattedLine.substr(lastPosition, unformattedLine.length() - lastPosition));
|
||||
}
|
||||
|
||||
return formattedLines;
|
||||
return formattedLines;
|
||||
}
|
||||
|
||||
/* Contains the conversions for tags
|
||||
* could probably be much more efficient...
|
||||
*/
|
||||
string PyDocConverter::pyDocFormat(DoxygenEntity &doxygenEntity){
|
||||
if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){
|
||||
return doxygenEntity.data;
|
||||
}
|
||||
if (doxygenEntity.typeOfEntity.compare("plainstring") == 0){
|
||||
return doxygenEntity.data;
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("b") == 0){
|
||||
return "<b>" + doxygenEntity.data + "</b>";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("c") == 0){
|
||||
return "<tt>" + doxygenEntity.data + "</tt>";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("@") == 0){
|
||||
return "@";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("\\") == 0){
|
||||
return "\\";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("<") == 0){
|
||||
return "<";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare(">") == 0){
|
||||
return ">";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("&") == 0){
|
||||
return "&";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("#") == 0){
|
||||
return "#";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("%") == 0){
|
||||
return "%";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("~") == 0){
|
||||
return "~";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){
|
||||
string returnedString;
|
||||
if (doxygenEntity.isLeaf){ return pyDocFormat(doxygenEntity) + " ";}
|
||||
else {
|
||||
returnedString += pyDocFormat(doxygenEntity);
|
||||
list<DoxygenEntity>::iterator p = doxygenEntity.entityList.begin();
|
||||
while (p != doxygenEntity.entityList.end()){
|
||||
returnedString+= translateSubtree(*p);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return returnedString;
|
||||
}
|
||||
|
||||
string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){
|
||||
if(doxyEntity.typeOfEntity.compare("partofdescription")== 0) return formatCommand(string(translateSubtree(doxyEntity)), 0);
|
||||
if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){
|
||||
return formatCommand(string(translateSubtree(doxyEntity)), 0) + "\n * ";}
|
||||
else if(doxyEntity.typeOfEntity.compare("plainstring")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("deprecated")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("brief")== 0)
|
||||
return formatCommand(doxyEntity.data, 0) + "\n * ";
|
||||
else if(doxyEntity.typeOfEntity.compare("see") == 0){
|
||||
return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else if(doxyEntity.typeOfEntity.compare("param") == 0) {
|
||||
return formatParam(n, doxyEntity);
|
||||
}
|
||||
else if(doxyEntity.typeOfEntity.compare("return")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("author")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("param")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("since")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("version")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("exception") == 0
|
||||
|| doxyEntity.typeOfEntity.compare("deprecated") == 0){
|
||||
return formatCommand(string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else if(doxyEntity.typeOfEntity.compare("sa")== 0){
|
||||
return formatCommand(string("@see\t\t" + translateSubtree(doxyEntity)), 2);
|
||||
}
|
||||
else return formatCommand(pyDocFormat(doxyEntity), 0 );
|
||||
return "";
|
||||
}
|
||||
|
||||
string PyDocConverter::convertToPyDoc(Node *n, list <DoxygenEntity> entityList){
|
||||
entityList.sort(compare_DoxygenEntities);
|
||||
|
||||
if(debug){
|
||||
cout << "---RESORTED LIST---" << endl;
|
||||
printSortedTree(entityList);
|
||||
std::string PyDocConverter::pyDocFormat(DoxygenEntity &doxygenEntity){
|
||||
if(doxygenEntity.typeOfEntity.compare("partofdescription") == 0){
|
||||
return doxygenEntity.data;
|
||||
}
|
||||
if (doxygenEntity.typeOfEntity.compare("plainstd::string") == 0){
|
||||
return doxygenEntity.data;
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("b") == 0){
|
||||
return "<b>" + doxygenEntity.data + "</b>";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("c") == 0){
|
||||
return "<tt>" + doxygenEntity.data + "</tt>";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("@") == 0){
|
||||
return "@";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("\\") == 0){
|
||||
return "\\";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("<") == 0){
|
||||
return "<";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare(">") == 0){
|
||||
return ">";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("&") == 0){
|
||||
return "&";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("#") == 0){
|
||||
return "#";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("%") == 0){
|
||||
return "%";
|
||||
}
|
||||
else if (doxygenEntity.typeOfEntity.compare("~") == 0){
|
||||
return "~";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
string pyDocString = "\"\"\"";
|
||||
|
||||
list<DoxygenEntity>::iterator entityIterator = entityList.begin();
|
||||
while (entityIterator != entityList.end()){
|
||||
pyDocString += translateEntity(n, *entityIterator);
|
||||
entityIterator++;
|
||||
}
|
||||
std::string PyDocConverter::translateSubtree( DoxygenEntity &doxygenEntity){
|
||||
std::string returnedString;
|
||||
if (doxygenEntity.isLeaf){ return pyDocFormat(doxygenEntity) + " ";}
|
||||
else {
|
||||
returnedString += pyDocFormat(doxygenEntity);
|
||||
std::list<DoxygenEntity>::iterator p = doxygenEntity.entityList.begin();
|
||||
while (p != doxygenEntity.entityList.end()){
|
||||
returnedString+= translateSubtree(*p);
|
||||
p++;
|
||||
}
|
||||
}
|
||||
return returnedString;
|
||||
}
|
||||
|
||||
pyDocString += "\n\"\"\"\n";
|
||||
|
||||
if(debug){
|
||||
cout << "\n---RESULT IN PYDOC---" << endl;
|
||||
cout << pyDocString;
|
||||
}
|
||||
|
||||
return pyDocString;
|
||||
std::string PyDocConverter::translateEntity(Node *n, DoxygenEntity &doxyEntity){
|
||||
if(doxyEntity.typeOfEntity.compare("partofdescription")== 0)
|
||||
return formatCommand(std::string(translateSubtree(doxyEntity)), 0);
|
||||
|
||||
if ((doxyEntity.typeOfEntity.compare("brief") == 0)||(doxyEntity.typeOfEntity.compare("details") == 0)){
|
||||
return formatCommand(std::string(translateSubtree(doxyEntity)), 0) + "\n * ";}
|
||||
|
||||
if(doxyEntity.typeOfEntity.compare("plainstd::string")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("deprecated")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("brief")== 0)
|
||||
return formatCommand(doxyEntity.data, 0) + "\n * ";
|
||||
|
||||
if(doxyEntity.typeOfEntity.compare("see") == 0)
|
||||
return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t\t" + translateSubtree(doxyEntity)), 2);
|
||||
|
||||
if(doxyEntity.typeOfEntity.compare("param") == 0)
|
||||
return formatParam(n, doxyEntity);
|
||||
|
||||
if(doxyEntity.typeOfEntity.compare("return")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("author")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("param")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("since")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("version")== 0
|
||||
|| doxyEntity.typeOfEntity.compare("exception") == 0
|
||||
|| doxyEntity.typeOfEntity.compare("deprecated") == 0)
|
||||
return formatCommand(std::string("@" + doxyEntity.typeOfEntity + "\t" + translateSubtree(doxyEntity)), 2);
|
||||
|
||||
if(doxyEntity.typeOfEntity.compare("sa")== 0)
|
||||
return formatCommand(std::string("@see\t\t" + translateSubtree(doxyEntity)), 2);
|
||||
|
||||
return formatCommand(pyDocFormat(doxyEntity), 0);
|
||||
}
|
||||
|
||||
std::string PyDocConverter::convertToPyDoc(Node *n, std::list<DoxygenEntity> entityList){
|
||||
entityList.sort(CompareDoxygenEntities());
|
||||
|
||||
if(debug){
|
||||
std::cout << "---RESORTED LIST---" << std::endl;
|
||||
printSortedTree(entityList);
|
||||
}
|
||||
|
||||
std::string pyDocString = "\"\"\"";
|
||||
|
||||
for(std::list<DoxygenEntity>::iterator entityIterator = entityList.begin(); entityIterator != entityList.end();){
|
||||
pyDocString += translateEntity(n, *entityIterator);
|
||||
entityIterator++;
|
||||
}
|
||||
|
||||
pyDocString += "\n\"\"\"\n";
|
||||
|
||||
if(debug){
|
||||
std::cout << "\n---RESULT IN PYDOC---" << std::endl;
|
||||
std::cout << pyDocString;
|
||||
}
|
||||
|
||||
return pyDocString;
|
||||
}
|
||||
|
|
@ -9,21 +9,20 @@
|
|||
class PyDocConverter
|
||||
{
|
||||
public:
|
||||
|
||||
PyDocConverter();
|
||||
string convertToPyDoc(Node *n, list <DoxygenEntity> entityList);
|
||||
~PyDocConverter();
|
||||
void printSortedTree(list <DoxygenEntity> &entityList);
|
||||
PyDocConverter();
|
||||
std::string convertToPyDoc(Node *n, std::list <DoxygenEntity> entityList);
|
||||
~PyDocConverter();
|
||||
void printSortedTree(std::list <DoxygenEntity> &entityList);
|
||||
|
||||
protected:
|
||||
std::string formatParam(Node *n, DoxygenEntity &doxygenEntity);
|
||||
std::string formatCommand(string unformattedLine, int indent);
|
||||
std::string pyDocFormat(DoxygenEntity &doxygenEntity);
|
||||
std::string translateSubtree( DoxygenEntity &doxygenEntity);
|
||||
std::string translateEntity(Node *n, DoxygenEntity &doxyEntity);
|
||||
std::string formatParam(Node *n, DoxygenEntity &doxygenEntity);
|
||||
std::string formatCommand(std::string unformattedLine, int indent);
|
||||
std::string pyDocFormat(DoxygenEntity &doxygenEntity);
|
||||
std::string translateSubtree( DoxygenEntity &doxygenEntity);
|
||||
std::string translateEntity(Node *n, DoxygenEntity &doxyEntity);
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
bool debug;
|
||||
};
|
||||
|
||||
#endif /*PYDOCCONVERTER_H_*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue