Imported Upstream version 1.9.8
[platform/upstream/doxygen.git] / src / xmldocvisitor.h
index c65688f..4439c82 100644 (file)
@@ -1,13 +1,13 @@
 /******************************************************************************
  *
- * 
+ *
  *
  *
  * 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.
  *
  *
  */
 
-#ifndef _XMLDOCVISITOR_H
-#define _XMLDOCVISITOR_H
+#ifndef XMLDOCVISITOR_H
+#define XMLDOCVISITOR_H
+
+#include <iostream>
 
+#include "qcstring.h"
 #include "docvisitor.h"
-#include <qstack.h>
-#include <qcstring.h>
+#include "docnode.h"
+#include "textstream.h"
 
-class FTextStream;
-class CodeOutputInterface;
+class OutputCodeList;
 class QCString;
 
 /*! @brief Concrete visitor implementation for XML output. */
 class XmlDocVisitor : public DocVisitor
 {
   public:
-    XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci);
-    
+    XmlDocVisitor(TextStream &t,OutputCodeList &ci,const QCString &langExt);
+
     //--------------------------------------
     // visitor functions for leaf nodes
     //--------------------------------------
-    
-    void visit(DocWord *);
-    void visit(DocLinkedWord *);
-    void visit(DocWhiteSpace *);
-    void visit(DocSymbol *);
-    void visit(DocURL *);
-    void visit(DocLineBreak *);
-    void visit(DocHorRuler *);
-    void visit(DocStyleChange *);
-    void visit(DocVerbatim *);
-    void visit(DocAnchor *);
-    void visit(DocInclude *);
-    void visit(DocIncOperator *);
-    void visit(DocFormula *);
-    void visit(DocIndexEntry *);
-    void visit(DocSimpleSectSep *);
-    void visit(DocCite *);
+
+    void operator()(const DocWord &);
+    void operator()(const DocLinkedWord &);
+    void operator()(const DocWhiteSpace &);
+    void operator()(const DocSymbol &);
+    void operator()(const DocEmoji &);
+    void operator()(const DocURL &);
+    void operator()(const DocLineBreak &);
+    void operator()(const DocHorRuler &);
+    void operator()(const DocStyleChange &);
+    void operator()(const DocVerbatim &);
+    void operator()(const DocAnchor &);
+    void operator()(const DocInclude &);
+    void operator()(const DocIncOperator &);
+    void operator()(const DocFormula &);
+    void operator()(const DocIndexEntry &);
+    void operator()(const DocSimpleSectSep &);
+    void operator()(const DocCite &);
+    void operator()(const DocSeparator &);
 
     //--------------------------------------
     // visitor functions for compound nodes
     //--------------------------------------
-    
-    void visitPre(DocAutoList *);
-    void visitPost(DocAutoList *);
-    void visitPre(DocAutoListItem *);
-    void visitPost(DocAutoListItem *);
-    void visitPre(DocPara *) ;
-    void visitPost(DocPara *);
-    void visitPre(DocRoot *);
-    void visitPost(DocRoot *);
-    void visitPre(DocSimpleSect *);
-    void visitPost(DocSimpleSect *);
-    void visitPre(DocTitle *);
-    void visitPost(DocTitle *);
-    void visitPre(DocSimpleList *);
-    void visitPost(DocSimpleList *);
-    void visitPre(DocSimpleListItem *);
-    void visitPost(DocSimpleListItem *);
-    void visitPre(DocSection *);
-    void visitPost(DocSection *);
-    void visitPre(DocHtmlList *);
-    void visitPost(DocHtmlList *) ;
-    void visitPre(DocHtmlListItem *);
-    void visitPost(DocHtmlListItem *);
-    //void visitPre(DocHtmlPre *);
-    //void visitPost(DocHtmlPre *);
-    void visitPre(DocHtmlDescList *);
-    void visitPost(DocHtmlDescList *);
-    void visitPre(DocHtmlDescTitle *);
-    void visitPost(DocHtmlDescTitle *);
-    void visitPre(DocHtmlDescData *);
-    void visitPost(DocHtmlDescData *);
-    void visitPre(DocHtmlTable *);
-    void visitPost(DocHtmlTable *);
-    void visitPre(DocHtmlRow *);
-    void visitPost(DocHtmlRow *) ;
-    void visitPre(DocHtmlCell *);
-    void visitPost(DocHtmlCell *);
-    void visitPre(DocHtmlCaption *);
-    void visitPost(DocHtmlCaption *);
-    void visitPre(DocInternal *);
-    void visitPost(DocInternal *);
-    void visitPre(DocHRef *);
-    void visitPost(DocHRef *);
-    void visitPre(DocHtmlHeader *);
-    void visitPost(DocHtmlHeader *);
-    void visitPre(DocImage *);
-    void visitPost(DocImage *);
-    void visitPre(DocDotFile *);
-    void visitPost(DocDotFile *);
 
-    void visitPre(DocMscFile *);
-    void visitPost(DocMscFile *);
-    void visitPre(DocDiaFile *);
-    void visitPost(DocDiaFile *);
-    void visitPre(DocLink *);
-    void visitPost(DocLink *);
-    void visitPre(DocRef *);
-    void visitPost(DocRef *);
-    void visitPre(DocSecRefItem *);
-    void visitPost(DocSecRefItem *);
-    void visitPre(DocSecRefList *);
-    void visitPost(DocSecRefList *);
-    //void visitPre(DocLanguage *);
-    //void visitPost(DocLanguage *);
-    void visitPre(DocParamSect *);
-    void visitPost(DocParamSect *);
-    void visitPre(DocParamList *);
-    void visitPost(DocParamList *);
-    void visitPre(DocXRefItem *);
-    void visitPost(DocXRefItem *);
-    void visitPre(DocInternalRef *);
-    void visitPost(DocInternalRef *);
-    void visitPre(DocCopy *);
-    void visitPost(DocCopy *);
-    void visitPre(DocText *);
-    void visitPost(DocText *);
-    void visitPre(DocHtmlBlockQuote *);
-    void visitPost(DocHtmlBlockQuote *);
-    void visitPre(DocVhdlFlow *);
-    void visitPost(DocVhdlFlow *);
-    void visitPre(DocParBlock *);
-    void visitPost(DocParBlock *);
+    void operator()(const DocAutoList &);
+    void operator()(const DocAutoListItem &);
+    void operator()(const DocPara &) ;
+    void operator()(const DocRoot &);
+    void operator()(const DocSimpleSect &);
+    void operator()(const DocTitle &);
+    void operator()(const DocSimpleList &);
+    void operator()(const DocSimpleListItem &);
+    void operator()(const DocSection &);
+    void operator()(const DocHtmlList &);
+    void operator()(const DocHtmlListItem &);
+    void operator()(const DocHtmlDescList &);
+    void operator()(const DocHtmlDescTitle &);
+    void operator()(const DocHtmlDescData &);
+    void operator()(const DocHtmlTable &);
+    void operator()(const DocHtmlRow &);
+    void operator()(const DocHtmlCell &);
+    void operator()(const DocHtmlCaption &);
+    void operator()(const DocInternal &);
+    void operator()(const DocHRef &);
+    void operator()(const DocHtmlSummary &);
+    void operator()(const DocHtmlDetails &);
+    void operator()(const DocHtmlHeader &);
+    void operator()(const DocImage &);
+    void operator()(const DocDotFile &);
+    void operator()(const DocMscFile &);
+    void operator()(const DocDiaFile &);
+    void operator()(const DocLink &);
+    void operator()(const DocRef &);
+    void operator()(const DocSecRefItem &);
+    void operator()(const DocSecRefList &);
+    void operator()(const DocParamSect &);
+    void operator()(const DocParamList &);
+    void operator()(const DocXRefItem &);
+    void operator()(const DocInternalRef &);
+    void operator()(const DocText &);
+    void operator()(const DocHtmlBlockQuote &);
+    void operator()(const DocVhdlFlow &);
+    void operator()(const DocParBlock &);
 
   private:
+    template<class T>
+    void visitChildren(const T &t)
+    {
+      for (const auto &child : t.children())
+      {
+        std::visit(*this, child);
+      }
+    }
 
     //--------------------------------------
-    // helper functions 
+    // helper functions
     //--------------------------------------
-    
-    void filter(const char *str);
+
+    void filter(const QCString &str);
     void startLink(const QCString &ref,const QCString &file,
                    const QCString &anchor);
     void endLink();
 
-    void pushEnabled();
-    void popEnabled();
-
     //--------------------------------------
     // state variables
     //--------------------------------------
 
-    FTextStream &m_t;
-    CodeOutputInterface &m_ci;
+    TextStream &m_t;
+    OutputCodeList &m_ci;
     bool m_insidePre;
     bool m_hide;
-    QStack<bool> m_enabled;
     QCString m_langExt;
 };