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) ...@@ -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) void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *header,bool localNames)
{ {
//static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); //static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
//static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); //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(); SrcLangExt lang = getLanguage();
if (isLink || if (visibleInParentsDeclList())
(!hideUndocClasses &&
(!isLocal() || extractLocalClasses)
)
)
{ {
if (!found) // first class if (!found) // first class
{ {
...@@ -1820,7 +1824,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade ...@@ -1820,7 +1824,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade
ol.writeString(" "); ol.writeString(" ");
ol.insertMemberAlign(); ol.insertMemberAlign();
} }
if (isLink) if (isLinkable())
{ {
ol.writeObjectLink(getReference(), ol.writeObjectLink(getReference(),
getOutputFileBase(), getOutputFileBase(),
......
...@@ -168,6 +168,9 @@ class ClassDef : public Definition ...@@ -168,6 +168,9 @@ class ClassDef : public Definition
/** the class is visible in a class diagram, or class hierarchy */ /** the class is visible in a class diagram, or class hierarchy */
bool isVisibleInHierarchy(); bool isVisibleInHierarchy();
/** show this class in the declaration section of its parent? */
bool visibleInParentsDeclList() const;
/** Returns the template arguments of this class /** Returns the template arguments of this class
* Will return 0 if not applicable. * Will return 0 if not applicable.
*/ */
...@@ -310,14 +313,13 @@ class ClassDef : public Definition ...@@ -310,14 +313,13 @@ class ClassDef : public Definition
QCString generatedFromFiles() const; QCString generatedFromFiles() const;
const FileList &usedFiles() const; const FileList &usedFiles() const;
QCString includeStatement() const;
const ArgumentList *typeConstraints() const; const ArgumentList *typeConstraints() const;
const ExampleSDict *exampleList() const; const ExampleSDict *exampleList() const;
bool hasExamples() const; bool hasExamples() const;
QCString getMemberListFileName() const; QCString getMemberListFileName() const;
bool subGrouping() const; bool subGrouping() const;
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// --- setters ---- // --- setters ----
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -432,6 +434,8 @@ class ClassDef : public Definition ...@@ -432,6 +434,8 @@ class ClassDef : public Definition
QPtrDict<void> *visitedClasses); QPtrDict<void> *visitedClasses);
void getTitleForMemberListType(MemberListType type, void getTitleForMemberListType(MemberListType type,
QCString &title,QCString &subtitle); QCString &title,QCString &subtitle);
QCString includeStatement() const;
ClassDefImpl *m_impl; ClassDefImpl *m_impl;
......
This diff is collapsed.
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "types.h" #include "types.h"
#include "template.h" #include "template.h"
#include <qlist.h>
class Definition; class Definition;
class ClassDef; class ClassDef;
...@@ -108,7 +109,7 @@ class UsedFilesContext : public TemplateListIntf ...@@ -108,7 +109,7 @@ class UsedFilesContext : public TemplateListIntf
class IncludeInfoContext : public TemplateStructIntf class IncludeInfoContext : public TemplateStructIntf
{ {
public: public:
IncludeInfoContext(IncludeInfo *,SrcLangExt lang); IncludeInfoContext(const IncludeInfo *,SrcLangExt lang);
~IncludeInfoContext(); ~IncludeInfoContext();
// TemplateStructIntf methods // TemplateStructIntf methods
...@@ -119,6 +120,25 @@ class IncludeInfoContext : public TemplateStructIntf ...@@ -119,6 +120,25 @@ class IncludeInfoContext : public TemplateStructIntf
Private *p; 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 class ClassContext : public TemplateStructIntf
...@@ -254,6 +274,26 @@ class NestedClassListContext : public TemplateListIntf ...@@ -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 class ClassListContext : public TemplateListIntf
{ {
public: public:
......
...@@ -170,12 +170,18 @@ void FileDef::findSectionsInDocumentation() ...@@ -170,12 +170,18 @@ void FileDef::findSectionsInDocumentation()
} }
} }
bool FileDef::hasDetailedDescription() const
{
static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
return ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) ||
!documentation().stripWhiteSpace().isEmpty() || // avail empty section
(sourceBrowser && getStartBodyLine()!=-1 && getBodyDef())
);
}
void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title)
{ {
if ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || if (hasDetailedDescription())
!documentation().stripWhiteSpace().isEmpty() || // avail empty section
(Config_getBool("SOURCE_BROWSER") && getStartBodyLine()!=-1 && getBodyDef())
)
{ {
ol.pushGeneratorState(); ol.pushGeneratorState();
ol.disable(OutputGenerator::Html); ol.disable(OutputGenerator::Html);
...@@ -379,7 +385,7 @@ void FileDef::writeIncludedByGraph(OutputList &ol) ...@@ -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()); 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.startTextBlock();
ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::Man);
...@@ -1800,3 +1806,7 @@ QCString FileDef::title() const ...@@ -1800,3 +1806,7 @@ QCString FileDef::title() const
return theTranslator->trFileReference(name()); return theTranslator->trFileReference(name());
} }
QCString FileDef::fileVersion() const
{
return m_fileVersion;
}
...@@ -133,6 +133,10 @@ class FileDef : public Definition ...@@ -133,6 +133,10 @@ class FileDef : public Definition
ClassSDict *getClassSDict() const { return m_classSDict; } ClassSDict *getClassSDict() const { return m_classSDict; }
QCString title() const; 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 ...@@ -3036,6 +3036,18 @@ static Definition *getClassFromType(Definition *scope,const QCString &type,SrcLa
} }
#endif #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) void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container)
{ {
Definition *scope = getOuterScope(); Definition *scope = getOuterScope();
...@@ -3056,15 +3068,7 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) ...@@ -3056,15 +3068,7 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container)
ol.startInlineMemberType(); ol.startInlineMemberType();
ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs); ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs);
QCString type = m_impl->accessorType; QCString ts = fieldType();
if (type.isEmpty())
{
type = m_impl->type;
}
if (isTypedef()) type.prepend("typedef ");
QCString ts = simplifyTypeForTable(type);
if (cd) // cd points to an anonymous struct pointed to by this member if (cd) // cd points to an anonymous struct pointed to by this member
// so we add a link to it from the type column. // so we add a link to it from the type column.
...@@ -3855,6 +3859,11 @@ void MemberDef::setAccessorType(ClassDef *cd,const char *t) ...@@ -3855,6 +3859,11 @@ void MemberDef::setAccessorType(ClassDef *cd,const char *t)
m_impl->accessorType = t; m_impl->accessorType = t;
} }
ClassDef *MemberDef::accessorClass() const
{
return m_impl->accessorClass;
}
void MemberDef::findSectionsInDocumentation() void MemberDef::findSectionsInDocumentation()
{ {
docFindSections(documentation(),this,0,docFile()); docFindSections(documentation(),this,0,docFile());
......
...@@ -81,6 +81,7 @@ class MemberDef : public Definition ...@@ -81,6 +81,7 @@ class MemberDef : public Definition
ClassDef *getClassDef() const; ClassDef *getClassDef() const;
FileDef *getFileDef() const; FileDef *getFileDef() const;
NamespaceDef* getNamespaceDef() const; NamespaceDef* getNamespaceDef() const;
ClassDef *accessorClass() const;
// grabbing the property read/write accessor names // grabbing the property read/write accessor names
const char *getReadAccessor() const; const char *getReadAccessor() const;
...@@ -251,7 +252,7 @@ class MemberDef : public Definition ...@@ -251,7 +252,7 @@ class MemberDef : public Definition
// overrules // overrules
QCString documentation() const; QCString documentation() const;
QCString briefDescription(bool abbr=FALSE) const; QCString briefDescription(bool abbr=FALSE) const;
QCString fieldType() const;
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
* *
*/ */
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <qdatetime.h> #include <qdatetime.h>
#include "config.h" #include "config.h"
...@@ -22,6 +21,7 @@ ...@@ -22,6 +21,7 @@
#include "doxygen.h" #include "doxygen.h"
#include "portable.h" #include "portable.h"
#include "filedef.h" #include "filedef.h"
#include "message.h"
static QCString outputFormat; static QCString outputFormat;
static const char *warning_str = "warning: "; static const char *warning_str = "warning: ";
...@@ -110,7 +110,7 @@ void msg(const char *fmt, ...) ...@@ -110,7 +110,7 @@ void msg(const char *fmt, ...)
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vfprintf(stdout, fmt, args); vfprintf(stdout, fmt, args);
va_end(args); va_end(args);
} }
} }
...@@ -172,6 +172,11 @@ void warn(const char *file,int line,const char *fmt, ...) ...@@ -172,6 +172,11 @@ void warn(const char *file,int line,const char *fmt, ...)
va_end(args); 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) void warn_simple(const char *file,int line,const char *text)
{ {
if (!Config_getBool("WARNINGS")) return; // warning type disabled if (!Config_getBool("WARNINGS")) return; // warning type disabled
......
...@@ -19,9 +19,11 @@ ...@@ -19,9 +19,11 @@
#define MESSAGE_H #define MESSAGE_H
#include <stdio.h> #include <stdio.h>
#include <stdarg.h>
extern void msg(const char *fmt, ...); 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, ...);
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_simple(const char *file,int line,const char *text);
extern void warn_undoc(const char *file,int line,const char *fmt, ...); 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, ...); 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, ...@@ -916,29 +916,9 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title,
continue; // will be output in another pass, see layout_default.xml continue; // will be output in another pass, see layout_default.xml
ol.startMemberDeclaration(); ol.startMemberDeclaration();
ol.startMemberItem(nd->getOutputFileBase(),0); ol.startMemberItem(nd->getOutputFileBase(),0);
if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp) QCString ct = nd->compoundTypeString();
{ ol.docify(ct);
ol.docify("package "); ol.docify(" ");
}
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");
}
}
ol.insertMemberAlign(); ol.insertMemberAlign();
QCString name; QCString name;
if (localName) if (localName)
...@@ -1103,3 +1083,33 @@ QCString NamespaceDef::title() const ...@@ -1103,3 +1083,33 @@ QCString NamespaceDef::title() const
} }
return pageTitle; 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 ...@@ -94,6 +94,7 @@ class NamespaceDef : public Definition
NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; } NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; }
QCString title() const; QCString title() const;
QCString compoundTypeString() const;
bool visited; bool visited;
......
This diff is collapsed.
...@@ -10,32 +10,32 @@ class TemplateListIntf; ...@@ -10,32 +10,32 @@ class TemplateListIntf;
class TemplateStructIntf; class TemplateStructIntf;
class TemplateEngine; class TemplateEngine;
/** @defgroup template_api Template API /** @defgroup template_api Template API
* *
* This is the API for a * This is the API for a
* <a href="https://docs.djangoproject.com/en/1.6/topics/templates/">Django</a> * <a href="https://docs.djangoproject.com/en/1.6/topics/templates/">Django</a>
* compatible template system written in C++. * compatible template system written in C++.
* It is somewhat inspired by Stephen Kelly's * It is somewhat inspired by Stephen Kelly's
* <a href="http://www.gitorious.org/grantlee/pages/Home">Grantlee</a>. * <a href="http://www.gitorious.org/grantlee/pages/Home">Grantlee</a>.
* *
* A template is simply a text file. * A template is simply a text file.
* A template contains \b variables, which get replaced with values when the * A template contains \b variables, which get replaced with values when the
* template is evaluated, and \b tags, which control the logic of the template. * template is evaluated, and \b tags, which control the logic of the template.
* *
* Variables look like this: `{{ variable }}` * Variables look like this: `{{ variable }}`
* When the template engine encounters a variable, it evaluates that variable and * When the template engine encounters a variable, it evaluates that variable and
* replaces it with the result. Variable names consist of any combination of * replaces it with the result. Variable names consist of any combination of
* alphanumeric characters and the underscore ("_"). * alphanumeric characters and the underscore ("_").
* Use a dot (.) to access attributes of a structured variable. * Use a dot (.) to access attributes of a structured variable.
* *
* One can modify variables for display by using \b filters, for example: * One can modify variables for display by using \b filters, for example:
* `{{ value|default:"nothing" }}` * `{{ value|default:"nothing" }}`
* *
* Tags look like this: `{% tag %}`. Tags are more complex than variables: * Tags look like this: `{% tag %}`. Tags are more complex than variables:
* Some create text in the output, some control flow by performing loops or logic, * Some create text in the output, some control flow by performing loops or logic,
* and some load external information into the template to be used by later variables. * and some load external information into the template to be used by later variables.
* *
* To comment-out part of a line in a template, use the comment syntax: * To comment-out part of a line in a template, use the comment syntax:
* `{# comment text #}`. * `{# comment text #}`.
* *
* Supported Django tags: * Supported Django tags:
...@@ -144,13 +144,13 @@ class TemplateVariant ...@@ -144,13 +144,13 @@ class TemplateVariant
/** Constructs a new variant with a string value \a s. */ /** Constructs a new variant with a string value \a s. */
TemplateVariant(const QCString &s,bool raw=FALSE); TemplateVariant(const QCString &s,bool raw=FALSE);
/** Constructs a new variant with a struct value \a s. /** Constructs a new variant with a struct value \a s.
* @note. Only a pointer to the struct is stored. The caller * @note. Only a pointer to the struct is stored. The caller
* is responsible to manage the memory for the struct object. * is responsible to manage the memory for the struct object.
*/ */
TemplateVariant(const TemplateStructIntf *s); TemplateVariant(const TemplateStructIntf *s);
/** Constructs a new variant with a list value \a l. /** Constructs a new variant with a list value \a l.
* @note. Only a pointer to the struct is stored. The caller * @note. Only a pointer to the struct is stored. The caller
* is responsible to manage the memory for the list object. * is responsible to manage the memory for the list object.
*/ */
...@@ -168,7 +168,7 @@ class TemplateVariant ...@@ -168,7 +168,7 @@ class TemplateVariant
/** Destroys the Variant object */ /** Destroys the Variant object */
~TemplateVariant(); ~TemplateVariant();
/** Constructs a copy of the variant, \a v, /** Constructs a copy of the variant, \a v,
* passed as the argument to this constructor. * passed as the argument to this constructor.
*/ */
TemplateVariant(const TemplateVariant &v); TemplateVariant(const TemplateVariant &v);
...@@ -176,7 +176,7 @@ class TemplateVariant ...@@ -176,7 +176,7 @@ class TemplateVariant
/** Assigns the value of the variant \a v to this variant. */ /** Assigns the value of the variant \a v to this variant. */
TemplateVariant &operator=(const TemplateVariant &v); TemplateVariant &operator=(const TemplateVariant &v);
/** Compares this QVariant with v and returns true if they are equal; /** Compares this QVariant with v and returns true if they are equal;
* otherwise returns false. * otherwise returns false.
*/ */
bool operator==(TemplateVariant &other); bool operator==(TemplateVariant &other);
...@@ -190,13 +190,13 @@ class TemplateVariant ...@@ -190,13 +190,13 @@ class TemplateVariant
/** Returns the variant as an integer. */ /** Returns the variant as an integer. */
int toInt() const; int toInt() const;
/** Returns the pointer to list referenced by this variant /** Returns the pointer to list referenced by this variant
* or 0 if this variant does not have list type. * or 0 if this variant does not have list type.
*/ */
const TemplateListIntf *toList() const; const TemplateListIntf *toList() const;
/** Returns the pointer to struct referenced by this variant /** Returns the pointer to struct referenced by this variant
* or 0 if this variant does not have struct type. * or 0 if this variant does not have struct type.
*/ */
const TemplateStructIntf *toStruct() const; const TemplateStructIntf *toStruct() const;
...@@ -205,7 +205,7 @@ class TemplateVariant ...@@ -205,7 +205,7 @@ class TemplateVariant
*/ */
TemplateVariant call(const QValueList<TemplateVariant> &args); TemplateVariant call(const QValueList<TemplateVariant> &args);
/** Sets whether or not the value of the Variant should be /** Sets whether or not the value of the Variant should be
* escaped or written as-is (raw). * escaped or written as-is (raw).
* @param[in] b TRUE means write as-is, FALSE means apply escaping. * @param[in] b TRUE means write as-is, FALSE means apply escaping.
*/ */
...@@ -223,7 +223,7 @@ class TemplateVariant ...@@ -223,7 +223,7 @@ class TemplateVariant
//------------------------------------------------------------------------ //------------------------------------------------------------------------
/** @brief Abstract read-only interface for a context value of type list. /** @brief Abstract read-only interface for a context value of type list.
* @note The values of the list are TemplateVariants. * @note The values of the list are TemplateVariants.
*/ */
class TemplateListIntf class TemplateListIntf
...@@ -245,7 +245,7 @@ class TemplateListIntf ...@@ -245,7 +245,7 @@ class TemplateListIntf
virtual void toPrev() = 0; virtual void toPrev() = 0;
/* Returns TRUE if the iterator points to a valid element /* Returns TRUE if the iterator points to a valid element
* in the list, or FALSE otherwise. * in the list, or FALSE otherwise.
* If TRUE is returned, the value pointed to be the * If TRUE is returned, the value pointed to be the
* iterator is assigned to \a v. * iterator is assigned to \a v.
*/ */
virtual bool current(TemplateVariant &v) const = 0; virtual bool current(TemplateVariant &v) const = 0;
...@@ -260,7 +260,7 @@ class TemplateListIntf ...@@ -260,7 +260,7 @@ class TemplateListIntf
/** Returns the element at index position \a index. */ /** Returns the element at index position \a index. */
virtual TemplateVariant at(int index) const = 0; virtual TemplateVariant at(int index) const = 0;
/** Creates a new iterator for this list. /** Creates a new iterator for this list.
* @note the user should call delete on the returned pointer. * @note the user should call delete on the returned pointer.
*/ */
virtual TemplateListIntf::ConstIterator *createIterator() const = 0; virtual TemplateListIntf::ConstIterator *createIterator() const = 0;
...@@ -279,7 +279,7 @@ class TemplateList : public TemplateListIntf ...@@ -279,7 +279,7 @@ class TemplateList : public TemplateListIntf
virtual int count() const; virtual int count() const;
virtual TemplateVariant at(int index) const; virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const; virtual TemplateListIntf::ConstIterator *createIterator() const;
/** Appends element \a v to the end of the list */ /** Appends element \a v to the end of the list */
virtual void append(const TemplateVariant &v); virtual void append(const TemplateVariant &v);
...@@ -350,8 +350,8 @@ class TemplateSpacelessIntf ...@@ -350,8 +350,8 @@ class TemplateSpacelessIntf
//------------------------------------------------------------------------ //------------------------------------------------------------------------
/** @brief Abstract interface for a template context. /** @brief Abstract interface for a template context.
* *
* A Context consists of a stack of dictionaries. * A Context consists of a stack of dictionaries.
* A dictionary consists of a mapping of string keys onto TemplateVariant values. * A dictionary consists of a mapping of string keys onto TemplateVariant values.
* A key is searched starting with the dictionary at the top of the stack * A key is searched starting with the dictionary at the top of the stack
...@@ -370,10 +370,10 @@ class TemplateContext ...@@ -370,10 +370,10 @@ class TemplateContext
/** Pop the current scope from the stack. */ /** Pop the current scope from the stack. */
virtual void pop() = 0; virtual void pop() = 0;
/** Sets a value in the current scope. /** Sets a value in the current scope.
* @param[in] name The name of the value; the key in the dictionary. * @param[in] name The name of the value; the key in the dictionary.
* @param[in] v The value associated with the key. * @param[in] v The value associated with the key.
* @note When a given key is already present, * @note When a given key is already present,
* its value will be replaced by \a v * its value will be replaced by \a v
*/ */
virtual void set(const char *name,const TemplateVariant &v) = 0; virtual void set(const char *name,const TemplateVariant &v) = 0;
...@@ -409,8 +409,8 @@ class TemplateContext ...@@ -409,8 +409,8 @@ class TemplateContext
//------------------------------------------------------------------------ //------------------------------------------------------------------------
/** @brief Abstract interface for a template. /** @brief Abstract interface for a template.
* @note Must be created by TemplateEngine * @note Must be created and is deleted by the TemplateEngine
*/ */
class Template class Template
{ {
...@@ -418,7 +418,7 @@ class Template ...@@ -418,7 +418,7 @@ class Template
/** Destructor */ /** Destructor */
virtual ~Template() {} virtual ~Template() {}
/** Renders a template instance to a stream. /** Renders a template instance to a stream.
* @param[in] ts The text stream to write the results to. * @param[in] ts The text stream to write the results to.
* @param[in] c The context containing data that can be used * @param[in] c The context containing data that can be used
* when instantiating the template. * when instantiating the template.
...@@ -444,13 +444,25 @@ class TemplateEngine ...@@ -444,13 +444,25 @@ class TemplateEngine
TemplateContext *createContext() const; TemplateContext *createContext() const;
/** Creates a new template whole contents are in a file. /** Creates a new template whole contents are in a file.
* @param[in] fileName The name of the file containing the * @param[in] fileName The name of the file containing the
* template data * 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. * @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: private:
friend class TemplateNodeBlock;
void enterBlock(const QCString &fileName,const QCString &blockName,int line);
void leaveBlock();
class Private; class Private;
Private *p; 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