00001 /****************************************************************************** 00002 * 00003 * $Id: $ 00004 * 00005 * 00006 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00007 * 00008 * Permission to use, copy, modify, and distribute this software and its 00009 * documentation under the terms of the GNU General Public License is hereby 00010 * granted. No representations are made about the suitability of this software 00011 * for any purpose. It is provided "as is" without express or implied warranty. 00012 * See the GNU General Public License for more details. 00013 * 00014 * Documents produced by Doxygen are derivative works derived from the 00015 * input used in their production; they are not affected by this license. 00016 * 00017 */ 00018 00019 #ifndef _HTMLDOCVISITOR_H 00020 #define _HTMLDOCVISITOR_H 00021 00022 #include "docvisitor.h" 00023 #include <qstack.h> 00024 #include <qcstring.h> 00025 00026 class QTextStream; 00027 class CodeOutputInterface; 00028 class QString; 00029 00031 class HtmlDocVisitor : public DocVisitor 00032 { 00033 public: 00034 HtmlDocVisitor(QTextStream &t,CodeOutputInterface &ci,const char *langExt); 00035 00036 //-------------------------------------- 00037 // visitor functions for leaf nodes 00038 //-------------------------------------- 00039 00040 void visit(DocWord *); 00041 void visit(DocLinkedWord *); 00042 void visit(DocWhiteSpace *); 00043 void visit(DocSymbol *); 00044 void visit(DocURL *); 00045 void visit(DocLineBreak *); 00046 void visit(DocHorRuler *); 00047 void visit(DocStyleChange *); 00048 void visit(DocVerbatim *); 00049 void visit(DocAnchor *); 00050 void visit(DocInclude *); 00051 void visit(DocIncOperator *); 00052 void visit(DocFormula *); 00053 void visit(DocIndexEntry *); 00054 00055 //-------------------------------------- 00056 // visitor functions for compound nodes 00057 //-------------------------------------- 00058 00059 void visitPre(DocAutoList *); 00060 void visitPost(DocAutoList *); 00061 void visitPre(DocAutoListItem *); 00062 void visitPost(DocAutoListItem *); 00063 void visitPre(DocPara *) ; 00064 void visitPost(DocPara *); 00065 void visitPre(DocRoot *); 00066 void visitPost(DocRoot *); 00067 void visitPre(DocSimpleSect *); 00068 void visitPost(DocSimpleSect *); 00069 void visitPre(DocTitle *); 00070 void visitPost(DocTitle *); 00071 void visitPre(DocSimpleList *); 00072 void visitPost(DocSimpleList *); 00073 void visitPre(DocSimpleListItem *); 00074 void visitPost(DocSimpleListItem *); 00075 void visitPre(DocSection *); 00076 void visitPost(DocSection *); 00077 void visitPre(DocHtmlList *); 00078 void visitPost(DocHtmlList *) ; 00079 void visitPre(DocHtmlListItem *); 00080 void visitPost(DocHtmlListItem *); 00081 void visitPre(DocHtmlDescList *); 00082 void visitPost(DocHtmlDescList *); 00083 void visitPre(DocHtmlDescTitle *); 00084 void visitPost(DocHtmlDescTitle *); 00085 void visitPre(DocHtmlDescData *); 00086 void visitPost(DocHtmlDescData *); 00087 void visitPre(DocHtmlTable *); 00088 void visitPost(DocHtmlTable *); 00089 void visitPre(DocHtmlRow *); 00090 void visitPost(DocHtmlRow *) ; 00091 void visitPre(DocHtmlCell *); 00092 void visitPost(DocHtmlCell *); 00093 void visitPre(DocHtmlCaption *); 00094 void visitPost(DocHtmlCaption *); 00095 void visitPre(DocInternal *); 00096 void visitPost(DocInternal *); 00097 void visitPre(DocHRef *); 00098 void visitPost(DocHRef *); 00099 void visitPre(DocHtmlHeader *); 00100 void visitPost(DocHtmlHeader *); 00101 void visitPre(DocImage *); 00102 void visitPost(DocImage *); 00103 void visitPre(DocDotFile *); 00104 void visitPost(DocDotFile *); 00105 void visitPre(DocLink *); 00106 void visitPost(DocLink *); 00107 void visitPre(DocRef *); 00108 void visitPost(DocRef *); 00109 void visitPre(DocSecRefItem *); 00110 void visitPost(DocSecRefItem *); 00111 void visitPre(DocSecRefList *); 00112 void visitPost(DocSecRefList *); 00113 void visitPre(DocParamSect *); 00114 void visitPost(DocParamSect *); 00115 void visitPre(DocParamList *); 00116 void visitPost(DocParamList *); 00117 void visitPre(DocXRefItem *); 00118 void visitPost(DocXRefItem *); 00119 void visitPre(DocInternalRef *); 00120 void visitPost(DocInternalRef *); 00121 void visitPre(DocCopy *); 00122 void visitPost(DocCopy *); 00123 void visitPre(DocText *); 00124 void visitPost(DocText *); 00125 00126 private: 00127 00128 //-------------------------------------- 00129 // helper functions 00130 //-------------------------------------- 00131 00132 void filter(const char *str); 00133 void filterQuotedCdataAttr(const char* str); 00134 void startLink(const QString &ref,const QString &file, 00135 const QString &relPath,const QString &anchor, 00136 const QString &tooltip = QString::null); 00137 void endLink(); 00138 void writeDotFile(const QString &fileName,const QString &relPath,const QString &context); 00139 void writeMscFile(const QString &fileName,const QString &relPath,const QString &context); 00140 00141 void pushEnabled(); 00142 void popEnabled(); 00143 00144 //-------------------------------------- 00145 // state variables 00146 //-------------------------------------- 00147 00148 QTextStream &m_t; 00149 CodeOutputInterface &m_ci; 00150 bool m_insidePre; 00151 bool m_hide; 00152 QStack<bool> m_enabled; 00153 QCString m_langExt; 00154 }; 00155 00156 #endif