Commit 744d1ca5 authored by Dimitri van Heesch's avatar Dimitri van Heesch

More work on the template and context mechanisms

parent 2912829c
......@@ -1767,20 +1767,24 @@ void ClassDef::writeMoreLink(OutputList &ol,const QCString &anchor)
}
}
bool ClassDef::visibleInParentsDeclList() const
{
static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES");
bool linkable = isLinkable();
return (name().find('@')==-1 && !isExtension() &&
(protection()!=::Private || extractPrivate) &&
(linkable || (!hideUndocClasses && (!isLocal() || extractLocalClasses)))
);
}
void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *header,bool localNames)
{
//static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
//static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
static bool hideUndocClasses = Config_getBool("HIDE_UNDOC_CLASSES");
static bool extractLocalClasses = Config_getBool("EXTRACT_LOCAL_CLASSES");
bool isLink = isLinkable();
SrcLangExt lang = getLanguage();
if (isLink ||
(!hideUndocClasses &&
(!isLocal() || extractLocalClasses)
)
)
if (visibleInParentsDeclList())
{
if (!found) // first class
{
......@@ -1820,7 +1824,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade
ol.writeString(" ");
ol.insertMemberAlign();
}
if (isLink)
if (isLinkable())
{
ol.writeObjectLink(getReference(),
getOutputFileBase(),
......
......@@ -168,6 +168,9 @@ class ClassDef : public Definition
/** the class is visible in a class diagram, or class hierarchy */
bool isVisibleInHierarchy();
/** show this class in the declaration section of its parent? */
bool visibleInParentsDeclList() const;
/** Returns the template arguments of this class
* Will return 0 if not applicable.
*/
......@@ -310,14 +313,13 @@ class ClassDef : public Definition
QCString generatedFromFiles() const;
const FileList &usedFiles() const;
QCString includeStatement() const;
const ArgumentList *typeConstraints() const;
const ExampleSDict *exampleList() const;
bool hasExamples() const;
QCString getMemberListFileName() const;
bool subGrouping() const;
//-----------------------------------------------------------------------------------
// --- setters ----
//-----------------------------------------------------------------------------------
......@@ -432,6 +434,8 @@ class ClassDef : public Definition
QPtrDict<void> *visitedClasses);
void getTitleForMemberListType(MemberListType type,
QCString &title,QCString &subtitle);
QCString includeStatement() const;
ClassDefImpl *m_impl;
......
This diff is collapsed.
......@@ -3,6 +3,7 @@
#include "types.h"
#include "template.h"
#include <qlist.h>
class Definition;
class ClassDef;
......@@ -108,7 +109,7 @@ class UsedFilesContext : public TemplateListIntf
class IncludeInfoContext : public TemplateStructIntf
{
public:
IncludeInfoContext(IncludeInfo *,SrcLangExt lang);
IncludeInfoContext(const IncludeInfo *,SrcLangExt lang);
~IncludeInfoContext();
// TemplateStructIntf methods
......@@ -119,6 +120,25 @@ class IncludeInfoContext : public TemplateStructIntf
Private *p;
};
//----------------------------------------------------
class IncludeInfoListContext : public TemplateListIntf
{
public:
IncludeInfoListContext(const QList<IncludeInfo> &list,SrcLangExt lang);
~IncludeInfoListContext();
// TemplateListIntf
virtual int count() const;
virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const;
private:
class Private;
Private *p;
};
//----------------------------------------------------
class ClassContext : public TemplateStructIntf
......@@ -254,6 +274,26 @@ class NestedClassListContext : public TemplateListIntf
//----------------------------------------------------
class NestedNamespaceListContext : public TemplateListIntf
{
public:
NestedNamespaceListContext();
~NestedNamespaceListContext();
// TemplateListIntf
virtual int count() const;
virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const;
void append(NamespaceDef *cd);
private:
class Private;
Private *p;
};
//----------------------------------------------------
class ClassListContext : public TemplateListIntf
{
public:
......
......@@ -170,12 +170,18 @@ void FileDef::findSectionsInDocumentation()
}
}
void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title)
bool FileDef::hasDetailedDescription() const
{
if ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) ||
static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
return ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) ||
!documentation().stripWhiteSpace().isEmpty() || // avail empty section
(Config_getBool("SOURCE_BROWSER") && getStartBodyLine()!=-1 && getBodyDef())
)
(sourceBrowser && getStartBodyLine()!=-1 && getBodyDef())
);
}
void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title)
{
if (hasDetailedDescription())
{
ol.pushGeneratorState();
ol.disable(OutputGenerator::Html);
......@@ -379,7 +385,7 @@ void FileDef::writeIncludedByGraph(OutputList &ol)
{
warn_uncond("Included by graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data());
}
if (!incDepGraph.isTrivial())
else if (!incDepGraph.isTrivial())
{
ol.startTextBlock();
ol.disable(OutputGenerator::Man);
......@@ -1800,3 +1806,7 @@ QCString FileDef::title() const
return theTranslator->trFileReference(name());
}
QCString FileDef::fileVersion() const
{
return m_fileVersion;
}
......@@ -133,6 +133,10 @@ class FileDef : public Definition
ClassSDict *getClassSDict() const { return m_classSDict; }
QCString title() const;
bool hasDetailedDescription() const;
QCString fileVersion() const;
bool subGrouping() const { return m_subGrouping; }
//---------------------------------
......
......@@ -3036,6 +3036,18 @@ static Definition *getClassFromType(Definition *scope,const QCString &type,SrcLa
}
#endif
QCString MemberDef::fieldType() const
{
QCString type = m_impl->accessorType;
if (type.isEmpty())
{
type = m_impl->type;
}
if (isTypedef()) type.prepend("typedef ");
return simplifyTypeForTable(type);
}
void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container)
{
Definition *scope = getOuterScope();
......@@ -3056,15 +3068,7 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container)
ol.startInlineMemberType();
ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs);
QCString type = m_impl->accessorType;
if (type.isEmpty())
{
type = m_impl->type;
}
if (isTypedef()) type.prepend("typedef ");
QCString ts = simplifyTypeForTable(type);
QCString ts = fieldType();
if (cd) // cd points to an anonymous struct pointed to by this member
// so we add a link to it from the type column.
......@@ -3855,6 +3859,11 @@ void MemberDef::setAccessorType(ClassDef *cd,const char *t)
m_impl->accessorType = t;
}
ClassDef *MemberDef::accessorClass() const
{
return m_impl->accessorClass;
}
void MemberDef::findSectionsInDocumentation()
{
docFindSections(documentation(),this,0,docFile());
......
......@@ -81,6 +81,7 @@ class MemberDef : public Definition
ClassDef *getClassDef() const;
FileDef *getFileDef() const;
NamespaceDef* getNamespaceDef() const;
ClassDef *accessorClass() const;
// grabbing the property read/write accessor names
const char *getReadAccessor() const;
......@@ -251,7 +252,7 @@ class MemberDef : public Definition
// overrules
QCString documentation() const;
QCString briefDescription(bool abbr=FALSE) const;
QCString fieldType() const;
//-----------------------------------------------------------------------------------
......
......@@ -13,7 +13,6 @@
*
*/
#include <stdarg.h>
#include <stdio.h>
#include <qdatetime.h>
#include "config.h"
......@@ -22,6 +21,7 @@
#include "doxygen.h"
#include "portable.h"
#include "filedef.h"
#include "message.h"
static QCString outputFormat;
static const char *warning_str = "warning: ";
......@@ -172,6 +172,11 @@ void warn(const char *file,int line,const char *fmt, ...)
va_end(args);
}
void warn(const char *file,int line,const char *fmt,va_list args)
{
do_warn("WARNINGS", file, line, warning_str, fmt, args);
}
void warn_simple(const char *file,int line,const char *text)
{
if (!Config_getBool("WARNINGS")) return; // warning type disabled
......
......@@ -19,9 +19,11 @@
#define MESSAGE_H
#include <stdio.h>
#include <stdarg.h>
extern void msg(const char *fmt, ...);
extern void warn(const char *file,int line,const char *fmt, ...);
extern void warn(const char *file,int line,const char *fmt, va_list args);
extern void warn_simple(const char *file,int line,const char *text);
extern void warn_undoc(const char *file,int line,const char *fmt, ...);
extern void warn_doc_error(const char *file,int line,const char *fmt, ...);
......
......@@ -916,29 +916,9 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,
continue; // will be output in another pass, see layout_default.xml
ol.startMemberDeclaration();
ol.startMemberItem(nd->getOutputFileBase(),0);
if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp)
{
ol.docify("package ");
}
else if (lang==SrcLangExt_Fortran)
{
ol.docify("module ");
}
else if (lang==SrcLangExt_IDL)
{
if (nd->isModule())
{
ol.docify("module ");
}
else if (nd->isConstantGroup())
{
ol.docify("constants");
}
else
{
err("Internal inconsistency: namespace in IDL not module or cg\n");
}
}
QCString ct = nd->compoundTypeString();
ol.docify(ct);
ol.docify(" ");
ol.insertMemberAlign();
QCString name;
if (localName)
......@@ -1103,3 +1083,33 @@ QCString NamespaceDef::title() const
}
return pageTitle;
}
QCString NamespaceDef::compoundTypeString() const
{
SrcLangExt lang = getLanguage();
if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp)
{
return "package";
}
else if (lang==SrcLangExt_Fortran)
{
return "module";
}
else if (lang==SrcLangExt_IDL)
{
if (isModule())
{
return "module";
}
else if (isConstantGroup())
{
return "constants";
}
else
{
err("Internal inconsistency: namespace in IDL not module or constant group\n");
}
}
return "";
}
......@@ -94,6 +94,7 @@ class NamespaceDef : public Definition
NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; }
QCString title() const;
QCString compoundTypeString() const;
bool visited;
......
This diff is collapsed.
......@@ -410,7 +410,7 @@ class TemplateContext
//------------------------------------------------------------------------
/** @brief Abstract interface for a template.
* @note Must be created by TemplateEngine
* @note Must be created and is deleted by the TemplateEngine
*/
class Template
{
......@@ -446,11 +446,23 @@ class TemplateEngine
/** Creates a new template whole contents are in a file.
* @param[in] fileName The name of the file containing the
* template data
* @param[in] fromLine The line number of the statement that triggered the load
* @return the new template, the caller will be the owner.
*/
Template *loadByName(const QCString &fileName);
Template *loadByName(const QCString &fileName,int fromLine);
/** Indicates that template \a t is no longer needed. The engine
* may decide to delete it.
*/
void unload(Template *t);
void printIncludeContext(const char *fileName,int line) const;
private:
friend class TemplateNodeBlock;
void enterBlock(const QCString &fileName,const QCString &blockName,int line);
void leaveBlock();
class Private;
Private *p;
};
......
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