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:
Jamie Kirkpatrick 2008-09-12 11:18:35 +00:00
commit d12b8bc06e
9 changed files with 638 additions and 657 deletions

View file

@ -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;
}