20 #include <qtextstream.h>
52 #define XML_DB(x) do {} while(0)
124 int spacesToNextTabStop = tabSize - (col%tabSize);
125 col+=spacesToNextTabStop;
126 while (spacesToNextTabStop--) t <<
"<sp/>";
129 case ' ': t <<
"<sp/>"; col++;
break;
130 case '<': t <<
"<"; col++;
break;
131 case '>': t <<
">"; col++;
break;
132 case '&': t <<
"&"; col++;
break;
133 case '\'': t <<
"'"; col++;
break;
134 case '"': t <<
"""; col++;
break;
135 case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
136 case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
137 case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
138 case 27:
case 28:
case 29:
case 30:
case 31:
148 t <<
"<?xml version='1.0' encoding='UTF-8' standalone='no'?>" <<
endl;;
149 t <<
"<doxygen xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
150 t <<
"xsi:noNamespaceSchemaLocation=\"compound.xsd\" ";
157 QCString fileName=outputDirectory+
"/combine.xslt";
159 if (!f.open(IO_WriteOnly))
161 err(
"Cannot open file %s for writing!\n",fileName.data());
168 "<!-- XSLT script to combine the generated output into a single file. \n"
169 " If you have xsltproc you could use:\n"
170 " xsltproc combine.xslt index.xml >all.xml\n"
172 "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n"
173 " <xsl:output method=\"xml\" version=\"1.0\" indent=\"no\" standalone=\"yes\" />\n"
174 " <xsl:template match=\"/\">\n"
175 " <doxygen version=\"{doxygenindex/@version}\">\n"
176 " <!-- Load all doxgen generated xml files -->\n"
177 " <xsl:for-each select=\"doxygenindex/compound\">\n"
178 " <xsl:copy-of select=\"document( concat( @refid, '.xml' ) )/doxygen/*\" />\n"
182 "</xsl:stylesheet>\n";
187 const char *anchorId,
const char *text,
const char *tooltip)
189 t <<
"<ref refid=\"" << compoundId;
190 if (anchorId) t <<
"_1" << anchorId;
191 t <<
"\" kindref=\"";
192 if (anchorId) t <<
"member";
else t <<
"compound";
194 if (extRef) t <<
" external=\"" << extRef <<
"\"";
195 if (tooltip) t <<
" tooltip=\"" <<
convertToXML(tooltip) <<
"\"";
212 const char *anchor,
const char *text
233 XML_DB((
"(codify \"%s\")\n",text));
236 m_t <<
"<highlight class=\"normal\">";
242 const char *anchor,
const char *name,
245 XML_DB((
"(writeCodeLink)\n"));
248 m_t <<
"<highlight class=\"normal\">";
252 m_col+=qstrlen(name);
258 XML_DB((
"(writeToolTip)\n"));
262 XML_DB((
"(startCodeLine)\n"));
272 m_t <<
" refkind=\"member\"";
276 m_t <<
" refkind=\"compound\"";
290 XML_DB((
"(endCodeLine)\n"));
293 m_t <<
"</highlight>";
304 XML_DB((
"(startFontClass)\n"));
307 m_t <<
"</highlight>";
310 m_t <<
"<highlight class=\"" << colorClass <<
"\">";
315 XML_DB((
"(endFontClass)\n"));
316 m_t <<
"</highlight>";
321 XML_DB((
"(writeCodeAnchor)\n"));
324 const char *anchorId,
int l)
326 XML_DB((
"(writeLineNumber)\n"));
333 if (anchorId)
m_refId+=(QCString)
"_1"+anchorId;
371 indentStr.fill(
' ',indent);
374 t << indentStr <<
"<templateparamlist>" <<
endl;
377 for (ali.toFirst();(a=ali.current());++ali)
379 t << indentStr <<
" <param>" <<
endl;
380 if (!a->
type.isEmpty())
382 t << indentStr <<
" <type>";
384 t <<
"</type>" <<
endl;
386 if (!a->
name.isEmpty())
388 t << indentStr <<
" <declname>" << a->
name <<
"</declname>" <<
endl;
389 t << indentStr <<
" <defname>" << a->
name <<
"</defname>" <<
endl;
393 t << indentStr <<
" <defval>";
395 t <<
"</defval>" <<
endl;
399 t << indentStr <<
" <typeconstraint>";
401 t <<
"</typeconstraint>" <<
endl;
403 t << indentStr <<
" </param>" <<
endl;
405 t << indentStr <<
"</templateparamlist>" <<
endl;
424 const QCString &fileName,
428 const QCString &text)
430 QCString stext = text.stripWhiteSpace();
431 if (stext.isEmpty())
return;
473 QCString name = rmd->
name();
474 if (!scope.isEmpty() && scope!=def->
name())
478 t <<
" <" << tagName <<
" refid=\"";
498 if (typeStr.stripPrefix(
"static "));
499 else if (typeStr.stripPrefix(
"virtual "));
500 else if (typeStr.stripPrefix(
"volatile "));
501 else if (typeStr==
"virtual") typeStr=
"";
572 <<
"_1" << md->
anchor() <<
"\" kind=\"" << memType <<
"\"><name>"
581 t <<
" <memberdef kind=\"";
583 t << memType <<
"\" id=\"";
597 case Public: t <<
"public";
break;
599 case Private: t <<
"private";
break;
600 case Package: t <<
"package";
break;
605 if (md->
isStatic()) t <<
"yes";
else t <<
"no";
616 if (md->
isExplicit()) t <<
"yes";
else t <<
"no";
620 if (md->
isInline()) t <<
"yes";
else t <<
"no";
625 t <<
" final=\"yes\"";
630 t <<
" sealed=\"yes\"";
640 t <<
" optional=\"yes\"";
645 t <<
" required=\"yes\"";
650 t <<
" volatile=\"yes\"";
656 case Normal: t <<
"non-virtual";
break;
657 case Virtual: t <<
"virtual";
break;
658 case Pure: t <<
"pure-virtual";
break;
671 if (md->
isMutable()) t <<
"yes";
else t <<
"no";
676 t <<
" initonly=\"yes\"";
680 t <<
" attribute=\"yes\"";
684 t <<
" property=\"yes\"";
688 t <<
" readonly=\"yes\"";
692 t <<
" bound=\"yes\"";
696 t <<
" removable=\"yes\"";
700 t <<
" constrained=\"yes\"";
704 t <<
" transient=\"yes\"";
708 t <<
" maybevoid=\"yes\"";
712 t <<
" maybedefault=\"yes\"";
716 t <<
" maybeambiguous=\"yes\"";
722 if (md->
isReadable()) t <<
"yes";
else t <<
"no";
726 if (md->
isWritable()) t <<
"yes";
else t <<
"no";
730 if (md->
isGettable()) t <<
"yes";
else t <<
"no";
733 t <<
" privategettable=\"";
737 t <<
" protectedgettable=\"";
742 if (md->
isSettable()) t <<
"yes";
else t <<
"no";
745 t <<
" privatesettable=\"";
749 t <<
" protectedsettable=\"";
757 else if (md->
isCopy()) t <<
"copy";
758 else if (md->
isRetain()) t <<
"retain";
759 else if (md->
isStrong()) t <<
"strong";
760 else if (md->
isWeak()) t <<
"weak";
767 if (md->
isAddable()) t <<
"yes";
else t <<
"no";
775 if (md->
isRaisable()) t <<
"yes";
else t <<
"no";
793 t <<
"</type>" <<
endl;
811 if (bitfield.at(0)==
':') bitfield=bitfield.mid(1);
818 t <<
" <reimplements refid=\""
826 for (mli.toFirst();(rmd=mli.current());++mli)
828 t <<
" <reimplementedby refid=\""
838 if (declAl && declAl->count()>0)
843 for (declAli.toFirst();(a=declAli.current());++declAli)
845 Argument *defArg = defAli.current();
846 t <<
" <param>" <<
endl;
849 t <<
" <attributes>";
851 t <<
"</attributes>" <<
endl;
853 if (!a->
type.isEmpty())
857 t <<
"</type>" <<
endl;
859 if (!a->
name.isEmpty())
863 t <<
"</declname>" <<
endl;
865 if (defArg && !defArg->
name.isEmpty() && defArg->
name!=a->
name)
869 t <<
"</defname>" <<
endl;
871 if (!a->
array.isEmpty())
875 t <<
"</array>" <<
endl;
881 t <<
"</defval>" <<
endl;
885 t <<
" <briefdescription>";
888 t <<
"</briefdescription>" <<
endl;
890 t <<
" </param>" <<
endl;
891 if (defArg) ++defAli;
901 t <<
" <param></param>" <<
endl;
907 for (ali.toFirst();(a=ali.current());++ali)
909 t <<
" <param><defname>" << a->type <<
"</defname></param>" <<
endl;
916 t <<
" <initializer>";
918 t <<
"</initializer>" <<
endl;
923 t <<
" <exceptions>";
925 t <<
"</exceptions>" <<
endl;
935 for (emli.toFirst();(emd=emli.current());++emli)
938 <<
"_1" << emd->
anchor() <<
"\" kind=\"enumvalue\"><name>"
942 << emd->
anchor() <<
"\" prot=\"";
945 case Public: t <<
"public";
break;
947 case Private: t <<
"private";
break;
948 case Package: t <<
"package";
break;
953 t <<
"</name>" <<
endl;
956 t <<
" <initializer>";
958 t <<
"</initializer>" <<
endl;
960 t <<
" <briefdescription>" <<
endl;
962 t <<
" </briefdescription>" <<
endl;
963 t <<
" <detaileddescription>" <<
endl;
965 t <<
" </detaileddescription>" <<
endl;
966 t <<
" </enumvalue>" <<
endl;
970 t <<
" <briefdescription>" <<
endl;
972 t <<
" </briefdescription>" <<
endl;
973 t <<
" <detaileddescription>" <<
endl;
975 t <<
" </detaileddescription>" <<
endl;
976 t <<
" <inbodydescription>" <<
endl;
978 t <<
" </inbodydescription>" <<
endl;
981 t <<
" <location file=\""
1004 for (mdi.toFirst();(rmd=mdi.current());++mdi)
1014 for (mdi.toFirst();(rmd=mdi.current());++mdi)
1020 t <<
" </memberdef>" <<
endl;
1024 MemberList *ml,
const char *kind,
const char *header=0,
1025 const char *documentation=0)
1031 for (mli.toFirst();(md=mli.current());++mli)
1040 if (count==0)
return;
1042 t <<
" <sectiondef kind=\"" << kind <<
"\">" <<
endl;
1049 t <<
" <description>";
1051 t <<
"</description>" <<
endl;
1053 for (mli.toFirst();(md=mli.current());++mli)
1062 t <<
" </sectiondef>" <<
endl;
1067 t <<
" <listofallmembers>" <<
endl;
1072 for (mnii.toFirst();(mni=mnii.current());++mnii)
1076 for (mii.toFirst();(mi=mii.current());++mii)
1079 if (md->
name().at(0)!=
'@')
1084 md->
anchor() <<
"\" prot=\"";
1087 case Public: t <<
"public";
break;
1088 case Protected: t <<
"protected";
break;
1089 case Private: t <<
"private";
break;
1090 case Package: t <<
"package";
break;
1095 case Normal: t <<
"non-virtual";
break;
1096 case Virtual: t <<
"virtual";
break;
1097 case Pure: t <<
"pure-virtual";
break;
1110 t <<
" </listofallmembers>" <<
endl;
1119 for (cli.toFirst();(cd=cli.current());++cli)
1127 case Public: t <<
"public";
break;
1128 case Protected: t <<
"protected";
break;
1129 case Private: t <<
"private";
break;
1130 case Package: t <<
"package";
break;
1144 for (nli.toFirst();(nd=nli.current());++nli)
1159 QListIterator<FileDef> fli(*fl);
1161 for (fli.toFirst();(fd=fli.current());++fli)
1175 for (pli.toFirst();(pd=pli.current());++pli)
1180 t <<
"_" << pd->
name();
1193 for (gli.toFirst();(sgd=gli.current());++gli)
1197 <<
"</innergroup>" <<
endl;
1206 QListIterator<DirDef> subdirs(*dl);
1208 for (subdirs.toFirst();(subdir=subdirs.current());++subdirs)
1236 if (cd->
name().find(
'@')!=-1)
return;
1240 msg(
"Generating XML output for class %s\n",cd->
name().data());
1249 if (!f.open(IO_WriteOnly))
1251 err(
"Cannot open file %s for writing!\n",fileName.data());
1258 t <<
" <compounddef id=\""
1264 case Public: t <<
"public";
break;
1265 case Protected: t <<
"protected";
break;
1266 case Private: t <<
"private";
break;
1267 case Package: t <<
"package";
break;
1269 if (cd->
isFinal()) t <<
"\" final=\"yes";
1270 if (cd->
isSealed()) t <<
"\" sealed=\"yes";
1271 if (cd->
isAbstract()) t <<
"\" abstract=\"yes";
1273 t <<
" <compoundname>";
1275 t <<
"</compoundname>" <<
endl;
1280 for (bcli.toFirst();(bcd=bcli.current());++bcli)
1282 t <<
" <basecompoundref ";
1283 if (bcd->classDef->isLinkable())
1290 case Public: t <<
"public";
break;
1291 case Protected: t <<
"protected";
break;
1292 case Private: t <<
"private";
break;
1293 case Package: ASSERT(0);
break;
1298 case Normal: t <<
"non-virtual";
break;
1299 case Virtual: t <<
"virtual";
break;
1300 case Pure: t <<
"pure-virtual";
break;
1303 if (!bcd->templSpecifiers.isEmpty())
1307 bcd->classDef->name(),bcd->templSpecifiers)
1314 t <<
"</basecompoundref>" <<
endl;
1321 for (bcli.toFirst();(bcd=bcli.current());++bcli)
1323 t <<
" <derivedcompoundref refid=\""
1328 case Public: t <<
"public";
break;
1329 case Protected: t <<
"protected";
break;
1330 case Private: t <<
"private";
break;
1331 case Package: ASSERT(0);
break;
1336 case Normal: t <<
"non-virtual";
break;
1337 case Virtual: t <<
"virtual";
break;
1338 case Pure: t <<
"pure-virtual";
break;
1340 t <<
"\">" <<
convertToXML(bcd->classDef->displayName())
1341 <<
"</derivedcompoundref>" << endl;
1357 t <<
" local=\"" << (ii->
local ?
"yes" :
"no") <<
"\">";
1359 t <<
"</includes>" <<
endl;
1370 for (;(mg=mgli.current());++mgli)
1373 mg->documentation());
1379 for (mli.toFirst();(ml=mli.current());++mli)
1387 t <<
" <briefdescription>" <<
endl;
1389 t <<
" </briefdescription>" <<
endl;
1390 t <<
" <detaileddescription>" <<
endl;
1392 t <<
" </detaileddescription>" <<
endl;
1396 t <<
" <inheritancegraph>" <<
endl;
1398 t <<
" </inheritancegraph>" <<
endl;
1403 t <<
" <collaborationgraph>" <<
endl;
1405 t <<
" </collaborationgraph>" <<
endl;
1407 t <<
" <location file=\""
1423 t <<
" </compounddef>" <<
endl;
1424 t <<
"</doxygen>" <<
endl;
1426 ti <<
" </compound>" <<
endl;
1443 <<
"\" kind=\"namespace\"" <<
"><name>"
1449 if (!f.open(IO_WriteOnly))
1451 err(
"Cannot open file %s for writing!\n",fileName.data());
1459 <<
"\" kind=\"namespace\" language=\""
1461 t <<
" <compoundname>";
1463 t <<
"</compoundname>" <<
endl;
1472 for (;(mg=mgli.current());++mgli)
1475 mg->documentation());
1481 for (mli.toFirst();(ml=mli.current());++mli)
1489 t <<
" <briefdescription>" <<
endl;
1491 t <<
" </briefdescription>" <<
endl;
1492 t <<
" <detaileddescription>" <<
endl;
1494 t <<
" </detaileddescription>" <<
endl;
1495 t <<
" <location file=\""
1499 t <<
" </compounddef>" <<
endl;
1500 t <<
"</doxygen>" <<
endl;
1502 ti <<
" </compound>" <<
endl;
1525 <<
"</name>" <<
endl;
1530 if (!f.open(IO_WriteOnly))
1532 err(
"Cannot open file %s for writing!\n",fileName.data());
1540 <<
"\" kind=\"file\" language=\""
1542 t <<
" <compoundname>";
1544 t <<
"</compoundname>" <<
endl;
1551 for (ili1.toFirst();(inc=ili1.current());++ili1)
1558 t <<
" local=\"" << (inc->
local ?
"yes" :
"no") <<
"\">";
1560 t <<
"</includes>" <<
endl;
1567 for (ili2.toFirst();(inc=ili2.current());++ili2)
1569 t <<
" <includedby";
1574 t <<
" local=\"" << (inc->
local ?
"yes" :
"no") <<
"\">";
1576 t <<
"</includedby>" <<
endl;
1583 t <<
" <incdepgraph>" <<
endl;
1585 t <<
" </incdepgraph>" <<
endl;
1591 t <<
" <invincdepgraph>" <<
endl;
1593 t <<
" </invincdepgraph>" <<
endl;
1609 for (;(mg=mgli.current());++mgli)
1612 mg->documentation());
1618 for (mli.toFirst();(ml=mli.current());++mli)
1626 t <<
" <briefdescription>" <<
endl;
1628 t <<
" </briefdescription>" <<
endl;
1629 t <<
" <detaileddescription>" <<
endl;
1631 t <<
" </detaileddescription>" <<
endl;
1634 t <<
" <programlisting>" <<
endl;
1636 t <<
" </programlisting>" <<
endl;
1639 t <<
" </compounddef>" <<
endl;
1640 t <<
"</doxygen>" <<
endl;
1642 ti <<
" </compound>" <<
endl;
1667 if (!f.open(IO_WriteOnly))
1669 err(
"Cannot open file %s for writing!\n",fileName.data());
1676 t <<
" <compounddef id=\""
1691 for (;(mg=mgli.current());++mgli)
1694 mg->documentation());
1700 for (mli.toFirst();(ml=mli.current());++mli)
1708 t <<
" <briefdescription>" <<
endl;
1710 t <<
" </briefdescription>" <<
endl;
1711 t <<
" <detaileddescription>" <<
endl;
1713 t <<
" </detaileddescription>" <<
endl;
1714 t <<
" </compounddef>" <<
endl;
1715 t <<
"</doxygen>" <<
endl;
1717 ti <<
" </compound>" <<
endl;
1725 <<
"</name>" <<
endl;
1730 if (!f.open(IO_WriteOnly))
1732 err(
"Cannot open file %s for writing!\n",fileName.data());
1739 t <<
" <compounddef id=\""
1746 t <<
" <briefdescription>" <<
endl;
1748 t <<
" </briefdescription>" <<
endl;
1749 t <<
" <detaileddescription>" <<
endl;
1751 t <<
" </detaileddescription>" <<
endl;
1753 t <<
" </compounddef>" <<
endl;
1754 t <<
"</doxygen>" <<
endl;
1756 ti <<
" </compound>" <<
endl;
1765 const char *kindName = isExample ?
"example" :
"page";
1772 pageName+=(QCString)
"_"+pd->
name();
1774 if (pageName==
"index") pageName=
"indexpage";
1776 ti <<
" <compound refid=\"" << pageName
1778 <<
"</name>" <<
endl;
1781 QCString fileName=outputDirectory+
"/"+pageName+
".xml";
1783 if (!f.open(IO_WriteOnly))
1785 err(
"Cannot open file %s for writing!\n",fileName.data());
1792 t <<
" <compounddef id=\"" << pageName;
1793 t <<
"\" kind=\"" << kindName <<
"\">" <<
endl;
1795 <<
"</compoundname>" << endl;
1800 if (!pd->
title().isEmpty() && pd->
title().lower()!=
"notitle")
1809 <<
"</title>" <<
endl;
1817 <<
"</title>" <<
endl;
1821 t <<
" <detaileddescription>" <<
endl;
1832 t <<
" </detaileddescription>" <<
endl;
1834 t <<
" </compounddef>" <<
endl;
1835 t <<
"</doxygen>" <<
endl;
1837 ti <<
" </compound>" <<
endl;
1850 QDir xmlDir(outputDirectory);
1855 QCString fileName=outputDirectory+
"/compound.xsd";
1857 if (!f.open(IO_WriteOnly))
1859 err(
"Cannot open file %s for writing!\n",fileName.data());
1865 const char *startLine = compound_xsd.data();
1869 const char *endLine = startLine+1;
1870 while (*endLine && *(endLine-1)!=
'\n') endLine++;
1871 int len=endLine-startLine;
1875 qstrncpy(s.rawData(),startLine,len);
1877 if (s.find(
"<!-- Automatically insert here the HTML entities -->")!=-1)
1884 f.writeBlock(startLine,len);
1891 fileName=outputDirectory+
"/index.xml";
1892 f.setName(fileName);
1893 if (!f.open(IO_WriteOnly))
1895 err(
"Cannot open file %s for writing!\n",fileName.data());
1902 t <<
"<?xml version='1.0' encoding='UTF-8' standalone='no'?>" <<
endl;;
1903 t <<
"<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
1904 t <<
"xsi:noNamespaceSchemaLocation=\"index.xsd\" ";
1910 for (cli.toFirst();(cd=cli.current());++cli)
1926 for (nli.toFirst();(nd=nli.current());++nli)
1928 msg(
"Generating XML output for namespace %s\n",nd->
name().data());
1933 for (;(fn=fnli.current());++fnli)
1937 for (;(fd=fni.current());++fni)
1939 msg(
"Generating XML output for file %s\n",fd->
name().data());
1945 for (;(gd=gli.current());++gli)
1947 msg(
"Generating XML output for group %s\n",gd->
name().data());
1953 for (pdi.toFirst();(pd=pdi.current());++pdi)
1955 msg(
"Generating XML output for page %s\n",pd->
name().data());
1962 for (sdi.toFirst();(dir=sdi.current());++sdi)
1964 msg(
"Generate XML output for dir %s\n",dir->
name().data());
1971 for (pdi.toFirst();(pd=pdi.current());++pdi)
1973 msg(
"Generating XML output for example %s\n",pd->
name().data());
1979 msg(
"Generating XML output for the main page\n");
1984 t <<
"</doxygenindex>" <<
endl;