Commit 784a67d2 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Added rudimentary support for django like template system for output creation.

parent 74815268
......@@ -916,9 +916,15 @@ static void writeTemplateSpec(OutputList &ol,Definition *d,
}
}
bool ClassDef::hasBriefDescription() const
{
static bool briefMemberDesc = Config_getBool("BRIEF_MEMBER_DESC");
return !briefDescription().isEmpty() && briefMemberDesc;
}
void ClassDef::writeBriefDescription(OutputList &ol,bool exampleFlag)
{
if (!briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
if (hasBriefDescription())
{
ol.startParagraph();
ol.generateDoc(briefFile(),briefLine(),this,0,
......@@ -929,10 +935,7 @@ void ClassDef::writeBriefDescription(OutputList &ol,bool exampleFlag)
ol.enable(OutputGenerator::RTF);
ol.popGeneratorState();
if (Config_getBool("REPEAT_BRIEF") ||
!documentation().isEmpty() ||
exampleFlag
)
if (hasDetailedDescription() || exampleFlag)
{
writeMoreLink(ol,anchor());
}
......@@ -990,14 +993,20 @@ void ClassDef::writeDetailedDocumentationBody(OutputList &ol)
ol.endTextBlock();
}
bool ClassDef::hasDetailedDescription() const
{
static bool repeatBrief = Config_getBool("REPEAT_BRIEF");
static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
return ((!briefDescription().isEmpty() && repeatBrief) ||
!documentation().isEmpty() ||
(sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()));
}
// write the detailed description for this class
void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &/*pageType*/, bool exampleFlag,
const QCString &title,const QCString &anchor)
{
if ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) ||
!documentation().isEmpty() ||
(Config_getBool("SOURCE_BROWSER") && getStartBodyLine()!=-1 && getBodyDef()) ||
exampleFlag)
if (hasDetailedDescription() || exampleFlag)
{
ol.pushGeneratorState();
ol.disable(OutputGenerator::Html);
......@@ -1990,12 +1999,8 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*page
ol.endContents();
}
// write all documentation for this class
void ClassDef::writeDocumentation(OutputList &ol)
QCString ClassDef::title() const
{
static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
//static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
//static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
QCString pageTitle;
SrcLangExt lang = getLanguage();
......@@ -2027,7 +2032,17 @@ void ClassDef::writeDocumentation(OutputList &ol)
m_impl->compType == Interface && getLanguage()==SrcLangExt_ObjC ? Class : m_impl->compType,
m_impl->tempArgs != 0);
}
return pageTitle;
}
// write all documentation for this class
void ClassDef::writeDocumentation(OutputList &ol)
{
static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
//static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
//static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
QCString pageTitle = title();
startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_ClassVisible,!generateTreeView);
if (!generateTreeView)
{
......@@ -4723,4 +4738,8 @@ bool ClassDef::isExtension() const
return b;
}
const ClassSDict *ClassDef::innerClasses() const
{
return m_impl->innerClasses;
}
......@@ -125,6 +125,12 @@ class ClassDef : public Definition
/** returns TRUE if this class has documentation */
bool hasDocumentation() const;
/** returns TRUE if this class has a brief description */
bool hasBriefDescription() const;
/** returns TRUE if this class has a non-empty detailed description */
bool hasDetailedDescription() const;
/** Returns the name as it is appears in the documentation */
QCString displayName(bool includeScope=TRUE) const;
......@@ -301,6 +307,8 @@ class ClassDef : public Definition
bool isJavaEnum() const;
bool isGeneric() const;
const ClassSDict *innerClasses() const;
QCString title() const;
//-----------------------------------------------------------------------------------
// --- setters ----
......
This diff is collapsed.
This diff is collapsed.
......@@ -1815,7 +1815,7 @@ int Definition::getEndBodyLine() const
return m_impl->body ? m_impl->body->endLine : -1;
}
FileDef *Definition::getBodyDef()
FileDef *Definition::getBodyDef() const
{
return m_impl->body ? m_impl->body->fileDef : 0;
}
......
......@@ -243,7 +243,7 @@ class Definition : public DefinitionIntf
/*! Returns the file in which the body of this item is located or 0 if no
* body is available.
*/
FileDef *getBodyDef();
FileDef *getBodyDef() const;
/** Returns the programming language this definition was written in. */
SrcLangExt getLanguage() const;
......
......@@ -329,12 +329,16 @@ void DirDef::endMemberDeclarations(OutputList &ol)
ol.endMemberSections();
}
QCString DirDef::shortTitle() const
{
return theTranslator->trDirReference(m_shortName);
}
void DirDef::writeDocumentation(OutputList &ol)
{
static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
ol.pushGeneratorState();
QCString shortTitle=theTranslator->trDirReference(m_shortName);
QCString title=theTranslator->trDirReference(m_dispName);
startFile(ol,getOutputFileBase(),name(),title,HLI_None,!generateTreeView);
......@@ -348,7 +352,7 @@ void DirDef::writeDocumentation(OutputList &ol)
startTitle(ol,getOutputFileBase());
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
ol.parseText(shortTitle);
ol.parseText(shortTitle());
ol.enableAll();
ol.disable(OutputGenerator::Html);
ol.parseText(title);
......
......@@ -66,6 +66,7 @@ class DirDef : public Definition
const QDict<UsedDir> *usedDirs() const { return m_usedDirs; }
bool isParentOf(DirDef *dir) const;
bool depGraphIsTrivial() const;
QCString shortTitle() const;
// generate output
void writeDocumentation(OutputList &ol);
......
......@@ -97,6 +97,7 @@
#include "docsets.h"
#include "formula.h"
#include "settings.h"
#include "context.h"
#define RECURSE_ENTRYTREE(func,var) \
do { if (var->children()) { \
......@@ -177,6 +178,7 @@ static QDict<FileDef> g_usingDeclarations(1009); // used classes
static FileStorage *g_storage = 0;
static bool g_successfulRun = FALSE;
static bool g_dumpSymbolMap = FALSE;
static bool g_useOutputTemplate = FALSE;
void clearAll()
{
......@@ -10230,6 +10232,12 @@ void readConfiguration(int argc, char **argv)
setvbuf(stdout,NULL,_IONBF,0);
Doxygen::outputToWizard=TRUE;
break;
case 'T':
msg("Warning: this option activates output generation via Django like template files. "
"This option is scheduled for doxygen 2.0, is currently incomplete and highly experimental! "
"Only use if you are a doxygen developer\n");
g_useOutputTemplate=TRUE;
break;
case 'h':
case '?':
usage(argv[0]);
......@@ -11309,6 +11317,17 @@ void generateOutput()
Doxygen::formulaList->generateBitmaps(Config_getString("HTML_OUTPUT"));
g_s.end();
}
if (Config_getBool("SORT_GROUP_NAMES"))
{
Doxygen::groupSDict->sort();
GroupSDict::Iterator gli(*Doxygen::groupSDict);
GroupDef *gd;
for (gli.toFirst();(gd=gli.current());++gli)
{
gd->sortSubGroups();
}
}
writeMainPageTagFileData();
......@@ -11475,6 +11494,8 @@ void generateOutput()
msg("finished...\n");
}
if (g_useOutputTemplate) generateOutputViaTemplate();
/**************************************************************************
* Start cleaning up *
**************************************************************************/
......
......@@ -1794,3 +1794,9 @@ void FileDef::getAllIncludeFilesRecursively(QStrList &incFiles) const
QDict<void> includes(257);
::getAllIncludeFilesRecursively(&includes,this,incFiles);
}
QCString FileDef::title() const
{
return theTranslator->trFileReference(name());
}
......@@ -131,6 +131,8 @@ class FileDef : public Definition
MemberGroupSDict *getMemberGroupSDict() const { return m_memberGroupSDict; }
NamespaceSDict *getNamespaceSDict() const { return m_namespaceSDict; }
ClassSDict *getClassSDict() const { return m_classSDict; }
QCString title() const;
//---------------------------------
......
File mode changed from 100755 to 100644
......@@ -48,14 +48,14 @@ class FTextStream
inline FTextStream &FTextStream::operator<<( char c)
{
m_dev->putch(c);
if (m_dev) m_dev->putch(c);
return *this;
}
inline FTextStream &FTextStream::operator<<( const char* s)
{
uint len = qstrlen( s );
m_dev->writeBlock( s, len );
if (m_dev) m_dev->writeBlock( s, len );
return *this;
}
......
......@@ -414,38 +414,11 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part,
}
}
//----------------------------------------------------------------------------
static bool classHasVisibleChildren(ClassDef *cd)
{
BaseClassList *bcl;
if (cd->getLanguage()==SrcLangExt_VHDL) // reverse baseClass/subClass relation
{
if (cd->baseClasses()==0) return FALSE;
bcl=cd->baseClasses();
}
else
{
if (cd->subClasses()==0) return FALSE;
bcl=cd->subClasses();
}
BaseClassListIterator bcli(*bcl);
for ( ; bcli.current() ; ++bcli)
{
if (bcli.current()->classDef->isVisibleInHierarchy())
{
return TRUE;
}
}
return FALSE;
}
//----------------------------------------------------------------------------
/*! Generates HTML Help tree of classes */
static void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int level,FTVHelp* ftv,bool addToIndex)
static void writeClassTree(OutputList &ol,const BaseClassList *bcl,bool hideSuper,int level,FTVHelp* ftv,bool addToIndex)
{
if (bcl==0) return;
BaseClassListIterator bcli(*bcl);
......@@ -562,14 +535,6 @@ static void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int
//----------------------------------------------------------------------------
static bool classVisibleInIndex(ClassDef *cd)
{
static bool allExternals = Config_getBool("ALLEXTERNALS");
return (allExternals && cd->isLinkable()) || cd->isLinkableInProject();
}
//----------------------------------------------------------------------------
static bool dirHasVisibleChildren(DirDef *dd)
{
if (dd->hasDocumentation()) return TRUE;
......@@ -1409,39 +1374,6 @@ void writeClassTree(ClassSDict *clDict,FTVHelp *ftv,bool addToIndex,bool globalO
}
}
static bool containsVisibleChild(NamespaceDef *nd,bool includeClasses)
{
if (nd->getNamespaceSDict())
{
NamespaceSDict::Iterator cnli(*nd->getNamespaceSDict());
NamespaceDef *cnd;
for (cnli.toFirst();(cnd=cnli.current());++cnli)
{
if (cnd->isLinkable() && cnd->localName().find('@')==-1)
{
return TRUE;
}
else if (containsVisibleChild(cnd,includeClasses))
{
return TRUE;
}
}
}
if (includeClasses && nd->getClassSDict())
{
ClassSDict::Iterator cli(*nd->getClassSDict());
ClassDef *cd;
for (;(cd=cli.current());++cli)
{
if (cd->isLinkableInProject() && cd->templateMaster()==0)
{
return TRUE;
}
}
}
return FALSE;
}
static void writeNamespaceTree(NamespaceSDict *nsDict,FTVHelp *ftv,
bool rootOnly,bool showClasses,bool addToIndex)
{
......@@ -1455,7 +1387,7 @@ static void writeNamespaceTree(NamespaceSDict *nsDict,FTVHelp *ftv,
(!rootOnly || nd->getOuterScope()==Doxygen::globalScope))
{
bool hasChildren = containsVisibleChild(nd,showClasses);
bool hasChildren = namespaceHasVisibleChild(nd,showClasses);
bool isLinkable = nd->isLinkableInProject();
QCString ref;
......@@ -3562,7 +3494,6 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp*
if (gd->getSubGroups()->count()>0)
{
startIndexHierarchy(ol,level+1);
if (Config_getBool("SORT_GROUP_NAMES")) gd->sortSubGroups();
QListIterator<GroupDef> gli(*gd->getSubGroups());
GroupDef *subgd = 0;
for (gli.toFirst();(subgd=gli.current());++gli)
......@@ -3596,10 +3527,6 @@ static void writeGroupHierarchy(OutputList &ol, FTVHelp* ftv,bool addToIndex)
ol.disable(OutputGenerator::Html);
}
startIndexHierarchy(ol,0);
if (Config_getBool("SORT_GROUP_NAMES"))
{
Doxygen::groupSDict->sort();
}
GroupSDict::Iterator gli(*Doxygen::groupSDict);
GroupDef *gd;
for (gli.toFirst();(gd=gli.current());++gli)
......
......@@ -30,6 +30,7 @@ HEADERS = arguments.h \
compound.xsd.h \
condparser.h \
config.h \
context.h \
constexp.h \
cppvalue.h \
debug.h \
......@@ -129,6 +130,7 @@ HEADERS = arguments.h \
store.h \
tagreader.h \
tclscanner.h \
template.h \
textdocvisitor.h \
tooltip.h \
translator.h \
......@@ -155,6 +157,7 @@ SOURCES = arguments.cpp \
commentcnv.cpp \
commentscan.cpp \
condparser.cpp \
context.cpp \
cppvalue.cpp \
dbusxmlscanner.cpp \
debug.cpp \
......@@ -224,6 +227,7 @@ SOURCES = arguments.cpp \
store.cpp \
tagreader.cpp \
tclscanner.cpp \
template.cpp \
textdocvisitor.cpp \
tooltip.cpp \
util.cpp \
......@@ -239,8 +243,8 @@ SOURCES = arguments.cpp \
win32:TMAKE_CXXFLAGS += -DQT_NODLL
win32-msvc:TMAKE_CXXFLAGS += -Zm200
win32-g++:TMAKE_CXXFLAGS += -fno-exceptions -fno-rtti
linux-g++:TMAKE_CXXFLAGS += -fno-exceptions -fno-rtti
win32-g++:TMAKE_CXXFLAGS += -fno-exceptions
linux-g++:TMAKE_CXXFLAGS += -fno-exceptions
INCLUDEPATH += ../qtools
#INCLUDEPATH += ../libpng
INCLUDEPATH += ../libmd5
......
......@@ -460,27 +460,8 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
//static bool outputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
//static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
SrcLangExt lang = getLanguage();
QCString pageTitle;
if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp)
{
pageTitle = theTranslator->trPackage(displayName());
}
else if (lang==SrcLangExt_Fortran)
{
pageTitle = theTranslator->trModuleReference(displayName());
}
else if (lang==SrcLangExt_IDL)
{
pageTitle = isConstantGroup()
? theTranslator->trConstantGroupReference(displayName())
: theTranslator->trModuleReference(displayName());
}
else
{
pageTitle = theTranslator->trNamespaceReference(displayName());
}
QCString pageTitle = title();
startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_NamespaceVisible,!generateTreeView);
if (!generateTreeView)
......@@ -522,6 +503,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
//---------------------------------------- start flexible part -------------------------------
SrcLangExt lang = getLanguage();
QListIterator<LayoutDocEntry> eli(
LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace));
LayoutDocEntry *lde;
......@@ -1096,3 +1078,27 @@ MemberDef * NamespaceDef::getMemberByName(const QCString &n) const
return md;
}
QCString NamespaceDef::title() const
{
SrcLangExt lang = getLanguage();
QCString pageTitle;
if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp)
{
pageTitle = theTranslator->trPackage(displayName());
}
else if (lang==SrcLangExt_Fortran)
{
pageTitle = theTranslator->trModuleReference(displayName());
}
else if (lang==SrcLangExt_IDL)
{
pageTitle = isConstantGroup()
? theTranslator->trConstantGroupReference(displayName())
: theTranslator->trModuleReference(displayName());
}
else
{
pageTitle = theTranslator->trNamespaceReference(displayName());
}
return pageTitle;
}
......@@ -92,6 +92,8 @@ class NamespaceDef : public Definition
/*! Returns the namespaces contained in this namespace */
NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; }
QCString title() const;
bool visited;
private:
......
This diff is collapsed.
This diff is collapsed.
......@@ -5076,6 +5076,34 @@ static void initBaseClassHierarchy(BaseClassList *bcl)
cd->visited=FALSE;
}
}
//----------------------------------------------------------------------------
bool classHasVisibleChildren(ClassDef *cd)
{
BaseClassList *bcl;
if (cd->getLanguage()==SrcLangExt_VHDL) // reverse baseClass/subClass relation
{
if (cd->baseClasses()==0) return FALSE;
bcl=cd->baseClasses();
}
else
{
if (cd->subClasses()==0) return FALSE;
bcl=cd->subClasses();
}
BaseClassListIterator bcli(*bcl);
for ( ; bcli.current() ; ++bcli)
{
if (bcli.current()->classDef->isVisibleInHierarchy())
{
return TRUE;
}
}
return FALSE;
}
//----------------------------------------------------------------------------
......@@ -7988,3 +8016,44 @@ uint getUtf8CodeToUpper( const QCString& s, int idx )
//--------------------------------------------------------------------------------------
bool namespaceHasVisibleChild(NamespaceDef *nd,bool includeClasses)
{
if (nd->getNamespaceSDict())
{
NamespaceSDict::Iterator cnli(*nd->getNamespaceSDict());
NamespaceDef *cnd;
for (cnli.toFirst();(cnd=cnli.current());++cnli)
{
if (cnd->isLinkable() && cnd->localName().find('@')==-1)
{
return TRUE;
}
else if (namespaceHasVisibleChild(cnd,includeClasses))
{
return TRUE;
}
}
}
if (includeClasses && nd->getClassSDict())
{
ClassSDict::Iterator cli(*nd->getClassSDict());
ClassDef *cd;
for (;(cd=cli.current());++cli)
{
if (cd->isLinkableInProject() && cd->templateMaster()==0)
{
return TRUE;
}
}
}
return FALSE;
}
//----------------------------------------------------------------------------
bool classVisibleInIndex(ClassDef *cd)
{
static bool allExternals = Config_getBool("ALLEXTERNALS");
return (allExternals && cd->isLinkable()) || cd->isLinkableInProject();
}
......@@ -257,6 +257,9 @@ QCString replaceAnonymousScopes(const QCString &s,const char *replacement=0);
void initClassHierarchy(ClassSDict *cl);
bool hasVisibleRoot(BaseClassList *bcl);
bool classHasVisibleChildren(ClassDef *cd);
bool namespaceHasVisibleChild(NamespaceDef *nd,bool includeClasses);
bool classVisibleInIndex(ClassDef *cd);
int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level=0);
Protection classInheritedProtectionLevel(ClassDef *cd,ClassDef *bcd,Protection prot=Public,int level=0);
......@@ -443,5 +446,7 @@ uint getUtf8Code( const QCString& s, int idx );
uint getUtf8CodeToLower( const QCString& s, int idx );
uint getUtf8CodeToUpper( const QCString& s, int idx );
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment