diff options
Diffstat (limited to 'src/outputgen.h')
-rw-r--r-- | src/outputgen.h | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/src/outputgen.h b/src/outputgen.h index 009225f..4bfed25 100644 --- a/src/outputgen.h +++ b/src/outputgen.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. * @@ -18,7 +18,10 @@ #ifndef OUTPUTGEN_H #define OUTPUTGEN_H -#include <qstack.h> +#include <memory> +#include <stack> + +#include <qfile.h> #include "index.h" #include "section.h" @@ -33,9 +36,7 @@ class DotGfxHierarchyTable; class DotGroupCollaboration; class DocNode; class MemberDef; -class GroupDef; class Definition; -class QFile; struct DocLinkInfo { @@ -54,15 +55,15 @@ struct SourceLinkInfo QCString anchor; }; -/** Output interface for code parser. +/** Output interface for code parser. */ class CodeOutputInterface { public: virtual ~CodeOutputInterface() {} - /*! Writes an code fragment to the output. This function should keep - * spaces visible, should break lines at a newline and should convert + /*! Writes an code fragment to the output. This function should keep + * spaces visible, should break lines at a newline and should convert * tabs to the right number of spaces. */ virtual void codify(const char *s) = 0; @@ -71,8 +72,8 @@ class CodeOutputInterface * \param ref If this is non-zero, the object is to be found in * an external documentation file. * \param file The file in which the object is located. - * \param anchor The anchor uniquely identifying the object within - * the file. + * \param anchor The anchor uniquely identifying the object within + * the file. * \param name The text to display as a placeholder for the link. * \param tooltip The tooltip to display when the mouse is on the link. */ @@ -89,7 +90,7 @@ class CodeOutputInterface virtual void writeLineNumber(const char *ref,const char *file, const char *anchor,int lineNumber) = 0; - /*! Writes a tool tip definition + /*! Writes a tool tip definition * \param id unique identifier for the tooltip * \param docInfo Info about the symbol's documentation. * \param decl full declaration of the symbol (for functions) @@ -97,14 +98,14 @@ class CodeOutputInterface * \param defInfo Info about the symbol's definition in the source code * \param declInfo Info about the symbol's declaration in the source code */ - virtual void writeTooltip(const char *id, + virtual void writeTooltip(const char *id, const DocLinkInfo &docInfo, const char *decl, const char *desc, const SourceLinkInfo &defInfo, const SourceLinkInfo &declInfo ) = 0; - + virtual void startCodeLine(bool hasLineNumbers) = 0; /*! Ends a line of code started with startCodeLine() */ @@ -141,29 +142,29 @@ class BaseOutputDocInterface : public CodeOutputInterface public: virtual ~BaseOutputDocInterface() {} enum ParamListTypes { Param, RetVal, Exception }; - enum SectionTypes { /*See, Return, Author, Version, + enum SectionTypes { /*See, Return, Author, Version, Since, Date, Bug, Note, - Warning, Par, Deprecated, Pre, - Post, Invar, Remark, Attention, + Warning, Par, Deprecated, Pre, + Post, Invar, Remark, Attention, Todo, Test, RCS, */ - EnumValues, - Examples + EnumValues, + Examples }; virtual void parseText(const QCString &) {} - + /*! Start of a bullet list: e.g. \c \<ul\> in html. startItemListItem() is * Used for the bullet items. */ virtual void startItemList() = 0; - /*! Writes a list item for a bullet or enumerated - * list: e.g. \c \<li\> in html + /*! Writes a list item for a bullet or enumerated + * list: e.g. \c \<li\> in html */ virtual void startItemListItem() = 0; - /*! Writes a list item for a bullet or enumerated - * list: e.g. \c \</li\> in html + /*! Writes a list item for a bullet or enumerated + * list: e.g. \c \</li\> in html */ virtual void endItemListItem() = 0; @@ -171,7 +172,7 @@ class BaseOutputDocInterface : public CodeOutputInterface virtual void endItemList() = 0; /*! Writes an ASCII string to the output. Converts characters that have - * A special meaning, like \c & in html. + * A special meaning, like \c & in html. */ virtual void docify(const char *s) = 0; @@ -180,8 +181,8 @@ class BaseOutputDocInterface : public CodeOutputInterface */ virtual void writeChar(char c) = 0; - /*! Writes an ASCII string to the output, \e without converting - * special characters. + /*! Writes an ASCII string to the output, \e without converting + * special characters. */ virtual void writeString(const char *text) = 0; @@ -197,8 +198,8 @@ class BaseOutputDocInterface : public CodeOutputInterface * \param ref If this is non-zero, the object is to be found in * an external documentation file. * \param file The file in which the object is located. - * \param anchor The anchor uniquely identifying the object within - * the file. + * \param anchor The anchor uniquely identifying the object within + * the file. * \param name The text to display as a placeholder for the link. */ virtual void writeObjectLink(const char *ref,const char *file, @@ -214,7 +215,7 @@ class BaseOutputDocInterface : public CodeOutputInterface */ virtual void endHtmlLink() = 0; - + /*! Changes the text font to bold face. The bold section ends with * endBold() */ @@ -250,13 +251,13 @@ class BaseOutputDocInterface : public CodeOutputInterface */ virtual void endCodeFragment() = 0; - - + + /*! Writes a horizontal ruler to the output */ virtual void writeRuler() = 0; - - /*! Starts a description list: e.g. \c \<dl\> in HTML + + /*! Starts a description list: e.g. \c \<dl\> in HTML * Items are surrounded by startDescItem() and endDescItem() */ virtual void startDescription() = 0; @@ -270,8 +271,8 @@ class BaseOutputDocInterface : public CodeOutputInterface virtual void startDescForItem() = 0; virtual void endDescForItem() = 0; - /*! Ends an item of a description list and starts the - * description itself: e.g. \c \</dt\> in HTML. + /*! Ends an item of a description list and starts the + * description itself: e.g. \c \</dt\> in HTML. */ virtual void endDescItem() = 0; @@ -324,19 +325,27 @@ class OutputGenerator : public BaseOutputDocInterface public: enum OutputType { Html, Latex, Man, RTF, XML, DEF, Perl , Docbook}; - OutputGenerator(); + OutputGenerator(const char *dir); + OutputGenerator(const OutputGenerator &o); + OutputGenerator &operator=(const OutputGenerator &o); virtual ~OutputGenerator(); + virtual OutputType type() const = 0; + virtual std::unique_ptr<OutputGenerator> clone() const = 0; + /////////////////////////////////////////////////////////////// // generic generator methods /////////////////////////////////////////////////////////////// - virtual void enable() = 0; - virtual void disable() = 0; - virtual void enableIf(OutputType o) = 0; - virtual void disableIf(OutputType o) = 0; - virtual void disableIfNot(OutputType o) = 0; - virtual bool isEnabled(OutputType o) = 0; - virtual OutputGenerator *get(OutputType o) = 0; + void enable(); + void disable(); + void enableIf(OutputType o); + void disableIf(OutputType o); + void disableIfNot(OutputType o); + bool isEnabled(OutputType o); + OutputGenerator *get(OutputType o); + QCString dir() const; + QCString fileName() const; + void startPlainFile(const char *name); void endPlainFile(); //QCString getContents() const; @@ -489,21 +498,18 @@ class OutputGenerator : public BaseOutputDocInterface protected: FTextStream t; - QFile *m_file; - QCString m_fileName; - QCString m_dir; - bool m_active; - QStack<bool> *m_genStack; - private: - OutputGenerator(const OutputGenerator &o); - OutputGenerator &operator=(const OutputGenerator &o); + QCString m_dir; + QCString m_fileName; + QFile m_file; + bool m_active = true; + std::stack<bool> m_genStack; }; /** Interface used for generating documentation. * * This abstract class is used by several functions - * to generate the output for a specific format. + * to generate the output for a specific format. * This interface contains some state saving and changing * functions for dealing with format specific output. */ @@ -512,18 +518,13 @@ class OutputDocInterface : public BaseOutputDocInterface public: virtual ~OutputDocInterface() {} - /*! Create a new output generator. This can later by appended - * to the current one using append(). - */ - //virtual OutputDocInterface *clone() = 0; - - /*! Disables all output formats except format \a o - * (useful for OutputList only) + /*! Disables all output formats except format \a o + * (useful for OutputList only) */ virtual void disableAllBut(OutputGenerator::OutputType o) = 0; /*! Enables all output formats as far as they have been enabled in - * the config file. (useful for OutputList only) + * the config file. (useful for OutputList only) */ virtual void enableAll() = 0; @@ -536,27 +537,26 @@ class OutputDocInterface : public BaseOutputDocInterface /*! Enables a specific output format (useful for OutputList only) */ virtual void enable(OutputGenerator::OutputType o) = 0; - /*! Check whether a specific output format is currently enabled - * (useful for OutputList only) + /*! Check whether a specific output format is currently enabled + * (useful for OutputList only) */ virtual bool isEnabled(OutputGenerator::OutputType o) = 0; /*! Appends the output generated by generator \a g to this * generator. - */ + */ //virtual void append(const OutputDocInterface *g) = 0; - /*! Pushes the state of the current generator (or list of + /*! Pushes the state of the current generator (or list of * generators) on a stack. */ virtual void pushGeneratorState() = 0; - /*! Pops the state of the current generator (or list of + /*! Pops the state of the current generator (or list of * generators) on a stack. Should be preceded by a call * the pushGeneratorState(). */ virtual void popGeneratorState() = 0; }; - #endif |