diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-08-09 18:55:22 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-08-24 14:08:14 (GMT) |
commit | 0815bb7d5c99fccdbdba24fb933f9e7fce29bbc6 (patch) | |
tree | f3af0df1bd26f367220386ab4e011a27c9b341fd /src/htmlgen.h | |
parent | 8b3efba55c297d9af5274bf525e53417b78e8be3 (diff) | |
download | Doxygen-0815bb7d5c99fccdbdba24fb933f9e7fce29bbc6.zip Doxygen-0815bb7d5c99fccdbdba24fb933f9e7fce29bbc6.tar.gz Doxygen-0815bb7d5c99fccdbdba24fb933f9e7fce29bbc6.tar.bz2 |
Refactoring: OutputList & OutputGen
- Initialized member variables inside the class
- Added copy & assign operators for OutputGenerator and Derived classes.
- throw a runtime exception when OutputGenerator is copied while is file
is still in progress.
- Added clone method to make a copy of OutputList.
- Moved the implementation of enable() & disable() and friend into
OutputGen instead of having the same implementation in each derived
class.
- Made m_dir and m_fileName readonly (members dir() and fileName())
- Removed call to new while adding generators to OutputList
- Replaced QStack by std::stack for the "enabled" state.
Diffstat (limited to 'src/htmlgen.h')
-rw-r--r-- | src/htmlgen.h | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/src/htmlgen.h b/src/htmlgen.h index a8268da..9487e60 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -39,7 +39,7 @@ class HtmlCodeGenerator : public CodeOutputInterface void writeCodeLink(const char *ref,const char *file, const char *anchor,const char *name, const char *tooltip); - void writeTooltip(const char *id, + void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, const char *desc, @@ -72,7 +72,12 @@ class HtmlGenerator : public OutputGenerator { public: HtmlGenerator(); + HtmlGenerator &operator=(const HtmlGenerator &g); + HtmlGenerator(const HtmlGenerator &g); virtual ~HtmlGenerator(); + virtual std::unique_ptr<OutputGenerator> clone() const; + + virtual OutputType type() const { return Html; } static void init(); static void writeStyleSheetFile(QFile &f); static void writeHeaderFile(QFile &f, const char *cssname); @@ -84,18 +89,9 @@ class HtmlGenerator : public OutputGenerator static void writeExternalSearchPage(); static QCString writeLogoAsString(const char *path); static QCString writeSplitBarAsString(const char *name,const char *relpath); - - void enable() - { if (m_genStack->top()) m_active=*m_genStack->top(); else m_active=TRUE; } - void disable() { m_active=FALSE; } - void enableIf(OutputType o) { if (o==Html) enable(); } - void disableIf(OutputType o) { if (o==Html) disable(); } - void disableIfNot(OutputType o) { if (o!=Html) disable(); } - bool isEnabled(OutputType o) { return (o==Html && m_active); } - OutputGenerator *get(OutputType o) { return (o==Html) ? this : 0; } // ---- CodeOutputInterface - void codify(const char *text) + void codify(const char *text) { m_codeGen.codify(text); } void writeCodeLink(const char *ref,const char *file, const char *anchor,const char *name, @@ -111,11 +107,11 @@ class HtmlGenerator : public OutputGenerator { m_codeGen.startCodeLine(hasLineNumbers); } void endCodeLine() { m_codeGen.endCodeLine(); } - void startFontClass(const char *s) + void startFontClass(const char *s) { m_codeGen.startFontClass(s); } - void endFontClass() + void endFontClass() { m_codeGen.endFontClass(); } - void writeCodeAnchor(const char *anchor) + void writeCodeAnchor(const char *anchor) { m_codeGen.writeCodeAnchor(anchor); } // --------------------------- @@ -139,7 +135,7 @@ class HtmlGenerator : public OutputGenerator void endTitleHead(const char *,const char *); void startTitle() { t << "<div class=\"title\">"; } void endTitle() { t << "</div>"; } - + void startParagraph(const char *classDef); void endParagraph(); void writeString(const char *text); @@ -210,7 +206,7 @@ class HtmlGenerator : public OutputGenerator const char *title,const char *name); void writeRuler() { t << "<hr/>"; } - void writeAnchor(const char *,const char *name) + void writeAnchor(const char *,const char *name) { t << "<a name=\"" << name <<"\" id=\"" << name << "\"></a>"; } void startCodeFragment(); void endCodeFragment(); @@ -226,10 +222,10 @@ class HtmlGenerator : public OutputGenerator void endDescForItem() { t << "</dd>\n"; } void lineBreak(const char *style); void writeChar(char c); - void startMemberDoc(const char *clName, const char *memName, - const char *anchor, const char *title, + void startMemberDoc(const char *clName, const char *memName, + const char *anchor, const char *title, int memCount, int memTotal, bool showInline); - void endMemberDoc(bool); + void endMemberDoc(bool); void startDoxyAnchor(const char *fName,const char *manName, const char *anchor,const char *name, const char *args); @@ -294,9 +290,9 @@ class HtmlGenerator : public OutputGenerator void endDirDepGraph(DotDirDeps &g); void writeGraphicalHierarchy(DotGfxHierarchyTable &g); - void startTextBlock(bool) + void startTextBlock(bool) { t << "<div class=\"textblock\">"; } - void endTextBlock(bool) + void endTextBlock(bool) { t << "</div>"; } void lastIndexPage() {} @@ -334,9 +330,6 @@ class HtmlGenerator : public OutputGenerator void writeLabel(const char *l,bool isLast); void endLabels(); - - //static void generateSectionImages(); - private: static void writePageFooter(FTextStream &t,const QCString &,const QCString &,const QCString &); QCString m_lastTitle; @@ -344,11 +337,8 @@ class HtmlGenerator : public OutputGenerator QCString m_relPath; void docify(const char *text,bool inHtmlComment); - HtmlGenerator &operator=(const HtmlGenerator &g); - HtmlGenerator(const HtmlGenerator &g); - - int m_sectionCount; - bool m_emptySection; + int m_sectionCount = 0; + bool m_emptySection = false; HtmlCodeGenerator m_codeGen; }; |