My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
docparser.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  *
4  *
5  *
6  * Copyright (C) 1997-2015 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby
10  * granted. No representations are made about the suitability of this software
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18 
19 #ifndef _DOCPARSER_H
20 #define _DOCPARSER_H
21 
22 #include <stdio.h>
23 
24 #include <qlist.h>
25 #include <qcstring.h>
26 
27 #include "docvisitor.h"
28 #include "htmlattrib.h"
29 
30 class DocNode;
31 class MemberDef;
32 class Definition;
33 class MemberGroup;
34 class SectionDict;
35 
36 //---------------------------------------------------------------------------
37 
38 
59 DocRoot *validatingParseDoc(const char *fileName,int startLine,
60  Definition *context, MemberDef *md,
61  const char *input,bool indexWords,
62  bool isExample,const char *exampleName=0,
63  bool singleLine=FALSE,bool linkFromIndex=FALSE);
64 
68 DocText *validatingParseText(const char *input);
69 
71 void docFindSections(const char *input,
72  Definition *d,
73  MemberGroup *m,
74  const char *fileName);
75 
76 //---------------------------------------------------------------------------
77 
79 class DocNode
80 {
81  public:
83  enum Kind { Kind_Root = 0,
84  Kind_Word = 1,
86  Kind_Para = 3,
90  Kind_URL = 7,
93  Kind_Title = 10,
113  Kind_HRef = 30,
119  Kind_Link = 36,
120  Kind_Ref = 37,
129  Kind_Copy = 46,
130  Kind_Text = 47,
136  };
138  DocNode() : m_parent(0), m_insidePre(FALSE) {}
139 
141  virtual ~DocNode() {}
142 
144  virtual Kind kind() const = 0;
145 
147  DocNode *parent() const { return m_parent; }
148 
151 
155  virtual void accept(DocVisitor *v) = 0;
156 
158  bool isPreformatted() const { return m_insidePre; }
159 
160  protected:
162  void setInsidePreformatted(bool p) { m_insidePre = p; }
164  private:
165 
167 };
168 
172 template<class T> class CompAccept
173 {
174  public:
175  CompAccept() { m_children.setAutoDelete(TRUE); }
176  virtual ~CompAccept() {}
177  void accept(T *obj, DocVisitor *v)
178  {
179  v->visitPre(obj);
180  QListIterator<DocNode> cli(m_children);
181  DocNode *n;
182  for (cli.toFirst();(n=cli.current());++cli) n->accept(v);
183  v->visitPost(obj);
184  }
185  const QList<DocNode> &children() const { return m_children; }
186  QList<DocNode> &children() { return m_children; }
187 
188  protected:
189  QList<DocNode> m_children;
190 };
191 
192 
195 class DocWord : public DocNode
196 {
197  public:
198  DocWord(DocNode *parent,const QCString &word);
199  QCString word() const { return m_word; }
200  Kind kind() const { return Kind_Word; }
201  void accept(DocVisitor *v) { v->visit(this); }
202 
203  private:
204  QCString m_word;
205 };
206 
209 class DocLinkedWord : public DocNode
210 {
211  public:
212  DocLinkedWord(DocNode *parent,const QCString &word,
213  const QCString &ref,const QCString &file,
214  const QCString &anchor,const QCString &tooltip);
215  QCString word() const { return m_word; }
216  Kind kind() const { return Kind_LinkedWord; }
217  QCString file() const { return m_file; }
218  QCString relPath() const { return m_relPath; }
219  QCString ref() const { return m_ref; }
220  QCString anchor() const { return m_anchor; }
221  QCString tooltip() const { return m_tooltip; }
222  void accept(DocVisitor *v) { v->visit(this); }
223 
224  private:
225  QCString m_word;
226  QCString m_ref;
227  QCString m_file;
228  QCString m_relPath;
229  QCString m_anchor;
230  QCString m_tooltip;
231 };
232 
234 class DocURL : public DocNode
235 {
236  public:
237  DocURL(DocNode *parent,const QCString &url,bool isEmail) :
238  m_url(url), m_isEmail(isEmail) { m_parent=parent; }
239  QCString url() const { return m_url; }
240  Kind kind() const { return Kind_URL; }
241  void accept(DocVisitor *v) { v->visit(this); }
242  bool isEmail() const { return m_isEmail; }
243 
244  private:
245  QCString m_url;
246  bool m_isEmail;
247 };
248 
250 class DocLineBreak : public DocNode
251 {
252  public:
254  Kind kind() const { return Kind_LineBreak; }
255  void accept(DocVisitor *v) { v->visit(this); }
256 
257  private:
258 };
259 
261 class DocHorRuler : public DocNode
262 {
263  public:
265  Kind kind() const { return Kind_HorRuler; }
266  void accept(DocVisitor *v) { v->visit(this); }
267 
268  private:
269 };
270 
272 class DocAnchor : public DocNode
273 {
274  public:
275  DocAnchor(DocNode *parent,const QCString &id,bool newAnchor);
276  Kind kind() const { return Kind_Anchor; }
277  QCString anchor() const { return m_anchor; }
278  QCString file() const { return m_file; }
279  void accept(DocVisitor *v) { v->visit(this); }
280 
281  private:
282  QCString m_anchor;
283  QCString m_file;
284 };
285 
287 class DocCite : public DocNode
288 {
289  public:
290  DocCite(DocNode *parent,const QCString &target,const QCString &context);
291  Kind kind() const { return Kind_Ref; }
292  QCString file() const { return m_file; }
293  QCString relPath() const { return m_relPath; }
294  QCString ref() const { return m_ref; }
295  QCString anchor() const { return m_anchor; }
296  QCString text() const { return m_text; }
297  void accept(DocVisitor *v) { v->visit(this); }
298 
299  private:
300  QCString m_file;
301  QCString m_relPath;
302  QCString m_ref;
303  QCString m_anchor;
304  QCString m_text;
305 };
306 
307 
309 class DocStyleChange : public DocNode
310 {
311  public:
312  enum Style { Bold = (1<<0),
313  Italic = (1<<1),
314  Code = (1<<2),
315  Center = (1<<3),
316  Small = (1<<4),
317  Subscript = (1<<5),
318  Superscript = (1<<6),
319  Preformatted = (1<<7),
320  Span = (1<<8),
321  Div = (1<<9)
322  };
323 
325  const HtmlAttribList *attribs=0) :
326  m_position(position), m_style(s), m_enable(enable)
327  { m_parent = parent; if (attribs) m_attribs=*attribs; }
328  Kind kind() const { return Kind_StyleChange; }
329  Style style() const { return m_style; }
330  const char *styleString() const;
331  bool enable() const { return m_enable; }
332  uint position() const { return m_position; }
333  void accept(DocVisitor *v) { v->visit(this); }
334  const HtmlAttribList &attribs() const { return m_attribs; }
335 
336  private:
339  bool m_enable;
341 };
342 
344 class DocSymbol : public DocNode
345 {
346  public:
347  enum SymType { Sym_Unknown = -1,
399 
400  /* doxygen extensions */
402 
403  /* doxygen commands mapped */
407  };
411  };
412  typedef struct PerlSymb {
413  const char *symb;
414  const PerlType type;
415  }PerlSymb;
417  m_symbol(s) { m_parent = parent; }
418  SymType symbol() const { return m_symbol; }
419  Kind kind() const { return Kind_Symbol; }
420  void accept(DocVisitor *v) { v->visit(this); }
421  static SymType decodeSymbol(const QCString &symName);
422 
423  private:
425 };
426 
428 class DocWhiteSpace : public DocNode
429 {
430  public:
431  DocWhiteSpace(DocNode *parent,const QCString &chars) :
432  m_chars(chars) { m_parent = parent; }
433  Kind kind() const { return Kind_WhiteSpace; }
434  QCString chars() const { return m_chars; }
435  void accept(DocVisitor *v) { v->visit(this); }
436  private:
437  QCString m_chars;
438 };
439 
441 class DocVerbatim : public DocNode
442 {
443  public:
445  DocVerbatim(DocNode *parent,const QCString &context,
446  const QCString &text, Type t,bool isExample,
447  const QCString &exampleFile,bool isBlock=FALSE,const QCString &lang=QCString());
448  Kind kind() const { return Kind_Verbatim; }
449  Type type() const { return m_type; }
450  QCString text() const { return m_text; }
451  QCString context() const { return m_context; }
452  void accept(DocVisitor *v) { v->visit(this); }
453  bool isExample() const { return m_isExample; }
454  QCString exampleFile() const { return m_exampleFile; }
455  QCString relPath() const { return m_relPath; }
456  QCString language() const { return m_lang; }
457  bool isBlock() const { return m_isBlock; }
458  bool hasCaption() const { return !m_children.isEmpty(); }
459  QCString width() const { return m_width; }
460  QCString height() const { return m_height; }
461  const QList<DocNode> &children() const { return m_children; }
462  QList<DocNode> &children() { return m_children; }
463  void setText(const QCString &t) { m_text=t; }
464  void setWidth(const QCString &w) { m_width=w; }
465  void setHeight(const QCString &h) { m_height=h; }
466 
467  private:
468  QCString m_context;
469  QCString m_text;
472  QCString m_exampleFile;
473  QCString m_relPath;
474  QCString m_lang;
475  bool m_isBlock;
476  QCString m_width;
477  QCString m_height;
478  QList<DocNode> m_children;
479 };
480 
481 
483 class DocInclude : public DocNode
484 {
485  public:
487  DocInclude(DocNode *parent,const QCString &file,
488  const QCString context, Type t,
489  bool isExample,const QCString exampleFile,
490  const QCString blockId) :
491  m_file(file), m_context(context), m_type(t),
492  m_isExample(isExample), m_exampleFile(exampleFile),
493  m_blockId(blockId) { m_parent = parent; }
494  Kind kind() const { return Kind_Include; }
495  QCString file() const { return m_file; }
496  QCString extension() const { int i=m_file.findRev('.');
497  if (i!=-1)
498  return m_file.right(m_file.length()-i);
499  else
500  return "";
501  }
502  Type type() const { return m_type; }
503  QCString text() const { return m_text; }
504  QCString context() const { return m_context; }
505  QCString blockId() const { return m_blockId; }
506  bool isExample() const { return m_isExample; }
507  QCString exampleFile() const { return m_exampleFile; }
508  void accept(DocVisitor *v) { v->visit(this); }
509  void parse();
510 
511  private:
512  QCString m_file;
513  QCString m_context;
514  QCString m_text;
517  QCString m_exampleFile;
518  QCString m_blockId;
519 };
520 
522 class DocIncOperator : public DocNode
523 {
524  public:
525  enum Type { Line, SkipLine, Skip, Until };
526  DocIncOperator(DocNode *parent,Type t,const QCString &pat,
527  const QCString &context,bool isExample,const QCString &exampleFile) :
528  m_type(t), m_pattern(pat), m_context(context),
529  m_isFirst(FALSE), m_isLast(FALSE),
530  m_isExample(isExample), m_exampleFile(exampleFile) { m_parent = parent; }
531  Kind kind() const { return Kind_IncOperator; }
532  Type type() const { return m_type; }
533  QCString text() const { return m_text; }
534  QCString pattern() const { return m_pattern; }
535  QCString context() const { return m_context; }
536  void accept(DocVisitor *v) { v->visit(this); }
537  bool isFirst() const { return m_isFirst; }
538  bool isLast() const { return m_isLast; }
539  void markFirst(bool v=TRUE) { m_isFirst = v; }
540  void markLast(bool v=TRUE) { m_isLast = v; }
541  bool isExample() const { return m_isExample; }
542  QCString exampleFile() const { return m_exampleFile; }
543  void parse();
544 
545  private:
547  QCString m_text;
548  QCString m_pattern;
549  QCString m_context;
550  bool m_isFirst;
551  bool m_isLast;
553  QCString m_exampleFile;
554 };
555 
557 class DocFormula : public DocNode
558 {
559  public:
560  DocFormula(DocNode *parent,int id);
561  Kind kind() const { return Kind_Formula; }
562  QCString name() const { return m_name; }
563  QCString text() const { return m_text; }
564  QCString relPath() const { return m_relPath; }
565  int id() const { return m_id; }
566  void accept(DocVisitor *v) { v->visit(this); }
567  bool isInline() { return m_text.length()>0 ? m_text.at(0)!='\\' : TRUE; }
568 
569  private:
570  QCString m_name;
571  QCString m_text;
572  QCString m_relPath;
573  int m_id;
574 };
575 
577 class DocIndexEntry : public DocNode
578 {
579  public:
581  : m_scope(scope), m_member(md){ m_parent = parent; }
582  Kind kind() const { return Kind_IndexEntry; }
583  int parse();
584  Definition *scope() const { return m_scope; }
585  MemberDef *member() const { return m_member; }
586  QCString entry() const { return m_entry; }
587  void accept(DocVisitor *v) { v->visit(this); }
588 
589  private:
590  QCString m_entry;
593 };
594 
595 //-----------------------------------------------------------------------
596 
598 class DocCopy : public DocNode
599 {
600  public:
601  DocCopy(DocNode *parent,const QCString &link,bool copyBrief,bool copyDetails)
602  : m_link(link),
603  m_copyBrief(copyBrief), m_copyDetails(copyDetails) { m_parent = parent; }
604  Kind kind() const { return Kind_Copy; }
605  QCString link() const { return m_link; }
606  void accept(DocVisitor * /*v*/) { /*CompAccept<DocCopy>::accept(this,v);*/ }
607  void parse(QList<DocNode> &children);
608 
609  private:
610  QCString m_link;
613 };
614 
616 class DocAutoList : public CompAccept<DocAutoList>, public DocNode
617 {
618  public:
620  Kind kind() const { return Kind_AutoList; }
621  bool isEnumList() const { return m_isEnumList; }
622  int indent() const { return m_indent; }
623  int depth() const { return m_depth; }
625  int parse();
626 
627  private:
628  int m_indent;
630  int m_depth;
631 };
632 
634 class DocAutoListItem : public CompAccept<DocAutoListItem>, public DocNode
635 {
636  public:
637  DocAutoListItem(DocNode *parent,int indent,int num);
638  Kind kind() const { return Kind_AutoListItem; }
639  int itemNumber() const { return m_itemNum; }
641  int parse();
642 
643  private:
644  int m_indent;
646 };
647 
648 
649 
651 class DocTitle : public CompAccept<DocTitle>, public DocNode
652 {
653  public:
655  void parse();
656  void parseFromString(const QCString &title);
657  Kind kind() const { return Kind_Title; }
659 
660  private:
661 };
662 
664 class DocXRefItem : public CompAccept<DocXRefItem>, public DocNode
665 {
666  public:
667  DocXRefItem(DocNode *parent,int id,const char *key);
668  Kind kind() const { return Kind_XRefItem; }
669  QCString file() const { return m_file; }
670  QCString anchor() const { return m_anchor; }
671  QCString title() const { return m_title; }
672  QCString relPath() const { return m_relPath; }
673  QCString key() const { return m_key; }
675  bool parse();
676 
677  private:
678  int m_id;
679  QCString m_key;
680  QCString m_file;
681  QCString m_anchor;
682  QCString m_title;
683  QCString m_relPath;
684 };
685 
687 class DocImage : public CompAccept<DocImage>, public DocNode
688 {
689  public:
690  enum Type { Html, Latex, Rtf, DocBook };
692  const QCString &name,Type t,const QCString &url=QCString());
693  Kind kind() const { return Kind_Image; }
694  Type type() const { return m_type; }
695  QCString name() const { return m_name; }
696  bool hasCaption() const { return !m_children.isEmpty(); }
697  QCString width() const { return m_width; }
698  QCString height() const { return m_height; }
699  QCString relPath() const { return m_relPath; }
700  QCString url() const { return m_url; }
701  const HtmlAttribList &attribs() const { return m_attribs; }
703  void parse();
704 
705  private:
707  QCString m_name;
709  QCString m_width;
710  QCString m_height;
711  QCString m_relPath;
712  QCString m_url;
713 };
714 
716 class DocDotFile : public CompAccept<DocDotFile>, public DocNode
717 {
718  public:
719  DocDotFile(DocNode *parent,const QCString &name,const QCString &context);
720  void parse();
721  Kind kind() const { return Kind_DotFile; }
722  QCString name() const { return m_name; }
723  QCString file() const { return m_file; }
724  QCString relPath() const { return m_relPath; }
725  bool hasCaption() const { return !m_children.isEmpty(); }
726  QCString width() const { return m_width; }
727  QCString height() const { return m_height; }
728  QCString context() const { return m_context; }
730  private:
731  QCString m_name;
732  QCString m_file;
733  QCString m_relPath;
734  QCString m_width;
735  QCString m_height;
736  QCString m_context;
737 };
738 
740 class DocMscFile : public CompAccept<DocMscFile>, public DocNode
741 {
742  public:
743  DocMscFile(DocNode *parent,const QCString &name,const QCString &context);
744  void parse();
745  Kind kind() const { return Kind_MscFile; }
746  QCString name() const { return m_name; }
747  QCString file() const { return m_file; }
748  QCString relPath() const { return m_relPath; }
749  bool hasCaption() const { return !m_children.isEmpty(); }
750  QCString width() const { return m_width; }
751  QCString height() const { return m_height; }
752  QCString context() const { return m_context; }
754  private:
755  QCString m_name;
756  QCString m_file;
757  QCString m_relPath;
758  QCString m_width;
759  QCString m_height;
760  QCString m_context;
761 };
762 
764 class DocDiaFile : public CompAccept<DocDiaFile>, public DocNode
765 {
766  public:
767  DocDiaFile(DocNode *parent,const QCString &name,const QCString &context);
768  void parse();
769  Kind kind() const { return Kind_DiaFile; }
770  QCString name() const { return m_name; }
771  QCString file() const { return m_file; }
772  QCString relPath() const { return m_relPath; }
773  bool hasCaption() const { return !m_children.isEmpty(); }
774  QCString width() const { return m_width; }
775  QCString height() const { return m_height; }
776  QCString context() const { return m_context; }
778  private:
779  QCString m_name;
780  QCString m_file;
781  QCString m_relPath;
782  QCString m_width;
783  QCString m_height;
784  QCString m_context;
785 };
786 
788 class DocVhdlFlow : public CompAccept<DocVhdlFlow>, public DocNode
789 {
790  public:
792  void parse();
793  Kind kind() const { return Kind_VhdlFlow; }
794  bool hasCaption() { return !m_children.isEmpty(); }
796  private:
797 };
798 
800 class DocLink : public CompAccept<DocLink>, public DocNode
801 {
802  public:
803  DocLink(DocNode *parent,const QCString &target);
804  QCString parse(bool,bool isXmlLink=FALSE);
805  Kind kind() const { return Kind_Link; }
806  QCString file() const { return m_file; }
807  QCString relPath() const { return m_relPath; }
808  QCString ref() const { return m_ref; }
809  QCString anchor() const { return m_anchor; }
811 
812  private:
813  QCString m_file;
814  QCString m_relPath;
815  QCString m_ref;
816  QCString m_anchor;
817  QCString m_refText;
818 };
819 
821 class DocRef : public CompAccept<DocRef>, public DocNode
822 {
823  public:
824  DocRef(DocNode *parent,const QCString &target,const QCString &context);
825  void parse();
826  Kind kind() const { return Kind_Ref; }
827  QCString file() const { return m_file; }
828  QCString relPath() const { return m_relPath; }
829  QCString ref() const { return m_ref; }
830  QCString anchor() const { return m_anchor; }
831  QCString targetTitle() const { return m_text; }
832  bool hasLinkText() const { return !m_children.isEmpty(); }
833  bool refToAnchor() const { return m_refType==Anchor; }
834  bool refToSection() const { return m_refType==Section; }
835  bool refToTable() const { return m_refType==Table; }
836  bool isSubPage() const { return m_isSubPage; }
838 
839  private:
843  QCString m_file;
844  QCString m_relPath;
845  QCString m_ref;
846  QCString m_anchor;
847  QCString m_text;
848 };
849 
851 class DocInternalRef : public CompAccept<DocInternalRef>, public DocNode
852 {
853  public:
854  DocInternalRef(DocNode *parent,const QCString &target);
855  void parse();
856  Kind kind() const { return Kind_Ref; }
857  QCString file() const { return m_file; }
858  QCString relPath() const { return m_relPath; }
859  QCString anchor() const { return m_anchor; }
861 
862  private:
863  QCString m_file;
864  QCString m_relPath;
865  QCString m_anchor;
866 };
867 
869 class DocHRef : public CompAccept<DocHRef>, public DocNode
870 {
871  public:
872  DocHRef(DocNode *parent,const HtmlAttribList &attribs,const QCString &url,
873  const QCString &relPath) :
874  m_attribs(attribs), m_url(url), m_relPath(relPath) { m_parent = parent; }
875  int parse();
876  QCString url() const { return m_url; }
877  QCString relPath() const { return m_relPath; }
878  Kind kind() const { return Kind_HRef; }
880  const HtmlAttribList &attribs() const { return m_attribs; }
881 
882  private:
884  QCString m_url;
885  QCString m_relPath;
886 };
887 
889 class DocHtmlHeader : public CompAccept<DocHtmlHeader>, public DocNode
890 {
891  public:
893  m_level(level), m_attribs(attribs) { m_parent = parent; }
894  int level() const { return m_level; }
895  Kind kind() const { return Kind_HtmlHeader; }
896  const HtmlAttribList &attribs() const { return m_attribs; }
898  int parse();
899 
900  private:
901  int m_level;
903 };
904 
906 class DocHtmlDescTitle : public CompAccept<DocHtmlDescTitle>, public DocNode
907 {
908  public:
910  m_attribs(attribs) { m_parent = parent; }
911  Kind kind() const { return Kind_HtmlDescTitle; }
912  const HtmlAttribList &attribs() const { return m_attribs; }
914  int parse();
915 
916  private:
918 };
919 
921 class DocHtmlDescList : public CompAccept<DocHtmlDescList>, public DocNode
922 {
923  public:
925  m_attribs(attribs) { m_parent = parent; }
926  Kind kind() const { return Kind_HtmlDescList; }
927  const HtmlAttribList &attribs() const { return m_attribs; }
929  int parse();
930 
931  private:
933 };
934 
936 class DocSection : public CompAccept<DocSection>, public DocNode
937 {
938  public:
939  DocSection(DocNode *parent,int level,const QCString &id) :
940  m_level(level), m_id(id) { m_parent = parent; }
941  Kind kind() const { return Kind_Section; }
942  int level() const { return m_level; }
943  QCString title() const { return m_title; }
944  QCString anchor() const { return m_anchor; }
945  QCString id() const { return m_id; }
946  QCString file() const { return m_file; }
948  int parse();
949 
950  private:
951  int m_level;
952  QCString m_id;
953  QCString m_title;
954  QCString m_anchor;
955  QCString m_file;
956 };
957 
959 class DocSecRefItem : public CompAccept<DocSecRefItem>, public DocNode
960 {
961  public:
962  DocSecRefItem(DocNode *parent,const QCString &target) :
963  m_target(target) { m_parent = parent; }
964  Kind kind() const { return Kind_SecRefItem; }
965  QCString target() const { return m_target; }
966  QCString file() const { return m_file; }
967  QCString anchor() const { return m_anchor; }
969  void parse();
970 
971  private:
972  QCString m_target;
973  QCString m_file;
974  QCString m_anchor;
975 };
976 
978 class DocSecRefList : public CompAccept<DocSecRefList>, public DocNode
979 {
980  public:
982  void parse();
983  Kind kind() const { return Kind_SecRefList; }
985 
986  private:
987 };
988 
990 class DocInternal : public CompAccept<DocInternal>, public DocNode
991 {
992  public:
994  int parse(int);
995  Kind kind() const { return Kind_Internal; }
997 
998  private:
999 };
1000 
1002 class DocParBlock : public CompAccept<DocParBlock>, public DocNode
1003 {
1004  public:
1006  int parse();
1007  Kind kind() const { return Kind_ParBlock; }
1009 
1010  private:
1011 };
1012 
1013 
1015 class DocSimpleList : public CompAccept<DocSimpleList>, public DocNode
1016 {
1017  public:
1019  Kind kind() const { return Kind_SimpleList; }
1021  int parse();
1022 
1023  private:
1024 };
1025 
1027 class DocHtmlList : public CompAccept<DocHtmlList>, public DocNode
1028 {
1029  public:
1032  m_type(t), m_attribs(attribs) { m_parent = parent; }
1033  Kind kind() const { return Kind_HtmlList; }
1034  Type type() const { return m_type; }
1036  const HtmlAttribList &attribs() const { return m_attribs; }
1037  int parse();
1038  int parseXml();
1039 
1040  private:
1043 };
1044 
1046 class DocSimpleSect : public CompAccept<DocSimpleSect>, public DocNode
1047 {
1048  public:
1049  enum Type
1050  {
1053  };
1055  virtual ~DocSimpleSect();
1056  Kind kind() const { return Kind_SimpleSect; }
1057  Type type() const { return m_type; }
1058  QCString typeString() const;
1059  void accept(DocVisitor *v);
1060  int parse(bool userTitle,bool needsSeparator);
1061  int parseRcs();
1062  int parseXml();
1063  void appendLinkWord(const QCString &word);
1064 
1065  private:
1068 };
1069 
1074 {
1075  public:
1077  Kind kind() const { return Kind_SimpleSectSep; }
1078  void accept(DocVisitor *v) { v->visit(this); }
1079 
1080  private:
1081 };
1082 
1084 class DocParamSect : public CompAccept<DocParamSect>, public DocNode
1085 {
1086  friend class DocParamList;
1087  public:
1088  enum Type
1089  {
1091  };
1093  {
1095  };
1097  : m_type(t), m_hasInOutSpecifier(FALSE), m_hasTypeSpecifier(FALSE)
1098  { m_parent = parent; }
1099  int parse(const QCString &cmdName,bool xmlContext,Direction d);
1100  Kind kind() const { return Kind_ParamSect; }
1101  Type type() const { return m_type; }
1103  bool hasInOutSpecifier() const { return m_hasInOutSpecifier; }
1104  bool hasTypeSpecifier() const { return m_hasTypeSpecifier; }
1105 
1106  private:
1110 };
1111 
1113 class DocPara : public CompAccept<DocPara>, public DocNode
1114 {
1115  public:
1117  m_isFirst(FALSE), m_isLast(FALSE) { m_parent = parent; }
1118  int parse();
1119  Kind kind() const { return Kind_Para; }
1120  bool isEmpty() const { return m_children.isEmpty(); }
1122  void markFirst(bool v=TRUE) { m_isFirst=v; }
1123  void markLast(bool v=TRUE) { m_isLast=v; }
1124  bool isFirst() const { return m_isFirst; }
1125  bool isLast() const { return m_isLast; }
1126 
1127  int handleCommand(const QCString &cmdName);
1128  int handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &tagHtmlAttribs);
1129  int handleHtmlEndTag(const QCString &tagName);
1130  int handleSimpleSection(DocSimpleSect::Type t,bool xmlContext=FALSE);
1131  int handleXRefItem();
1132  int handleParamSection(const QCString &cmdName,DocParamSect::Type t,
1133  bool xmlContext,
1134  int direction);
1135  void handleIncludeOperator(const QCString &cmdName,DocIncOperator::Type t);
1136  void handleImage(const QCString &cmdName);
1137  template<class T> void handleFile(const QCString &cmdName);
1138  void handleInclude(const QCString &cmdName,DocInclude::Type t);
1139  void handleLink(const QCString &cmdName,bool isJavaLink);
1140  void handleCite();
1141  void handleRef(const QCString &cmdName);
1142  void handleSection(const QCString &cmdName);
1143  void handleInheritDoc();
1144  void handleVhdlFlow();
1145  int handleStartCode();
1146  int handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level);
1147 
1148  bool injectToken(int tok,const QCString &tokText);
1149 
1150  private:
1151  QCString m_sectionId;
1153  bool m_isLast;
1154 };
1155 
1157 class DocParamList : public DocNode
1158 {
1159  public:
1161  : m_type(t), m_dir(d), m_isFirst(TRUE), m_isLast(TRUE)
1162  { m_paragraphs.setAutoDelete(TRUE);
1163  m_params.setAutoDelete(TRUE);
1164  m_paramTypes.setAutoDelete(TRUE);
1165  m_parent = parent;
1166  }
1167  virtual ~DocParamList() { }
1168  Kind kind() const { return Kind_ParamList; }
1169  const QList<DocNode> &parameters() { return m_params; }
1170  const QList<DocNode> &paramTypes() { return m_paramTypes; }
1171  DocParamSect::Type type() const { return m_type; }
1173  void markFirst(bool b=TRUE) { m_isFirst=b; }
1174  void markLast(bool b=TRUE) { m_isLast=b; }
1175  bool isFirst() const { return m_isFirst; }
1176  bool isLast() const { return m_isLast; }
1178  {
1179  v->visitPre(this);
1180  QListIterator<DocPara> cli(m_paragraphs);
1181  DocNode *n;
1182  for (cli.toFirst();(n=cli.current());++cli) n->accept(v);
1183  v->visitPost(this);
1184  }
1185  int parse(const QCString &cmdName);
1186  int parseXml(const QCString &paramName);
1187 
1188  private:
1189  QList<DocPara> m_paragraphs;
1190  QList<DocNode> m_params;
1191  QList<DocNode> m_paramTypes;
1195  bool m_isLast;
1196 };
1197 
1200 {
1201  public:
1203  { m_paragraph=new DocPara(this); m_parent = parent; }
1204  int parse();
1205  virtual ~DocSimpleListItem() { delete m_paragraph; }
1206  Kind kind() const { return Kind_SimpleListItem; }
1208  {
1209  v->visitPre(this);
1210  m_paragraph->accept(v);
1211  v->visitPost(this);
1212  }
1213 
1214  private:
1216 };
1217 
1219 class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode
1220 {
1221  public:
1223  m_attribs(attribs), m_itemNum(num) { m_parent = parent; }
1224  Kind kind() const { return Kind_HtmlListItem; }
1225  int itemNumber() const { return m_itemNum; }
1226  const HtmlAttribList &attribs() const { return m_attribs; }
1228  int parse();
1229  int parseXml();
1230 
1231  private:
1234 };
1235 
1237 class DocHtmlDescData : public CompAccept<DocHtmlDescData>, public DocNode
1238 {
1239  public:
1241  Kind kind() const { return Kind_HtmlDescData; }
1242  const HtmlAttribList &attribs() const { return m_attribs; }
1244  int parse();
1245 
1246  private:
1248 };
1249 
1251 class DocHtmlCell : public CompAccept<DocHtmlCell>, public DocNode
1252 {
1253  friend class DocHtmlTable;
1254  public:
1257  m_isHeading(isHeading),
1258  m_isFirst(FALSE), m_isLast(FALSE), m_attribs(attribs),
1259  m_rowIdx(-1), m_colIdx(-1) { m_parent = parent; }
1260  bool isHeading() const { return m_isHeading; }
1261  bool isFirst() const { return m_isFirst; }
1262  bool isLast() const { return m_isLast; }
1263  Kind kind() const { return Kind_HtmlCell; }
1265  void markFirst(bool v=TRUE) { m_isFirst=v; }
1266  void markLast(bool v=TRUE) { m_isLast=v; }
1267  const HtmlAttribList &attribs() const { return m_attribs; }
1268  int parse();
1269  int parseXml();
1270  int rowIndex() const { return m_rowIdx; }
1271  int columnIndex() const { return m_colIdx; }
1272  int rowSpan() const;
1273  int colSpan() const;
1274  Alignment alignment() const;
1275 
1276  private:
1277  void setRowIndex(int idx) { m_rowIdx = idx; }
1278  void setColumnIndex(int idx) { m_colIdx = idx; }
1281  bool m_isLast;
1285 };
1286 
1288 class DocHtmlCaption : public CompAccept<DocHtmlCaption>, public DocNode
1289 {
1290  public:
1292  Kind kind() const { return Kind_HtmlCaption; }
1294  const HtmlAttribList &attribs() const { return m_attribs; }
1295  int parse();
1296  bool hasCaptionId() const { return m_hasCaptionId; }
1297  QCString file() const { return m_file; }
1298  QCString anchor() const { return m_anchor; }
1299 
1300  private:
1303  QCString m_file;
1304  QCString m_anchor;
1305 };
1306 
1308 class DocHtmlRow : public CompAccept<DocHtmlRow>, public DocNode
1309 {
1310  friend class DocHtmlTable;
1311  public:
1313  m_attribs(attribs), m_visibleCells(-1), m_rowIdx(-1) { m_parent = parent; }
1314  Kind kind() const { return Kind_HtmlRow; }
1315  uint numCells() const { return m_children.count(); }
1317  const HtmlAttribList &attribs() const { return m_attribs; }
1318  int parse();
1319  int parseXml(bool header);
1320  bool isHeading() const { // a row is a table heading if all cells are marked as such
1321  bool heading=TRUE;
1322  QListIterator<DocNode> it(m_children);
1323  DocNode *n;
1324  for (;(n=it.current());++it)
1325  {
1326  if (n->kind()==Kind_HtmlCell)
1327  {
1328  heading = heading && ((DocHtmlCell*)n)->isHeading();
1329  }
1330  }
1331  return m_children.count()>0 && heading;
1332  }
1333  void setVisibleCells(int n) { m_visibleCells = n; }
1334  int visibleCells() const { return m_visibleCells; }
1335  int rowIndex() const { return m_rowIdx; }
1336 
1337  private:
1338  void setRowIndex(int idx) { m_rowIdx = idx; }
1342 };
1343 
1345 class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode
1346 {
1347  public:
1349  : m_attribs(attribs) { m_caption=0; m_parent = parent; }
1350  ~DocHtmlTable() { delete m_caption; }
1351  Kind kind() const { return Kind_HtmlTable; }
1352  uint numRows() const { return m_children.count(); }
1353  bool hasCaption() { return m_caption!=0; }
1354  const HtmlAttribList &attribs() const { return m_attribs; }
1355  int parse();
1356  int parseXml();
1357  uint numColumns() const { return m_numCols; }
1358  void accept(DocVisitor *v);
1359  DocHtmlCaption *caption() const { return m_caption; }
1361  DocNode *n = m_children.getFirst();
1362  if (n && n->kind()==Kind_HtmlRow) return (DocHtmlRow*)n;
1363  return 0;
1364  }
1365 
1366  private:
1367  void computeTableGrid();
1371 };
1372 
1374 class DocHtmlBlockQuote : public CompAccept<DocHtmlBlockQuote>, public DocNode
1375 {
1376  public:
1378  : m_attribs(attribs) { m_parent = parent; }
1379  Kind kind() const { return Kind_HtmlBlockQuote; }
1380  int parse();
1382  const HtmlAttribList &attribs() const { return m_attribs; }
1383 
1384  private:
1386 };
1387 
1389 class DocText : public CompAccept<DocText>, public DocNode
1390 {
1391  public:
1392  DocText() {}
1393  Kind kind() const { return Kind_Text; }
1395  void parse();
1396  bool isEmpty() const { return m_children.isEmpty(); }
1397 };
1398 
1400 class DocRoot : public CompAccept<DocRoot>, public DocNode
1401 {
1402  public:
1403  DocRoot(bool indent,bool sl) : m_indent(indent), m_singleLine(sl) {}
1404  Kind kind() const { return Kind_Root; }
1406  void parse();
1407  bool indent() const { return m_indent; }
1408  bool singleLine() const { return m_singleLine; }
1409  bool isEmpty() const { return m_children.isEmpty(); }
1410 
1411  private:
1412  bool m_indent;
1414 };
1415 
1416 
1417 #endif