Permalink
Browse files

Template enhancements and various other small fixes

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Sep 8, 2015
1 parent 5aa4ade commit e58fb0a46f73f37d16859f43fda1eb5ba4a15c5d
Showing with 739 additions and 219 deletions.
  1. +350 −36 src/context.cpp
  2. +30 −8 src/context.h
  3. +23 −0 src/definition.cpp
  4. +3 −0 src/definition.h
  5. +1 −1 src/diagram.cpp
  6. +4 −4 src/doxygen.cpp
  7. +1 −1 src/htmldocvisitor.cpp
  8. +3 −5 src/htmlgen.cpp
  9. +3 −3 src/index.cpp
  10. +1 −1 src/latexgen.cpp
  11. +11 −5 src/memberdef.cpp
  12. +1 −0 src/memberdef.h
  13. +2 −2 src/memberlist.cpp
  14. +34 −5 src/template.cpp
  15. +2 −2 src/translator_br.h
  16. +2 −2 src/translator_cn.h
  17. +2 −2 src/translator_cz.h
  18. +2 −2 src/translator_de.h
  19. +2 −2 src/translator_en.h
  20. +2 −2 src/translator_eo.h
  21. +2 −2 src/translator_es.h
  22. +2 −2 src/translator_fr.h
  23. +2 −2 src/translator_gr.h
  24. +2 −2 src/translator_it.h
  25. +2 −2 src/translator_jp.h
  26. +2 −2 src/translator_kr.h
  27. +2 −2 src/translator_lv.h
  28. +2 −2 src/translator_nl.h
  29. +2 −2 src/translator_pt.h
  30. +2 −2 src/translator_ro.h
  31. +2 −2 src/translator_ru.h
  32. +2 −2 src/translator_sk.h
  33. +2 −2 src/translator_sv.h
  34. +2 −2 src/translator_tw.h
  35. +2 −2 src/translator_ua.h
  36. +34 −1 src/util.cpp
  37. +2 −0 src/util.h
  38. +1 −1 templates/html/htmlannotated.tpl
  39. +9 −0 templates/html/htmlbase.tpl
  40. +6 −4 templates/html/htmlclass.tpl
  41. +1 −1 templates/html/htmlclasses.tpl
  42. +0 −1 templates/html/htmldeclcomp.tpl
  43. +4 −12 templates/html/htmldir.tpl
  44. +7 −1 templates/html/htmldirtree.tpl
  45. +17 −0 templates/html/htmlexample.tpl
  46. +15 −0 templates/html/htmlexamples.tpl
  47. +5 −3 templates/html/htmlfile.tpl
  48. +1 −1 templates/html/htmlfiles.tpl
  49. +1 −1 templates/html/htmlhierarchy.tpl
  50. +1 −1 templates/html/htmlindexpages.tpl
  51. +1 −1 templates/html/htmljsnavtree.tpl
  52. +35 −20 templates/html/htmllayout.tpl
  53. +10 −10 templates/html/htmlmembersindex.tpl
  54. +9 −11 templates/html/htmlmemdecl.tpl
  55. +37 −8 templates/html/htmlmemdef.tpl
  56. +5 −3 templates/html/htmlmodule.tpl
  57. +1 −1 templates/html/htmlmodules.tpl
  58. +5 −3 templates/html/htmlnamespace.tpl
  59. +1 −1 templates/html/htmlnamespaces.tpl
  60. +1 −1 templates/html/htmlnavtree.tpl
  61. +5 −1 templates/html/htmlobjlink.tpl
  62. +5 −3 templates/html/htmlpage.tpl
  63. +1 −1 templates/html/htmlpages.tpl
  64. +4 −12 templates/html/htmlsource.tpl
  65. +1 −1 templates/html/htmltabs.tpl
  66. +2 −2 templates/latex/latexclass.tpl
  67. +1 −0 templates/latex/latexfiles.tpl
  68. +1 −0 templates/latex/latexmodules.tpl
  69. +1 −0 templates/latex/latexnamespaces.tpl
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -329,15 +329,15 @@ class DirContext : public RefCountedContext, public TemplateStructIntf
class PageContext : public RefCountedContext, public TemplateStructIntf
{
public:
static PageContext *alloc(PageDef *pd,bool isMainPage=FALSE) { return new PageContext(pd,isMainPage); }
static PageContext *alloc(PageDef *pd,bool isMainPage,bool isExample) { return new PageContext(pd,isMainPage,isExample); }
// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }
private:
PageContext(PageDef *,bool isMainPage);
PageContext(PageDef *,bool isMainPage,bool isExample);
~PageContext();
class Private;
Private *p;
@@ -710,15 +710,15 @@ class PageListContext : public RefCountedContext, public TemplateListIntf
class PageTreeContext : public RefCountedContext, public TemplateStructIntf
{
public:
static PageTreeContext *alloc() { return new PageTreeContext; }
static PageTreeContext *alloc(const PageSDict *pages) { return new PageTreeContext(pages); }
// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }
private:
PageTreeContext();
PageTreeContext(const PageSDict *pages);
~PageTreeContext();
class Private;
Private *p;
@@ -788,13 +788,15 @@ class ModuleTreeContext : public RefCountedContext, public TemplateStructIntf
//----------------------------------------------------
class ExampleListContext : public RefCountedContext, public TemplateStructIntf
class ExampleListContext : public RefCountedContext, public TemplateListIntf
{
public:
static ExampleListContext *alloc() { return new ExampleListContext(); }
static ExampleListContext *alloc() { return new ExampleListContext; }
// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
// TemplateListIntf methods
virtual int count() const;
virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }
@@ -807,6 +809,26 @@ class ExampleListContext : public RefCountedContext, public TemplateStructIntf
//----------------------------------------------------
class ExampleTreeContext : public RefCountedContext, public TemplateStructIntf
{
public:
static ExampleTreeContext *alloc() { return new ExampleTreeContext; }
// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
virtual int addRef() { return RefCountedContext::addRef(); }
virtual int release() { return RefCountedContext::release(); }
private:
ExampleTreeContext();
~ExampleTreeContext();
class Private;
Private *p;
};
//----------------------------------------------------
class GlobalsIndexContext : public RefCountedContext, public TemplateStructIntf
{
public:
View
@@ -1943,4 +1943,27 @@ bool Definition::hasBriefDescription() const
return !briefDescription().isEmpty() && briefMemberDesc;
}
QCString Definition::externalReference(const QCString &relPath) const
{
QCString ref = getReference();
if (!ref.isEmpty())
{
QCString *dest = Doxygen::tagDestinationDict[ref];
if (dest)
{
QCString result = *dest;
int l = result.length();
if (!relPath.isEmpty() && l>0 && result.at(0)=='.')
{ // relative path -> prepend relPath.
result.prepend(relPath);
l+=relPath.length();
}
if (l>0 && result.at(l-1)!='/') result+='/';
return result;
}
}
return relPath;
}
View
@@ -231,6 +231,9 @@ class Definition : public DefinitionIntf
/*! Returns TRUE if this definition is imported via a tag file. */
virtual bool isReference() const;
/*! Convenience method to return a resolved external link */
QCString externalReference(const QCString &relPath) const;
/*! Returns the first line of the body of this item (applicable to classes and
* functions).
*/
View
@@ -274,7 +274,7 @@ static void writeMapArea(FTextStream &t,ClassDef *cd,QCString relPath,
QCString tooltip = cd->briefDescriptionAsTooltip();
if (!tooltip.isEmpty())
{
t << "title=\"" << tooltip << "\" ";
t << "title=\"" << convertToHtml(tooltip) << "\" ";
}
t << "alt=\"" << convertToXML(cd->displayName());
t << "\" shape=\"rect\" coords=\"" << x << "," << y << ",";
View
@@ -7847,7 +7847,7 @@ static void generateFileSources()
QStrList filesInSameTu;
fd->getAllIncludeFilesRecursively(filesInSameTu);
fd->startParsing();
if (fd->generateSourceFile()) // sources need to be shown in the output
if (fd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output
{
msg("Generating code for file %s...\n",fd->docName().data());
fd->writeSource(*g_outputList,FALSE,filesInSameTu);
@@ -7870,7 +7870,7 @@ static void generateFileSources()
FileDef *ifd=findFileDef(Doxygen::inputNameDict,incFile,ambig);
if (ifd && !ifd->isReference())
{
if (ifd->generateSourceFile()) // sources need to be shown in the output
if (ifd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output
{
msg(" Generating code for file %s...\n",ifd->docName().data());
ifd->writeSource(*g_outputList,TRUE,moreFiles);
@@ -7903,7 +7903,7 @@ static void generateFileSources()
{
QStrList filesInSameTu;
fd->startParsing();
if (fd->generateSourceFile()) // sources need to be shown in the output
if (fd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output
{
msg("Generating code for file %s...\n",fd->docName().data());
fd->writeSource(*g_outputList,FALSE,filesInSameTu);
@@ -7933,7 +7933,7 @@ static void generateFileSources()
{
QStrList filesInSameTu;
fd->startParsing();
if (fd->generateSourceFile()) // sources need to be shown in the output
if (fd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output
{
msg("Generating code for file %s...\n",fd->docName().data());
fd->writeSource(*g_outputList,FALSE,filesInSameTu);
View
@@ -1927,7 +1927,7 @@ void HtmlDocVisitor::startLink(const QCString &ref,const QCString &file,
if (!file.isEmpty()) m_t << file << Doxygen::htmlFileExtension;
if (!anchor.isEmpty()) m_t << "#" << anchor;
m_t << "\"";
if (!tooltip.isEmpty()) m_t << " title=\"" << substitute(tooltip,"\"","&quot;") << "\"";
if (!tooltip.isEmpty()) m_t << " title=\"" << convertToHtml(tooltip) << "\"";
m_t << ">";
}
View
@@ -549,7 +549,7 @@ void HtmlCodeGenerator::_writeCodeLink(const char *className,
if (f) m_t << f << Doxygen::htmlFileExtension;
if (anchor) m_t << "#" << anchor;
m_t << "\"";
if (tooltip) m_t << " title=\"" << tooltip << "\"";
if (tooltip) m_t << " title=\"" << convertToHtml(tooltip) << "\"";
m_t << ">";
docify(name);
m_t << "</a>";
@@ -1340,11 +1340,9 @@ void HtmlGenerator::endClassDiagram(const ClassDiagram &d,
startSectionContent(t,m_sectionCount);
t << " <div class=\"center\">" << endl;
t << " <img src=\"";
t << relPath << fileName << ".png\" usemap=\"#";
docify(name);
t << relPath << fileName << ".png\" usemap=\"#" << convertToId(name);
t << "_map\" alt=\"\"/>" << endl;
t << " <map id=\"";
docify(name);
t << " <map id=\"" << convertToId(name);
t << "_map\" name=\"";
docify(name);
t << "_map\">" << endl;
View
@@ -1640,7 +1640,7 @@ static void writeAnnotatedClassList(OutputList &ol)
static QCString letterToLabel(uint startLetter)
{
char s[11]; // max 0x12345678 + '\0'
if (startLetter>0x20 && startLetter<=0x7f) // printable ASCII character
if (isId(startLetter)) // printable ASCII character
{
s[0]=(char)startLetter;
s[1]=0;
@@ -2476,8 +2476,8 @@ static void writeQuickMemberIndex(OutputList &ol,
anchor=fullName+extension+"#index_";
else
anchor=fullName+"_"+letterToLabel(i)+extension+"#index_";
startQuickIndexItem(ol,anchor+ci,i==page,TRUE,first);
ol.writeString(is);
startQuickIndexItem(ol,anchor+is,i==page,TRUE,first);
ol.writeString(ci);
endQuickIndexItem(ol);
first=FALSE;
}
View
@@ -47,7 +47,7 @@ LatexCodeGenerator::LatexCodeGenerator(FTextStream &t,const QCString &relPath,co
setTextStream(t);
}
LatexCodeGenerator::LatexCodeGenerator() : m_col(0)
LatexCodeGenerator::LatexCodeGenerator() : m_col(0), m_streamSet(FALSE)
{
m_prettyCode=Config_getBool("LATEX_SOURCE_CODE");
}
View
@@ -967,7 +967,7 @@ QCString MemberDef::getOutputFileBase() const
return baseName;
}
}
else if (m_impl->nspace)
else if (m_impl->nspace && m_impl->nspace->isLinkableInProject())
{
baseName=m_impl->nspace->getOutputFileBase();
}
@@ -1092,7 +1092,8 @@ void MemberDef::_computeLinkableInProject()
m_isLinkableCached = 1; // in class but class not linkable
return;
}
if (!m_impl->group && m_impl->nspace && !m_impl->related && !m_impl->nspace->isLinkableInProject())
if (!m_impl->group && m_impl->nspace && !m_impl->related && !m_impl->nspace->isLinkableInProject()
&& (m_impl->fileDef==0 || !m_impl->fileDef->isLinkableInProject()))
{
//printf("in a namespace but namespace not linkable!\n");
m_isLinkableCached = 1; // in namespace but namespace not linkable
@@ -1914,7 +1915,7 @@ bool MemberDef::isDetailedSectionVisible(bool inGroup,bool inFile) const
static bool inlineSimpleStructs = Config_getBool("INLINE_SIMPLE_STRUCTS");
static bool hideUndocMembers = Config_getBool("HIDE_UNDOC_MEMBERS");
bool groupFilter = getGroupDef()==0 || inGroup || separateMemPages;
bool fileFilter = getNamespaceDef()==0 || !inFile;
bool fileFilter = getNamespaceDef()==0 || !getNamespaceDef()->isLinkable() || !inFile;
bool simpleFilter = (hasBriefDescription() || !hideUndocMembers) && inlineSimpleStructs &&
getClassDef()!=0 && getClassDef()->isSimple();
@@ -2261,7 +2262,7 @@ void MemberDef::_writeCategoryRelation(OutputList &ol)
text = theTranslator->trExtendsClass();
name = m_impl->classDef->categoryOf()->displayName();
}
i=text.find("@1");
i=text.find("@0");
if (i!=-1)
{
MemberDef *md = m_impl->categoryRelation;
@@ -2495,7 +2496,7 @@ void MemberDef::_writeGroupInclude(OutputList &ol,bool inGroup)
if (isIDLorJava) ol.docify("\""); else ol.docify("<");
if (fd && fd->isLinkable())
if (fd->isLinkable())
{
ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),fd->anchor(),nm);
}
@@ -4481,6 +4482,11 @@ MemberDef *MemberDef::getEnumScope() const
return m_impl->enumScope;
}
bool MemberDef::livesInsideEnum() const
{
return m_impl->livesInsideEnum;
}
MemberList *MemberDef::enumFieldList() const
{
return m_impl->enumFields;
View
@@ -176,6 +176,7 @@ class MemberDef : public Definition
bool protectionVisible() const;
bool showInCallGraph() const;
bool isStrongEnumValue() const;
bool livesInsideEnum() const;
// derived getters
bool isFriendToHide() const;
View
@@ -435,8 +435,8 @@ void MemberList::writePlainDeclarations(OutputList &ol,
}
delete rootNode;
}
ol.endMemberDeclaration(md->anchor(),inheritId);
ol.endMemberItem();
ol.endMemberDeclaration(md->anchor(),inheritId);
}
md->warnIfUndocumented();
break;
@@ -681,7 +681,7 @@ void MemberList::writeDocumentation(OutputList &ol,
}
if (memberGroupList)
{
//printf("MemberList::writeDocumentation() -- member groups\n");
printf("MemberList::writeDocumentation() -- member groups %d\n",memberGroupList->count());
MemberGroupListIterator mgli(*memberGroupList);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
View
@@ -839,6 +839,31 @@ class FilterRaw
//-----------------------------------------------------------------------------
/** @brief The implementation of the "list" filter */
class FilterList
{
public:
static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &)
{
if (v.isValid())
{
if (v.type()==TemplateVariant::List) // input is already a list
{
return v;
}
// create a list with v as the only element
TemplateList *list = TemplateList::alloc();
list->append(v);
return list;
}
else
{
return v;
}
}
};
//-----------------------------------------------------------------------------
/** @brief The implementation of the "texlabel" filter */
class FilterTexLabel
{
@@ -1268,16 +1293,19 @@ class FilterAlphaIndex
static QCString keyToLabel(uint startLetter)
{
char s[11]; // 0x12345678 + '\0'
if (startLetter>0x20 && startLetter<=0x7f) // printable ASCII character
if ((startLetter>='0' && startLetter<='9') ||
(startLetter>='a' && startLetter<='z') ||
(startLetter>='A' && startLetter<='Z'))
{
s[0]=tolower((char)startLetter);
s[1]=0;
int i=0;
if (startLetter>='0' && startLetter<='9') s[i++] = 'x';
s[i++]=tolower((char)startLetter);
s[i++]=0;
}
else
{
const char hex[]="0123456789abcdef";
int i=0;
s[i++]='0';
s[i++]='x';
if (startLetter>(1<<24)) // 4 byte character
{
@@ -1492,6 +1520,7 @@ class TemplateFilterFactory
static TemplateFilterFactory::AutoRegister<FilterAdd> fAdd("add");
static TemplateFilterFactory::AutoRegister<FilterGet> fGet("get");
static TemplateFilterFactory::AutoRegister<FilterRaw> fRaw("raw");
static TemplateFilterFactory::AutoRegister<FilterList> fList("list");
static TemplateFilterFactory::AutoRegister<FilterAppend> fAppend("append");
static TemplateFilterFactory::AutoRegister<FilterLength> fLength("length");
static TemplateFilterFactory::AutoRegister<FilterNoWrap> fNoWrap("nowrap");
@@ -2429,7 +2458,7 @@ class TemplateImpl : public TemplateNode, public Template
TemplateContextImpl::TemplateContextImpl(const TemplateEngine *e)
: m_engine(e), m_templateName("<unknown>"), m_line(1), m_activeEscapeIntf(0),
m_spacelessIntf(0), m_spacelessEnabled(FALSE), m_indices(TemplateStruct::alloc())
m_spacelessIntf(0), m_spacelessEnabled(FALSE), m_tabbingEnabled(FALSE), m_indices(TemplateStruct::alloc())
{
m_indexStacks.setAutoDelete(TRUE);
m_contextStack.setAutoDelete(TRUE);
Oops, something went wrong.

0 comments on commit e58fb0a

Please sign in to comment.