Orb/Doxygen/src/printdocvisitor.h
changeset 0 42188c7ea2d9
child 4 468f4c8d3d5b
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 /******************************************************************************
       
     2  *
       
     3  * 
       
     4  *
       
     5  *
       
     6  * Copyright (C) 1997-2008 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 _PRINTDOCVISITOR_H
       
    20 #define _PRINTDOCVISITOR_H
       
    21 
       
    22 #include "docvisitor.h"
       
    23 
       
    24 /*! Concrete visitor implementation for pretty printing */
       
    25 class PrintDocVisitor : public DocVisitor
       
    26 {
       
    27   public:
       
    28     PrintDocVisitor() : DocVisitor(DocVisitor_Other), m_indent(0), 
       
    29                         m_needsEnter(FALSE), m_insidePre(FALSE) {}
       
    30     
       
    31     //--------------------------------------
       
    32     
       
    33     void visit(DocWord *w)
       
    34     {
       
    35       indent_leaf();
       
    36       printf("%s",w->word().data());
       
    37     }
       
    38     void visit(DocLinkedWord *w)
       
    39     {
       
    40       indent_leaf();
       
    41       printf("%s",w->word().data());
       
    42     }
       
    43     void visit(DocWhiteSpace *w)
       
    44     {
       
    45       indent_leaf();
       
    46       if (m_insidePre)
       
    47       {
       
    48         printf("%s",w->chars().data());
       
    49       }
       
    50       else
       
    51       {
       
    52         printf(" ");
       
    53       }
       
    54     }
       
    55     void visit(DocSymbol *s)
       
    56     {
       
    57       indent_leaf();
       
    58       switch(s->symbol())
       
    59       {
       
    60 	case DocSymbol::BSlash:  printf("\\"); break;
       
    61 	case DocSymbol::At:      printf("@"); break;
       
    62 	case DocSymbol::Less:    printf("<"); break;
       
    63 	case DocSymbol::Greater: printf(">"); break;
       
    64 	case DocSymbol::Amp:     printf("&"); break;
       
    65 	case DocSymbol::Dollar:  printf("$"); break;
       
    66 	case DocSymbol::Hash:    printf("#"); break;
       
    67 	case DocSymbol::Percent: printf("%%"); break;
       
    68 	case DocSymbol::Copy:    printf("&copy;"); break;
       
    69 	case DocSymbol::Apos:    printf("'"); break;
       
    70 	case DocSymbol::Quot:    printf("\""); break;
       
    71         case DocSymbol::Lsquo:   printf("&lsquo;"); break;
       
    72         case DocSymbol::Rsquo:   printf("&rsquo;"); break;
       
    73         case DocSymbol::Ldquo:   printf("&ldquo;"); break;
       
    74         case DocSymbol::Rdquo:   printf("&rdquo;"); break;
       
    75         case DocSymbol::Ndash:   printf("&ndash;"); break;
       
    76         case DocSymbol::Mdash:   printf("&mdash;"); break;
       
    77 	case DocSymbol::Uml:     printf("&%cuml;",s->letter()); break;
       
    78 	case DocSymbol::Acute:   printf("&%cacute;",s->letter()); break;
       
    79 	case DocSymbol::Grave:   printf("&%cgrave;",s->letter()); break;
       
    80 	case DocSymbol::Circ:    printf("&%ccirc;",s->letter()); break;
       
    81 	case DocSymbol::Tilde:   printf("&%ctilde;",s->letter()); break;
       
    82 	case DocSymbol::Szlig:   printf("&szlig;"); break;
       
    83 	case DocSymbol::Cedil:   printf("&%ccedul;",s->letter()); break;
       
    84 	case DocSymbol::Ring:    printf("&%cring;",s->letter()); break;
       
    85 	case DocSymbol::Nbsp:    printf("&nbsp;"); break;
       
    86 	case DocSymbol::Aelig:   printf("&aelig;"); break;
       
    87 	case DocSymbol::AElig:   printf("&AElig;"); break;
       
    88 	default:
       
    89 	  printf("Error: unknown symbol found\n");
       
    90       }
       
    91     }
       
    92     void visit(DocURL *u)
       
    93     {
       
    94       indent_leaf();
       
    95       printf("%s",u->url().data());
       
    96     }
       
    97     void visit(DocLineBreak *)
       
    98     {
       
    99       indent_leaf();
       
   100       printf("<br/>");
       
   101     }
       
   102     void visit(DocHorRuler *)
       
   103     {
       
   104       indent_leaf();
       
   105       printf("<hr>");
       
   106     }
       
   107     void visit(DocStyleChange *s)
       
   108     {
       
   109       indent_leaf();
       
   110       switch (s->style())
       
   111       {
       
   112         case DocStyleChange::Bold:
       
   113          if (s->enable()) printf("<bold>"); else printf("</bold>");
       
   114          break;
       
   115         case DocStyleChange::Italic:
       
   116          if (s->enable()) printf("<italic>"); else printf("</italic>");
       
   117          break;
       
   118         case DocStyleChange::Code:
       
   119          if (s->enable()) printf("<code>"); else printf("</code>");
       
   120          break;
       
   121         case DocStyleChange::Subscript:
       
   122          if (s->enable()) printf("<sub>"); else printf("</sub>");
       
   123          break;
       
   124         case DocStyleChange::Superscript:
       
   125          if (s->enable()) printf("<sup>"); else printf("</sup>");
       
   126          break;
       
   127         case DocStyleChange::Center:
       
   128          if (s->enable()) printf("<center>"); else printf("</center>");
       
   129          break;
       
   130         case DocStyleChange::Small:
       
   131          if (s->enable()) printf("<small>"); else printf("</small>");
       
   132          break;
       
   133         case DocStyleChange::Preformatted:
       
   134          if (s->enable()) printf("<pre>"); else printf("</pre>");
       
   135          break;
       
   136         case DocStyleChange::Div:
       
   137          if (s->enable()) printf("<div>"); else printf("</div>");
       
   138          break;
       
   139         case DocStyleChange::Span:
       
   140          if (s->enable()) printf("<span>"); else printf("</span>");
       
   141          break;
       
   142       }
       
   143     }
       
   144     void visit(DocVerbatim *s)
       
   145     {
       
   146       indent_leaf();
       
   147       switch(s->type())
       
   148       {
       
   149         case DocVerbatim::Code: printf("<code>"); break;
       
   150         case DocVerbatim::Verbatim: printf("<verbatim>"); break;
       
   151         case DocVerbatim::HtmlOnly: printf("<htmlonly>"); break;
       
   152         case DocVerbatim::ManOnly: printf("<manonly>"); break;
       
   153         case DocVerbatim::LatexOnly: printf("<latexonly>"); break;
       
   154         case DocVerbatim::XmlOnly: printf("<xmlonly>"); break;
       
   155         case DocVerbatim::Dot: printf("<dot>"); break;
       
   156         case DocVerbatim::Msc: printf("<msc>"); break;
       
   157       }
       
   158       printf("%s",s->text().data());
       
   159       switch(s->type())
       
   160       {
       
   161         case DocVerbatim::Code: printf("</code>"); break;
       
   162         case DocVerbatim::Verbatim: printf("</verbatim>"); break;
       
   163         case DocVerbatim::HtmlOnly: printf("</htmlonly>"); break;
       
   164         case DocVerbatim::ManOnly: printf("</manonly>"); break;
       
   165         case DocVerbatim::LatexOnly: printf("</latexonly>"); break;
       
   166         case DocVerbatim::XmlOnly: printf("</xmlonly>"); break;
       
   167         case DocVerbatim::Dot: printf("</dot>"); break;
       
   168         case DocVerbatim::Msc: printf("</msc>"); break;
       
   169       }
       
   170     }
       
   171     void visit(DocAnchor *a)
       
   172     {
       
   173       indent_leaf();
       
   174       printf("<anchor name=\"%s\"/>",a->anchor().data());
       
   175     }
       
   176     void visit(DocInclude *inc)
       
   177     {
       
   178       indent_leaf();
       
   179       printf("<include file=\"%s\" type=\"",inc->file().data());
       
   180       switch(inc->type())
       
   181       {
       
   182         case DocInclude::Include: printf("include"); break;
       
   183         case DocInclude::IncWithLines: printf("incwithlines"); break;
       
   184         case DocInclude::DontInclude: printf("dontinclude"); break;
       
   185         case DocInclude::HtmlInclude: printf("htmlinclude"); break;
       
   186         case DocInclude::VerbInclude: printf("verbinclude"); break;
       
   187       }
       
   188       printf("\"/>");
       
   189     }
       
   190     void visit(DocIncOperator *op)
       
   191     {
       
   192       indent_leaf();
       
   193       printf("<incoperator pattern=\"%s\" type=\"",op->pattern().data());
       
   194       switch(op->type())
       
   195       {
       
   196         case DocIncOperator::Line:     printf("line");     break;
       
   197         case DocIncOperator::Skip:     printf("skip");     break;
       
   198         case DocIncOperator::SkipLine: printf("skipline"); break;
       
   199         case DocIncOperator::Until:    printf("until");    break;
       
   200       }
       
   201       printf("\"/>");
       
   202     }
       
   203     void visit(DocFormula *f)
       
   204     {
       
   205       indent_leaf();
       
   206       printf("<formula name=%s test=%s/>",f->name().data(),f->text().data());
       
   207     }
       
   208     void visit(DocIndexEntry *i)
       
   209     {
       
   210       indent_leaf();
       
   211       printf("<indexentry>%s</indexentry\n",i->entry().data());
       
   212     }
       
   213     void visit(DocSimpleSectSep *)
       
   214     {
       
   215       indent_leaf();
       
   216       printf("<simplesectsep/>");
       
   217     }
       
   218 
       
   219     //--------------------------------------
       
   220     
       
   221     void visitPre(DocAutoList *l)
       
   222     {
       
   223       indent_pre();
       
   224       if (l->isEnumList())
       
   225       {
       
   226         printf("<ol>\n");
       
   227       }
       
   228       else
       
   229       {
       
   230         printf("<ul>\n");
       
   231       }
       
   232     }
       
   233     void visitPost(DocAutoList *l)
       
   234     {
       
   235       indent_post();
       
   236       if (l->isEnumList())
       
   237       {
       
   238         printf("</ol>\n");
       
   239       }
       
   240       else
       
   241       {
       
   242         printf("</ul>\n");
       
   243       }
       
   244     }
       
   245     void visitPre(DocAutoListItem *)
       
   246     {
       
   247       indent_pre();
       
   248       printf("<li>\n");
       
   249     }
       
   250     void visitPost(DocAutoListItem *) 
       
   251     {
       
   252       indent_post();
       
   253       printf("</li>\n");
       
   254     }
       
   255     void visitPre(DocPara *) 
       
   256     {
       
   257       indent_pre();
       
   258       printf("<para>\n");
       
   259     }
       
   260     void visitPost(DocPara *)
       
   261     {
       
   262       indent_post();
       
   263       printf("</para>\n");
       
   264     }
       
   265     void visitPre(DocRoot *)
       
   266     {
       
   267       indent_pre();
       
   268       printf("<root>\n");
       
   269     }
       
   270     void visitPost(DocRoot *)
       
   271     {
       
   272       indent_post();
       
   273       printf("</root>\n");
       
   274     }
       
   275     void visitPre(DocSimpleSect *s)
       
   276     {
       
   277       indent_pre();
       
   278       printf("<simplesect type=");
       
   279       switch(s->type())
       
   280       {
       
   281 	case DocSimpleSect::See: printf("see"); break;
       
   282 	case DocSimpleSect::Return: printf("return"); break;
       
   283 	case DocSimpleSect::Author: printf("author"); break;
       
   284 	case DocSimpleSect::Authors: printf("authors"); break;
       
   285 	case DocSimpleSect::Version: printf("version"); break;
       
   286 	case DocSimpleSect::Since: printf("since"); break;
       
   287 	case DocSimpleSect::Date: printf("date"); break;
       
   288 	case DocSimpleSect::Note: printf("note"); break;
       
   289 	case DocSimpleSect::Warning: printf("warning"); break;
       
   290 	case DocSimpleSect::Pre: printf("pre"); break;
       
   291 	case DocSimpleSect::Post: printf("post"); break;
       
   292 	case DocSimpleSect::Invar: printf("invar"); break;
       
   293 	case DocSimpleSect::Remark: printf("remark"); break;
       
   294 	case DocSimpleSect::Attention: printf("attention"); break;
       
   295 	case DocSimpleSect::User: printf("user"); break;
       
   296 	case DocSimpleSect::Rcs: printf("rcs"); break;
       
   297 	case DocSimpleSect::Unknown: printf("unknown"); break;
       
   298       }
       
   299       printf(">\n");
       
   300     }
       
   301     void visitPost(DocSimpleSect *)
       
   302     {
       
   303       indent_post();
       
   304       printf("</simplesect>\n");
       
   305     }
       
   306     void visitPre(DocTitle *)
       
   307     {
       
   308       indent_pre();
       
   309       printf("<title>\n");
       
   310     }
       
   311     void visitPost(DocTitle *)
       
   312     {
       
   313       indent_post();
       
   314       printf("</title>\n");
       
   315     }
       
   316     void visitPre(DocSimpleList *)
       
   317     {
       
   318       indent_pre();
       
   319       printf("<ul>\n");
       
   320     }
       
   321     void visitPost(DocSimpleList *)
       
   322     {
       
   323       indent_post();
       
   324       printf("</ul>\n");
       
   325     }
       
   326     void visitPre(DocSimpleListItem *)
       
   327     {
       
   328       indent_pre();
       
   329       printf("<li>\n");
       
   330     }
       
   331     void visitPost(DocSimpleListItem *) 
       
   332     {
       
   333       indent_post();
       
   334       printf("</li>\n");
       
   335     }
       
   336     void visitPre(DocSection *s)
       
   337     {
       
   338       indent_pre();
       
   339       printf("<sect%d>\n",s->level());
       
   340     }
       
   341     void visitPost(DocSection *s) 
       
   342     {
       
   343       indent_post();
       
   344       printf("</sect%d>\n",s->level());
       
   345     }
       
   346     void visitPre(DocHtmlList *s)
       
   347     {
       
   348       indent_pre();
       
   349       if (s->type()==DocHtmlList::Ordered) printf("<ol>\n"); else printf("<ul>\n");
       
   350     }
       
   351     void visitPost(DocHtmlList *s) 
       
   352     {
       
   353       indent_post();
       
   354       if (s->type()==DocHtmlList::Ordered) printf("</ol>\n"); else printf("</ul>\n");
       
   355     }
       
   356     void visitPre(DocHtmlListItem *)
       
   357     {
       
   358       indent_pre();
       
   359       printf("<li>\n");
       
   360     }
       
   361     void visitPost(DocHtmlListItem *) 
       
   362     {
       
   363       indent_post();
       
   364       printf("</li>\n");
       
   365     }
       
   366     //void visitPre(DocHtmlPre *)
       
   367     //{
       
   368     //  indent_pre();
       
   369     //  printf("<pre>\n");
       
   370     //  m_insidePre=TRUE;
       
   371     //}
       
   372     //void visitPost(DocHtmlPre *) 
       
   373     //{
       
   374     //  m_insidePre=FALSE;
       
   375     //  indent_post();
       
   376     //  printf("</pre>\n");
       
   377     //}
       
   378     void visitPre(DocHtmlDescList *)
       
   379     {
       
   380       indent_pre();
       
   381       printf("<dl>\n");
       
   382     }
       
   383     void visitPost(DocHtmlDescList *) 
       
   384     {
       
   385       indent_post();
       
   386       printf("</dl>\n");
       
   387     }
       
   388     void visitPre(DocHtmlDescTitle *)
       
   389     {
       
   390       indent_pre();
       
   391       printf("<dt>\n");
       
   392     }
       
   393     void visitPost(DocHtmlDescTitle *) 
       
   394     {
       
   395       indent_post();
       
   396       printf("</dt>\n");
       
   397     }
       
   398     void visitPre(DocHtmlDescData *)
       
   399     {
       
   400       indent_pre();
       
   401       printf("<dd>\n");
       
   402     }
       
   403     void visitPost(DocHtmlDescData *) 
       
   404     {
       
   405       indent_post();
       
   406       printf("</dd>\n");
       
   407     }
       
   408     void visitPre(DocHtmlTable *t)
       
   409     {
       
   410       indent_pre();
       
   411       printf("<table rows=\"%d\" cols=\"%d\">\n",
       
   412           t->numRows(),t->numCols());
       
   413     }
       
   414     void visitPost(DocHtmlTable *) 
       
   415     {
       
   416       indent_post();
       
   417       printf("</table>\n");
       
   418     }
       
   419     void visitPre(DocHtmlRow *)
       
   420     {
       
   421       indent_pre();
       
   422       printf("<tr>\n");
       
   423     }
       
   424     void visitPost(DocHtmlRow *) 
       
   425     {
       
   426       indent_post();
       
   427       printf("</tr>\n");
       
   428     }
       
   429     void visitPre(DocHtmlCell *c)
       
   430     {
       
   431       indent_pre();
       
   432       printf("<t%c>\n",c->isHeading()?'h':'d');
       
   433     }
       
   434     void visitPost(DocHtmlCell *c) 
       
   435     {
       
   436       indent_post();
       
   437       printf("</t%c>\n",c->isHeading()?'h':'d');
       
   438     }
       
   439     void visitPre(DocHtmlCaption *)
       
   440     {
       
   441       indent_pre();
       
   442       printf("<caption>\n");
       
   443     }
       
   444     void visitPost(DocHtmlCaption *) 
       
   445     {
       
   446       indent_post();
       
   447       printf("</caption>\n");
       
   448     }
       
   449     void visitPre(DocInternal *)
       
   450     {
       
   451       indent_pre();
       
   452       printf("<internal>\n");
       
   453     }
       
   454     void visitPost(DocInternal *) 
       
   455     {
       
   456       indent_post();
       
   457       printf("</internal>\n");
       
   458     }
       
   459     void visitPre(DocHRef *href)
       
   460     {
       
   461       indent_pre();
       
   462       printf("<a url=\"%s\">\n",href->url().data());
       
   463     }
       
   464     void visitPost(DocHRef *) 
       
   465     {
       
   466       indent_post();
       
   467       printf("</a>\n");
       
   468     }
       
   469     void visitPre(DocHtmlHeader *header)
       
   470     {
       
   471       indent_pre();
       
   472       printf("<h%d>\n",header->level());
       
   473     }
       
   474     void visitPost(DocHtmlHeader *header) 
       
   475     {
       
   476       indent_post();
       
   477       printf("</h%d>\n",header->level());
       
   478     }
       
   479     void visitPre(DocImage *img)
       
   480     {
       
   481       indent_pre();
       
   482       printf("<image src=\"%s\" type=\"",img->name().data());
       
   483       switch(img->type())
       
   484       {
       
   485         case DocImage::Html: printf("html"); break;
       
   486         case DocImage::Latex: printf("latex"); break;
       
   487         case DocImage::Rtf: printf("rtf"); break;
       
   488       }
       
   489       printf("\" width=%s height=%s>\n",img->width().data(),img->height().data());
       
   490     }
       
   491     void visitPost(DocImage *) 
       
   492     {
       
   493       indent_post();
       
   494       printf("</image>\n");
       
   495     }
       
   496     void visitPre(DocDotFile *df)
       
   497     {
       
   498       indent_pre();
       
   499       printf("<dotfile src=\"%s\">\n",df->name().data());
       
   500     }
       
   501     void visitPost(DocDotFile *) 
       
   502     {
       
   503       indent_post();
       
   504       printf("</dotfile>\n");
       
   505     }
       
   506     void visitPre(DocLink *lnk)
       
   507     {
       
   508       indent_pre();
       
   509       printf("<link ref=\"%s\" file=\"%s\" anchor=\"%s\">\n",
       
   510           lnk->ref().data(),lnk->file().data(),lnk->anchor().data());
       
   511     }
       
   512     void visitPost(DocLink *) 
       
   513     {
       
   514       indent_post();
       
   515       printf("</link>\n");
       
   516     }
       
   517     void visitPre(DocRef *ref)
       
   518     {
       
   519       indent_pre();
       
   520       printf("<ref ref=\"%s\" file=\"%s\" "
       
   521              "anchor=\"%s\" targetTitle=\"%s\""
       
   522              " hasLinkText=\"%s\" refToAnchor=\"%s\" refToSection=\"%s\">\n",
       
   523              ref->ref().data(),ref->file().data(),ref->anchor().data(),
       
   524              ref->targetTitle().data(),ref->hasLinkText()?"yes":"no",
       
   525              ref->refToAnchor()?"yes":"no", ref->refToSection()?"yes":"no");
       
   526     }
       
   527     void visitPost(DocRef *) 
       
   528     {
       
   529       indent_post();
       
   530       printf("</ref>\n");
       
   531     }
       
   532     void visitPre(DocSecRefItem *ref)
       
   533     {
       
   534       indent_pre();
       
   535       printf("<secrefitem target=\"%s\">\n",ref->target().data());
       
   536     }
       
   537     void visitPost(DocSecRefItem *) 
       
   538     {
       
   539       indent_post();
       
   540       printf("</secrefitem>\n");
       
   541     }
       
   542     void visitPre(DocSecRefList *)
       
   543     {
       
   544       indent_pre();
       
   545       printf("<secreflist>\n");
       
   546     }
       
   547     void visitPost(DocSecRefList *) 
       
   548     {
       
   549       indent_post();
       
   550       printf("</secreflist>\n");
       
   551     }
       
   552     //void visitPre(DocLanguage *l)
       
   553     //{
       
   554     //  indent_pre();
       
   555     //  printf("<language id=%s>\n",l->id().data());
       
   556     //}
       
   557     //void visitPost(DocLanguage *) 
       
   558     //{
       
   559     //  indent_post();
       
   560     //  printf("</language>\n");
       
   561     //}
       
   562     void visitPre(DocParamList *pl)
       
   563     {
       
   564       indent_pre();
       
   565       //QStrListIterator sli(pl->parameters());
       
   566       QListIterator<DocNode> sli(pl->parameters());
       
   567       //const char *s;
       
   568       DocNode *param;
       
   569       printf("<parameters>");
       
   570       for (sli.toFirst();(param=sli.current());++sli)
       
   571       {
       
   572         printf("<param>");
       
   573         if (param->kind()==DocNode::Kind_Word)
       
   574         {
       
   575           visit((DocWord*)param); 
       
   576         }
       
   577         else if (param->kind()==DocNode::Kind_LinkedWord)
       
   578         {
       
   579           visit((DocLinkedWord*)param); 
       
   580         }
       
   581         printf("</param>");
       
   582       }
       
   583       printf("\n");
       
   584     }
       
   585     void visitPost(DocParamList *)
       
   586     {
       
   587       indent_post();
       
   588       printf("</parameters>\n");
       
   589     }
       
   590     void visitPre(DocParamSect *ps)
       
   591     {
       
   592       indent_pre();
       
   593       printf("<paramsect type=");
       
   594       switch (ps->type())
       
   595       {
       
   596 	case DocParamSect::Param: printf("param"); break;
       
   597 	case DocParamSect::RetVal: printf("retval"); break;
       
   598 	case DocParamSect::Exception: printf("exception"); break;
       
   599 	case DocParamSect::TemplateParam: printf("templateparam"); break;
       
   600 	case DocParamSect::Unknown: printf("unknown"); break;
       
   601       }
       
   602       printf(">\n");
       
   603     }
       
   604     void visitPost(DocParamSect *)
       
   605     {
       
   606       indent_post();
       
   607       printf("</paramsect>\n");
       
   608     }
       
   609     void visitPre(DocXRefItem *x)
       
   610     {
       
   611       indent_pre();
       
   612       printf("<xrefitem file=\"%s\" anchor=\"%s\" title=\"%s\"/>\n",
       
   613           x->file().data(),x->anchor().data(),x->title().data());
       
   614     }
       
   615     void visitPost(DocXRefItem *)
       
   616     {
       
   617       indent_post();
       
   618       printf("<xrefitem/>\n");
       
   619     }
       
   620     void visitPre(DocInternalRef *r)
       
   621     {
       
   622       indent_pre();
       
   623       printf("<internalref file=%s anchor=%s>\n",r->file().data(),r->anchor().data());
       
   624     }
       
   625     void visitPost(DocInternalRef *)
       
   626     {
       
   627       indent_post();
       
   628       printf("</internalref>\n");
       
   629     }
       
   630     void visitPre(DocCopy *c)
       
   631     {
       
   632       indent_pre();
       
   633       printf("<copy link=\"%s\">\n",c->link().data());
       
   634     }
       
   635     void visitPost(DocCopy *)
       
   636     {
       
   637       indent_post();
       
   638       printf("</copy>\n");
       
   639     }
       
   640     void visitPre(DocText *)
       
   641     {
       
   642       indent_pre();
       
   643       printf("<text>\n");
       
   644     }
       
   645     void visitPost(DocText *)
       
   646     {
       
   647       indent_post();
       
   648       printf("</text>\n");
       
   649     }
       
   650 
       
   651   private:
       
   652     // helper functions
       
   653     void indent() 
       
   654     { 
       
   655       if (m_needsEnter) printf("\n");
       
   656       for (int i=0;i<m_indent;i++) printf("."); 
       
   657       m_needsEnter=FALSE;
       
   658     } 
       
   659     void indent_leaf()
       
   660     {
       
   661       if (!m_needsEnter) indent();
       
   662       m_needsEnter=TRUE;
       
   663     }
       
   664     void indent_pre()
       
   665     {
       
   666       indent();
       
   667       m_indent++;
       
   668     }
       
   669     void indent_post()
       
   670     {
       
   671       m_indent--;
       
   672       indent();
       
   673     }
       
   674     
       
   675     // member variables
       
   676     int m_indent;
       
   677     bool m_needsEnter;
       
   678     bool m_insidePre;
       
   679 };
       
   680 
       
   681 #endif