summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2016-02-07 14:35:40 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2016-02-07 14:35:40 (GMT)
commitd168f8bfef6aac5a71eccad36dced78d55765ae1 (patch)
treeff740e5cb3ad29df2caafd20f7cf7cd6c0c0acae
parentee2d6faecab57c1f929d6868ae6eb9bdaa53d654 (diff)
downloadDoxygen-d168f8bfef6aac5a71eccad36dced78d55765ae1.zip
Doxygen-d168f8bfef6aac5a71eccad36dced78d55765ae1.tar.gz
Doxygen-d168f8bfef6aac5a71eccad36dced78d55765ae1.tar.bz2
Optimized use of convertNameToFile to improve performance
-rw-r--r--src/classdef.cpp69
-rw-r--r--src/classdef.h7
-rw-r--r--src/definition.cpp13
-rw-r--r--src/definition.h1
-rw-r--r--src/dot.cpp56
-rw-r--r--src/dot.h7
-rw-r--r--src/filedef.cpp30
-rw-r--r--src/filedef.h17
-rw-r--r--src/filename.cpp16
-rw-r--r--src/groupdef.cpp15
-rw-r--r--src/namespacedef.cpp32
-rwxr-xr-xsrc/util.cpp4
12 files changed, 126 insertions, 141 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp
index a51c0bf..e67de25 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -62,6 +62,15 @@ class ClassDefImpl
*/
QCString fileName;
+ /*! file name used for the list of all members */
+ QCString memberListFileName;
+
+ /*! file name used for the collaboration diagram */
+ QCString collabFileName;
+
+ /*! file name used for the inheritance graph */
+ QCString inheritFileName;
+
/*! Include information about the header file should be included
* in the documentation. 0 by default, set by setIncludeFile().
*/
@@ -296,6 +305,13 @@ ClassDef::ClassDef(
m_impl->compType = ct;
m_impl->isJavaEnum = isJavaEnum;
m_impl->init(defFileName,name(),compoundTypeString(),fName);
+ m_impl->memberListFileName = convertNameToFile(compoundTypeString()+name()+"-members");
+ m_impl->collabFileName = convertNameToFile(m_impl->fileName+"_coll_graph");
+ m_impl->inheritFileName = convertNameToFile(m_impl->fileName+"_inherit_graph");
+ if (!lref)
+ {
+ m_impl->fileName = convertNameToFile(m_impl->fileName);
+ }
}
// destroy the class definition
@@ -306,7 +322,7 @@ ClassDef::~ClassDef()
QCString ClassDef::getMemberListFileName() const
{
- return convertNameToFile(compoundTypeString()+name()+"-members");
+ return m_impl->memberListFileName;
}
QCString ClassDef::displayName(bool includeScope) const
@@ -3564,40 +3580,12 @@ QCString ClassDef::getOutputFileBase() const
// point to the template of which this class is an instance
return m_impl->templateMaster->getOutputFileBase();
}
- else if (isReference())
- {
- // point to the external location
- return m_impl->fileName;
- }
- else
- {
- // normal locally defined class
- return convertNameToFile(m_impl->fileName);
- }
+ return m_impl->fileName;
}
QCString ClassDef::getInstanceOutputFileBase() const
{
- if (isReference())
- {
- return m_impl->fileName;
- }
- else
- {
- return convertNameToFile(m_impl->fileName);
- }
-}
-
-QCString ClassDef::getFileBase() const
-{
- if (m_impl->templateMaster)
- {
- return m_impl->templateMaster->getFileBase();
- }
- else
- {
- return m_impl->fileName;
- }
+ return m_impl->fileName;
}
QCString ClassDef::getSourceFileBase() const
@@ -4613,15 +4601,9 @@ QCString ClassDef::anchor() const
// point to the template of which this class is an instance
anc = m_impl->templateMaster->getOutputFileBase();
}
- else if (isReference())
- {
- // point to the external location
- anc = m_impl->fileName;
- }
else
{
- // normal locally defined class
- anc = convertNameToFile(m_impl->fileName);
+ anc = m_impl->fileName;
}
}
return anc;
@@ -4750,3 +4732,14 @@ bool ClassDef::isAnonymous() const
{
return m_impl->isAnonymous;
}
+
+QCString ClassDef::collaborationGraphFileName() const
+{
+ return m_impl->collabFileName;
+}
+
+QCString ClassDef::inheritanceGraphFileName() const
+{
+ return m_impl->inheritFileName;
+}
+
diff --git a/src/classdef.h b/src/classdef.h
index 6cdd491..524bb96 100644
--- a/src/classdef.h
+++ b/src/classdef.h
@@ -108,7 +108,6 @@ class ClassDef : public Definition
/** Returns the unique base name (without extension) of the class's file on disk */
QCString getOutputFileBase() const;
QCString getInstanceOutputFileBase() const;
- QCString getFileBase() const;
/** Returns the base name for the source code file */
QCString getSourceFileBase() const;
@@ -130,6 +129,12 @@ class ClassDef : public Definition
/** returns TRUE if this class has a non-empty detailed description */
bool hasDetailedDescription() const;
+
+ /** returns the file name to use for the collaboration graph */
+ QCString collaborationGraphFileName() const;
+
+ /** returns the file name to use for the inheritance graph */
+ QCString inheritanceGraphFileName() const;
/** Returns the name as it is appears in the documentation */
QCString displayName(bool includeScope=TRUE) const;
diff --git a/src/definition.cpp b/src/definition.cpp
index ec30cd5..795d4f3 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -1507,19 +1507,6 @@ QList<ListItemInfo> *Definition::xrefListItems() const
return m_impl->xrefListItems;
}
-
-QCString Definition::convertNameToFile(const char *name,bool allowDots) const
-{
- if (!m_impl->ref.isEmpty())
- {
- return name;
- }
- else
- {
- return ::convertNameToFile(name,allowDots);
- }
-}
-
QCString Definition::pathFragment() const
{
QCString result;
diff --git a/src/definition.h b/src/definition.h
index 6277c6c..a7401ad 100644
--- a/src/definition.h
+++ b/src/definition.h
@@ -326,7 +326,6 @@ class Definition : public DefinitionIntf
// --- actions ----
//-----------------------------------------------------------------------------------
- QCString convertNameToFile(const char *name,bool allowDots=FALSE) const;
void writeSourceDef(OutputList &ol,const char *scopeName);
void writeInlineCode(OutputList &ol,const char *scopeName);
void writeSourceRefs(OutputList &ol,const char *scopeName);
diff --git a/src/dot.cpp b/src/dot.cpp
index 8c33d18..4189748 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -2953,7 +2953,8 @@ DotClassGraph::DotClassGraph(ClassDef *cd,DotNode::GraphType t)
openNodeQueue.append(m_startNode);
determineTruncatedNodes(openNodeQueue,t==DotNode::Inheritance);
- m_diskName = cd->getFileBase().copy();
+ m_collabFileName = cd->collaborationGraphFileName();
+ m_inheritFileName = cd->inheritanceGraphFileName();
}
bool DotClassGraph::isTrivial() const
@@ -3071,27 +3072,6 @@ static bool updateDotGraph(DotNode *root,
return checkAndUpdateMd5Signature(baseName,md5); // graph needs to be regenerated
}
-QCString DotClassGraph::diskName() const
-{
- QCString result=m_diskName.copy();
- switch (m_graphType)
- {
- case DotNode::Collaboration:
- result+="_coll_graph";
- break;
- //case Interface:
- // result+="_intf_graph";
- // break;
- case DotNode::Inheritance:
- result+="_inherit_graph";
- break;
- default:
- ASSERT(0);
- break;
- }
- return result;
-}
-
QCString DotClassGraph::writeGraph(FTextStream &out,
GraphOutputFormat graphFormat,
EmbeddedOutputFormat textFormat,
@@ -3116,18 +3096,16 @@ QCString DotClassGraph::writeGraph(FTextStream &out,
{
case DotNode::Collaboration:
mapName="coll_map";
+ baseName=m_collabFileName;
break;
- //case Interface:
- // mapName="intf_map";
- // break;
case DotNode::Inheritance:
mapName="inherit_map";
+ baseName=m_inheritFileName;
break;
default:
ASSERT(0);
break;
}
- baseName = convertNameToFile(diskName());
// derive target file names from baseName
QCString imgExt = getDotImageExtension();
@@ -3425,8 +3403,9 @@ DotInclDepGraph::DotInclDepGraph(FileDef *fd,bool inverse)
{
m_inverse = inverse;
ASSERT(fd!=0);
- m_diskName = fd->getFileBase().copy();
- QCString tmp_url=fd->getReference()+"$"+fd->getFileBase();
+ m_inclDepFileName = fd->includeDependencyGraphFileName();
+ m_inclByDepFileName = fd->includedByDependencyGraphFileName();
+ QCString tmp_url=fd->getReference()+"$"+fd->getOutputFileBase();
m_startNode = new DotNode(m_curNodeNumber++,
fd->docName(),
"",
@@ -3458,14 +3437,6 @@ DotInclDepGraph::~DotInclDepGraph()
delete m_usedNodes;
}
-QCString DotInclDepGraph::diskName() const
-{
- QCString result=m_diskName.copy();
- if (m_inverse) result+="_dep";
- result+="_incl";
- return convertNameToFile(result);
-}
-
QCString DotInclDepGraph::writeGraph(FTextStream &out,
GraphOutputFormat graphFormat,
EmbeddedOutputFormat textFormat,
@@ -3484,10 +3455,15 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out,
}
static bool usePDFLatex = Config_getBool(USE_PDFLATEX);
- QCString baseName=m_diskName;
- if (m_inverse) baseName+="_dep";
- baseName+="_incl";
- baseName=convertNameToFile(baseName);
+ QCString baseName;
+ if (m_inverse)
+ {
+ baseName=m_inclByDepFileName;
+ }
+ else
+ {
+ baseName=m_inclDepFileName;
+ }
QCString mapName=escapeCharsInString(m_startNode->m_label,FALSE);
if (m_inverse) mapName+="dep";
diff --git a/src/dot.h b/src/dot.h
index cb2e83c..dce1a3a 100644
--- a/src/dot.h
+++ b/src/dot.h
@@ -180,7 +180,6 @@ class DotClassGraph
void writeXML(FTextStream &t);
void writeDocbook(FTextStream &t);
void writeDEF(FTextStream &t);
- QCString diskName() const;
static void resetNumbering();
private:
@@ -195,7 +194,8 @@ class DotClassGraph
QDict<DotNode> * m_usedNodes;
static int m_curNodeNumber;
DotNode::GraphType m_graphType;
- QCString m_diskName;
+ QCString m_collabFileName;
+ QCString m_inheritFileName;
bool m_lrRank;
};
@@ -223,7 +223,8 @@ class DotInclDepGraph
DotNode *m_startNode;
QDict<DotNode> *m_usedNodes;
static int m_curNodeNumber;
- QCString m_diskName;
+ QCString m_inclDepFileName;
+ QCString m_inclByDepFileName;
bool m_inverse;
};
diff --git a/src/filedef.cpp b/src/filedef.cpp
index d5f736d..96cfe9e 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -82,8 +82,7 @@ FileDef::FileDef(const char *p,const char *nm,
m_path=p;
m_filePath=m_path+nm;
m_fileName=nm;
- m_diskName=dn;
- if (m_diskName.isEmpty()) m_diskName=nm;
+ setDiskName(dn?dn:nm);
setReference(lref);
m_classSDict = 0;
m_includeList = 0;
@@ -125,6 +124,13 @@ FileDef::~FileDef()
delete m_memberGroupSDict;
}
+void FileDef::setDiskName(const QCString &name)
+{
+ m_outputDiskName = convertNameToFile(name);
+ m_inclDepFileName = convertNameToFile(name+"_incl");
+ m_inclByDepFileName = convertNameToFile(name+"_dep_incl");
+}
+
/*! Compute the HTML anchor names for all members in the class */
void FileDef::computeAnchors()
{
@@ -1769,17 +1775,22 @@ void FileDef::acquireFileVersion()
QCString FileDef::getSourceFileBase() const
-{
+{
if (Htags::useHtags)
{
return Htags::path2URL(m_filePath);
}
else
{
- return convertNameToFile(m_diskName)+"_source";
+ return m_outputDiskName+"_source";
}
}
+QCString FileDef::getOutputFileBase() const
+{
+ return m_outputDiskName;
+}
+
/*! Returns the name of the verbatim copy of this file (if any). */
QCString FileDef::includeName() const
{
@@ -1916,3 +1927,14 @@ QCString FileDef::fileVersion() const
{
return m_fileVersion;
}
+
+QCString FileDef::includeDependencyGraphFileName() const
+{
+ return m_inclDepFileName;
+}
+
+QCString FileDef::includedByDependencyGraphFileName() const
+{
+ return m_inclByDepFileName;
+}
+
diff --git a/src/filedef.h b/src/filedef.h
index 712128c..9167249 100644
--- a/src/filedef.h
+++ b/src/filedef.h
@@ -63,8 +63,6 @@ struct IncludeInfo
*/
class FileDef : public Definition
{
- friend class FileName;
-
public:
//enum FileType { Source, Header, Unknown };
@@ -80,17 +78,18 @@ class FileDef : public Definition
QCString displayName(bool=TRUE) const { return name(); }
QCString fileName() const { return m_fileName; }
- QCString getOutputFileBase() const
- { return convertNameToFile(m_diskName); }
+ QCString getOutputFileBase() const;
QCString anchor() const { return QCString(); }
- QCString getFileBase() const { return m_diskName; }
-
QCString getSourceFileBase() const;
/*! Returns the name of the verbatim copy of this file (if any). */
QCString includeName() const;
+
+ QCString includeDependencyGraphFileName() const;
+
+ QCString includedByDependencyGraphFileName() const;
/*! Returns the absolute path including the file name. */
QCString absFilePath() const { return m_filePath; }
@@ -153,8 +152,8 @@ class FileDef : public Definition
void writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu);
void parseSource(bool sameTu,QStrList &filesInSameTu);
void finishParsing();
+ void setDiskName(const QCString &name);
- friend void generatedFileNames();
void insertMember(MemberDef *md);
void insertClass(ClassDef *cd);
void insertNamespace(NamespaceDef *nd);
@@ -219,7 +218,9 @@ class FileDef : public Definition
SDict<Definition> *m_usingDeclList;
QCString m_path;
QCString m_filePath;
- QCString m_diskName;
+ QCString m_inclDepFileName;
+ QCString m_inclByDepFileName;
+ QCString m_outputDiskName;
QCString m_fileName;
QCString m_docname;
QIntDict<Definition> *m_srcDefDict;
diff --git a/src/filename.cpp b/src/filename.cpp
index dfa763c..ae3b596 100644
--- a/src/filename.cpp
+++ b/src/filename.cpp
@@ -49,7 +49,7 @@ void FileName::generateDiskNames()
{
// name if unique, so diskname is simply the name
//printf("!!!!!!!! Unique disk name=%s for fd=%s\n",name.data(),fd->diskname.data());
- fd->m_diskName=name;
+ fd->setDiskName(name);
}
}
else if (count>1) // multiple occurrences of the same file name
@@ -62,21 +62,22 @@ void FileName::generateDiskNames()
for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { }
if (fd)
{
- char c=fd->m_path.at(i);
+ char c=fd->getPath().at(i);
if (c=='/') j=i; // remember last position of dirname
++it;
while ((fd=it.current()) && !found)
{
+ QCString path = fd->getPath();
if (!fd->isReference())
{
//printf("i=%d j=%d fd->path=`%s' fd->name=`%s'\n",i,j,fd->path.left(i).data(),fd->name().data());
- if (i==(int)fd->m_path.length())
+ if (i==(int)path.length())
{
//warning("Input file %s found multiple times!\n"
// " The generated documentation for this file may not be correct!\n",fd->absFilePath().data());
found=TRUE;
}
- else if (fd->m_path[i]!=c)
+ else if (path[i]!=c)
{
found=TRUE;
}
@@ -91,10 +92,11 @@ void FileName::generateDiskNames()
//printf("fd->setName(%s)\n",(fd->path.right(fd->path.length()-j-1)+name).data());
if (!fd->isReference())
{
- QCString prefix = fd->m_path.right(fd->m_path.length()-j-1);
+ QCString path = fd->getPath();
+ QCString prefix = path.right(path.length()-j-1);
fd->setName(prefix+name);
- //printf("!!!!!!!! non unique disk name=%s for fd=%s\n",(prefix+name).data(),fd->diskname.data());
- fd->m_diskName=prefix+name;
+ //printf("!!!!!!!! non unique disk name=%s:%s\n",prefix.data(),name.data());
+ fd->setDiskName(prefix+name);
}
}
}
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 48acb68..6b6d659 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -61,7 +61,7 @@ GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t,
}
else
{
- fileName = (QCString)"group_"+na;
+ fileName = convertNameToFile(QCString("group_")+na);
}
setGroupTitle( t );
memberGroupSDict = new MemberGroupSDict;
@@ -1509,16 +1509,9 @@ void addExampleToGroups(Entry *root,PageDef *eg)
}
}
-QCString GroupDef::getOutputFileBase() const
-{
- if (isReference())
- {
- return fileName;
- }
- else
- {
- return convertNameToFile(fileName);
- }
+QCString GroupDef::getOutputFileBase() const
+{
+ return fileName;
}
void GroupDef::addListReferences()
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index ce50302..c04fa7b 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -42,7 +42,14 @@ NamespaceDef::NamespaceDef(const char *df,int dl,int dc,
{
if (fName)
{
- fileName = stripExtension(fName);
+ if (lref)
+ {
+ fileName = stripExtension(fName);
+ }
+ else
+ {
+ fileName = convertNameToFile(stripExtension(fName));
+ }
}
else
{
@@ -90,8 +97,14 @@ NamespaceDef::~NamespaceDef()
void NamespaceDef::setFileName(const QCString &fn)
{
- fileName="namespace";
- fileName+=fn;
+ if (isReference())
+ {
+ fileName = "namespace"+fn;
+ }
+ else
+ {
+ fileName = convertNameToFile("namespace"+fn);
+ }
}
void NamespaceDef::distributeMemberGroupDocumentation()
@@ -796,16 +809,9 @@ void NamespaceDef::addUsingDeclaration(Definition *d)
}
}
-QCString NamespaceDef::getOutputFileBase() const
-{
- if (isReference())
- {
- return fileName;
- }
- else
- {
- return convertNameToFile(fileName);
- }
+QCString NamespaceDef::getOutputFileBase() const
+{
+ return fileName;
}
Definition *NamespaceDef::findInnerCompound(const char *n)
diff --git a/src/util.cpp b/src/util.cpp
index 3a15102..56bdd00 100755
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -7027,8 +7027,8 @@ void initDefaultExtensionMapping()
updateLanguageMapping(".ddl", "idl");
updateLanguageMapping(".odl", "idl");
updateLanguageMapping(".java", "java");
- updateLanguageMapping(".as", "javascript");
- updateLanguageMapping(".js", "javascript");
+ //updateLanguageMapping(".as", "javascript"); // not officially supported
+ //updateLanguageMapping(".js", "javascript"); // not officially supported
updateLanguageMapping(".cs", "csharp");
updateLanguageMapping(".d", "d");
updateLanguageMapping(".php", "php");