Doxygen
Loading...
Searching...
No Matches
xmlgen.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2015 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#include <stdlib.h>
17
18#include "textstream.h"
19#include "xmlgen.h"
20#include "doxygen.h"
21#include "message.h"
22#include "config.h"
23#include "classlist.h"
24#include "util.h"
25#include "defargs.h"
26#include "outputgen.h"
27#include "outputlist.h"
28#include "dot.h"
29#include "dotclassgraph.h"
30#include "dotincldepgraph.h"
31#include "pagedef.h"
32#include "filename.h"
33#include "version.h"
34#include "xmldocvisitor.h"
35#include "docparser.h"
36#include "language.h"
37#include "parserintf.h"
38#include "arguments.h"
39#include "memberlist.h"
40#include "groupdef.h"
41#include "memberdef.h"
42#include "namespacedef.h"
43#include "membername.h"
44#include "membergroup.h"
45#include "dirdef.h"
46#include "section.h"
47#include "htmlentity.h"
48#include "resourcemgr.h"
49#include "dir.h"
50#include "utf8.h"
51#include "portable.h"
52#include "moduledef.h"
53#include "requirement.h"
54#include "conceptdef.h"
55
56// no debug info
57#define XML_DB(x) do {} while(0)
58// debug to stdout
59//#define XML_DB(x) printf x
60// debug inside output
61//#define XML_DB(x) DString __t;__t.sprintf x;m_t << __t
62
63static void writeXMLDocBlock(TextStream &t,
64 const DString &fileName,
65 int lineNr,
66 const Definition *scope,
67 const MemberDef * md,
68 const DString &text);
69//------------------
70
71inline void writeXMLString(TextStream &t,const DString &s)
72{
73 t << convertToXML(s);
74}
75
76inline DString xmlRequirementId(const DString &reqId)
77{
78 return convertNameToFile("requirement_"+reqId,false,true);
79}
80
81inline void writeXMLCodeString(bool hide,TextStream &t,const DString &str, size_t &col, size_t stripIndentAmount)
82{
83 if (str.empty()) return;
84 const int tabSize = Config_getInt(TAB_SIZE);
85 const char *s = str.data();
86 char c=0;
87 if (hide) // only update column count
88 {
89 col=updateColumnCount(s,col);
90 }
91 else // actually output content and keep track of m_col
92 {
93 while ((c=*s++))
94 {
95 switch(c)
96 {
97 case '\t':
98 {
99 int spacesToNextTabStop = tabSize - (col%tabSize);
100 while (spacesToNextTabStop--)
101 {
102 if (col>=stripIndentAmount) t << "<sp/>";
103 col++;
104 }
105 break;
106 }
107 case ' ':
108 if (col>=stripIndentAmount) t << "<sp/>";
109 col++;
110 break;
111 case '<': t << "&lt;"; col++; break;
112 case '>': t << "&gt;"; col++; break;
113 case '&': t << "&amp;"; col++; break;
114 case '\'': t << "&apos;"; col++; break;
115 case '"': t << "&quot;"; col++; break;
116 case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8:
117 case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18:
118 case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26:
119 case 27: case 28: case 29: case 30: case 31:
120 // encode invalid XML characters (see http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char)
121 t << "<sp value=\"" << int(c) << "\"/>";
122 break;
123 default: s=writeUTF8Char(t,s-1); col++; break;
124 }
125 }
126 }
127}
128
129
131{
132 t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";
133 t << "<doxygen xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
134 t << "xsi:noNamespaceSchemaLocation=\"compound.xsd\" ";
135 t << "version=\"" << getDoxygenVersion() << "\" ";
136 t << "xml:lang=\"" << theTranslator->trISOLang() << "\"";
137 t << ">\n";
138}
139
141{
142 DString outputDirectory = Config_getString(XML_OUTPUT);
143 DString fileName=outputDirectory+"/combine.xslt";
144 std::ofstream t = Portable::openOutputStream(fileName);
145 if (!t.is_open())
146 {
147 err("Cannot open file {} for writing!\n",fileName);
148 return;
149 }
150
151 t <<
152 "<!-- XSLT script to combine the generated output into a single file. \n"
153 " If you have xsltproc you could use:\n"
154 " xsltproc combine.xslt index.xml >all.xml\n"
155 "-->\n"
156 "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n"
157 " <xsl:output method=\"xml\" version=\"1.0\" indent=\"no\" standalone=\"yes\" />\n"
158 " <xsl:template match=\"/\">\n"
159 " <doxygen version=\"{doxygenindex/@version}\" xml:lang=\"{doxygenindex/@xml:lang}\">\n"
160 " <!-- Load all doxygen generated xml files -->\n"
161 " <xsl:for-each select=\"doxygenindex/compound\">\n"
162 " <xsl:copy-of select=\"document( concat( @refid, '.xml' ) )/doxygen/*\" />\n"
163 " </xsl:for-each>\n"
164 " </doxygen>\n"
165 " </xsl:template>\n"
166 "</xsl:stylesheet>\n";
167
168}
169
170void writeXMLLink(TextStream &t,const DString &extRef,const DString &compoundId,
171 const DString &anchorId,const DString &text,const DString &tooltip)
172{
173 t << "<ref refid=\"" << compoundId;
174 if (!anchorId.empty()) t << "_1" << anchorId;
175 t << "\" kindref=\"";
176 if (!anchorId.empty()) t << "member"; else t << "compound";
177 t << "\"";
178 if (!extRef.empty()) t << " external=\"" << extRef << "\"";
179 if (!tooltip.empty()) t << " tooltip=\"" << convertToXML(tooltip) << "\"";
180 t << ">";
181 writeXMLString(t,text);
182 t << "</ref>";
183}
184
185/** Implements TextGeneratorIntf for an XML stream. */
187{
188 public:
190 void writeString(std::string_view s,bool /*keepSpaces*/) const override
191 {
193 }
194 void writeBreak(int) const override {}
195 void writeLink(const DString &extRef,const DString &file,
196 const DString &anchor,std::string_view text
197 ) const override
198 {
199 writeXMLLink(m_t,extRef,file,anchor,text,DString());
200 }
201 private:
203};
204
205//-------------------------------------------------------------------------------------------
206
210
211/** Generator for producing XML formatted source code. */
213{
214 XML_DB(("(codify \"%s\")\n",qPrint(text)));
216 {
217 *m_t << "<highlight class=\"normal\">";
219 }
221}
222
227
229{
230 m_hide = false;
231}
232
237
239{
240 m_stripIndentAmount = amount;
241}
242
244 const DString &ref,const DString &file,
245 const DString &anchor,const DString &name,
246 const DString &tooltip)
247{
248 if (m_hide) return;
249 XML_DB(("(writeCodeLink)\n"));
251 {
252 *m_t << "<highlight class=\"normal\">";
254 }
255 writeXMLLink(*m_t,ref,file,anchor,name,tooltip);
256 m_col+=name.length();
257}
258
260 const DString &, const SourceLinkInfo &, const SourceLinkInfo &
261 )
262{
263 if (m_hide) return;
264 XML_DB(("(writeToolTip)\n"));
265}
266
268{
269 m_col=0;
270 if (m_hide) return;
271 XML_DB(("(startCodeLine)\n"));
272 *m_t << "<codeline";
273 if (m_lineNumber!=-1)
274 {
275 *m_t << " lineno=\"" << m_lineNumber << "\"";
276 if (!m_refId.empty())
277 {
278 *m_t << " refid=\"" << m_refId << "\"";
279 if (m_isMemberRef)
280 {
281 *m_t << " refkind=\"member\"";
282 }
283 else
284 {
285 *m_t << " refkind=\"compound\"";
286 }
287 }
288 if (!m_external.empty())
289 {
290 *m_t << " external=\"" << m_external << "\"";
291 }
292 }
293 *m_t << ">";
294 m_insideCodeLine=true;
295 m_col=0;
296}
297
299{
300 if (m_hide) return;
301 XML_DB(("(endCodeLine)\n"));
303 {
304 *m_t << "</highlight>";
306 }
308 {
309 *m_t << "</codeline>\n";
310 }
311 m_lineNumber = -1;
312 m_refId.clear();
314 m_insideCodeLine=false;
315}
316
318{
319 if (m_hide) return;
320 XML_DB(("(startFontClass)\n"));
322 {
323 *m_t << "</highlight>";
325 }
326 *m_t << "<highlight class=\"" << colorClass << "\">"; // non DocBook
328}
329
331{
332 if (m_hide) return;
333 XML_DB(("(endFontClass)\n"));
334 *m_t << "</highlight>"; // non DocBook
335 m_insideSpecialHL=false;
336}
337
339{
340 if (m_hide) return;
341 XML_DB(("(writeCodeAnchor)\n"));
342}
343
344void XMLCodeGenerator::writeLineNumber(const DString &extRef,const DString &compId,
345 const DString &anchorId,int l,bool)
346{
347 if (m_hide) return;
348 XML_DB(("(writeLineNumber)\n"));
349 // we remember the information provided here to use it
350 // at the <codeline> start tag.
351 m_lineNumber = l;
352 if (!compId.empty())
353 {
354 m_refId=compId;
355 if (!anchorId.empty()) m_refId+=DString("_1")+anchorId;
356 m_isMemberRef = anchorId!=nullptr;
357 if (!extRef.empty()) m_external=extRef;
358 }
359}
360
362{
363 XML_DB(("(startCodeFragment)\n"));
364 *m_t << " <programlisting>\n";
365}
366
368{
369 XML_DB(("(endCodeFragment)\n"));
370 *m_t << " </programlisting>\n";
371}
372
373//-------------------------------------------------------------------------------------------
374
376 const ArgumentList &al,
377 const Definition *scope,
378 const FileDef *fileScope,
379 int indent)
380{
381 DString indentStr;
382 indentStr.fill(' ',indent);
383 LinkifyTextOptions options;
384 options.setScope(scope).setFileScope(fileScope);
385 if (al.hasParameters())
386 {
387 t << indentStr << "<templateparamlist>\n";
388 for (const Argument &a : al)
389 {
390 t << indentStr << " <param>\n";
391 if (!a.type.empty())
392 {
393 t << indentStr << " <type>";
394 linkifyText(TextGeneratorXMLImpl(t),a.type,options);
395 t << "</type>\n";
396 }
397 if (!a.name.empty())
398 {
399 t << indentStr << " <declname>" << convertToXML(a.name) << "</declname>\n";
400 t << indentStr << " <defname>" << convertToXML(a.name) << "</defname>\n";
401 }
402 if (!a.defval.empty())
403 {
404 t << indentStr << " <defval>";
405 linkifyText(TextGeneratorXMLImpl(t),a.defval,options);
406 t << "</defval>\n";
407 }
408 if (!a.typeConstraint.empty())
409 {
410 t << indentStr << " <typeconstraint>";
411 linkifyText(TextGeneratorXMLImpl(t),a.typeConstraint,options);
412 t << "</typeconstraint>\n";
413 }
414 if (a.hasTemplateDocumentation())
415 {
416 t << indentStr << " <briefdescription>\n";
417 t << indentStr << " ";
418 if (scope)
419 {
420 writeXMLDocBlock(t,scope->briefFile(),scope->briefLine(),scope,nullptr,a.docs);
421 }
422 else
423 {
424 writeXMLDocBlock(t,fileScope->briefFile(),fileScope->briefLine(),fileScope,nullptr,a.docs);
425 }
426 t << indentStr << " </briefdescription>\n";
427 }
428 t << indentStr << " </param>\n";
429 }
430 t << indentStr << "</templateparamlist>\n";
431 }
432}
433
438
439static void writeTemplateList(const ClassDef *cd,TextStream &t)
440{
442}
443
444static void writeTemplateList(const ConceptDef *cd,TextStream &t)
445{
447}
448
450 const DString &fileName,
451 int lineNr,
452 const Definition *scope,
453 const MemberDef * md,
454 const DString &text)
455{
456 DString stext = text.stripWhiteSpace();
457 if (stext.empty()) return;
458 // convert the documentation string into an abstract syntax tree
459 auto parser { createDocParser() };
460 auto ast { validatingParseDoc(*parser.get(),
461 fileName,
462 lineNr,
463 scope,
464 md,
465 text,
466 DocOptions())
467 };
468 auto astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
469 if (astImpl)
470 {
471 // create a code generator
472 OutputCodeList xmlCodeList;
473 xmlCodeList.add<XMLCodeGenerator>(&t);
474 // create a parse tree visitor for XML
475 XmlDocVisitor visitor(t,xmlCodeList,scope?scope->getDefFileExtension():DString(""));
476 // visit all nodes
477 std::visit(visitor,astImpl->root);
478 // clean up
479 }
480}
481
483{
486 intf->resetCodeParserState();
487 OutputCodeList xmlList;
488 xmlList.add<XMLCodeGenerator>(&t);
489 xmlList.startCodeFragment("DoxyCode");
490 intf->parseCode(xmlList, // codeOutList
491 DString(), // scopeName
493 Config_getBool(FILTER_SOURCE_FILES)),
494 langExt, // lang
495 Config_getBool(STRIP_CODE_COMMENTS),
496 CodeParserOptions().setFileDef(fd)
497 );
498 xmlList.endCodeFragment("DoxyCode");
499}
500
501static void writeMemberReference(TextStream &t,const Definition *def,const MemberDef *rmd,const DString &tagName)
502{
503 DString scope = rmd->getScopeString();
504 DString name = rmd->name();
505 if (!scope.empty() && scope!=def->name())
506 {
508 }
509 t << " <" << tagName << " refid=\"";
510 t << rmd->getOutputFileBase() << "_1" << rmd->anchor() << "\"";
511 if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef())
512 {
513 t << " compoundref=\"" << rmd->getBodyDef()->getOutputFileBase() << "\"";
514 t << " startline=\"" << rmd->getStartBodyLine() << "\"";
515 if (rmd->getEndBodyLine()!=-1)
516 {
517 t << " endline=\"" << rmd->getEndBodyLine() << "\"";
518 }
519 }
520 t << ">" << convertToXML(name) << "</" << tagName << ">\n";
521
522}
523
524static void stripQualifiers(DString &typeStr)
525{
526 bool done=false;
527 typeStr.stripPrefix("friend ");
528 while (!done)
529 {
530 if (typeStr.stripPrefix("static ")) {}
531 else if (typeStr.stripPrefix("constexpr ")) {}
532 else if (typeStr.stripPrefix("consteval ")) {}
533 else if (typeStr.stripPrefix("constinit ")) {}
534 else if (typeStr.stripPrefix("virtual ")) {}
535 else if (typeStr=="virtual") typeStr="";
536 else done=true;
537 }
538}
539
541{
542 //bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
543 //if (inlineGroupedClasses && cd->partOfGroups()!=0)
544 return cd->getOutputFileBase();
545 //else
546 // return cd->getOutputFileBase();
547}
548
550{
551 //bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
552 //if (inlineGroupedClasses && md->getClassDef() && md->getClassDef()->partOfGroups()!=0)
553 // return md->getClassDef()->getXmlOutputFileBase();
554 //else
555 // return md->getOutputFileBase();
556 return md->getOutputFileBase();
557}
558
559// Removes a keyword from a given string
560// @param str string from which to strip the keyword
561// @param needSpace true if spacing is required around the keyword
562// @return true if the keyword was removed, false otherwise
563static bool stripKeyword(DString& str, const char *keyword, bool needSpace)
564{
565 bool found = false;
566 size_t searchStart = 0;
567 size_t searchEnd = str.size();
568 size_t len = strlen(keyword);
569 while (searchStart<searchEnd)
570 {
571 size_t index = str.find(keyword, searchStart);
572 if (index==DString::npos)
573 {
574 break; // no more occurrences found
575 }
576 size_t end = index + len;
577 if (needSpace)
578 {
579 if ((index>0 && str[index-1]!=' ') || // at the start of the string or preceded by a space, or
580 (end!=searchEnd && str[end] !=' ') // at the end of the string or followed by a space.
581 )
582 {
583 searchStart = end;
584 continue; // no a standalone word
585 }
586 }
587 if (needSpace && index>0) // strip with space before keyword
588 {
589 str.remove(index-1, len+1);
590 searchEnd -= (len+1);
591 }
592 else if (needSpace && end<searchEnd) // strip with space after string starting with keyword
593 {
594 str.remove(index, len+1);
595 searchEnd -= (len+1);
596 }
597 else // strip just keyword
598 {
599 str.remove(index, len);
600 searchEnd -= len;
601 }
602 found = true;
603 }
604 return found;
605}
606
608{
609 DString expr;
610 //printf("extractNoExcept(%s)\n",qPrint(argsStr));
611 if (size_t i = argsStr.find("noexcept("); i!=DString::npos)
612 {
613 int bracketCount = 1;
614 size_t p = i+9;
615 bool found = false;
616 bool insideString = false;
617 bool insideChar = false;
618 char pc = 0;
619 while (!found && p<argsStr.length())
620 {
621 char c = argsStr[p++];
622 if (insideString)
623 {
624 if (c=='"' && pc!='\\') insideString=false;
625 }
626 else if (insideChar)
627 {
628 if (c=='\'' && pc!='\\') insideChar=false;
629 }
630 else
631 {
632 switch (c)
633 {
634 case '(': bracketCount++; break;
635 case ')': bracketCount--; found = bracketCount==0; break;
636 case '"': insideString = true; break;
637 case '\'': insideChar = true; break;
638 }
639 }
640 pc = c;
641 }
642 expr = argsStr.mid(i+9,p-i-10);
643 argsStr = (argsStr.left(i) + argsStr.mid(p)).stripWhiteSpace();
644 }
645 //printf("extractNoExcept -> argsStr='%s', expr='%s'\n",qPrint(argsStr),qPrint(expr));
646 return expr;
647}
648
649static void writeRequirementRefs(const Definition *d,TextStream &t,const char *prefix="")
650{
651 auto writeRefsForType = [&t,&prefix](const RequirementRefs &refs,const char *tagName)
652 {
653 if (!refs.empty())
654 {
655 t << prefix << " <" << tagName << ">\n";
656 for (const auto &ref : refs)
657 {
658 t << prefix << " <requirement refid=\"" << xmlRequirementId(ref.reqId()) << "\">"
659 << convertToXML(ref.title()) << "</requirement>\n";
660 }
661 t << prefix << " </" << tagName << ">\n";
662 }
663 };
664 RequirementRefs satisfiesRefs;
665 RequirementRefs verifiesRefs;
666 splitRequirementRefs(d->requirementReferences(),satisfiesRefs,verifiesRefs);
667 writeRefsForType(satisfiesRefs,"satisfies");
668 writeRefsForType(verifiesRefs,"verifies");
669}
670
671
672static void generateXMLForMember(const MemberDef *md,TextStream &ti,TextStream &t,const Definition *def)
673{
674
675 // + declaration/definition arg lists
676 // + reimplements
677 // + reimplementedBy
678 // + exceptions
679 // + const/volatile specifiers
680 // - examples
681 // + source definition
682 // + source references
683 // + source referenced by
684 // - body code
685 // + template arguments
686 // (templateArguments(), definitionTemplateParameterLists())
687 // - call graph
688
689 // enum values are written as part of the enum
690 if (md->memberType()==MemberType::EnumValue) return;
691 if (md->isHidden()) return;
692
693 LinkifyTextOptions options;
694 options.setScope(def).setFileScope(md->getBodyDef()).setSelf(md);
695
696 // group members are only visible in their group
697 bool groupMember = md->getGroupDef() && def->definitionType()!=Definition::TypeGroup;
698
699 if (md->memberType() == MemberType::EnumValue) ASSERT(0);
700 bool isFunc=to_isFunction(md->memberType());
701 DString memType = to_string_lower(md->memberType());
702
703 DString nameStr = md->name();
704 DString typeStr = md->typeString();
705 DString argsStr = md->argsString();
706 DString defStr = md->definition();
707 defStr.stripPrefix("constexpr ");
708 defStr.stripPrefix("consteval ");
709 defStr.stripPrefix("constinit ");
710 stripQualifiers(typeStr);
711 if (typeStr=="auto")
712 {
713 if (size_t i=argsStr.rfind("->"); i!=DString::npos) // move trailing return type into type and strip it from argsStr
714 {
715 typeStr=argsStr.mid(i+2).stripWhiteSpace();
716 argsStr=argsStr.left(i).stripWhiteSpace();
717 if (stripKeyword(typeStr, "override", true))
718 {
719 argsStr += " override";
720 }
721 if (stripKeyword(typeStr, "final", true))
722 {
723 argsStr += " final";
724 }
725 if (stripKeyword(typeStr, "=0", false))
726 {
727 argsStr += "=0";
728 }
729 if (stripKeyword(typeStr, "=default", false))
730 {
731 argsStr += "=default";
732 }
733 if (stripKeyword(typeStr, "=delete", false))
734 {
735 argsStr += "=delete";
736 }
737 i=defStr.find("auto ");
738 if (i!=DString::npos)
739 {
740 defStr=defStr.left(i)+typeStr+defStr.mid(i+4);
741 }
742 }
743 }
744 DString noExceptExpr = extractNoExcept(argsStr);
745
746 ti << " <member refid=\"" << memberOutputFileBase(md)
747 << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>"
748 << convertToXML(nameStr) << "</name></member>\n";
749
750 if (groupMember)
751 {
752 t << " <member refid=\""
754 << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>"
755 << convertToXML(nameStr) << "</name></member>\n";
756 return;
757 }
758 else
759 {
760 t << " <memberdef kind=\"";
761 t << memType << "\" id=\"";
762 t << memberOutputFileBase(md);
763 t << "_1" // encoded ':' character (see util.cpp:convertNameToFile)
764 << md->anchor();
765 }
766 //enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t;
767
768 t << "\" prot=\"" << to_string_lower(md->protection());
769 t << "\"";
770
771 t << " static=\"";
772 if (md->isStatic()) t << "yes"; else t << "no";
773 t << "\"";
774
775 if (md->isNoDiscard())
776 {
777 t << " nodiscard=\"yes\"";
778 }
779
780 if (md->isConstExpr())
781 {
782 t << " constexpr=\"yes\"";
783 }
784
785 if (md->isConstEval())
786 {
787 t << " consteval=\"yes\"";
788 }
789
790 if (md->isConstInit())
791 {
792 t << " constinit=\"yes\"";
793 }
794
795 if (md->isExternal())
796 {
797 t << " extern=\"yes\"";
798 }
799
800 if (isFunc)
801 {
802 const ArgumentList &al = md->argumentList();
803 t << " const=\"";
804 if (al.constSpecifier()) t << "yes"; else t << "no";
805 t << "\"";
806
807 t << " explicit=\"";
808 if (md->isExplicit()) t << "yes"; else t << "no";
809 t << "\"";
810
811 t << " inline=\"";
812 if (md->isInline()) t << "yes"; else t << "no";
813 t << "\"";
814
816 {
817 t << " refqual=\"";
818 if (al.refQualifier()==RefQualifierType::LValue) t << "lvalue"; else t << "rvalue";
819 t << "\"";
820 }
821
822 if (md->isFinal())
823 {
824 t << " final=\"yes\"";
825 }
826
827 if (md->isSealed())
828 {
829 t << " sealed=\"yes\"";
830 }
831
832 if (md->isNew())
833 {
834 t << " new=\"yes\"";
835 }
836
837 if (md->isOptional())
838 {
839 t << " optional=\"yes\"";
840 }
841
842 if (md->isRequired())
843 {
844 t << " required=\"yes\"";
845 }
846
847 if (md->isNoExcept())
848 {
849 t << " noexcept=\"yes\"";
850 }
851
852 if (!noExceptExpr.empty())
853 {
854 t << " noexceptexpression=\"" << convertToXML(noExceptExpr) << "\"";
855 }
856
857 if (al.volatileSpecifier())
858 {
859 t << " volatile=\"yes\"";
860 }
861
862 t << " virt=\"" << to_string_lower(md->virtualness());
863 t << "\"";
864 }
865
866 if (md->memberType() == MemberType::Enumeration)
867 {
868 t << " strong=\"";
869 if (md->isStrong()) t << "yes"; else t << "no";
870 t << "\"";
871 }
872
873 if (md->memberType() == MemberType::Variable)
874 {
875 //ArgumentList *al = md->argumentList();
876 //t << " volatile=\"";
877 //if (al && al->volatileSpecifier) t << "yes"; else t << "no";
878
879 t << " mutable=\"";
880 if (md->isMutable()) t << "yes"; else t << "no";
881 t << "\"";
882
883 if (md->isThreadLocal())
884 {
885 t << " thread_local=\"yes\"";
886 }
887
888 if (md->isInitonly())
889 {
890 t << " initonly=\"yes\"";
891 }
892 if (md->isAttribute())
893 {
894 t << " attribute=\"yes\"";
895 }
896 if (md->isUNOProperty())
897 {
898 t << " property=\"yes\"";
899 }
900 if (md->isReadonly())
901 {
902 t << " readonly=\"yes\"";
903 }
904 if (md->isBound())
905 {
906 t << " bound=\"yes\"";
907 }
908 if (md->isRemovable())
909 {
910 t << " removable=\"yes\"";
911 }
912 if (md->isConstrained())
913 {
914 t << " constrained=\"yes\"";
915 }
916 if (md->isTransient())
917 {
918 t << " transient=\"yes\"";
919 }
920 if (md->isMaybeVoid())
921 {
922 t << " maybevoid=\"yes\"";
923 }
924 if (md->isMaybeDefault())
925 {
926 t << " maybedefault=\"yes\"";
927 }
928 if (md->isMaybeAmbiguous())
929 {
930 t << " maybeambiguous=\"yes\"";
931 }
932 }
933 else if (md->memberType() == MemberType::Property)
934 {
935 t << " readable=\"";
936 if (md->isReadable()) t << "yes"; else t << "no";
937 t << "\"";
938
939 t << " writable=\"";
940 if (md->isWritable()) t << "yes"; else t << "no";
941 t << "\"";
942
943 t << " gettable=\"";
944 if (md->isGettable()) t << "yes"; else t << "no";
945 t << "\"";
946
947 t << " privategettable=\"";
948 if (md->isPrivateGettable()) t << "yes"; else t << "no";
949 t << "\"";
950
951 t << " protectedgettable=\"";
952 if (md->isProtectedGettable()) t << "yes"; else t << "no";
953 t << "\"";
954
955 t << " settable=\"";
956 if (md->isSettable()) t << "yes"; else t << "no";
957 t << "\"";
958
959 t << " privatesettable=\"";
960 if (md->isPrivateSettable()) t << "yes"; else t << "no";
961 t << "\"";
962
963 t << " protectedsettable=\"";
964 if (md->isProtectedSettable()) t << "yes"; else t << "no";
965 t << "\"";
966
967 if (md->isAssign() || md->isCopy() || md->isRetain() || md->isStrong() || md->isWeak())
968 {
969 t << " accessor=\"";
970 if (md->isAssign()) t << "assign";
971 else if (md->isCopy()) t << "copy";
972 else if (md->isRetain()) t << "retain";
973 else if (md->isStrong()) t << "strong";
974 else if (md->isWeak()) t << "weak";
975 t << "\"";
976 }
977 }
978 else if (md->memberType() == MemberType::Event)
979 {
980 t << " add=\"";
981 if (md->isAddable()) t << "yes"; else t << "no";
982 t << "\"";
983
984 t << " remove=\"";
985 if (md->isRemovable()) t << "yes"; else t << "no";
986 t << "\"";
987
988 t << " raise=\"";
989 if (md->isRaisable()) t << "yes"; else t << "no";
990 t << "\"";
991 }
992
993 t << ">\n";
994
995 if (md->memberType()!=MemberType::Define &&
996 md->memberType()!=MemberType::Enumeration
997 )
998 {
1000 t << " <type>";
1001 linkifyText(TextGeneratorXMLImpl(t),typeStr,options);
1002 t << "</type>\n";
1003 if (md->isTypeAlias())
1004 {
1005 defStr+=" = "+md->initializer();
1006 }
1007 t << " <definition>" << convertToXML(defStr) << "</definition>\n";
1008 t << " <argsstring>" << convertToXML(argsStr) << "</argsstring>\n";
1009 }
1010
1011 if (md->memberType() == MemberType::Enumeration)
1012 {
1013 t << " <type>";
1015 t << "</type>\n";
1016 }
1017
1018 DString qualifiedNameStr = md->qualifiedName();
1019 t << " <name>" << convertToXML(nameStr) << "</name>\n";
1020 if (nameStr!=qualifiedNameStr)
1021 {
1022 t << " <qualifiedname>" << convertToXML(qualifiedNameStr) << "</qualifiedname>\n";
1023 }
1024
1025 if (md->memberType() == MemberType::Property)
1026 {
1027 if (md->isReadable())
1028 t << " <read>" << convertToXML(md->getReadAccessor()) << "</read>\n";
1029 if (md->isWritable())
1030 t << " <write>" << convertToXML(md->getWriteAccessor()) << "</write>\n";
1031 }
1032
1033 if (md->memberType()==MemberType::Variable && !md->bitfieldString().empty())
1034 {
1035 DString bitfield = md->bitfieldString();
1036 if (bitfield.at(0)==':') bitfield=bitfield.mid(1);
1037 t << " <bitfield>" << convertToXML(bitfield) << "</bitfield>\n";
1038 }
1039
1040 const MemberDef *rmd = md->reimplements();
1041 if (rmd)
1042 {
1043 t << " <reimplements refid=\""
1044 << memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">"
1045 << convertToXML(rmd->name()) << "</reimplements>\n";
1046 }
1047 for (const auto &rbmd : md->reimplementedBy())
1048 {
1049 t << " <reimplementedby refid=\""
1050 << memberOutputFileBase(rbmd) << "_1" << rbmd->anchor() << "\">"
1051 << convertToXML(rbmd->name()) << "</reimplementedby>\n";
1052 }
1053
1054 for (const auto &qmd : md->getQualifiers())
1055 {
1056 t << " <qualifier>" << convertToXML(qmd) << "</qualifier>\n";
1057 }
1058
1059 if (md->isFriendClass()) // for friend classes we show a link to the class as a "parameter"
1060 {
1061 t << " <param>\n";
1062 t << " <type>";
1063 linkifyText(TextGeneratorXMLImpl(t),nameStr,options);
1064 t << "</type>\n";
1065 t << " </param>\n";
1066 }
1067 else if (isFunc) //function
1068 {
1069 const ArgumentList &declAl = md->declArgumentList();
1070 const ArgumentList &defAl = md->argumentList();
1071 bool isFortran = md->getLanguage()==SrcLangExt::Fortran;
1072 if (declAl.hasParameters())
1073 {
1074 auto defIt = defAl.begin();
1075 for (const Argument &a : declAl)
1076 {
1077 //const Argument *defArg = defAli.current();
1078 const Argument *defArg = nullptr;
1079 if (defIt!=defAl.end())
1080 {
1081 defArg = &(*defIt);
1082 ++defIt;
1083 }
1084 t << " <param>\n";
1085 if (!a.attrib.empty())
1086 {
1087 t << " <attributes>";
1088 writeXMLString(t,a.attrib);
1089 t << "</attributes>\n";
1090 }
1091 if (isFortran && defArg && !defArg->type.empty())
1092 {
1093 t << " <type>";
1094 linkifyText(TextGeneratorXMLImpl(t),defArg->type,options);
1095 t << "</type>\n";
1096 }
1097 else if (!a.type.empty())
1098 {
1099 t << " <type>";
1100 linkifyText(TextGeneratorXMLImpl(t),a.type,options);
1101 t << "</type>\n";
1102 }
1103 if (!a.name.empty())
1104 {
1105 t << " <declname>";
1106 writeXMLString(t,a.name);
1107 t << "</declname>\n";
1108 }
1109 if (defArg && !defArg->name.empty() && defArg->name!=a.name)
1110 {
1111 t << " <defname>";
1112 writeXMLString(t,defArg->name);
1113 t << "</defname>\n";
1114 }
1115 if (!a.array.empty())
1116 {
1117 t << " <array>";
1118 writeXMLString(t,a.array);
1119 t << "</array>\n";
1120 }
1121 if (!a.defval.empty())
1122 {
1123 t << " <defval>";
1124 linkifyText(TextGeneratorXMLImpl(t),a.defval,options);
1125 t << "</defval>\n";
1126 }
1127 if (defArg && defArg->hasDocumentation())
1128 {
1129 t << " <briefdescription>";
1131 md->getOuterScope(),md,defArg->docs);
1132 t << "</briefdescription>\n";
1133 }
1134 t << " </param>\n";
1135 }
1136 }
1137 }
1138 else if (md->memberType()==MemberType::Define &&
1139 !md->argsString().empty()) // define
1140 {
1141 if (md->argumentList().empty()) // special case for "foo()" to
1142 // distinguish it from "foo".
1143 {
1144 t << " <param></param>\n";
1145 }
1146 else
1147 {
1148 for (const Argument &a : md->argumentList())
1149 {
1150 t << " <param><defname>" << a.type << "</defname></param>\n";
1151 }
1152 }
1153 }
1154 if (!md->requiresClause().empty())
1155 {
1156 t << " <requiresclause>";
1158 t << " </requiresclause>\n";
1159 }
1160
1161 if (!md->isTypeAlias() && (md->hasOneLineInitializer() || md->hasMultiLineInitializer()))
1162 {
1163 t << " <initializer>";
1165 t << "</initializer>\n";
1166 }
1167
1168 if (!md->excpString().empty())
1169 {
1170 t << " <exceptions>";
1172 t << "</exceptions>\n";
1173 }
1174 writeRequirementRefs(md,t," ");
1175
1176 if (md->memberType()==MemberType::Enumeration) // enum
1177 {
1178 for (const auto &emd : md->enumFieldList())
1179 {
1180 ti << " <member refid=\"" << memberOutputFileBase(md)
1181 << "_1" << emd->anchor() << "\" kind=\"enumvalue\"><name>"
1182 << convertToXML(emd->name()) << "</name></member>\n";
1183
1184 t << " <enumvalue id=\"" << memberOutputFileBase(md) << "_1"
1185 << emd->anchor() << "\" prot=\"" << to_string_lower(emd->protection());
1186 t << "\">\n";
1187 t << " <name>";
1188 writeXMLString(t,emd->name());
1189 t << "</name>\n";
1190 if (!emd->initializer().empty())
1191 {
1192 t << " <initializer>";
1193 writeXMLString(t,emd->initializer());
1194 t << "</initializer>\n";
1195 }
1196 t << " <briefdescription>\n";
1197 writeXMLDocBlock(t,emd->briefFile(),emd->briefLine(),emd->getOuterScope(),emd,emd->briefDescription());
1198 t << " </briefdescription>\n";
1199 t << " <detaileddescription>\n";
1200 writeXMLDocBlock(t,emd->docFile(),emd->docLine(),emd->getOuterScope(),emd,emd->documentation());
1201 t << " </detaileddescription>\n";
1202 t << " </enumvalue>\n";
1203 }
1204 }
1205 t << " <briefdescription>\n";
1207 t << " </briefdescription>\n";
1208 t << " <detaileddescription>\n";
1209 writeXMLDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation());
1210 t << " </detaileddescription>\n";
1211 t << " <inbodydescription>\n";
1213 t << " </inbodydescription>\n";
1214 if (md->getDefLine()!=-1)
1215 {
1216 t << " <location file=\""
1217 << convertToXML(stripFromPath(md->getDefFileName())) << "\" line=\""
1218 << md->getDefLine() << "\" column=\""
1219 << md->getDefColumn() << "\"" ;
1220 if (md->getStartBodyLine()!=-1)
1221 {
1222 const FileDef *bodyDef = md->getBodyDef();
1223 if (bodyDef)
1224 {
1225 t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\"";
1226 }
1227 t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\""
1228 << md->getEndBodyLine() << "\"";
1229 }
1230 if (md->getDeclLine()!=-1)
1231 {
1232 t << " declfile=\"" << convertToXML(stripFromPath(md->getDeclFileName())) << "\" declline=\""
1233 << md->getDeclLine() << "\" declcolumn=\""
1234 << md->getDeclColumn() << "\"";
1235 }
1236 t << "/>\n";
1237 }
1238
1239 //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers());
1240 auto refList = md->getReferencesMembers();
1241 for (const auto &refmd : refList)
1242 {
1243 writeMemberReference(t,def,refmd,"references");
1244 }
1245 auto refByList = md->getReferencedByMembers();
1246 for (const auto &refmd : refByList)
1247 {
1248 writeMemberReference(t,def,refmd,"referencedby");
1249 }
1250
1251 t << " </memberdef>\n";
1252}
1253
1254// namespace members are also inserted in the file scope, but
1255// to prevent this duplication in the XML output, we optionally filter those here.
1256static bool memberVisible(const Definition *d,const MemberDef *md)
1257{
1258 return Config_getBool(XML_NS_MEMB_FILE_SCOPE) ||
1260 md->getNamespaceDef()==nullptr;
1261}
1262
1264 const MemberList *ml,const DString &kind,const DString &header=DString(),
1265 const DString &documentation=DString())
1266{
1267 if (ml==nullptr) return;
1268 int count=0;
1269 for (const auto &md : *ml)
1270 {
1271 if (memberVisible(d,md) && (md->memberType()!=MemberType::EnumValue) &&
1272 !md->isHidden())
1273 {
1274 count++;
1275 }
1276 }
1277 if (count==0) return; // empty list
1278
1279 t << " <sectiondef kind=\"" << kind << "\">\n";
1280 if (!header.empty())
1281 {
1282 t << " <header>" << convertToXML(header) << "</header>\n";
1283 }
1284 if (!documentation.empty())
1285 {
1286 t << " <description>";
1287 writeXMLDocBlock(t,d->docFile(),d->docLine(),d,nullptr,documentation);
1288 t << "</description>\n";
1289 }
1290 for (const auto &md : *ml)
1291 {
1292 if (memberVisible(d,md))
1293 {
1294 generateXMLForMember(md,ti,t,d);
1295 }
1296 }
1297 t << " </sectiondef>\n";
1298}
1299
1301{
1302 t << " <listofallmembers>\n";
1303 for (auto &mni : cd->memberNameInfoLinkedMap())
1304 {
1305 for (auto &mi : *mni)
1306 {
1307 const MemberDef *md=mi->memberDef();
1308 if (!md->isAnonymous())
1309 {
1310 Protection prot = mi->prot();
1311 Specifier virt=md->virtualness();
1312 t << " <member refid=\"" << memberOutputFileBase(md) << "_1" <<
1313 md->anchor() << "\" prot=\"" << to_string_lower(prot);
1314 t << "\" virt=\"" << to_string_lower(virt) << "\"";
1315 if (!mi->ambiguityResolutionScope().empty())
1316 {
1317 t << " ambiguityscope=\"" << convertToXML(mi->ambiguityResolutionScope()) << "\"";
1318 }
1319 t << "><scope>" << convertToXML(cd->name()) << "</scope><name>" <<
1320 convertToXML(md->name()) << "</name></member>\n";
1321 }
1322 }
1323 }
1324 t << " </listofallmembers>\n";
1325}
1326
1328{
1329 for (const auto &cd : cl)
1330 {
1331 if (!cd->isHidden() && !cd->isAnonymous())
1332 {
1333 t << " <innerclass refid=\"" << classOutputFileBase(cd)
1334 << "\" prot=\"" << to_string_lower(cd->protection());
1335 t << "\">" << convertToXML(cd->name()) << "</innerclass>\n";
1336 }
1337 }
1338}
1339
1341{
1342 for (const auto &cd : cl)
1343 {
1344 if (!cd->isHidden())
1345 {
1346 t << " <innerconcept refid=\"" << cd->getOutputFileBase()
1347 << "\">" << convertToXML(cd->name()) << "</innerconcept>\n";
1348 }
1349 }
1350}
1351
1353{
1354 for (const auto &mod : ml)
1355 {
1356 if (!mod->isHidden())
1357 {
1358 t << " <innermodule refid=\"" << mod->getOutputFileBase()
1359 << "\">" << convertToXML(mod->name()) << "</innermodule>\n";
1360 }
1361 }
1362}
1363
1365{
1366 for (const auto &nd : nl)
1367 {
1368 if (!nd->isHidden() && !nd->isAnonymous())
1369 {
1370 t << " <innernamespace refid=\"" << nd->getOutputFileBase()
1371 << "\"" << (nd->isInline() ? " inline=\"yes\"" : "")
1372 << ">" << convertToXML(nd->name()) << "</innernamespace>\n";
1373 }
1374 }
1375}
1376
1377static void writeExports(const ImportInfoMap &exportMap,TextStream &t)
1378{
1379 if (exportMap.empty()) return;
1380 t << " <exports>\n";
1381 for (const auto &[moduleName,importInfoList] : exportMap)
1382 {
1383 for (const auto &importInfo : importInfoList)
1384 {
1385 t << " <export";
1386 ModuleDef *mod = ModuleManager::instance().getPrimaryInterface(importInfo.importName);
1387 if (mod && mod->isLinkableInProject())
1388 {
1389 t << " refid=\"" << mod->getOutputFileBase() << "\"";
1390 }
1391 t << ">";
1392 t << importInfo.importName;
1393 t << "</export>\n";
1394 }
1395 }
1396 t << " </exports>\n";
1397}
1398
1399static void writeInnerFiles(const FileList &fl,TextStream &t)
1400{
1401 for (const auto &fd : fl)
1402 {
1403 t << " <innerfile refid=\"" << fd->getOutputFileBase()
1404 << "\">" << convertToXML(fd->name()) << "</innerfile>\n";
1405 }
1406}
1407
1409{
1410 for (const auto &pd : pl)
1411 {
1412 t << " <innerpage refid=\"" << pd->getOutputFileBase();
1413 if (pd->getGroupDef())
1414 {
1415 t << "_" << pd->name();
1416 }
1417 t << "\">" << convertToXML(pd->title()) << "</innerpage>\n";
1418 }
1419}
1420
1421static void writeInnerGroups(const GroupList &gl,TextStream &t)
1422{
1423 for (const auto &sgd : gl)
1424 {
1425 t << " <innergroup refid=\"" << sgd->getOutputFileBase()
1426 << "\">" << convertToXML(sgd->groupTitle())
1427 << "</innergroup>\n";
1428 }
1429}
1430
1431static void writeInnerDirs(const DirList *dl,TextStream &t)
1432{
1433 if (dl)
1434 {
1435 for(const auto &subdir : *dl)
1436 {
1437 t << " <innerdir refid=\"" << subdir->getOutputFileBase()
1438 << "\">" << convertToXML(subdir->displayName()) << "</innerdir>\n";
1439 }
1440 }
1441}
1442
1443static void writeIncludeInfo(const IncludeInfo *ii,TextStream &t)
1444{
1445 if (ii)
1446 {
1447 DString nm = ii->includeName;
1448 if (nm.empty() && ii->fileDef) nm = ii->fileDef->docName();
1449 if (!nm.empty())
1450 {
1451 t << " <includes";
1452 if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references
1453 {
1454 t << " refid=\"" << ii->fileDef->getOutputFileBase() << "\"";
1455 }
1456 t << " local=\"" << ((ii->kind & IncludeKind_LocalMask) ? "yes" : "no") << "\">";
1457 t << nm;
1458 t << "</includes>\n";
1459 }
1460 }
1461}
1462
1463static void generateXMLForClass(const ClassDef *cd,TextStream &ti)
1464{
1465 // + brief description
1466 // + detailed description
1467 // + template argument list(s)
1468 // - include file
1469 // + member groups
1470 // + inheritance diagram
1471 // + list of direct super classes
1472 // + list of direct sub classes
1473 // + list of inner classes
1474 // + collaboration diagram
1475 // + list of all members
1476 // + user defined member sections
1477 // + standard member sections
1478 // + detailed member documentation
1479 // - examples using the class
1480
1481 if (cd->isReference()) return; // skip external references.
1482 if (cd->isHidden()) return; // skip hidden classes.
1483 if (cd->isAnonymous()) return; // skip anonymous compounds.
1484 if (cd->isImplicitTemplateInstance()) return; // skip generated template instances.
1485 if (cd->isArtificial()) return; // skip artificially created classes
1486
1487 msg("Generating XML output for class {}\n",cd->name());
1488
1489 ti << " <compound refid=\"" << classOutputFileBase(cd)
1490 << "\" kind=\"" << cd->compoundTypeString()
1491 << "\"><name>" << convertToXML(cd->name()) << "</name>\n";
1492
1493 DString outputDirectory = Config_getString(XML_OUTPUT);
1494 DString fileName=outputDirectory+"/"+ classOutputFileBase(cd)+".xml";
1495 std::ofstream f = Portable::openOutputStream(fileName);
1496 if (!f.is_open())
1497 {
1498 err("Cannot open file {} for writing!\n",fileName);
1499 return;
1500 }
1501 TextStream t(&f);
1502
1503 writeXMLHeader(t);
1504 t << " <compounddef id=\""
1505 << classOutputFileBase(cd) << "\" kind=\""
1506 << cd->compoundTypeString() << "\" language=\""
1507 << to_string(cd->getLanguage()) << "\" prot=\"";
1508 t << to_string_lower(cd->protection());
1509 if (cd->isFinal()) t << "\" final=\"yes";
1510 if (cd->isSealed()) t << "\" sealed=\"yes";
1511 if (cd->isAbstract()) t << "\" abstract=\"yes";
1512 t << "\">\n";
1513 t << " <compoundname>";
1514 DString nameStr = cd->name();
1515 writeXMLString(t,nameStr);
1516 t << "</compoundname>\n";
1517 for (const auto &bcd : cd->baseClasses())
1518 {
1519 t << " <basecompoundref ";
1520 if (bcd.classDef->isLinkable())
1521 {
1522 t << "refid=\"" << classOutputFileBase(bcd.classDef) << "\" ";
1523 }
1524 if (bcd.prot == Protection::Package) ASSERT(0);
1525 t << "prot=\"";
1526 t << to_string_lower(bcd.prot);
1527 t << "\" virt=\"";
1528 t << to_string_lower(bcd.virt);
1529 t << "\">";
1530 if (!bcd.templSpecifiers.empty())
1531 {
1532 t << convertToXML(
1534 bcd.classDef->name(),bcd.templSpecifiers)
1535 );
1536 }
1537 else
1538 {
1539 t << convertToXML(bcd.classDef->displayName());
1540 }
1541 t << "</basecompoundref>\n";
1542 }
1543 for (const auto &bcd : cd->subClasses())
1544 {
1545 if (bcd.prot == Protection::Package) ASSERT(0);
1546 t << " <derivedcompoundref refid=\""
1547 << classOutputFileBase(bcd.classDef)
1548 << "\" prot=\"";
1549 t << to_string_lower(bcd.prot);
1550 t << "\" virt=\"";
1551 t << to_string_lower(bcd.virt);
1552 t << "\">" << convertToXML(bcd.classDef->displayName())
1553 << "</derivedcompoundref>\n";
1554 }
1555
1557
1559
1560 writeTemplateList(cd,t);
1561 for (const auto &mg : cd->getMemberGroups())
1562 {
1563 generateXMLSection(cd,ti,t,&mg->members(),"user-defined",mg->header(),
1564 mg->documentation());
1565 }
1566
1567 for (const auto &ml : cd->getMemberLists())
1568 {
1569 if (!ml->listType().isDetailed())
1570 {
1571 generateXMLSection(cd,ti,t,ml.get(),ml->listType().toXML());
1572 }
1573 }
1574
1575 LinkifyTextOptions options;
1576 options.setScope(cd).setFileScope(cd->getFileDef());
1577
1578 if (!cd->requiresClause().empty())
1579 {
1580 t << " <requiresclause>";
1582 t << " </requiresclause>\n";
1583 }
1584
1585 for (const auto &qcd : cd->getQualifiers())
1586 {
1587 t << " <qualifier>" << convertToXML(qcd) << "</qualifier>\n";
1588 }
1589
1590 t << " <briefdescription>\n";
1591 writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,nullptr,cd->briefDescription());
1592 t << " </briefdescription>\n";
1593 t << " <detaileddescription>\n";
1594 writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd,nullptr,cd->documentation());
1595 t << " </detaileddescription>\n";
1596 DotClassGraph inheritanceGraph(cd,GraphType::Inheritance);
1597 if (!inheritanceGraph.isTrivial())
1598 {
1599 t << " <inheritancegraph>\n";
1600 inheritanceGraph.writeXML(t);
1601 t << " </inheritancegraph>\n";
1602 }
1603 DotClassGraph collaborationGraph(cd,GraphType::Collaboration);
1604 if (!collaborationGraph.isTrivial())
1605 {
1606 t << " <collaborationgraph>\n";
1607 collaborationGraph.writeXML(t);
1608 t << " </collaborationgraph>\n";
1609 }
1611 t << " <location file=\""
1612 << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\""
1613 << cd->getDefLine() << "\"" << " column=\""
1614 << cd->getDefColumn() << "\"" ;
1615 if (cd->getStartBodyLine()!=-1)
1616 {
1617 const FileDef *bodyDef = cd->getBodyDef();
1618 if (bodyDef)
1619 {
1620 t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\"";
1621 }
1622 t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\""
1623 << cd->getEndBodyLine() << "\"";
1624 }
1625 t << "/>\n";
1627 t << " </compounddef>\n";
1628 t << "</doxygen>\n";
1629
1630 ti << " </compound>\n";
1631}
1632
1634{
1635 if (cd->isReference() || cd->isHidden()) return; // skip external references.
1636
1637 ti << " <compound refid=\"" << cd->getOutputFileBase()
1638 << "\" kind=\"concept\"" << "><name>"
1639 << convertToXML(cd->name()) << "</name>\n";
1640
1641 LinkifyTextOptions options;
1642 options.setScope(cd).setFileScope(cd->getFileDef());
1643 DString outputDirectory = Config_getString(XML_OUTPUT);
1644 DString fileName=outputDirectory+"/"+cd->getOutputFileBase()+".xml";
1645 std::ofstream f = Portable::openOutputStream(fileName);
1646 if (!f.is_open())
1647 {
1648 err("Cannot open file {} for writing!\n",fileName);
1649 return;
1650 }
1651 TextStream t(&f);
1652 writeXMLHeader(t);
1653 t << " <compounddef id=\"" << cd->getOutputFileBase()
1654 << "\" kind=\"concept\">\n";
1655 t << " <compoundname>";
1656 DString nameStr = cd->name();
1657 writeXMLString(t,nameStr);
1658 t << "</compoundname>\n";
1660 writeTemplateList(cd,t);
1661 t << " <initializer>";
1663 t << "</initializer>\n";
1664 auto intf=Doxygen::parserManager->getCodeParser(".cpp");
1665 intf->resetCodeParserState();
1666 OutputCodeList xmlList;
1667 xmlList.add<XMLCodeGenerator>(&t);
1668 t << " <conceptparts>\n";
1669 for (const auto &part : cd->conceptParts())
1670 {
1671 switch (part.type)
1672 {
1674 t << " <docpart line=\"" << part.lineNr << "\" col=\"" << part.colNr << "\">\n";
1675 writeXMLDocBlock(t,cd->getDefFileName(),part.lineNr,cd,nullptr,part.content);
1676 t << " </docpart>\n";
1677 break;
1679 t << " <codepart line=\"" << part.lineNr << "\">";
1680 xmlList.startCodeFragment("DoxyCode");
1681 intf->parseCode(xmlList, // codeOutList
1682 nameStr, // scopeName
1683 part.content, // code
1684 SrcLangExt::Cpp, // lang
1685 false, // stripCodeComments
1687 );
1688 xmlList.endCodeFragment("DoxyCode");
1689 t << "</codepart>\n";
1690 break;
1691 }
1692 }
1693 t << " </conceptparts>\n";
1694 t << " <briefdescription>\n";
1695 writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,nullptr,cd->briefDescription());
1696 t << " </briefdescription>\n";
1697 t << " <detaileddescription>\n";
1698 writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd,nullptr,cd->documentation());
1699 t << " </detaileddescription>\n";
1701 t << " <location file=\""
1702 << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\""
1703 << cd->getDefLine() << "\"" << " column=\""
1704 << cd->getDefColumn() << "\"/>\n" ;
1705 t << " </compounddef>\n";
1706 t << "</doxygen>\n";
1707
1708 ti << " </compound>\n";
1709}
1710
1711static void generateXMLForModule(const ModuleDef *mod,TextStream &ti)
1712{
1713 if (mod->isReference() || mod->isHidden() || !mod->isPrimaryInterface()) return;
1714 ti << " <compound refid=\"" << mod->getOutputFileBase()
1715 << "\" kind=\"module\"" << "><name>"
1716 << convertToXML(mod->name()) << "</name>\n";
1717
1718 DString outputDirectory = Config_getString(XML_OUTPUT);
1719 DString fileName=outputDirectory+"/"+mod->getOutputFileBase()+".xml";
1720 std::ofstream f = Portable::openOutputStream(fileName);
1721 if (!f.is_open())
1722 {
1723 err("Cannot open file {} for writing!\n",fileName);
1724 return;
1725 }
1726 TextStream t(&f);
1727 writeXMLHeader(t);
1728 t << " <compounddef id=\"" << mod->getOutputFileBase()
1729 << "\" kind=\"module\">\n";
1730 t << " <compoundname>";
1731 writeXMLString(t,mod->name());
1732 t << "</compoundname>\n";
1733 writeInnerFiles(mod->getUsedFiles(),t);
1734 writeInnerClasses(mod->getClasses(),t);
1736 for (const auto &ml : mod->getMemberLists())
1737 {
1738 if (ml->listType().isDeclaration())
1739 {
1740 generateXMLSection(mod,ti,t,ml.get(),ml->listType().toXML());
1741 }
1742 }
1743 for (const auto &mg : mod->getMemberGroups())
1744 {
1745 generateXMLSection(mod,ti,t,&mg->members(),"user-defined",mg->header(),
1746 mg->documentation());
1747 }
1748 t << " <briefdescription>\n";
1749 writeXMLDocBlock(t,mod->briefFile(),mod->briefLine(),mod,nullptr,mod->briefDescription());
1750 t << " </briefdescription>\n";
1751 t << " <detaileddescription>\n";
1752 writeXMLDocBlock(t,mod->docFile(),mod->docLine(),mod,nullptr,mod->documentation());
1753 t << " </detaileddescription>\n";
1754 writeExports(mod->getExports(),t);
1755 writeRequirementRefs(mod,t);
1756 t << " <location file=\""
1757 << convertToXML(stripFromPath(mod->getDefFileName())) << "\" line=\""
1758 << mod->getDefLine() << "\"" << " column=\""
1759 << mod->getDefColumn() << "\"/>\n" ;
1760 t << " </compounddef>\n";
1761 t << "</doxygen>\n";
1762
1763 ti << " </compound>\n";
1764
1765}
1766
1768{
1769 // + contained class definitions
1770 // + contained namespace definitions
1771 // + member groups
1772 // + normal members
1773 // + brief desc
1774 // + detailed desc
1775 // + location
1776 // - files containing (parts of) the namespace definition
1777
1778 if (nd->isReference() || nd->isHidden()) return; // skip external references
1779
1780 ti << " <compound refid=\"" << nd->getOutputFileBase()
1781 << "\" kind=\"namespace\"" << "><name>"
1782 << convertToXML(nd->name()) << "</name>\n";
1783
1784 DString outputDirectory = Config_getString(XML_OUTPUT);
1785 DString fileName=outputDirectory+"/"+nd->getOutputFileBase()+".xml";
1786 std::ofstream f = Portable::openOutputStream(fileName);
1787 if (!f.is_open())
1788 {
1789 err("Cannot open file {} for writing!\n",fileName);
1790 return;
1791 }
1792 TextStream t(&f);
1793
1794 writeXMLHeader(t);
1795 t << " <compounddef id=\"" << nd->getOutputFileBase()
1796 << "\" kind=\"namespace\" "
1797 << (nd->isInline()?"inline=\"yes\" ":"")
1798 << "language=\""
1799 << to_string(nd->getLanguage()) << "\">\n";
1800 t << " <compoundname>";
1801 DString nameStr = nd->name();
1802 writeXMLString(t,nameStr);
1803 t << "</compoundname>\n";
1804
1808
1809 for (const auto &mg : nd->getMemberGroups())
1810 {
1811 generateXMLSection(nd,ti,t,&mg->members(),"user-defined",mg->header(),
1812 mg->documentation());
1813 }
1814
1815 for (const auto &ml : nd->getMemberLists())
1816 {
1817 if (ml->listType().isDeclaration())
1818 {
1819 generateXMLSection(nd,ti,t,ml.get(),ml->listType().toXML());
1820 }
1821 }
1822
1823 t << " <briefdescription>\n";
1824 writeXMLDocBlock(t,nd->briefFile(),nd->briefLine(),nd,nullptr,nd->briefDescription());
1825 t << " </briefdescription>\n";
1826 t << " <detaileddescription>\n";
1827 writeXMLDocBlock(t,nd->docFile(),nd->docLine(),nd,nullptr,nd->documentation());
1828 t << " </detaileddescription>\n";
1830 t << " <location file=\""
1831 << convertToXML(stripFromPath(nd->getDefFileName())) << "\" line=\""
1832 << nd->getDefLine() << "\"" << " column=\""
1833 << nd->getDefColumn() << "\"/>\n" ;
1834 t << " </compounddef>\n";
1835 t << "</doxygen>\n";
1836
1837 ti << " </compound>\n";
1838}
1839
1841{
1842 // + includes files
1843 // + includedby files
1844 // + include graph
1845 // + included by graph
1846 // + contained class definitions
1847 // + contained namespace definitions
1848 // + member groups
1849 // + normal members
1850 // + brief desc
1851 // + detailed desc
1852 // + source code
1853 // + location
1854 // - number of lines
1855
1856 if (fd->isReference()) return; // skip external references
1857
1858 ti << " <compound refid=\"" << fd->getOutputFileBase()
1859 << "\" kind=\"file\"><name>" << convertToXML(fd->name())
1860 << "</name>\n";
1861
1862 DString outputDirectory = Config_getString(XML_OUTPUT);
1863 DString fileName=outputDirectory+"/"+fd->getOutputFileBase()+".xml";
1864 std::ofstream f = Portable::openOutputStream(fileName);
1865 if (!f.is_open())
1866 {
1867 err("Cannot open file {} for writing!\n",fileName);
1868 return;
1869 }
1870 TextStream t(&f);
1871
1872 writeXMLHeader(t);
1873 t << " <compounddef id=\"" << fd->getOutputFileBase()
1874 << "\" kind=\"file\" language=\""
1875 << to_string(fd->getLanguage()) << "\">\n";
1876 t << " <compoundname>";
1877 writeXMLString(t,fd->name());
1878 t << "</compoundname>\n";
1879
1880 for (const auto &inc : fd->includeFileList())
1881 {
1882 t << " <includes";
1883 if (inc.fileDef && !inc.fileDef->isReference()) // TODO: support external references
1884 {
1885 t << " refid=\"" << inc.fileDef->getOutputFileBase() << "\"";
1886 }
1887 t << " local=\"" << ((inc.kind & IncludeKind_LocalMask) ? "yes" : "no") << "\">";
1888 t << convertToXML(inc.includeName);
1889 t << "</includes>\n";
1890 }
1891
1892 for (const auto &inc : fd->includedByFileList())
1893 {
1894 t << " <includedby";
1895 if (inc.fileDef && !inc.fileDef->isReference()) // TODO: support external references
1896 {
1897 t << " refid=\"" << inc.fileDef->getOutputFileBase() << "\"";
1898 }
1899 t << " local=\"" << ((inc.kind &IncludeKind_LocalMask) ? "yes" : "no") << "\">";
1900 t << convertToXML(inc.includeName);
1901 t << "</includedby>\n";
1902 }
1903
1904 DotInclDepGraph incDepGraph(fd,false);
1905 if (!incDepGraph.isTrivial())
1906 {
1907 t << " <incdepgraph>\n";
1908 incDepGraph.writeXML(t);
1909 t << " </incdepgraph>\n";
1910 }
1911
1912 DotInclDepGraph invIncDepGraph(fd,true);
1913 if (!invIncDepGraph.isTrivial())
1914 {
1915 t << " <invincdepgraph>\n";
1916 invIncDepGraph.writeXML(t);
1917 t << " </invincdepgraph>\n";
1918 }
1919
1923
1924 for (const auto &mg : fd->getMemberGroups())
1925 {
1926 generateXMLSection(fd,ti,t,&mg->members(),"user-defined",mg->header(),
1927 mg->documentation());
1928 }
1929
1930 for (const auto &ml : fd->getMemberLists())
1931 {
1932 if (ml->listType().isDeclaration())
1933 {
1934 generateXMLSection(fd,ti,t,ml.get(),ml->listType().toXML());
1935 }
1936 }
1937
1938 t << " <briefdescription>\n";
1939 writeXMLDocBlock(t,fd->briefFile(),fd->briefLine(),fd,nullptr,fd->briefDescription());
1940 t << " </briefdescription>\n";
1941 t << " <detaileddescription>\n";
1942 writeXMLDocBlock(t,fd->docFile(),fd->docLine(),fd,nullptr,fd->documentation());
1943 t << " </detaileddescription>\n";
1944 if (Config_getBool(XML_PROGRAMLISTING))
1945 {
1946 writeXMLCodeBlock(t,fd);
1947 }
1949 t << " <location file=\"" << convertToXML(stripFromPath(fd->getDefFileName())) << "\"/>\n";
1950 t << " </compounddef>\n";
1951 t << "</doxygen>\n";
1952
1953 ti << " </compound>\n";
1954}
1955
1956static void generateXMLForGroup(const GroupDef *gd,TextStream &ti)
1957{
1958 // + members
1959 // + member groups
1960 // + files
1961 // + classes
1962 // + namespaces
1963 // - packages
1964 // + pages
1965 // + child groups
1966 // - examples
1967 // + brief description
1968 // + detailed description
1969
1970 if (gd->isReference()) return; // skip external references
1971
1972 ti << " <compound refid=\"" << gd->getOutputFileBase()
1973 << "\" kind=\"group\"><name>" << convertToXML(gd->name()) << "</name>\n";
1974
1975 DString outputDirectory = Config_getString(XML_OUTPUT);
1976 DString fileName=outputDirectory+"/"+gd->getOutputFileBase()+".xml";
1977 std::ofstream f = Portable::openOutputStream(fileName);
1978 if (!f.is_open())
1979 {
1980 err("Cannot open file {} for writing!\n",fileName);
1981 return;
1982 }
1983 TextStream t(&f);
1984
1985 writeXMLHeader(t);
1986 t << " <compounddef id=\""
1987 << gd->getOutputFileBase() << "\" kind=\"group\">\n";
1988 t << " <compoundname>" << convertToXML(gd->name()) << "</compoundname>\n";
1989 t << " <title>" << convertToXML(gd->groupTitle()) << "</title>\n";
1990
1992 writeInnerFiles(gd->getFiles(),t);
1996 writeInnerPages(gd->getPages(),t);
1998
1999 for (const auto &mg : gd->getMemberGroups())
2000 {
2001 generateXMLSection(gd,ti,t,&mg->members(),"user-defined",mg->header(),
2002 mg->documentation());
2003 }
2004
2005 for (const auto &ml : gd->getMemberLists())
2006 {
2007 if (ml->listType().isDeclaration())
2008 {
2009 generateXMLSection(gd,ti,t,ml.get(),ml->listType().toXML());
2010 }
2011 }
2012
2013 t << " <briefdescription>\n";
2014 writeXMLDocBlock(t,gd->briefFile(),gd->briefLine(),gd,nullptr,gd->briefDescription());
2015 t << " </briefdescription>\n";
2016 t << " <detaileddescription>\n";
2017 writeXMLDocBlock(t,gd->docFile(),gd->docLine(),gd,nullptr,gd->documentation());
2018 t << " </detaileddescription>\n";
2020 t << " </compounddef>\n";
2021 t << "</doxygen>\n";
2022
2023 ti << " </compound>\n";
2024}
2025
2027{
2028 if (dd->isReference()) return; // skip external references
2029 ti << " <compound refid=\"" << dd->getOutputFileBase()
2030 << "\" kind=\"dir\"><name>" << convertToXML(dd->displayName())
2031 << "</name>\n";
2032
2033 DString outputDirectory = Config_getString(XML_OUTPUT);
2034 DString fileName=outputDirectory+"/"+dd->getOutputFileBase()+".xml";
2035 std::ofstream f = Portable::openOutputStream(fileName);
2036 if (!f.is_open())
2037 {
2038 err("Cannot open file {} for writing!\n",fileName);
2039 return;
2040 }
2041 TextStream t(&f);
2042
2043 writeXMLHeader(t);
2044 t << " <compounddef id=\""
2045 << dd->getOutputFileBase() << "\" kind=\"dir\">\n";
2046 t << " <compoundname>" << convertToXML(dd->displayName()) << "</compoundname>\n";
2047
2048 writeInnerDirs(&dd->subDirs(),t);
2049 writeInnerFiles(dd->getFiles(),t);
2050
2051 t << " <briefdescription>\n";
2052 writeXMLDocBlock(t,dd->briefFile(),dd->briefLine(),dd,nullptr,dd->briefDescription());
2053 t << " </briefdescription>\n";
2054 t << " <detaileddescription>\n";
2055 writeXMLDocBlock(t,dd->docFile(),dd->docLine(),dd,nullptr,dd->documentation());
2056 t << " </detaileddescription>\n";
2058 t << " <location file=\"" << convertToXML(stripFromPath(dd->name())) << "\"/>\n";
2059 t << " </compounddef>\n";
2060 t << "</doxygen>\n";
2061
2062 ti << " </compound>\n";
2063}
2064
2066{
2067 ti << " <compound refid=\"requirements\" kind=\"requirements\"><name>" << convertToXML(pd->name()) << "</name>\n";
2068 DString outputDirectory = Config_getString(XML_OUTPUT);
2069 DString fileName = outputDirectory+"/requirements.xml";
2070 std::ofstream f = Portable::openOutputStream(fileName);
2071 if (!f.is_open())
2072 {
2073 err("Cannot open file {} for writing!\n",fileName);
2074 return;
2075 }
2076 TextStream t(&f);
2077
2078 auto writeDefsForReq = [&t](const std::vector<const Definition *> &defs,const char *tagName)
2079 {
2080 for (const auto &def : defs)
2081 {
2082 t << " <" << tagName << " refid=\"";
2083 t << def->getOutputFileBase();
2084 if (def->definitionType()==Definition::TypeMember)
2085 {
2086 t << "_1" << def->anchor();
2087 }
2088 t << "\">";
2089 t << convertToXML(def->name());
2090 t << "</" << tagName<< ">\n";
2091 }
2092 };
2093
2094 writeXMLHeader(t);
2095 t << " <compounddef id=\"requirements\" kind=\"requirements\">\n";
2096 t << " <compoundname>" << convertToXML(pd->name()) << "</compoundname>\n";
2097 t << " <requirementslist>\n";
2099 for (const auto &req : reqs)
2100 {
2101 t << " <requirement refid=\"" << req->id();
2102 if (auto tagFile = req->getTagFile(); !tagFile.empty())
2103 {
2104 t << "\" tagfile=\"" << convertToXML(stripFromPath(tagFile)) << "\" page=\"" << convertToXML(req->getExtPage());
2105 }
2106 t << "\">\n";
2107 t << " <title>" << convertToXML(filterTitle(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(req->title()))) << "</title>\n";
2108 t << " <location file=\"" << convertToXML(stripFromPath(req->file())) << "\" line=\"" << req->line() << "\"/>\n" ;
2109 writeDefsForReq(req->satisfiedBy(),"satisfiedby");
2110 writeDefsForReq(req->verifiedBy(),"verifiedby");
2111 t << " </requirement>\n";
2112 }
2113 t << " </requirementslist>\n";
2114 t << " </compounddef>\n";
2115 t << "</doxygen>\n";
2116
2117 ti << " </compound>\n";
2118}
2119
2120static void generateXMLForPage(PageDef *pd,TextStream &ti,bool isExample)
2121{
2122 // + name
2123 // + title
2124 // + documentation
2125 // + location
2126
2127 const char *kindName = isExample ? "example" : "page";
2128
2129 if (pd->isReference()) return;
2130
2131 DString pageName = pd->getOutputFileBase();
2132 if (pd->getGroupDef())
2133 {
2134 pageName+=DString("_")+pd->name();
2135 }
2136 if (pageName=="index")
2137 {
2138 pageName="indexpage"; // to prevent overwriting the generated index page.
2139 }
2140 else if (pageName=="requirements")
2141 {
2143 return; // requirements are listed separately
2144 }
2145
2146 ti << " <compound refid=\"" << pageName
2147 << "\" kind=\"" << kindName << "\"><name>" << convertToXML(pd->name())
2148 << "</name>\n";
2149
2150 DString outputDirectory = Config_getString(XML_OUTPUT);
2151 DString fileName=outputDirectory+"/"+pageName+".xml";
2152 std::ofstream f = Portable::openOutputStream(fileName);
2153 if (!f.is_open())
2154 {
2155 err("Cannot open file {} for writing!\n",fileName);
2156 return;
2157 }
2158 TextStream t(&f);
2159
2160 writeXMLHeader(t);
2161 t << " <compounddef id=\"" << pageName;
2162 t << "\" kind=\"" << kindName << "\">\n";
2163 t << " <compoundname>" << convertToXML(pd->name())
2164 << "</compoundname>\n";
2165
2166 if (pd==Doxygen::mainPage.get()) // main page is special
2167 {
2168 DString title;
2169 if (mainPageHasTitle())
2170 {
2171 title = filterTitle(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(Doxygen::mainPage->title()));
2172 }
2173 else
2174 {
2175 title = Config_getString(PROJECT_NAME);
2176 }
2177 t << " <title>" << convertToXML(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(title))
2178 << "</title>\n";
2179 }
2180 else
2181 {
2182 const SectionInfo *si = SectionManager::instance().find(pd->name());
2183 if (si)
2184 {
2185 t << " <title>" << convertToXML(filterTitle(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(si->title())))
2186 << "</title>\n";
2187 }
2188 }
2190 const SectionRefs &sectionRefs = pd->getSectionRefs();
2191 if (pd->localToc().isXmlEnabled() && !sectionRefs.empty())
2192 {
2193 int level=1;
2194 int indent=0;
2195 auto writeIndent = [&]() { for (int i=0;i<4+indent*2;i++) t << " "; };
2196 auto incIndent = [&](const char *text) { writeIndent(); t << text << "\n"; indent++; };
2197 auto decIndent = [&](const char *text) { indent--; writeIndent(); t << text << "\n"; };
2198 incIndent("<tableofcontents>");
2199 int maxLevel = pd->localToc().xmlLevel();
2200 BoolVector inLi(maxLevel+1,false);
2201 for (const SectionInfo *si : sectionRefs)
2202 {
2203 if (si->type().isSection())
2204 {
2205 //printf(" level=%d title=%s\n",level,qPrint(si->title));
2206 int nextLevel = si->type().level();
2207 if (nextLevel>level)
2208 {
2209 for (int l=level;l<nextLevel;l++)
2210 {
2211 if (l < maxLevel) incIndent("<tableofcontents>");
2212 }
2213 }
2214 else if (nextLevel<level)
2215 {
2216 for (int l=level;l>nextLevel;l--)
2217 {
2218 if (l <= maxLevel && inLi[l]) decIndent("</tocsect>");
2219 inLi[l]=false;
2220 if (l <= maxLevel) decIndent("</tableofcontents>");
2221 }
2222 }
2223 if (nextLevel <= maxLevel)
2224 {
2225 if (inLi[nextLevel])
2226 {
2227 decIndent("</tocsect>");
2228 }
2229 else if (level>nextLevel)
2230 {
2231 decIndent("</tableofcontents>");
2232 incIndent("<tableofcontents>");
2233 }
2234 DString titleDoc = convertToXML(si->title());
2235 DString label = convertToXML(si->label());
2236 if (titleDoc.empty()) titleDoc = label;
2237 incIndent("<tocsect>");
2238 writeIndent(); t << "<name>" << titleDoc << "</name>\n"; // kept for backwards compatibility
2239 writeIndent(); t << "<docs>";
2240 if (!si->title().empty())
2241 {
2242 writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,nullptr,si->title());
2243 }
2244 t << "</docs>\n";
2245 writeIndent(); t << "<reference>" << convertToXML(pageName) << "_1" << label << "</reference>\n";
2246 inLi[nextLevel]=true;
2247 level = nextLevel;
2248 }
2249 }
2250 }
2251 while (level>1 && level <= maxLevel)
2252 {
2253 if (inLi[level]) decIndent("</tocsect>");
2254 inLi[level]=false;
2255 decIndent("</tableofcontents>");
2256 level--;
2257 }
2258 if (level <= maxLevel && inLi[level]) decIndent("</tocsect>");
2259 inLi[level]=false;
2260 decIndent("</tableofcontents>");
2261 }
2262 t << " <briefdescription>\n";
2263 writeXMLDocBlock(t,pd->briefFile(),pd->briefLine(),pd,nullptr,pd->briefDescription());
2264 t << " </briefdescription>\n";
2265 t << " <detaileddescription>\n";
2266 if (isExample)
2267 {
2268 writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,nullptr,
2269 pd->documentation()+"\n\\include "+pd->name());
2270 }
2271 else
2272 {
2273 writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,nullptr,
2274 pd->documentation());
2275 }
2276 t << " </detaileddescription>\n";
2278
2279 t << " <location file=\"" << convertToXML(stripFromPath(pd->getDefFileName())) << "\"/>\n";
2280
2281 t << " </compounddef>\n";
2282 t << "</doxygen>\n";
2283
2284 ti << " </compound>\n";
2285}
2286
2288{
2289 DString pageName = xmlRequirementId(req->id());
2290 ti << " <compound refid=\"" << pageName << "\" kind=\"requirement\"><name>" << convertToXML(req->id()) << "</name>\n";
2291
2292 DString outputDirectory = Config_getString(XML_OUTPUT);
2293 DString fileName = outputDirectory+"/"+pageName+".xml";
2294 std::ofstream f = Portable::openOutputStream(fileName);
2295 if (!f.is_open())
2296 {
2297 err("Cannot open file {} for writing!\n",fileName);
2298 return;
2299 }
2300 TextStream t(&f);
2301 writeXMLHeader(t);
2302 t << " <compounddef id=\"" << pageName << "\" kind=\"requirement\">\n";
2303 t << " <compoundname>" << convertToXML(req->id()) << "</compoundname>\n";
2304 t << " <title>" << convertToXML(filterTitle(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(req->title()))) << "</title>\n";
2305 t << " <detaileddescription>\n";
2306 writeXMLDocBlock(t,req->file(),req->line(),RequirementManager::instance().requirementsPage(),nullptr,req->doc());
2307 t << " </detaileddescription>\n";
2308 t << " <location file=\"" << convertToXML(stripFromPath(req->file())) << "\" line=\"" << req->line() << "\"/>\n" ;
2309 t << " </compounddef>\n";
2310 t << "</doxygen>\n";
2311
2312 ti << " </compound>\n";
2313}
2314
2315
2317{
2318 // + classes
2319 // + concepts
2320 // + namespaces
2321 // + files
2322 // + groups
2323 // + related pages
2324 // - examples
2325
2326 DString outputDirectory = Config_getString(XML_OUTPUT);
2327 Dir xmlDir(outputDirectory.str());
2328 createSubDirs(xmlDir);
2329
2330 ResourceMgr::instance().copyResource("xml.xsd",outputDirectory);
2331 ResourceMgr::instance().copyResource("index.xsd",outputDirectory);
2332
2333 DString fileName=outputDirectory+"/compound.xsd";
2334 std::ofstream f = Portable::openOutputStream(fileName);
2335 if (!f.is_open())
2336 {
2337 err("Cannot open file {} for writing!\n",fileName);
2338 return;
2339 }
2340 {
2341 TextStream t(&f);
2342
2343 // write compound.xsd, but replace special marker with the entities
2344 DString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd");
2345 const char *startLine = compound_xsd.data();
2346 while (*startLine)
2347 {
2348 // find end of the line
2349 const char *endLine = startLine+1;
2350 while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n
2351 int len=static_cast<int>(endLine-startLine);
2352 if (len>0)
2353 {
2354 DString s(startLine,len);
2355 if (s.find("<!-- Automatically insert here the HTML entities -->")!=DString::npos)
2356 {
2358 }
2359 else
2360 {
2361 t.write(startLine,len);
2362 }
2363 }
2364 startLine=endLine;
2365 }
2366 }
2367 f.close();
2368
2369 fileName=outputDirectory+"/doxyfile.xsd";
2370 f = Portable::openOutputStream(fileName);
2371 if (!f.is_open())
2372 {
2373 err("Cannot open file {} for writing!\n",fileName);
2374 return;
2375 }
2376 {
2377 TextStream t(&f);
2378
2379 // write doxyfile.xsd, but replace special marker with the entities
2380 DString doxyfile_xsd = ResourceMgr::instance().getAsString("doxyfile.xsd");
2381 const char *startLine = doxyfile_xsd.data();
2382 while (*startLine)
2383 {
2384 // find end of the line
2385 const char *endLine = startLine+1;
2386 while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n
2387 int len=static_cast<int>(endLine-startLine);
2388 if (len>0)
2389 {
2390 DString s(startLine,len);
2391 if (s.find("<!-- Automatically insert here the configuration settings -->")!=DString::npos)
2392 {
2394 }
2395 else
2396 {
2397 t.write(startLine,len);
2398 }
2399 }
2400 startLine=endLine;
2401 }
2402 }
2403 f.close();
2404
2405 fileName=outputDirectory+"/Doxyfile.xml";
2406 f = Portable::openOutputStream(fileName);
2407 if (!f.is_open())
2408 {
2409 err("Cannot open file {} for writing\n",fileName);
2410 return;
2411 }
2412 else
2413 {
2414 TextStream t(&f);
2416 }
2417 f.close();
2418
2419 fileName=outputDirectory+"/index.xml";
2420 f = Portable::openOutputStream(fileName);
2421 if (!f.is_open())
2422 {
2423 err("Cannot open file {} for writing!\n",fileName);
2424 return;
2425 }
2426 else
2427 {
2428 TextStream t(&f);
2429
2430 // write index header
2431 t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";
2432 t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
2433 t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" ";
2434 t << "version=\"" << getDoxygenVersion() << "\" ";
2435 t << "xml:lang=\"" << theTranslator->trISOLang() << "\"";
2436 t << ">\n";
2437
2438 for (const auto &cd : *Doxygen::classLinkedMap)
2439 {
2440 generateXMLForClass(cd.get(),t);
2441 }
2442 for (const auto &cd : *Doxygen::conceptLinkedMap)
2443 {
2444 msg("Generating XML output for concept {}\n",cd->displayName());
2445 generateXMLForConcept(cd.get(),t);
2446 }
2447 for (const auto &nd : *Doxygen::namespaceLinkedMap)
2448 {
2449 msg("Generating XML output for namespace {}\n",nd->displayName());
2450 generateXMLForNamespace(nd.get(),t);
2451 }
2452 for (const auto &fn : *Doxygen::inputNameLinkedMap)
2453 {
2454 for (const auto &fd : *fn)
2455 {
2456 msg("Generating XML output for file {}\n",fd->name());
2457 generateXMLForFile(fd.get(),t);
2458 }
2459 }
2460 for (const auto &gd : *Doxygen::groupLinkedMap)
2461 {
2462 msg("Generating XML output for group {}\n",gd->name());
2463 generateXMLForGroup(gd.get(),t);
2464 }
2465 for (const auto &pd : *Doxygen::pageLinkedMap)
2466 {
2467 msg("Generating XML output for page {}\n",pd->name());
2468 generateXMLForPage(pd.get(),t,false);
2469 }
2470 for (const auto &req : RequirementManager::instance().requirements())
2471 {
2472 if (req->getTagFile().empty())
2473 {
2474 msg("Generating XML output for requirement {}\n", req->id());
2476 }
2477 }
2478 for (const auto &dd : *Doxygen::dirLinkedMap)
2479 {
2480 msg("Generate XML output for dir {}\n",dd->name());
2481 generateXMLForDir(dd.get(),t);
2482 }
2483 for (const auto &mod : ModuleManager::instance().modules())
2484 {
2485 msg("Generating XML output for module {}\n",mod->name());
2486 generateXMLForModule(mod.get(),t);
2487 }
2488 for (const auto &pd : *Doxygen::exampleLinkedMap)
2489 {
2490 msg("Generating XML output for example {}\n",pd->name());
2491 generateXMLForPage(pd.get(),t,true);
2492 }
2494 {
2495 msg("Generating XML output for the main page\n");
2497 }
2498
2499 //t << " </compoundlist>\n";
2500 t << "</doxygenindex>\n";
2501 }
2502
2504 clearSubDirs(xmlDir);
2505}
2506
2507
constexpr auto prefix
Definition anchor.cpp:44
This class contains the information about the argument of a function or template.
Definition arguments.h:27
bool hasDocumentation(bool allowEmptyName=false) const
Definition arguments.h:32
DString docs
Definition arguments.h:48
DString name
Definition arguments.h:45
DString type
Definition arguments.h:43
This class represents an function or template argument list.
Definition arguments.h:66
RefQualifierType refQualifier() const
Definition arguments.h:117
iterator end()
Definition arguments.h:95
bool hasParameters() const
Definition arguments.h:77
bool constSpecifier() const
Definition arguments.h:112
bool empty() const
Definition arguments.h:100
iterator begin()
Definition arguments.h:94
bool volatileSpecifier() const
Definition arguments.h:113
A abstract class representing of a compound symbol.
Definition classdef.h:100
virtual DString requiresClause() const =0
virtual bool isAbstract() const =0
Returns true if there is at least one pure virtual member in this class.
virtual bool isFinal() const =0
Returns true if this class is marked as final.
virtual const ArgumentList & templateArguments() const =0
Returns the template arguments of this class.
virtual const MemberLists & getMemberLists() const =0
Returns the list containing the list of members sorted per type.
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual bool isSealed() const =0
Returns true if this class is marked as sealed.
virtual StringVector getQualifiers() const =0
virtual Protection protection() const =0
Return the protection level (Public,Protected,Private) in which this compound was found.
virtual DString compoundTypeString() const =0
Returns the type of compound as a string.
virtual const MemberNameInfoLinkedMap & memberNameInfoLinkedMap() const =0
Returns a dictionary of all members.
virtual bool isImplicitTemplateInstance() const =0
virtual const MemberGroupList & getMemberGroups() const =0
Returns the member groups defined for this class.
virtual ClassLinkedRefMap getClasses() const =0
returns the classes nested into this class
virtual FileDef * getFileDef() const =0
Returns the file in which this compound's definition can be found.
virtual const IncludeInfo * includeInfo() const =0
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
virtual DString initializer() const =0
virtual ArgumentList getTemplateParameterList() const =0
virtual const IncludeInfo * includeInfo() const =0
virtual Parts conceptParts() const =0
virtual const FileDef * getFileDef() const =0
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:88
void clear()
Definition dstring.h:218
DString()=default
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:248
DString fill(char c, size_t len)
Fills a string with a predefined character.
Definition dstring.h:282
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:322
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:152
DString & remove(size_t index, size_t len)
Definition dstring.h:539
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:182
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:690
size_t size() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:158
DString & prepend(const char *s)
Definition dstring.h:519
size_t find(char c, size_t pos=0) const
Definition dstring.h:243
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:341
DString left(size_t len) const
Definition dstring.h:310
const std::string & str() const
Definition dstring.h:649
bool stripPrefix(const DString &prefix)
Definition dstring.h:294
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:161
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:155
The common base class of all entity definitions found in the sources.
Definition definition.h:77
virtual DString briefDescription(bool abbreviate=false) const =0
virtual int getEndBodyLine() const =0
virtual DString briefFile() const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual DString getDefFileExtension() const =0
virtual int docLine() const =0
virtual DString getDefFileName() const =0
virtual DString documentation() const =0
virtual DString inbodyDocumentation() const =0
virtual int getDefLine() const =0
virtual DefType definitionType() const =0
virtual const SectionRefs & getSectionRefs() const =0
returns the section dictionary, only of importance for pagedef
virtual const DString & name() const =0
virtual int inbodyLine() const =0
virtual const FileDef * getBodyDef() const =0
virtual int briefLine() const =0
virtual bool isLinkableInProject() const =0
virtual size_t getDefColumn() const =0
virtual bool isAnonymous() const =0
virtual const RequirementRefs & requirementReferences() const =0
virtual DString displayName(bool includeScope=true) const =0
virtual DString qualifiedName() const =0
virtual bool isHidden() const =0
virtual DString anchor() const =0
virtual bool isArtificial() const =0
virtual Definition * getOuterScope() const =0
virtual DString docFile() const =0
virtual const MemberVector & getReferencedByMembers() const =0
virtual int getStartBodyLine() const =0
virtual bool isReference() const =0
virtual const MemberVector & getReferencesMembers() const =0
virtual DString getOutputFileBase() const =0
A model of a directory symbol.
Definition dirdef.h:108
virtual const DirList & subDirs() const =0
virtual const FileList & getFiles() const =0
Class representing a directory in the file system.
Definition dir.h:73
A list of directories.
Definition dirdef.h:178
Class representing the abstract syntax tree of a documentation block.
Definition docnode.h:1471
Representation of a class inheritance or dependency graph.
void writeXML(TextStream &t)
bool isTrivial() const
Representation of an include dependency graph.
void writeXML(TextStream &t)
bool isTrivial() const
static NamespaceLinkedMap * namespaceLinkedMap
Definition doxygen.h:108
static ConceptLinkedMap * conceptLinkedMap
Definition doxygen.h:90
static std::unique_ptr< PageDef > mainPage
Definition doxygen.h:93
static FileNameLinkedMap * inputNameLinkedMap
Definition doxygen.h:97
static ParserManager * parserManager
Definition doxygen.h:122
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:88
static PageLinkedMap * exampleLinkedMap
Definition doxygen.h:91
static PageLinkedMap * pageLinkedMap
Definition doxygen.h:92
static DirLinkedMap * dirLinkedMap
Definition doxygen.h:120
static GroupLinkedMap * groupLinkedMap
Definition doxygen.h:107
A model of a file symbol.
Definition filedef.h:97
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual DString absFilePath() const =0
virtual const DString & docName() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual const IncludeInfoList & includeFileList() const =0
virtual const MemberLists & getMemberLists() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const IncludeInfoList & includedByFileList() const =0
A model of a group of symbols.
Definition groupdef.h:48
virtual DString groupTitle() const =0
virtual const GroupList & getSubGroups() const =0
virtual const FileList & getFiles() const =0
virtual const MemberLists & getMemberLists() const =0
virtual const MemberGroupList & getMemberGroups() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const PageLinkedRefMap & getPages() const =0
virtual const NamespaceLinkedRefMap & getNamespaces() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
virtual const ModuleLinkedRefMap & getModules() const =0
void writeXMLSchema(TextStream &t)
static HtmlEntityMapper & instance()
Returns the one and only instance of the HTML entity mapper.
Class representing the data associated with a #include statement.
Definition filedef.h:72
IncludeKind kind
Definition filedef.h:79
const FileDef * fileDef
Definition filedef.h:77
DString includeName
Definition filedef.h:78
const T * find(const std::string &key) const
Definition linkedmap.h:47
constexpr bool isXmlEnabled() const noexcept
Definition types.h:656
constexpr int xmlLevel() const noexcept
Definition types.h:661
A model of a class/file/namespace member symbol.
Definition memberdef.h:45
virtual bool isConstExpr() const =0
virtual bool isConstEval() const =0
virtual bool isInitonly() const =0
virtual bool isNoExcept() const =0
virtual bool isAssign() const =0
virtual bool isExplicit() const =0
virtual bool isNew() const =0
virtual DString requiresClause() const =0
virtual bool isMaybeVoid() const =0
virtual DString argsString() const =0
virtual bool isSealed() const =0
virtual bool isConstInit() const =0
virtual DString definition() const =0
virtual const ClassDef * getClassDef() const =0
virtual DString excpString() const =0
virtual const ArgumentList & templateArguments() const =0
virtual DString getDeclFileName() const =0
virtual const DString & initializer() const =0
virtual GroupDef * getGroupDef()=0
virtual bool isSettable() const =0
virtual bool isRetain() const =0
virtual bool isAddable() const =0
virtual const MemberVector & enumFieldList() const =0
virtual const FileDef * getFileDef() const =0
virtual bool isInline() const =0
virtual DString getReadAccessor() const =0
virtual const ArgumentList & argumentList() const =0
virtual bool isWritable() const =0
virtual bool isMaybeAmbiguous() const =0
virtual bool isPrivateGettable() const =0
virtual const MemberVector & reimplementedBy() const =0
virtual bool isRequired() const =0
virtual bool isAttribute() const =0
virtual bool isExternal() const =0
virtual bool isCopy() const =0
virtual DString bitfieldString() const =0
virtual int getDeclLine() const =0
virtual bool isTypeAlias() const =0
virtual bool isStatic() const =0
virtual const MemberDef * reimplements() const =0
virtual bool isMaybeDefault() const =0
virtual bool isPrivateSettable() const =0
virtual StringVector getQualifiers() const =0
virtual bool isRaisable() const =0
virtual bool isRemovable() const =0
virtual bool isConstrained() const =0
virtual DString getWriteAccessor() const =0
virtual bool isReadonly() const =0
virtual bool isBound() const =0
virtual bool isThreadLocal() const =0
virtual const NamespaceDef * getNamespaceDef() const =0
virtual DString getScopeString() const =0
virtual size_t getDeclColumn() const =0
virtual bool isProtectedSettable() const =0
virtual bool isProtectedGettable() const =0
virtual bool hasOneLineInitializer() const =0
virtual bool isTransient() const =0
virtual bool hasMultiLineInitializer() const =0
virtual Protection protection() const =0
virtual bool isOptional() const =0
virtual bool isGettable() const =0
virtual MemberType memberType() const =0
virtual bool isReadable() const =0
virtual bool isWeak() const =0
virtual bool isNoDiscard() const =0
virtual DString enumBaseType() const =0
virtual bool isStrong() const =0
virtual DString typeString() const =0
virtual Specifier virtualness(int count=0) const =0
virtual bool isUNOProperty() const =0
virtual bool isFinal() const =0
virtual const ArgumentList & declArgumentList() const =0
virtual bool isMutable() const =0
virtual bool isFriendClass() const =0
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:125
MemberListType listType() const
Definition memberlist.h:130
constexpr const char * toXML() const noexcept
Definition types.h:414
constexpr bool isDeclaration() const noexcept
Definition types.h:384
constexpr bool isDetailed() const noexcept
Definition types.h:383
virtual const MemberGroupList & getMemberGroups() const =0
virtual bool isPrimaryInterface() const =0
virtual const MemberLists & getMemberLists() const =0
virtual FileList getUsedFiles() const =0
virtual const ImportInfoMap & getExports() const =0
virtual const ConceptLinkedRefMap & getConcepts() const =0
virtual const ClassLinkedRefMap & getClasses() const =0
static ModuleManager & instance()
ModuleDef * getPrimaryInterface(const DString &moduleName) const
An abstract interface of a namespace symbol.
virtual ConceptLinkedRefMap getConcepts() const =0
virtual const MemberLists & getMemberLists() const =0
virtual NamespaceLinkedRefMap getNamespaces() const =0
virtual bool isInline() const =0
virtual ClassLinkedRefMap getClasses() const =0
virtual const MemberGroupList & getMemberGroups() const =0
Class representing a list of different code generators.
Definition outputlist.h:162
void startCodeFragment(const DString &style)
Definition outputlist.h:276
void add(OutputCodeIntfPtr &&p)
Definition outputlist.h:192
void endCodeFragment(const DString &style)
Definition outputlist.h:279
A model of a page symbol.
Definition pagedef.h:27
virtual const PageLinkedRefMap & getSubPages() const =0
virtual LocalToc localToc() const =0
virtual DString title() const =0
virtual const GroupDef * getGroupDef() const =0
std::unique_ptr< CodeParserInterface > getCodeParser(const DString &extension)
Gets the interface to the parser associated with a given extension.
Definition parserintf.h:253
virtual DString file() const =0
virtual int line() const =0
virtual DString title() const =0
virtual DString id() const =0
virtual DString doc() const =0
static RequirementManager & instance()
const PageDef * requirementsPage() const
RequirementIntfList requirements() const
static ResourceMgr & instance()
Returns the one and only instance of this class.
bool copyResource(const DString &name, const DString &targetDir) const
Copies a registered resource to a given target directory.
DString getAsString(const DString &name) const
Gets the resource data as a C string.
class that provide information about a section.
Definition section.h:58
DString title() const
Definition section.h:70
static SectionManager & instance()
returns a reference to the singleton
Definition section.h:179
class that represents a list of constant references to sections.
Definition section.h:103
bool empty() const
Definition section.h:125
Abstract interface for a hyperlinked text fragment.
Definition linkifytext.h:30
TextGeneratorXMLImpl(TextStream &t)
Definition xmlgen.cpp:189
void writeString(std::string_view s, bool) const override
Definition xmlgen.cpp:190
void writeLink(const DString &extRef, const DString &file, const DString &anchor, std::string_view text) const override
Definition xmlgen.cpp:195
TextStream & m_t
Definition xmlgen.cpp:202
void writeBreak(int) const override
Definition xmlgen.cpp:194
Text streaming class that buffers data.
Definition textstream.h:36
void write(const char *buf, size_t len)
Adds a array of character to the stream.
Definition textstream.h:204
virtual DString trISOLang()=0
bool m_insideSpecialHL
Definition xmlgen.h:66
void setStripIndentAmount(size_t amount) override
Definition xmlgen.cpp:238
void endCodeLine() override
Definition xmlgen.cpp:298
size_t m_stripIndentAmount
Definition xmlgen.h:69
void startCodeLine(int) override
Definition xmlgen.cpp:267
DString m_external
Definition xmlgen.h:59
void startSpecialComment() override
Definition xmlgen.cpp:233
bool m_normalHLNeedStartTag
Definition xmlgen.h:65
void startFontClass(const DString &colorClass) override
Definition xmlgen.cpp:317
void writeCodeLink(CodeSymbolType type, const DString &ref, const DString &file, const DString &anchor, const DString &name, const DString &tooltip) override
Definition xmlgen.cpp:243
void endSpecialComment() override
Definition xmlgen.cpp:228
void writeTooltip(const DString &, const DocLinkInfo &, const DString &, const DString &, const SourceLinkInfo &, const SourceLinkInfo &) override
Definition xmlgen.cpp:259
bool m_insideCodeLine
Definition xmlgen.h:64
void stripCodeComments(bool b) override
Definition xmlgen.cpp:223
bool m_stripCodeComments
Definition xmlgen.h:67
void endCodeFragment(const DString &) override
Definition xmlgen.cpp:367
void startCodeFragment(const DString &) override
Definition xmlgen.cpp:361
size_t m_col
Definition xmlgen.h:62
void writeLineNumber(const DString &extRef, const DString &compId, const DString &anchorId, int l, bool writeLineAnchor) override
Definition xmlgen.cpp:344
void codify(const DString &text) override
Generator for producing XML formatted source code.
Definition xmlgen.cpp:212
TextStream * m_t
Definition xmlgen.h:57
DString m_refId
Definition xmlgen.h:58
XMLCodeGenerator(TextStream *t)
Definition xmlgen.cpp:207
void writeCodeAnchor(const DString &) override
Definition xmlgen.cpp:338
void endFontClass() override
Definition xmlgen.cpp:330
bool m_isMemberRef
Definition xmlgen.h:61
Concrete visitor implementation for XML output.
#define Config_getInt(name)
Definition config.h:34
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
std::vector< bool > BoolVector
Definition containers.h:36
DirIterator end(const DirIterator &) noexcept
Definition dir.cpp:176
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:59
IDocNodeASTPtr validatingParseDoc(IDocParser &parserIntf, const DString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const DString &input, const DocOptions &options)
@ Collaboration
Definition dotgraph.h:31
@ Inheritance
Definition dotgraph.h:31
const char * qPrint(const char *s)
Definition dstring.h:787
#define ASSERT(x)
Definition dstring.h:28
constexpr uint32_t IncludeKind_LocalMask
Definition filedef.h:60
Translator * theTranslator
Definition language.cpp:71
void linkifyText(const TextGeneratorIntf &out, const DString &text, const LinkifyTextOptions &options)
#define msg(fmt,...)
Definition message.h:94
#define err(fmt,...)
Definition message.h:127
std::unordered_map< std::string, ImportInfoList > ImportInfoMap
Definition moduledef.h:61
void writeXMLDoxyfile(TextStream &t)
void writeXSDDoxyfile(TextStream &t)
std::ofstream openOutputStream(const DString &name, bool append=false)
Definition portable.cpp:665
size_t updateColumnCount(const char *s, size_t col)
Definition outputgen.cpp:60
Portable versions of functions that are platform dependent.
void splitRequirementRefs(const RequirementRefs &inputReqRefs, RequirementRefs &satisfiesRefs, RequirementRefs &verifiesRefs)
std::vector< RequirementRef > RequirementRefs
List of requirement references.
Definition requirement.h:56
Options to configure the code parser.
Definition parserintf.h:77
Helper class to pass options when calling OutputList::generateDoc().
Definition docoptions.h:24
LinkifyTextOptions & setScope(const Definition *scope)
Definition linkifytext.h:58
LinkifyTextOptions & setSelf(const Definition *self)
Definition linkifytext.h:64
LinkifyTextOptions & setFileScope(const FileDef *fileScope)
Definition linkifytext.h:61
CodeSymbolType
Definition types.h:481
Protection
Definition types.h:32
SrcLangExt
Definition types.h:207
Specifier
Definition types.h:80
static constexpr const char * to_string(Protection prot) noexcept
Definition types.h:38
const char * writeUTF8Char(TextStream &t, const char *s)
Writes the UTF8 character pointed to by s to stream t and returns a pointer to the next character.
Definition utf8.cpp:198
Various UTF8 related helper functions.
bool mainPageHasTitle()
Definition util.cpp:4961
DString filterTitle(const DString &title)
Definition util.cpp:4456
DString insertTemplateSpecifierInScope(const DString &scope, const DString &templ)
Definition util.cpp:3078
DString convertNameToFile(const DString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:2865
void clearSubDirs(const Dir &d)
Definition util.cpp:2998
void createSubDirs(const Dir &d)
Definition util.cpp:2971
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4170
DString fileToString(const DString &name, bool filter, bool isSourceCode)
Definition util.cpp:1055
DString convertToXML(const DString &s, bool keepEntities, const bool citeEntry)
Definition util.cpp:3234
DString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Definition util.cpp:4631
DString stripFromPath(const DString &path)
Definition util.cpp:221
A bunch of utility functions.
static void generateXMLForGroup(const GroupDef *gd, TextStream &ti)
Definition xmlgen.cpp:1956
void generateXML()
Definition xmlgen.cpp:2316
static void writeInnerConcepts(const ConceptLinkedRefMap &cl, TextStream &t)
Definition xmlgen.cpp:1340
void writeXMLCodeString(bool hide, TextStream &t, const DString &str, size_t &col, size_t stripIndentAmount)
Definition xmlgen.cpp:81
static void writeInnerGroups(const GroupList &gl, TextStream &t)
Definition xmlgen.cpp:1421
static void stripQualifiers(DString &typeStr)
Definition xmlgen.cpp:524
static void writeInnerDirs(const DirList *dl, TextStream &t)
Definition xmlgen.cpp:1431
static DString memberOutputFileBase(const MemberDef *md)
Definition xmlgen.cpp:549
static void writeListOfAllMembers(const ClassDef *cd, TextStream &t)
Definition xmlgen.cpp:1300
#define XML_DB(x)
Definition xmlgen.cpp:57
static void writeXMLDocBlock(TextStream &t, const DString &fileName, int lineNr, const Definition *scope, const MemberDef *md, const DString &text)
Definition xmlgen.cpp:449
static void generateXMLForClass(const ClassDef *cd, TextStream &ti)
Definition xmlgen.cpp:1463
static void generateXMLForFile(FileDef *fd, TextStream &ti)
Definition xmlgen.cpp:1840
static void generateXMLSection(const Definition *d, TextStream &ti, TextStream &t, const MemberList *ml, const DString &kind, const DString &header=DString(), const DString &documentation=DString())
Definition xmlgen.cpp:1263
static void writeMemberTemplateLists(const MemberDef *md, TextStream &t)
Definition xmlgen.cpp:434
void writeXMLCodeBlock(TextStream &t, FileDef *fd)
Definition xmlgen.cpp:482
static void writeTemplateList(const ClassDef *cd, TextStream &t)
Definition xmlgen.cpp:439
void writeXMLString(TextStream &t, const DString &s)
Definition xmlgen.cpp:71
static void writeMemberReference(TextStream &t, const Definition *def, const MemberDef *rmd, const DString &tagName)
Definition xmlgen.cpp:501
void generateXMLForRequirements(PageDef *pd, TextStream &ti)
Definition xmlgen.cpp:2065
static bool memberVisible(const Definition *d, const MemberDef *md)
Definition xmlgen.cpp:1256
static void writeIncludeInfo(const IncludeInfo *ii, TextStream &t)
Definition xmlgen.cpp:1443
static void writeInnerPages(const PageLinkedRefMap &pl, TextStream &t)
Definition xmlgen.cpp:1408
DString xmlRequirementId(const DString &reqId)
Definition xmlgen.cpp:76
static void generateXMLForNamespace(const NamespaceDef *nd, TextStream &ti)
Definition xmlgen.cpp:1767
static void generateXMLForRequirement(const RequirementIntf *req, TextStream &ti)
Definition xmlgen.cpp:2287
void writeXMLLink(TextStream &t, const DString &extRef, const DString &compoundId, const DString &anchorId, const DString &text, const DString &tooltip)
Definition xmlgen.cpp:170
static void writeXMLHeader(TextStream &t)
Definition xmlgen.cpp:130
static void writeInnerModules(const ModuleLinkedRefMap &ml, TextStream &t)
Definition xmlgen.cpp:1352
static void generateXMLForModule(const ModuleDef *mod, TextStream &ti)
Definition xmlgen.cpp:1711
static void generateXMLForConcept(const ConceptDef *cd, TextStream &ti)
Definition xmlgen.cpp:1633
static void writeExports(const ImportInfoMap &exportMap, TextStream &t)
Definition xmlgen.cpp:1377
static void writeInnerFiles(const FileList &fl, TextStream &t)
Definition xmlgen.cpp:1399
static bool stripKeyword(DString &str, const char *keyword, bool needSpace)
Definition xmlgen.cpp:563
static void generateXMLForMember(const MemberDef *md, TextStream &ti, TextStream &t, const Definition *def)
Definition xmlgen.cpp:672
static DString classOutputFileBase(const ClassDef *cd)
Definition xmlgen.cpp:540
static void writeRequirementRefs(const Definition *d, TextStream &t, const char *prefix="")
Definition xmlgen.cpp:649
static void writeTemplateArgumentList(TextStream &t, const ArgumentList &al, const Definition *scope, const FileDef *fileScope, int indent)
Definition xmlgen.cpp:375
static void writeInnerClasses(const ClassLinkedRefMap &cl, TextStream &t)
Definition xmlgen.cpp:1327
static DString extractNoExcept(DString &argsStr)
Definition xmlgen.cpp:607
static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl, TextStream &t)
Definition xmlgen.cpp:1364
static void generateXMLForDir(DirDef *dd, TextStream &ti)
Definition xmlgen.cpp:2026
static void generateXMLForPage(PageDef *pd, TextStream &ti, bool isExample)
Definition xmlgen.cpp:2120
static void writeCombineScript()
Definition xmlgen.cpp:140