Orb/Doxygen/src/xmlditadocvisitor.h
changeset 4 468f4c8d3d5b
parent 3 d8fccb2cd802
equal deleted inserted replaced
3:d8fccb2cd802 4:468f4c8d3d5b
     2 #ifndef _XMLDITADOCVISITOR_H
     2 #ifndef _XMLDITADOCVISITOR_H
     3 #define _XMLDITADOCVISITOR_H
     3 #define _XMLDITADOCVISITOR_H
     4 
     4 
     5 #include "docvisitor.h"
     5 #include "docvisitor.h"
     6 #include "xmlwriter.h"
     6 #include "xmlwriter.h"
       
     7 #include "xmlditaparammap.h"
     7 #include <qstack.h>
     8 #include <qstack.h>
     8 #include <qcstring.h>
     9 #include <qcstring.h>
     9 #include <qmap.h>
    10 #include <qmap.h>
    10 #include <qdict.h>
    11 #include <qdict.h>
    11 
    12 
    16 
    17 
    17 /*! @brief Concrete visitor implementation for XML output. */
    18 /*! @brief Concrete visitor implementation for XML output. */
    18 class XmlDitaDocVisitor : public DocVisitor
    19 class XmlDitaDocVisitor : public DocVisitor
    19 {
    20 {
    20   public:
    21   public:
    21     XmlDitaDocVisitor(XmlStream &s,CodeOutputInterface &ci);
    22     XmlDitaDocVisitor(XmlStream &s,CodeOutputInterface &ci, DocBlockContents *docBlockMaps);
    22     
    23     
    23     //--------------------------------------
    24     //--------------------------------------
    24     // visitor functions for leaf nodes
    25     // visitor functions for leaf nodes
    25     //--------------------------------------
    26     //--------------------------------------
    26     
    27     
   115     void visitPre(DocText *);
   116     void visitPre(DocText *);
   116     void visitPost(DocText *);
   117     void visitPost(DocText *);
   117 
   118 
   118 	virtual ~XmlDitaDocVisitor() {}
   119 	virtual ~XmlDitaDocVisitor() {}
   119 
   120 
   120 	const QString query(const QString &paramName) const;
   121 	//const QString query(const QString &paramName) const;
   121 	QDictIterator<QString> queryIterator()
       
   122 	{
       
   123 		return QDictIterator<QString>(paramDict);
       
   124 	}
       
   125   private:
   122   private:
   126 
   123 
   127     //--------------------------------------
   124     //--------------------------------------
   128     // helper functions 
   125     // helper functions 
   129     //--------------------------------------
   126     //--------------------------------------
   131     void filter(const char *str);
   128     void filter(const char *str);
   132     void startLink(const QString &ref,const QString &file,
   129     void startLink(const QString &ref,const QString &file,
   133                    const QString &anchor);
   130                    const QString &anchor);
   134     void endLink();
   131     void endLink();
   135 
   132 
       
   133 	bool canWriteToXmlStream() const;
       
   134 	bool shouldAddTextToReturnDoc() const;
       
   135 	bool canLoadParameterMap() const;
       
   136 	void checkSimpleTable(const QString &tagName);
       
   137 	void addStrowToSimpleTableOnPop(const QString &tagName);
   136 	void write(const QString &string);
   138 	void write(const QString &string);
   137 	void push(const QString &tagName);
   139 	void push(const QString &tagName);
   138 	void push(const QString &tagName, const QString &key, const QString &value);
   140 	void push(const QString &tagName, const QString &key, const QString &value);
   139 	void push(const QString &tagName, AttributeMap &map);
   141 	void push(const QString &tagName, AttributeMap &map);
       
   142 	void pop();
   140 	void pop(const QString &tagName);
   143 	void pop(const QString &tagName);
   141 	void pushpop(const QString &tagName);
   144 	void pushpop(const QString &tagName);
   142 	void pushpop(const QString &tagName, const QString &text);	
   145 	void pushpop(const QString &tagName, const QString &text);
   143 
   146 	// Definition list stuff
       
   147 	void pushDl(const QString &outputClass);
       
   148 	void popDl();
   144     void pushEnabled();
   149     void pushEnabled();
   145     void popEnabled();
   150     void popEnabled();
   146 	// Default pop of a single element
   151 	// Default pop of a single element
   147 	void visitPreDefault(const QString &elem);
   152 	void visitPreDefault(const QString &elem);
   148 	// Default pop of a single element
   153 	// Default pop of a single element
   160     CodeOutputInterface &m_ci;
   165     CodeOutputInterface &m_ci;
   161     bool m_insidePre;
   166     bool m_insidePre;
   162     bool m_hide;
   167     bool m_hide;
   163     QStack<bool> m_enabled;
   168     QStack<bool> m_enabled;
   164     QCString m_langExt;
   169     QCString m_langExt;
       
   170 	// Parameter capture
   165 	bool m_insideParamlist;
   171 	bool m_insideParamlist;
   166 	QMap<int, QString> paramMap;
   172 	bool m_paramIsTemplate;
   167 	QDict<QString> paramDict;
   173 	//QDict<QString> paramDict;
   168 	QString currParam;
   174 	QString currParam;
       
   175 	DocBlockContents *m_docBlockMaps;
       
   176 	// State flag for when we are writing definition lists
       
   177 	bool m_writingDl;
       
   178 	// Used to detect if we need to insert an empty \<strow\>
       
   179 	// in a \<simpletable\>. This is set/cleared by push/pop.
       
   180 	bool m_mustInsertStrow;
       
   181 	// This is used to help lazy evaluation of a stentry that might be
       
   182 	// either within a sthead or a strow. It is only at the point of
       
   183 	// getting a stentry that we can decide which one to use
       
   184 	bool m_strowOrStheadIsPending;
       
   185 	// Adds text to m_docBlockMaps->returnDoc
       
   186 	bool m_addTextToReturnDoc;
       
   187 	// Keeps track of the number of XmlDitaDocVisitor::visitPre(DocPara*) events
       
   188 	// that do NOT result in a <p> element being written.
       
   189 	// This is incremented by XmlDitaDocVisitor::visitPre(DocPara*) when canPushPara()
       
   190 	// and is decremented by XmlDitaDocVisitor::visitPost(DocPara*). Only when this is
       
   191 	// zero can a XmlDitaDocVisitor::visitPost(DocPara*) cause a </p>
       
   192 	int m_paraRefCount;
   169 };
   193 };
   170 
   194 
   171 #endif //_XMLDITADOCVISITOR_H
   195 #endif //_XMLDITADOCVISITOR_H