summaryrefslogtreecommitdiffstats
path: root/addon/doxmlparser/test/main.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2002-04-21 17:27:45 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2002-04-21 17:27:45 (GMT)
commit210582f8060fb41f6ad34d8315c9dd27b1bb6834 (patch)
tree4859bfed167f695f5ce9e9c0f2f6f02313de2ed3 /addon/doxmlparser/test/main.cpp
parent481a46c5ec227eaf82bfef99b742b793a727b8ec (diff)
downloadDoxygen-210582f8060fb41f6ad34d8315c9dd27b1bb6834.zip
Doxygen-210582f8060fb41f6ad34d8315c9dd27b1bb6834.tar.gz
Doxygen-210582f8060fb41f6ad34d8315c9dd27b1bb6834.tar.bz2
Release-1.2.15-20020421
Diffstat (limited to 'addon/doxmlparser/test/main.cpp')
-rw-r--r--addon/doxmlparser/test/main.cpp226
1 files changed, 156 insertions, 70 deletions
diff --git a/addon/doxmlparser/test/main.cpp b/addon/doxmlparser/test/main.cpp
index 457d881..a6b867d 100644
--- a/addon/doxmlparser/test/main.cpp
+++ b/addon/doxmlparser/test/main.cpp
@@ -14,8 +14,12 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <doxmlintf.h>
+/*! Dumps the contents of a hyperlinked text fragment as plain text to the
+ * output.
+ */
QString linkedTextToString(ILinkedTextIterator *ti)
{
QString result;
@@ -24,106 +28,116 @@ QString linkedTextToString(ILinkedTextIterator *ti)
{
switch (lt->kind())
{
- case ILinkedText::Kind_Text:
- result+=dynamic_cast<ILT_Text*>(lt)->text(); break;
- case ILinkedText::Kind_Ref:
- result+=dynamic_cast<ILT_Ref *>(lt)->text(); break;
+ case ILinkedText::Kind_Text: // plain text
+ result+=dynamic_cast<ILT_Text*>(lt)->text()->latin1(); break;
+ case ILinkedText::Kind_Ref: // a link
+ result+=dynamic_cast<ILT_Ref *>(lt)->text()->latin1(); break;
}
}
return result;
}
-void DumpDoc(IDoc *doc)
+/*! Macro for printing an indented message. */
+#define InPrint(x) printf("%s",indent.latin1()), printf x;
+
+/*! Dumps the contents of a documentation block to stdout.
+ * @note This function will call itself recursively.
+ * @param doc The root of the documentation tree.
+ * @param level The indent level.
+ */
+void DumpDoc(IDoc *doc,int level)
{
- printf(" doc node kind=`%d'\n",doc->kind());
+ QString indent;
+ indent.fill(' ',level);
+ //printf(" doc node kind=`%d'\n",doc->kind());
switch (doc->kind())
{
case IDoc::Para:
{
- printf(" --- par --- \n");
+ InPrint(("<para>\n"));
IDocPara *par = dynamic_cast<IDocPara*>(doc);
ASSERT(par!=0);
IDocIterator *di = par->contents();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
di->release();
- printf(" --- end par --- \n");
+ InPrint(("</para>\n"));
}
break;
case IDoc::Text:
{
IDocText *txt = dynamic_cast<IDocText*>(doc);
ASSERT(txt!=0);
- printf(" --- text `%s' markup=%d --- \n",txt->text().data(),txt->markup());
+ InPrint(("<text value=`%s' markup=%d/>\n",txt->text()->latin1(),txt->markup()));
}
break;
case IDoc::MarkupModifier:
{
IDocMarkupModifier *md = dynamic_cast<IDocMarkupModifier*>(doc);
ASSERT(md!=0);
- printf(" --- markup modifier enabled=%d markup=%d\n",md->enabled(),md->markup());
+ InPrint(("<markup modifier enabled=%d markup=%d/>\n",md->enabled(),md->markup()));
}
break;
case IDoc::ItemizedList:
{
- printf(" --- itemized list --- \n");
+ InPrint(("<itemized list>\n"));
IDocItemizedList *list = dynamic_cast<IDocItemizedList*>(doc);
ASSERT(list!=0);
IDocIterator *di = list->elements();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
di->release();
- printf(" --- end itemized list --- \n");
+ InPrint(("</itemized list>\n"));
}
break;
case IDoc::OrderedList:
{
- printf(" --- ordered list --- \n");
+ InPrint(("<ordered list>\n"));
IDocOrderedList *list = dynamic_cast<IDocOrderedList*>(doc);
ASSERT(list!=0);
IDocIterator *di = list->elements();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
di->release();
- printf(" --- end ordered list --- \n");
+ InPrint(("</ordered list>\n"));
}
break;
case IDoc::ListItem:
{
- printf(" --- list item --- \n");
+ InPrint(("<list item>\n"));
IDocListItem *li = dynamic_cast<IDocListItem*>(doc);
ASSERT(li!=0);
IDocIterator *di = li->contents();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
di->release();
- printf(" --- end list item --- \n");
+ InPrint(("</list item>\n"));
}
break;
case IDoc::ParameterList:
{
IDocParameterList *list = dynamic_cast<IDocParameterList*>(doc);
- printf(" --- parameter list type=%d --- \n",list->listType());
+ InPrint(("<parameter list type=%d>\n",list->listType()));
IDocIterator *di = list->params();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
di->release();
- printf(" --- parameter list item --- \n");
+ InPrint(("</parameter list>\n"));
ASSERT(list!=0);
}
break;
@@ -131,187 +145,248 @@ void DumpDoc(IDoc *doc)
{
IDocParameter *par = dynamic_cast<IDocParameter*>(doc);
ASSERT(par!=0);
- printf(" --- parameter name=%s --- \n",par->name().data());
- DumpDoc(par->description());
- printf(" --- end parameter --- \n");
+ InPrint(("<parameter name=%s>\n",par->name()->latin1()));
+ DumpDoc(par->description(),level+1);
+ InPrint(("<parameter/>\n"));
}
break;
case IDoc::SimpleSect:
{
IDocSimpleSect *ss = dynamic_cast<IDocSimpleSect*>(doc);
ASSERT(ss!=0);
- printf(" --- simplesect type=%s --- \n",ss->typeString().data());
- DumpDoc(ss->title());
- DumpDoc(ss->description());
- printf(" --- end simplesect --- \n");
+ InPrint(("<simplesect type=%s>\n",ss->typeString()->latin1()));
+ DumpDoc(ss->title(),level+1);
+ DumpDoc(ss->description(),level+1);
+ InPrint(("<simplesect/>\n"));
}
break;
case IDoc::Title:
{
- printf(" --- title --- \n");
+ InPrint(("<title>\n"));
IDocTitle *t = dynamic_cast<IDocTitle*>(doc);
ASSERT(t!=0);
IDocIterator *di = t->title();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
- printf(" --- end title --- \n");
+ InPrint(("<title/>\n"));
}
break;
case IDoc::Ref:
{
IDocRef *ref = dynamic_cast<IDocRef*>(doc);
ASSERT(ref!=0);
- printf(" ref=%p\n",ref);
- printf(" --- ref id=%s text=%s --- \n",
- ref->refId().data(),ref->text().data());
- printf(" --- end ref --- \n");
+ InPrint(("<ref id=%s text=%s/>\n",
+ ref->refId()->latin1(),ref->text()->latin1()));
}
break;
case IDoc::VariableList:
{
- printf(" --- start variablelist --- \n");
+ InPrint(("<variablelist>\n"));
IDocVariableList *vl = dynamic_cast<IDocVariableList*>(doc);
ASSERT(vl!=0);
IDocIterator *di = vl->entries();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
di->release();
- printf(" --- end variablelist --- \n");
+ InPrint(("<variablelist/>\n"));
}
break;
case IDoc::VariableListEntry:
{
IDocVariableListEntry *vle = dynamic_cast<IDocVariableListEntry*>(doc);
ASSERT(vle!=0);
- printf(" --- start variablelistentry term=%s --- \n",vle->term().data());
- DumpDoc(vle->description());
- printf(" --- end variablelistentry --- \n");
+ InPrint(("<variablelistentry term=%s>\n",vle->term()->latin1()));
+ DumpDoc(vle->description(),level+1);
+ InPrint(("<variablelistentry/>\n"));
}
break;
case IDoc::HRuler:
{
IDocHRuler *hr = dynamic_cast<IDocHRuler*>(doc);
ASSERT(hr!=0);
+ InPrint(("<hruler/>\n"));
}
break;
case IDoc::LineBreak:
{
IDocLineBreak *lb = dynamic_cast<IDocLineBreak*>(doc);
ASSERT(lb!=0);
+ InPrint(("<linebreak/>\n"));
}
break;
case IDoc::ULink:
{
IDocULink *ul = dynamic_cast<IDocULink*>(doc);
ASSERT(ul!=0);
+ InPrint(("<ulink url=`%s' text=`%s'/>\n",ul->url()->latin1(),ul->text()->latin1()));
}
break;
case IDoc::EMail:
{
IDocEMail *em = dynamic_cast<IDocEMail*>(doc);
ASSERT(em!=0);
+ InPrint(("<email address=`%s'/>\n",em->address()->latin1()));
}
break;
case IDoc::Link:
{
IDocLink *lk = dynamic_cast<IDocLink*>(doc);
ASSERT(lk!=0);
+ InPrint(("<link refid=`%s' text=`%s'/>\n",lk->refId()->latin1(),lk->text()->latin1()));
}
break;
case IDoc::ProgramListing:
{
IDocProgramListing *pl = dynamic_cast<IDocProgramListing*>(doc);
ASSERT(pl!=0);
+ InPrint(("<programlisting>\n"));
+ IDocIterator *cli = pl->codeLines();
+ IDoc *cl;
+ for (cli->toFirst();(cl=cli->current());cli->toNext())
+ {
+ DumpDoc(cl,level+1);
+ }
+ cli->release();
+ InPrint(("<programlisting/>\n"));
}
break;
case IDoc::CodeLine:
{
IDocCodeLine *cl = dynamic_cast<IDocCodeLine*>(doc);
ASSERT(cl!=0);
+ InPrint(("<codeline lineNumber=%d refId=`%s'>\n",cl->lineNumber(),cl->refId()->latin1()));
+ IDocIterator *cei = cl->codeElements();
+ IDoc *ce;
+ for (cei->toFirst();(ce=cei->current());cei->toNext())
+ {
+ DumpDoc(ce,level+1);
+ }
+ cei->release();
+ InPrint(("<codeline/>\n"));
}
break;
case IDoc::Highlight:
{
IDocHighlight *hl = dynamic_cast<IDocHighlight*>(doc);
ASSERT(hl!=0);
+ InPrint(("<highlight kind=%d>\n",hl->kind()));
+ IDocIterator *cei = hl->codeElements();
+ IDoc *ce;
+ for (cei->toFirst();(ce=cei->current());cei->toNext())
+ {
+ DumpDoc(ce,level+1);
+ }
+ cei->release();
+ InPrint(("</highlight>\n"));
}
break;
case IDoc::Formula:
{
IDocFormula *fm = dynamic_cast<IDocFormula*>(doc);
ASSERT(fm!=0);
+ InPrint(("<formula id=`%s' text=`%s'/>\n",fm->id()->latin1(),fm->text()->latin1()));
}
break;
case IDoc::Image:
{
IDocImage *img = dynamic_cast<IDocImage*>(doc);
ASSERT(img!=0);
+ InPrint(("<image name=`%s' caption=`%s'/>\n",img->name()->latin1(),img->caption()->latin1()));
}
break;
case IDoc::DotFile:
{
IDocDotFile *df = dynamic_cast<IDocDotFile*>(doc);
ASSERT(df!=0);
+ InPrint(("<dotfile name=`%s' caption=`%s'/>\n",df->name()->latin1(),df->caption()->latin1()));
}
break;
case IDoc::IndexEntry:
{
IDocIndexEntry *ie = dynamic_cast<IDocIndexEntry*>(doc);
ASSERT(ie!=0);
+ InPrint(("<indexentry primary=`%s' secondary=`%s'/>\n",ie->primary()->latin1(),ie->secondary()->latin1()));
}
break;
case IDoc::Table:
{
IDocTable *tbl = dynamic_cast<IDocTable*>(doc);
ASSERT(tbl!=0);
+ InPrint(("<table numcols=%d caption=`%s'>\n",tbl->numColumns(),tbl->caption()->latin1()));
+ IDocIterator *ri = tbl->rows();
+ IDoc *row;
+ for (ri->toFirst();(row=ri->current());ri->toNext())
+ {
+ DumpDoc(row,level+1);
+ }
+ ri->release();
+ InPrint(("</table>\n"));
}
break;
case IDoc::Row:
{
IDocRow *row = dynamic_cast<IDocRow*>(doc);
ASSERT(row!=0);
+ InPrint(("<row>\n"));
+ IDocIterator *ei = row->entries();
+ IDoc *e;
+ for (ei->toFirst();(e=ei->current());ei->toNext())
+ {
+ DumpDoc(e,level+1);
+ }
+ ei->release();
+ InPrint(("</row>\n"));
}
break;
case IDoc::Entry:
{
IDocEntry *ent = dynamic_cast<IDocEntry*>(doc);
ASSERT(ent!=0);
+ InPrint(("<entry>\n"));
+ IDocIterator *di = ent->contents();
+ IDoc *pdoc;
+ for (di->toFirst();(pdoc=di->current());di->toNext())
+ {
+ DumpDoc(pdoc,level+1);
+ }
+ di->release();
+ InPrint(("</entry>\n"));
}
break;
case IDoc::Section:
{
IDocSection *sec = dynamic_cast<IDocSection*>(doc);
ASSERT(sec!=0);
- printf(" --- section id=`%s' level=%d --- \n",
- sec->id().data(),sec->level());
+ InPrint(("<section id=`%s' level=%d>\n",
+ sec->id()->latin1(),sec->level()));
IDocIterator *di = sec->title();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
- printf(" --- end section --- \n");
+ InPrint(("<section/>\n"));
}
break;
case IDoc::Root:
{
- printf(" --- root --- \n");
+ InPrint(("<root>\n"));
IDocRoot *root = dynamic_cast<IDocRoot*>(doc);
ASSERT(root!=0);
IDocIterator *di = root->contents();
IDoc *pdoc;
for (di->toFirst();(pdoc=di->current());di->toNext())
{
- DumpDoc(pdoc);
+ DumpDoc(pdoc,level+1);
}
di->release();
- printf(" --- end root --- \n");
+ InPrint(("<root/>\n"));
}
break;
@@ -329,24 +404,24 @@ void DumpGraph(IGraph *graph)
for (ni->toFirst();(node=ni->current());ni->toNext())
{
printf(" --- node id=%s label=%s linkId=%s\n",
- node->id().data(),
- node->label().data(),
- node->linkId().data()
+ node->id()->latin1(),
+ node->label()->latin1(),
+ node->linkId()->latin1()
);
IChildNodeIterator *cni = node->children();
IChildNode *cn;
for (cni->toFirst();(cn=cni->current());cni->toNext())
{
printf(" + child id=%s label=%s relation=%s\n",
- cn->node()->id().data(),
- cn->node()->label().data(),
- cn->relationString().data()
+ cn->node()->id()->latin1(),
+ cn->node()->label()->latin1(),
+ cn->relationString()->latin1()
);
IEdgeLabelIterator *eli = cn->edgeLabels();
IEdgeLabel *el;
for (eli->toFirst();(el=eli->current());eli->toNext())
{
- printf(" edgeLabel=%s\n",el->label().data());
+ printf(" edgeLabel=%s\n",el->label()->latin1());
}
eli->release();
}
@@ -381,19 +456,19 @@ int main(int argc,char **argv)
for (cli->toFirst();(comp=cli->current());cli->toNext())
{
printf("Compound name=%s id=%s kind=%s\n",
- comp->name().data(),comp->id().data(),comp->kindString().data());
+ comp->name()->latin1(),comp->id()->latin1(),comp->kindString()->latin1());
ISectionIterator *sli = comp->sections();
ISection *sec;
for (sli->toFirst();(sec=sli->current());sli->toNext())
{
- printf(" Section kind=%s\n",sec->kindString().data());
+ printf(" Section kind=%s\n",sec->kindString()->latin1());
IMemberIterator *mli = sec->members();
IMember *mem;
for (mli->toFirst();(mem=mli->current());mli->toNext())
{
ILinkedTextIterator *lti = mem->type();
printf(" Member type=%s name=%s\n",
- linkedTextToString(lti).data(),mem->name().data());
+ linkedTextToString(lti).latin1(),mem->name()->latin1());
lti->release();
IParamIterator *pli = mem->params();
@@ -407,7 +482,7 @@ int main(int argc,char **argv)
QString defVal = linkedTextToString(lti);
lti->release();
printf(" Param type=%s name=%s defvalue=%s\n",
- parType.data(), par->definitionName().data(),defVal.data());
+ parType.latin1(), par->definitionName()->latin1(),defVal.latin1());
}
pli->release();
IMemberReferenceIterator *mri = mem->references();
@@ -416,7 +491,7 @@ int main(int argc,char **argv)
{
IMember *memr = mr->member();
printf(" References %s at line %d\n",
- mr->memberName().data(),memr->bodyStart());
+ mr->memberName()->latin1(),memr->bodyStart());
}
mri->release();
@@ -425,7 +500,7 @@ int main(int argc,char **argv)
{
IMember *memr = mr->member();
printf(" ReferencedBy %s at line %d\n",
- mr->memberName().data(),memr->bodyStart());
+ mr->memberName()->latin1(),memr->bodyStart());
}
mri->release();
@@ -434,7 +509,7 @@ int main(int argc,char **argv)
for (evi->toFirst();(ev=evi->current());evi->toNext())
{
printf(" Enum value `%s' init=`%s'\n",
- ev->name().data(),ev->initializer().data());
+ ev->name()->latin1(),ev->initializer()->latin1());
}
evi->release();
@@ -442,14 +517,14 @@ int main(int argc,char **argv)
if (doc)
{
printf("===== brief description ==== \n");
- DumpDoc(doc);
+ DumpDoc(doc,0);
}
doc = mem->detailedDescription();
if (doc)
{
printf("===== detailed description ==== \n");
- DumpDoc(doc);
+ DumpDoc(doc,0);
}
}
mli->release();
@@ -460,14 +535,14 @@ int main(int argc,char **argv)
if (doc)
{
printf("===== brief description ==== \n");
- DumpDoc(doc);
+ DumpDoc(doc,0);
}
doc = comp->detailedDescription();
if (doc)
{
printf("===== detailed description ==== \n");
- DumpDoc(doc);
+ DumpDoc(doc,0);
}
if (comp->kind()==ICompound::Class)
@@ -487,7 +562,7 @@ int main(int argc,char **argv)
for (bcli->toFirst();(bClass=bcli->current());bcli->toNext())
{
ICompound *bc = bClass->compound();
- printf(" + class %s\n",bc->name().data());
+ printf(" + class %s\n",bc->name()->latin1());
bc->release();
}
bcli->release();
@@ -498,11 +573,22 @@ int main(int argc,char **argv)
for (dcli->toFirst();(dClass=dcli->current());dcli->toNext())
{
ICompound *dc = dClass->compound();
- printf(" + class %s\n",dc->name().data());
+ printf(" + class %s\n",dc->name()->latin1());
dc->release();
}
dcli->release();
}
+ else if (comp->kind()==ICompound::File)
+ {
+ IFile *file = dynamic_cast<IFile*>(comp);
+ ASSERT(file!=0);
+
+ printf("==== include dependency graph ==== \n");
+ DumpGraph(file->includeDependencyGraph());
+
+ printf("==== included by dependency graph ==== \n");
+ DumpGraph(file->includedByDependencyGraph());
+ }
comp->release();
}