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// own header
17#include "xmlgen.h"
18
19// other headers
20#include "arguments.h"
21#include "classlist.h"
22#include "conceptdef.h"
23#include "config.h"
24#include "defargs.h"
25#include "dir.h"
26#include "dirdef.h"
27#include "docparser.h"
28#include "dotclassgraph.h"
29#include "dotincldepgraph.h"
30#include "doxygen.h"
31#include "filename.h"
32#include "groupdef.h"
33#include "htmlentity.h"
34#include "language.h"
35#include "memberdef.h"
36#include "membergroup.h"
37#include "memberlist.h"
38#include "membername.h"
39#include "message.h"
40#include "moduledef.h"
41#include "namespacedef.h"
42#include "outputgen.h"
43#include "outputlist.h"
44#include "pagedef.h"
45#include "parserintf.h"
46#include "portable.h"
47#include "requirement.h"
48#include "resourcemgr.h"
49#include "section.h"
50#include "textstream.h"
51#include "utf8.h"
52#include "util.h"
53#include "version.h"
54#include "xmldocvisitor.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 const ArgumentList &typeConstraints=ArgumentList())
381{
382 DString indentStr;
383 indentStr.fill(' ',indent);
384 LinkifyTextOptions options;
385 options.setScope(scope).setFileScope(fileScope);
386 if (al.hasParameters())
387 {
388 t << indentStr << "<templateparamlist>\n";
389 for (const Argument &a : al)
390 {
391 t << indentStr << " <param>\n";
392 if (!a.type.empty())
393 {
394 t << indentStr << " <type>";
395 linkifyText(TextGeneratorXMLImpl(t),a.type,options);
396 t << "</type>\n";
397 }
398 if (!a.name.empty())
399 {
400 t << indentStr << " <declname>" << convertToXML(a.name) << "</declname>\n";
401 t << indentStr << " <defname>" << convertToXML(a.name) << "</defname>\n";
402 }
403 if (!a.defval.empty())
404 {
405 t << indentStr << " <defval>";
406 linkifyText(TextGeneratorXMLImpl(t),a.defval,options);
407 t << "</defval>\n";
408 }
409 DString typeConstraint = a.typeConstraint;
410 // C# where clauses, with one entry per constraint. A C# type parameter has its name in type.
411 const DString &paramName = a.name.empty() ? a.type : a.name;
412 for (const Argument &tc : typeConstraints)
413 {
414 if (tc.name==paramName && !tc.type.empty())
415 {
416 if (!typeConstraint.empty()) typeConstraint+=", ";
417 typeConstraint+=tc.type;
418 }
419 }
420 if (!typeConstraint.empty())
421 {
422 t << indentStr << " <typeconstraint>";
423 linkifyText(TextGeneratorXMLImpl(t),typeConstraint,options);
424 t << "</typeconstraint>\n";
425 }
426 if (a.hasTemplateDocumentation())
427 {
428 t << indentStr << " <briefdescription>\n";
429 t << indentStr << " ";
430 if (scope)
431 {
432 writeXMLDocBlock(t,scope->briefFile(),scope->briefLine(),scope,nullptr,a.docs);
433 }
434 else
435 {
436 writeXMLDocBlock(t,fileScope->briefFile(),fileScope->briefLine(),fileScope,nullptr,a.docs);
437 }
438 t << indentStr << " </briefdescription>\n";
439 }
440 t << indentStr << " </param>\n";
441 }
442 t << indentStr << "</templateparamlist>\n";
443 }
444}
445
450
451static void writeTemplateList(const ClassDef *cd,TextStream &t)
452{
454}
455
456static void writeTemplateList(const ConceptDef *cd,TextStream &t)
457{
459}
460
462 const DString &fileName,
463 int lineNr,
464 const Definition *scope,
465 const MemberDef * md,
466 const DString &text)
467{
468 DString stext = text.stripWhiteSpace();
469 if (stext.empty()) return;
470 // convert the documentation string into an abstract syntax tree
471 auto parser { createDocParser() };
472 auto ast { validatingParseDoc(*parser.get(),
473 fileName,
474 lineNr,
475 scope,
476 md,
477 text,
478 DocOptions())
479 };
480 auto astImpl = dynamic_cast<const DocNodeAST*>(ast.get());
481 if (astImpl)
482 {
483 // create a code generator
484 OutputCodeList xmlCodeList;
485 xmlCodeList.add<XMLCodeGenerator>(&t);
486 // create a parse tree visitor for XML
487 XmlDocVisitor visitor(t,xmlCodeList,scope?scope->getDefFileExtension():DString(""));
488 // visit all nodes
489 std::visit(visitor,astImpl->root);
490 // clean up
491 }
492}
493
495{
498 intf->resetCodeParserState();
499 OutputCodeList xmlList;
500 xmlList.add<XMLCodeGenerator>(&t);
501 xmlList.startCodeFragment("DoxyCode");
502 intf->parseCode(xmlList, // codeOutList
503 DString(), // scopeName
505 Config_getBool(FILTER_SOURCE_FILES)),
506 langExt, // lang
507 Config_getBool(STRIP_CODE_COMMENTS),
508 CodeParserOptions().setFileDef(fd)
509 );
510 xmlList.endCodeFragment("DoxyCode");
511}
512
513static void writeMemberReference(TextStream &t,const Definition *def,const MemberDef *rmd,const DString &tagName)
514{
515 DString scope = rmd->getScopeString();
516 DString name = rmd->name();
517 if (!scope.empty() && scope!=def->name())
518 {
519 name.prepend(scope+getLanguageSpecificSeparator(rmd->getLanguage()));
520 }
521 t << " <" << tagName << " refid=\"";
522 t << rmd->getOutputFileBase() << "_1" << rmd->anchor() << "\"";
523 if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef())
524 {
525 t << " compoundref=\"" << rmd->getBodyDef()->getOutputFileBase() << "\"";
526 t << " startline=\"" << rmd->getStartBodyLine() << "\"";
527 if (rmd->getEndBodyLine()!=-1)
528 {
529 t << " endline=\"" << rmd->getEndBodyLine() << "\"";
530 }
531 }
532 t << ">" << convertToXML(name) << "</" << tagName << ">\n";
533
534}
535
536static void stripQualifiers(DString &typeStr)
537{
538 bool done=false;
539 typeStr.stripPrefix("friend ");
540 while (!done)
541 {
542 if (typeStr.stripPrefix("static ")) {}
543 else if (typeStr.stripPrefix("constexpr ")) {}
544 else if (typeStr.stripPrefix("consteval ")) {}
545 else if (typeStr.stripPrefix("constinit ")) {}
546 else if (typeStr.stripPrefix("virtual ")) {}
547 else if (typeStr=="virtual") typeStr="";
548 else done=true;
549 }
550}
551
553{
554 //bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
555 //if (inlineGroupedClasses && cd->partOfGroups()!=0)
556 return cd->getOutputFileBase();
557 //else
558 // return cd->getOutputFileBase();
559}
560
562{
563 //bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES);
564 //if (inlineGroupedClasses && md->getClassDef() && md->getClassDef()->partOfGroups()!=0)
565 // return md->getClassDef()->getXmlOutputFileBase();
566 //else
567 // return md->getOutputFileBase();
568 return md->getOutputFileBase();
569}
570
571// Removes a keyword from a given string
572// @param str string from which to strip the keyword
573// @param needSpace true if spacing is required around the keyword
574// @return true if the keyword was removed, false otherwise
575static bool stripKeyword(DString& str, const char *keyword, bool needSpace)
576{
577 bool found = false;
578 size_t searchStart = 0;
579 size_t searchEnd = str.size();
580 size_t len = strlen(keyword);
581 while (searchStart<searchEnd)
582 {
583 size_t index = str.find(keyword, searchStart);
584 if (index==DString::npos)
585 {
586 break; // no more occurrences found
587 }
588 size_t end = index + len;
589 if (needSpace)
590 {
591 if ((index>0 && str[index-1]!=' ') || // at the start of the string or preceded by a space, or
592 (end!=searchEnd && str[end] !=' ') // at the end of the string or followed by a space.
593 )
594 {
595 searchStart = end;
596 continue; // no a standalone word
597 }
598 }
599 if (needSpace && index>0) // strip with space before keyword
600 {
601 str.remove(index-1, len+1);
602 searchEnd -= (len+1);
603 }
604 else if (needSpace && end<searchEnd) // strip with space after string starting with keyword
605 {
606 str.remove(index, len+1);
607 searchEnd -= (len+1);
608 }
609 else // strip just keyword
610 {
611 str.remove(index, len);
612 searchEnd -= len;
613 }
614 found = true;
615 }
616 return found;
617}
618
620{
621 DString expr;
622 //printf("extractNoExcept(%s)\n",qPrint(argsStr));
623 if (size_t i = argsStr.find("noexcept("); i!=DString::npos)
624 {
625 int bracketCount = 1;
626 size_t p = i+9;
627 bool found = false;
628 bool insideString = false;
629 bool insideChar = false;
630 char pc = 0;
631 while (!found && p<argsStr.length())
632 {
633 char c = argsStr[p++];
634 if (insideString)
635 {
636 if (c=='"' && pc!='\\') insideString=false;
637 }
638 else if (insideChar)
639 {
640 if (c=='\'' && pc!='\\') insideChar=false;
641 }
642 else
643 {
644 switch (c)
645 {
646 case '(': bracketCount++; break;
647 case ')': bracketCount--; found = bracketCount==0; break;
648 case '"': insideString = true; break;
649 case '\'': insideChar = true; break;
650 }
651 }
652 pc = c;
653 }
654 expr = argsStr.mid(i+9,p-i-10);
655 argsStr = (argsStr.left(i) + argsStr.mid(p)).stripWhiteSpace();
656 }
657 //printf("extractNoExcept -> argsStr='%s', expr='%s'\n",qPrint(argsStr),qPrint(expr));
658 return expr;
659}
660
661static void writeRequirementRefs(const Definition *d,TextStream &t,const char *prefix="")
662{
663 auto writeRefsForType = [&t,&prefix](const RequirementRefs &refs,const char *tagName)
664 {
665 if (!refs.empty())
666 {
667 t << prefix << " <" << tagName << ">\n";
668 for (const auto &ref : refs)
669 {
670 t << prefix << " <requirement refid=\"" << xmlRequirementId(ref.reqId()) << "\">"
671 << convertToXML(ref.title()) << "</requirement>\n";
672 }
673 t << prefix << " </" << tagName << ">\n";
674 }
675 };
676 RequirementRefs satisfiesRefs;
677 RequirementRefs verifiesRefs;
678 splitRequirementRefs(d->requirementReferences(),satisfiesRefs,verifiesRefs);
679 writeRefsForType(satisfiesRefs,"satisfies");
680 writeRefsForType(verifiesRefs,"verifies");
681}
682
683// namespace members are also inserted in the file scope, but
684// to prevent this duplication in the XML output, we optionally filter those here.
685static bool memberVisible(const Definition *d,const MemberDef *md)
686{
687 return Config_getBool(XML_NS_MEMB_FILE_SCOPE) ||
689 md->getNamespaceDef()==nullptr;
690}
691
692static void generateXMLForMember(const MemberDef *md,TextStream &ti,TextStream &t,const Definition *def)
693{
694
695 // + declaration/definition arg lists
696 // + reimplements
697 // + reimplementedBy
698 // + exceptions
699 // + const/volatile specifiers
700 // - examples
701 // + source definition
702 // + source references
703 // + source referenced by
704 // - body code
705 // + template arguments
706 // (templateArguments(), definitionTemplateParameterLists())
707 // - call graph
708
709 // in case the member is an placeholder for an anonymous type without name (i.e. the union in struct S { union { int x; }; };), then
710 // we need to generate the members (e.g. x) of that type instead of the placeholder member.
711 const ClassDef *annoClassDef=md->getClassDefOfAnonymousType();
712 if (annoClassDef && md->isAnonymous() && !md->isEnumerate())
713 {
714 for (auto lt : { MemberListType::PubAttribs(), MemberListType::ProAttribs(),
715 MemberListType::PacAttribs(), MemberListType::PriAttribs() })
716 {
717 const MemberList *ml = annoClassDef->getMemberList(lt);
718 if (ml)
719 {
720 for (const auto &imd : *ml)
721 {
722 if (memberVisible(def,imd))
723 {
724 generateXMLForMember(imd,ti,t,def);
725 }
726 }
727 }
728 }
729 return;
730 }
731
732 // enum values are written as part of the enum
733 if (md->memberType()==MemberType::EnumValue) return;
734 if (md->isHidden()) return;
735
736 LinkifyTextOptions options;
737 options.setScope(def).setFileScope(md->getBodyDef()).setSelf(md);
738
739 // group members are only visible in their group
740 bool groupMember = md->getGroupDef() && def->definitionType()!=Definition::TypeGroup;
741
742 if (md->memberType() == MemberType::EnumValue) ASSERT(0);
743 bool isFunc=to_isFunction(md->memberType());
744 DString memType = to_string_lower(md->memberType());
745
746 DString nameStr = md->name();
747 DString typeStr = md->typeString();
748 DString argsStr = md->argsString();
749 DString defStr = md->definition();
750 defStr.stripPrefix("constexpr ");
751 defStr.stripPrefix("consteval ");
752 defStr.stripPrefix("constinit ");
753 stripQualifiers(typeStr);
754 if (typeStr=="auto")
755 {
756 if (size_t i=argsStr.rfind("->"); i!=DString::npos) // move trailing return type into type and strip it from argsStr
757 {
758 typeStr=argsStr.mid(i+2).stripWhiteSpace();
759 argsStr=argsStr.left(i).stripWhiteSpace();
760 if (stripKeyword(typeStr, "override", true))
761 {
762 argsStr += " override";
763 }
764 if (stripKeyword(typeStr, "final", true))
765 {
766 argsStr += " final";
767 }
768 if (stripKeyword(typeStr, "=0", false))
769 {
770 argsStr += "=0";
771 }
772 if (stripKeyword(typeStr, "=default", false))
773 {
774 argsStr += "=default";
775 }
776 if (stripKeyword(typeStr, "=delete", false))
777 {
778 argsStr += "=delete";
779 }
780 i=defStr.find("auto ");
781 if (i!=DString::npos)
782 {
783 defStr=defStr.left(i)+typeStr+defStr.mid(i+4);
784 }
785 }
786 }
787 DString noExceptExpr = extractNoExcept(argsStr);
788
789 ti << " <member refid=\"" << memberOutputFileBase(md)
790 << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>"
791 << convertToXML(nameStr) << "</name></member>\n";
792
793 if (groupMember)
794 {
795 t << " <member refid=\""
797 << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>"
798 << convertToXML(nameStr) << "</name></member>\n";
799 return;
800 }
801 else
802 {
803 t << " <memberdef kind=\"";
804 t << memType << "\" id=\"";
805 t << memberOutputFileBase(md);
806 t << "_1" // encoded ':' character (see util.cpp:convertNameToFile)
807 << md->anchor();
808 }
809 //enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t;
810
811 t << "\" prot=\"" << to_string_lower(md->protection());
812 t << "\"";
813
814 t << " static=\"";
815 if (md->isStatic()) t << "yes"; else t << "no";
816 t << "\"";
817
818 if (md->isNoDiscard())
819 {
820 t << " nodiscard=\"yes\"";
821 }
822
823 if (md->isConstExpr())
824 {
825 t << " constexpr=\"yes\"";
826 }
827
828 if (md->isConstEval())
829 {
830 t << " consteval=\"yes\"";
831 }
832
833 if (md->isConstInit())
834 {
835 t << " constinit=\"yes\"";
836 }
837
838 if (md->isExternal())
839 {
840 t << " extern=\"yes\"";
841 }
842
843 if (isFunc)
844 {
845 const ArgumentList &al = md->argumentList();
846 t << " const=\"";
847 if (al.constSpecifier()) t << "yes"; else t << "no";
848 t << "\"";
849
850 t << " explicit=\"";
851 if (md->isExplicit()) t << "yes"; else t << "no";
852 t << "\"";
853
854 t << " inline=\"";
855 if (md->isInline()) t << "yes"; else t << "no";
856 t << "\"";
857
859 {
860 t << " refqual=\"";
861 if (al.refQualifier()==RefQualifierType::LValue) t << "lvalue"; else t << "rvalue";
862 t << "\"";
863 }
864
865 if (md->isFinal())
866 {
867 t << " final=\"yes\"";
868 }
869
870 if (md->isSealed())
871 {
872 t << " sealed=\"yes\"";
873 }
874
875 if (md->isNew())
876 {
877 t << " new=\"yes\"";
878 }
879
880 if (md->isOptional())
881 {
882 t << " optional=\"yes\"";
883 }
884
885 if (md->isRequired())
886 {
887 t << " required=\"yes\"";
888 }
889
890 if (md->isNoExcept())
891 {
892 t << " noexcept=\"yes\"";
893 }
894
895 if (!noExceptExpr.empty())
896 {
897 t << " noexceptexpression=\"" << convertToXML(noExceptExpr) << "\"";
898 }
899
900 if (al.volatileSpecifier())
901 {
902 t << " volatile=\"yes\"";
903 }
904
905 t << " virt=\"" << to_string_lower(md->virtualness());
906 t << "\"";
907 }
908
909 if (md->memberType() == MemberType::Enumeration)
910 {
911 t << " strong=\"";
912 if (md->isStrong()) t << "yes"; else t << "no";
913 t << "\"";
914 }
915
916 if (md->memberType() == MemberType::Variable)
917 {
918 //ArgumentList *al = md->argumentList();
919 //t << " volatile=\"";
920 //if (al && al->volatileSpecifier) t << "yes"; else t << "no";
921
922 t << " mutable=\"";
923 if (md->isMutable()) t << "yes"; else t << "no";
924 t << "\"";
925
926 if (md->isThreadLocal())
927 {
928 t << " thread_local=\"yes\"";
929 }
930
931 if (md->isInitonly())
932 {
933 t << " initonly=\"yes\"";
934 }
935 if (md->isAttribute())
936 {
937 t << " attribute=\"yes\"";
938 }
939 if (md->isUNOProperty())
940 {
941 t << " property=\"yes\"";
942 }
943 if (md->isReadonly())
944 {
945 t << " readonly=\"yes\"";
946 }
947 if (md->isBound())
948 {
949 t << " bound=\"yes\"";
950 }
951 if (md->isRemovable())
952 {
953 t << " removable=\"yes\"";
954 }
955 if (md->isConstrained())
956 {
957 t << " constrained=\"yes\"";
958 }
959 if (md->isTransient())
960 {
961 t << " transient=\"yes\"";
962 }
963 if (md->isMaybeVoid())
964 {
965 t << " maybevoid=\"yes\"";
966 }
967 if (md->isMaybeDefault())
968 {
969 t << " maybedefault=\"yes\"";
970 }
971 if (md->isMaybeAmbiguous())
972 {
973 t << " maybeambiguous=\"yes\"";
974 }
975 }
976 else if (md->memberType() == MemberType::Property)
977 {
978 t << " readable=\"";
979 if (md->isReadable()) t << "yes"; else t << "no";
980 t << "\"";
981
982 t << " writable=\"";
983 if (md->isWritable()) t << "yes"; else t << "no";
984 t << "\"";
985
986 t << " gettable=\"";
987 if (md->isGettable()) t << "yes"; else t << "no";
988 t << "\"";
989
990 t << " privategettable=\"";
991 if (md->isPrivateGettable()) t << "yes"; else t << "no";
992 t << "\"";
993
994 t << " protectedgettable=\"";
995 if (md->isProtectedGettable()) t << "yes"; else t << "no";
996 t << "\"";
997
998 t << " settable=\"";
999 if (md->isSettable()) t << "yes"; else t << "no";
1000 t << "\"";
1001
1002 t << " privatesettable=\"";
1003 if (md->isPrivateSettable()) t << "yes"; else t << "no";
1004 t << "\"";
1005
1006 t << " protectedsettable=\"";
1007 if (md->isProtectedSettable()) t << "yes"; else t << "no";
1008 t << "\"";
1009
1010 if (md->isInitonly())
1011 {
1012 t << " initonly=\"yes\"";
1013 }
1014
1015 if (md->isAssign() || md->isCopy() || md->isRetain() || md->isStrong() || md->isWeak())
1016 {
1017 t << " accessor=\"";
1018 if (md->isAssign()) t << "assign";
1019 else if (md->isCopy()) t << "copy";
1020 else if (md->isRetain()) t << "retain";
1021 else if (md->isStrong()) t << "strong";
1022 else if (md->isWeak()) t << "weak";
1023 t << "\"";
1024 }
1025 }
1026 else if (md->memberType() == MemberType::Event)
1027 {
1028 t << " add=\"";
1029 if (md->isAddable()) t << "yes"; else t << "no";
1030 t << "\"";
1031
1032 t << " remove=\"";
1033 if (md->isRemovable()) t << "yes"; else t << "no";
1034 t << "\"";
1035
1036 t << " raise=\"";
1037 if (md->isRaisable()) t << "yes"; else t << "no";
1038 t << "\"";
1039 }
1040
1041 t << ">\n";
1042
1043 if (md->memberType()!=MemberType::Define &&
1044 md->memberType()!=MemberType::Enumeration
1045 )
1046 {
1048 t << " <type>";
1049 linkifyText(TextGeneratorXMLImpl(t),typeStr,options);
1050 t << "</type>\n";
1051 if (md->isTypeAlias())
1052 {
1053 defStr+=" = "+md->initializer();
1054 }
1055 t << " <definition>" << convertToXML(defStr) << "</definition>\n";
1056 t << " <argsstring>" << convertToXML(argsStr) << "</argsstring>\n";
1057 }
1058
1059 if (md->memberType() == MemberType::Enumeration)
1060 {
1061 t << " <type>";
1063 t << "</type>\n";
1064 }
1065
1066 DString qualifiedNameStr = md->qualifiedName();
1067 t << " <name>" << convertToXML(nameStr) << "</name>\n";
1068 if (nameStr!=qualifiedNameStr)
1069 {
1070 t << " <qualifiedname>" << convertToXML(qualifiedNameStr) << "</qualifiedname>\n";
1071 }
1072
1073 if (md->memberType() == MemberType::Property)
1074 {
1075 if (md->isReadable())
1076 t << " <read>" << convertToXML(md->getReadAccessor()) << "</read>\n";
1077 if (md->isWritable())
1078 t << " <write>" << convertToXML(md->getWriteAccessor()) << "</write>\n";
1079 }
1080
1081 if (md->memberType()==MemberType::Variable && !md->bitfieldString().empty())
1082 {
1083 DString bitfield = md->bitfieldString();
1084 if (bitfield.at(0)==':') bitfield=bitfield.mid(1);
1085 t << " <bitfield>" << convertToXML(bitfield) << "</bitfield>\n";
1086 }
1087
1088 const MemberDef *rmd = md->reimplements();
1089 if (rmd)
1090 {
1091 t << " <reimplements refid=\""
1092 << memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">"
1093 << convertToXML(rmd->name()) << "</reimplements>\n";
1094 }
1095 for (const auto &rbmd : md->reimplementedBy())
1096 {
1097 t << " <reimplementedby refid=\""
1098 << memberOutputFileBase(rbmd) << "_1" << rbmd->anchor() << "\">"
1099 << convertToXML(rbmd->name()) << "</reimplementedby>\n";
1100 }
1101
1102 for (const auto &qmd : md->getQualifiers())
1103 {
1104 t << " <qualifier>" << convertToXML(qmd) << "</qualifier>\n";
1105 }
1106
1107 if (md->isFriendClass()) // for friend classes we show a link to the class as a "parameter"
1108 {
1109 t << " <param>\n";
1110 t << " <type>";
1111 linkifyText(TextGeneratorXMLImpl(t),nameStr,options);
1112 t << "</type>\n";
1113 t << " </param>\n";
1114 }
1115 else if (isFunc) //function
1116 {
1117 const ArgumentList &declAl = md->declArgumentList();
1118 const ArgumentList &defAl = md->argumentList();
1119 bool isFortran = md->getLanguage()==SrcLangExt::Fortran;
1120 if (declAl.hasParameters())
1121 {
1122 auto defIt = defAl.begin();
1123 for (const Argument &a : declAl)
1124 {
1125 //const Argument *defArg = defAli.current();
1126 const Argument *defArg = nullptr;
1127 if (defIt!=defAl.end())
1128 {
1129 defArg = &(*defIt);
1130 ++defIt;
1131 }
1132 t << " <param>\n";
1133 if (!a.attrib.empty())
1134 {
1135 t << " <attributes>";
1136 writeXMLString(t,a.attrib);
1137 t << "</attributes>\n";
1138 }
1139 if (isFortran && defArg && !defArg->type.empty())
1140 {
1141 t << " <type>";
1142 linkifyText(TextGeneratorXMLImpl(t),defArg->type,options);
1143 t << "</type>\n";
1144 }
1145 else if (!a.type.empty())
1146 {
1147 t << " <type>";
1148 linkifyText(TextGeneratorXMLImpl(t),a.type,options);
1149 t << "</type>\n";
1150 }
1151 if (!a.name.empty())
1152 {
1153 t << " <declname>";
1154 writeXMLString(t,a.name);
1155 t << "</declname>\n";
1156 }
1157 if (defArg && !defArg->name.empty() && defArg->name!=a.name)
1158 {
1159 t << " <defname>";
1160 writeXMLString(t,defArg->name);
1161 t << "</defname>\n";
1162 }
1163 if (!a.array.empty())
1164 {
1165 t << " <array>";
1166 writeXMLString(t,a.array);
1167 t << "</array>\n";
1168 }
1169 if (!a.defval.empty())
1170 {
1171 t << " <defval>";
1172 linkifyText(TextGeneratorXMLImpl(t),a.defval,options);
1173 t << "</defval>\n";
1174 }
1175 if (defArg && defArg->hasDocumentation())
1176 {
1177 t << " <briefdescription>";
1179 md->getOuterScope(),md,defArg->docs);
1180 t << "</briefdescription>\n";
1181 }
1182 t << " </param>\n";
1183 }
1184 }
1185 }
1186 else if (md->memberType()==MemberType::Define &&
1187 !md->argsString().empty()) // define
1188 {
1189 if (md->argumentList().empty()) // special case for "foo()" to
1190 // distinguish it from "foo".
1191 {
1192 t << " <param></param>\n";
1193 }
1194 else
1195 {
1196 for (const Argument &a : md->argumentList())
1197 {
1198 t << " <param><defname>" << a.type << "</defname></param>\n";
1199 }
1200 }
1201 }
1202 if (!md->requiresClause().empty())
1203 {
1204 t << " <requiresclause>";
1206 t << " </requiresclause>\n";
1207 }
1208
1209 if (!md->isTypeAlias() && (md->hasOneLineInitializer() || md->hasMultiLineInitializer()))
1210 {
1211 t << " <initializer>";
1213 t << "</initializer>\n";
1214 }
1215
1216 if (!md->excpString().empty())
1217 {
1218 t << " <exceptions>";
1220 t << "</exceptions>\n";
1221 }
1222 writeRequirementRefs(md,t," ");
1223
1224 if (md->memberType()==MemberType::Enumeration) // enum
1225 {
1226 for (const auto &emd : md->enumFieldList())
1227 {
1228 ti << " <member refid=\"" << memberOutputFileBase(md)
1229 << "_1" << emd->anchor() << "\" kind=\"enumvalue\"><name>"
1230 << convertToXML(emd->name()) << "</name></member>\n";
1231
1232 t << " <enumvalue id=\"" << memberOutputFileBase(md) << "_1"
1233 << emd->anchor() << "\" prot=\"" << to_string_lower(emd->protection());
1234 t << "\">\n";
1235 t << " <name>";
1236 writeXMLString(t,emd->name());
1237 t << "</name>\n";
1238 if (!emd->initializer().empty())
1239 {
1240 t << " <initializer>";
1241 writeXMLString(t,emd->initializer());
1242 t << "</initializer>\n";
1243 }
1244 t << " <briefdescription>\n";
1245 writeXMLDocBlock(t,emd->briefFile(),emd->briefLine(),emd->getOuterScope(),emd,emd->briefDescription());
1246 t << " </briefdescription>\n";
1247 t << " <detaileddescription>\n";
1248 writeXMLDocBlock(t,emd->docFile(),emd->docLine(),emd->getOuterScope(),emd,emd->documentation());
1249 t << " </detaileddescription>\n";
1250 t << " </enumvalue>\n";
1251 }
1252 }
1253 t << " <briefdescription>\n";
1255 t << " </briefdescription>\n";
1256 t << " <detaileddescription>\n";
1257 writeXMLDocBlock(t,md->docFile(),md->docLine(),md->getOuterScope(),md,md->documentation());
1258 t << " </detaileddescription>\n";
1259 t << " <inbodydescription>\n";
1261 t << " </inbodydescription>\n";
1262 if (md->getDefLine()!=-1)
1263 {
1264 t << " <location file=\""
1265 << convertToXML(stripFromPath(md->getDefFileName())) << "\" line=\""
1266 << md->getDefLine() << "\" column=\""
1267 << md->getDefColumn() << "\"" ;
1268 if (md->getStartBodyLine()!=-1)
1269 {
1270 const FileDef *bodyDef = md->getBodyDef();
1271 if (bodyDef)
1272 {
1273 t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\"";
1274 }
1275 t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\""
1276 << md->getEndBodyLine() << "\"";
1277 }
1278 if (md->getDeclLine()!=-1)
1279 {
1280 t << " declfile=\"" << convertToXML(stripFromPath(md->getDeclFileName())) << "\" declline=\""
1281 << md->getDeclLine() << "\" declcolumn=\""
1282 << md->getDeclColumn() << "\"";
1283 }
1284 t << "/>\n";
1285 }
1286
1287 //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers());
1288 auto refList = md->getReferencesMembers();
1289 for (const auto &refmd : refList)
1290 {
1291 writeMemberReference(t,def,refmd,"references");
1292 }
1293 auto refByList = md->getReferencedByMembers();
1294 for (const auto &refmd : refByList)
1295 {
1296 writeMemberReference(t,def,refmd,"referencedby");
1297 }
1298
1299 t << " </memberdef>\n";
1300}
1301
1302
1304 const MemberList *ml,const DString &kind,const DString &header=DString(),
1305 const DString &documentation=DString())
1306{
1307 if (ml==nullptr) return;
1308 int count=0;
1309 for (const auto &md : *ml)
1310 {
1311 if (memberVisible(d,md) && (md->memberType()!=MemberType::EnumValue) &&
1312 !md->isHidden())
1313 {
1314 count++;
1315 }
1316 }
1317 if (count==0) return; // empty list
1318
1319 t << " <sectiondef kind=\"" << kind << "\">\n";
1320 if (!header.empty())
1321 {
1322 t << " <header>" << convertToXML(header) << "</header>\n";
1323 }
1324 if (!documentation.empty())
1325 {
1326 t << " <description>";
1327 writeXMLDocBlock(t,d->docFile(),d->docLine(),d,nullptr,documentation);
1328 t << "</description>\n";
1329 }
1330 for (const auto &md : *ml)
1331 {
1332 if (memberVisible(d,md))
1333 {
1334 generateXMLForMember(md,ti,t,d);
1335 }
1336 }
1337 t << " </sectiondef>\n";
1338}
1339
1341{
1342 t << " <listofallmembers>\n";
1343 for (auto &mni : cd->memberNameInfoLinkedMap())
1344 {
1345 for (auto &mi : *mni)
1346 {
1347 const MemberDef *md=mi->memberDef();
1348 if (!md->isAnonymous())
1349 {
1350 Protection prot = mi->prot();
1351 Specifier virt=md->virtualness();
1352 t << " <member refid=\"" << memberOutputFileBase(md) << "_1" <<
1353 md->anchor() << "\" prot=\"" << to_string_lower(prot);
1354 t << "\" virt=\"" << to_string_lower(virt) << "\"";
1355 if (!mi->ambiguityResolutionScope().empty())
1356 {
1357 t << " ambiguityscope=\"" << convertToXML(mi->ambiguityResolutionScope()) << "\"";
1358 }
1359 t << "><scope>" << convertToXML(cd->name()) << "</scope><name>" <<
1360 convertToXML(md->name()) << "</name></member>\n";
1361 }
1362 }
1363 }
1364 t << " </listofallmembers>\n";
1365}
1366
1368{
1369 for (const auto &cd : cl)
1370 {
1371 if (!cd->isHidden() && !cd->isAnonymous())
1372 {
1373 t << " <innerclass refid=\"" << classOutputFileBase(cd)
1374 << "\" prot=\"" << to_string_lower(cd->protection());
1375 t << "\">" << convertToXML(cd->name()) << "</innerclass>\n";
1376 }
1377 }
1378}
1379
1381{
1382 for (const auto &cd : cl)
1383 {
1384 if (!cd->isHidden())
1385 {
1386 t << " <innerconcept refid=\"" << cd->getOutputFileBase()
1387 << "\">" << convertToXML(cd->name()) << "</innerconcept>\n";
1388 }
1389 }
1390}
1391
1393{
1394 for (const auto &mod : ml)
1395 {
1396 if (!mod->isHidden())
1397 {
1398 t << " <innermodule refid=\"" << mod->getOutputFileBase()
1399 << "\">" << convertToXML(mod->name()) << "</innermodule>\n";
1400 }
1401 }
1402}
1403
1405{
1406 for (const auto &nd : nl)
1407 {
1408 if (!nd->isHidden() && !nd->isAnonymous())
1409 {
1410 t << " <innernamespace refid=\"" << nd->getOutputFileBase()
1411 << "\"" << (nd->isInline() ? " inline=\"yes\"" : "")
1412 << ">" << convertToXML(nd->name()) << "</innernamespace>\n";
1413 }
1414 }
1415}
1416
1417static void writeExports(const ImportInfoMap &exportMap,TextStream &t)
1418{
1419 if (exportMap.empty()) return;
1420 t << " <exports>\n";
1421 for (const auto &[moduleName,importInfoList] : exportMap)
1422 {
1423 for (const auto &importInfo : importInfoList)
1424 {
1425 t << " <export";
1426 ModuleDef *mod = ModuleManager::instance().getPrimaryInterface(importInfo.importName);
1427 if (mod && mod->isLinkableInProject())
1428 {
1429 t << " refid=\"" << mod->getOutputFileBase() << "\"";
1430 }
1431 t << ">";
1432 t << importInfo.importName;
1433 t << "</export>\n";
1434 }
1435 }
1436 t << " </exports>\n";
1437}
1438
1439static void writeInnerFiles(const FileList &fl,TextStream &t)
1440{
1441 for (const auto &fd : fl)
1442 {
1443 t << " <innerfile refid=\"" << fd->getOutputFileBase()
1444 << "\">" << convertToXML(fd->name()) << "</innerfile>\n";
1445 }
1446}
1447
1449{
1450 for (const auto &pd : pl)
1451 {
1452 t << " <innerpage refid=\"" << pd->getOutputFileBase();
1453 if (pd->getGroupDef())
1454 {
1455 t << "_" << pd->name();
1456 }
1457 t << "\">" << convertToXML(pd->title()) << "</innerpage>\n";
1458 }
1459}
1460
1461static void writeInnerGroups(const GroupList &gl,TextStream &t)
1462{
1463 for (const auto &sgd : gl)
1464 {
1465 t << " <innergroup refid=\"" << sgd->getOutputFileBase()
1466 << "\">" << convertToXML(sgd->groupTitle())
1467 << "</innergroup>\n";
1468 }
1469}
1470
1471static void writeInnerDirs(const DirList *dl,TextStream &t)
1472{
1473 if (dl)
1474 {
1475 for(const auto &subdir : *dl)
1476 {
1477 t << " <innerdir refid=\"" << subdir->getOutputFileBase()
1478 << "\">" << convertToXML(subdir->displayName()) << "</innerdir>\n";
1479 }
1480 }
1481}
1482
1483static void writeIncludeInfo(const IncludeInfo *ii,TextStream &t)
1484{
1485 if (ii)
1486 {
1487 DString nm = ii->includeName;
1488 if (nm.empty() && ii->fileDef) nm = ii->fileDef->docName();
1489 if (!nm.empty())
1490 {
1491 t << " <includes";
1492 if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references
1493 {
1494 t << " refid=\"" << ii->fileDef->getOutputFileBase() << "\"";
1495 }
1496 t << " local=\"" << ((ii->kind & IncludeKind_LocalMask) ? "yes" : "no") << "\">";
1497 t << nm;
1498 t << "</includes>\n";
1499 }
1500 }
1501}
1502
1503static void generateXMLForClass(const ClassDef *cd,TextStream &ti)
1504{
1505 // + brief description
1506 // + detailed description
1507 // + template argument list(s)
1508 // - include file
1509 // + member groups
1510 // + inheritance diagram
1511 // + list of direct super classes
1512 // + list of direct sub classes
1513 // + list of inner classes
1514 // + collaboration diagram
1515 // + list of all members
1516 // + user defined member sections
1517 // + standard member sections
1518 // + detailed member documentation
1519 // - examples using the class
1520
1521 if (cd->isReference()) return; // skip external references.
1522 if (cd->isHidden()) return; // skip hidden classes.
1523 if (cd->isAnonymous()) return; // skip anonymous compounds.
1524 if (cd->isImplicitTemplateInstance()) return; // skip generated template instances.
1525 if (cd->isArtificial()) return; // skip artificially created classes
1526
1527 msg("Generating XML output for class {}\n",cd->name());
1528
1529 ti << " <compound refid=\"" << classOutputFileBase(cd)
1530 << "\" kind=\"" << cd->compoundTypeString()
1531 << "\"><name>" << convertToXML(cd->name()) << "</name>\n";
1532
1533 DString outputDirectory = Config_getString(XML_OUTPUT);
1534 DString fileName=outputDirectory+"/"+ classOutputFileBase(cd)+".xml";
1535 std::ofstream f = Portable::openOutputStream(fileName);
1536 if (!f.is_open())
1537 {
1538 err("Cannot open file {} for writing!\n",fileName);
1539 return;
1540 }
1541 TextStream t(&f);
1542
1543 writeXMLHeader(t);
1544 t << " <compounddef id=\""
1545 << classOutputFileBase(cd) << "\" kind=\""
1546 << cd->compoundTypeString() << "\" language=\""
1547 << to_string(cd->getLanguage()) << "\" prot=\"";
1548 t << to_string_lower(cd->protection());
1549 if (cd->isFinal()) t << "\" final=\"yes";
1550 if (cd->isSealed()) t << "\" sealed=\"yes";
1551 if (cd->isAbstract()) t << "\" abstract=\"yes";
1552 if (cd->isRef()) t << "\" ref=\"yes";
1553 t << "\">\n";
1554 t << " <compoundname>";
1555 DString nameStr = cd->name();
1556 writeXMLString(t,nameStr);
1557 t << "</compoundname>\n";
1558 for (const auto &bcd : cd->baseClasses())
1559 {
1560 t << " <basecompoundref ";
1561 if (bcd.classDef->isLinkable())
1562 {
1563 t << "refid=\"" << classOutputFileBase(bcd.classDef) << "\" ";
1564 }
1565 if (bcd.prot == Protection::Package) ASSERT(0);
1566 t << "prot=\"";
1567 t << to_string_lower(bcd.prot);
1568 t << "\" virt=\"";
1569 t << to_string_lower(bcd.virt);
1570 t << "\">";
1571 if (!bcd.templSpecifiers.empty())
1572 {
1573 t << convertToXML(
1575 bcd.classDef->name(),bcd.templSpecifiers)
1576 );
1577 }
1578 else
1579 {
1580 t << convertToXML(bcd.classDef->displayName());
1581 }
1582 t << "</basecompoundref>\n";
1583 }
1584 for (const auto &bcd : cd->subClasses())
1585 {
1586 if (bcd.prot == Protection::Package) ASSERT(0);
1587 t << " <derivedcompoundref refid=\""
1588 << classOutputFileBase(bcd.classDef)
1589 << "\" prot=\"";
1590 t << to_string_lower(bcd.prot);
1591 t << "\" virt=\"";
1592 t << to_string_lower(bcd.virt);
1593 t << "\">" << convertToXML(bcd.classDef->displayName())
1594 << "</derivedcompoundref>\n";
1595 }
1596
1598
1600
1601 writeTemplateList(cd,t);
1602 for (const auto &mg : cd->getMemberGroups())
1603 {
1604 generateXMLSection(cd,ti,t,&mg->members(),"user-defined",mg->header(),
1605 mg->documentation());
1606 }
1607
1608 for (const auto &ml : cd->getMemberLists())
1609 {
1610 if (!ml->listType().isDetailed())
1611 {
1612 generateXMLSection(cd,ti,t,ml.get(),ml->listType().toXML());
1613 }
1614 }
1615
1616 LinkifyTextOptions options;
1617 options.setScope(cd).setFileScope(cd->getFileDef());
1618
1619 if (!cd->requiresClause().empty())
1620 {
1621 t << " <requiresclause>";
1623 t << " </requiresclause>\n";
1624 }
1625
1626 for (const auto &qcd : cd->getQualifiers())
1627 {
1628 t << " <qualifier>" << convertToXML(qcd) << "</qualifier>\n";
1629 }
1630
1631 t << " <briefdescription>\n";
1632 writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,nullptr,cd->briefDescription());
1633 t << " </briefdescription>\n";
1634 t << " <detaileddescription>\n";
1635 writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd,nullptr,cd->documentation());
1636 t << " </detaileddescription>\n";
1637 DotClassGraph inheritanceGraph(cd,GraphType::Inheritance);
1638 if (!inheritanceGraph.isTrivial())
1639 {
1640 t << " <inheritancegraph>\n";
1641 inheritanceGraph.writeXML(t);
1642 t << " </inheritancegraph>\n";
1643 }
1644 DotClassGraph collaborationGraph(cd,GraphType::Collaboration);
1645 if (!collaborationGraph.isTrivial())
1646 {
1647 t << " <collaborationgraph>\n";
1648 collaborationGraph.writeXML(t);
1649 t << " </collaborationgraph>\n";
1650 }
1652 t << " <location file=\""
1653 << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\""
1654 << cd->getDefLine() << "\"" << " column=\""
1655 << cd->getDefColumn() << "\"" ;
1656 if (cd->getStartBodyLine()!=-1)
1657 {
1658 const FileDef *bodyDef = cd->getBodyDef();
1659 if (bodyDef)
1660 {
1661 t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\"";
1662 }
1663 t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\""
1664 << cd->getEndBodyLine() << "\"";
1665 }
1666 t << "/>\n";
1668 t << " </compounddef>\n";
1669 t << "</doxygen>\n";
1670
1671 ti << " </compound>\n";
1672}
1673
1675{
1676 if (cd->isReference() || cd->isHidden()) return; // skip external references.
1677
1678 ti << " <compound refid=\"" << cd->getOutputFileBase()
1679 << "\" kind=\"concept\"" << "><name>"
1680 << convertToXML(cd->name()) << "</name>\n";
1681
1682 LinkifyTextOptions options;
1683 options.setScope(cd).setFileScope(cd->getFileDef());
1684 DString outputDirectory = Config_getString(XML_OUTPUT);
1685 DString fileName=outputDirectory+"/"+cd->getOutputFileBase()+".xml";
1686 std::ofstream f = Portable::openOutputStream(fileName);
1687 if (!f.is_open())
1688 {
1689 err("Cannot open file {} for writing!\n",fileName);
1690 return;
1691 }
1692 TextStream t(&f);
1693 writeXMLHeader(t);
1694 t << " <compounddef id=\"" << cd->getOutputFileBase()
1695 << "\" kind=\"concept\">\n";
1696 t << " <compoundname>";
1697 DString nameStr = cd->name();
1698 writeXMLString(t,nameStr);
1699 t << "</compoundname>\n";
1701 writeTemplateList(cd,t);
1702 t << " <initializer>";
1704 t << "</initializer>\n";
1705 auto intf=Doxygen::parserManager->getCodeParser(".cpp");
1706 intf->resetCodeParserState();
1707 OutputCodeList xmlList;
1708 xmlList.add<XMLCodeGenerator>(&t);
1709 t << " <conceptparts>\n";
1710 for (const auto &part : cd->conceptParts())
1711 {
1712 switch (part.type)
1713 {
1715 t << " <docpart line=\"" << part.lineNr << "\" col=\"" << part.colNr << "\">\n";
1716 writeXMLDocBlock(t,cd->getDefFileName(),part.lineNr,cd,nullptr,part.content);
1717 t << " </docpart>\n";
1718 break;
1720 t << " <codepart line=\"" << part.lineNr << "\">";
1721 xmlList.startCodeFragment("DoxyCode");
1722 intf->parseCode(xmlList, // codeOutList
1723 nameStr, // scopeName
1724 part.content, // code
1725 SrcLangExt::Cpp, // lang
1726 false, // stripCodeComments
1728 );
1729 xmlList.endCodeFragment("DoxyCode");
1730 t << "</codepart>\n";
1731 break;
1732 }
1733 }
1734 t << " </conceptparts>\n";
1735 t << " <briefdescription>\n";
1736 writeXMLDocBlock(t,cd->briefFile(),cd->briefLine(),cd,nullptr,cd->briefDescription());
1737 t << " </briefdescription>\n";
1738 t << " <detaileddescription>\n";
1739 writeXMLDocBlock(t,cd->docFile(),cd->docLine(),cd,nullptr,cd->documentation());
1740 t << " </detaileddescription>\n";
1742 t << " <location file=\""
1743 << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\""
1744 << cd->getDefLine() << "\"" << " column=\""
1745 << cd->getDefColumn() << "\"/>\n" ;
1746 t << " </compounddef>\n";
1747 t << "</doxygen>\n";
1748
1749 ti << " </compound>\n";
1750}
1751
1752static void generateXMLForModule(const ModuleDef *mod,TextStream &ti)
1753{
1754 if (mod->isReference() || mod->isHidden() || !mod->isPrimaryInterface()) return;
1755 ti << " <compound refid=\"" << mod->getOutputFileBase()
1756 << "\" kind=\"module\"" << "><name>"
1757 << convertToXML(mod->name()) << "</name>\n";
1758
1759 DString outputDirectory = Config_getString(XML_OUTPUT);
1760 DString fileName=outputDirectory+"/"+mod->getOutputFileBase()+".xml";
1761 std::ofstream f = Portable::openOutputStream(fileName);
1762 if (!f.is_open())
1763 {
1764 err("Cannot open file {} for writing!\n",fileName);
1765 return;
1766 }
1767 TextStream t(&f);
1768 writeXMLHeader(t);
1769 t << " <compounddef id=\"" << mod->getOutputFileBase()
1770 << "\" kind=\"module\">\n";
1771 t << " <compoundname>";
1772 writeXMLString(t,mod->name());
1773 t << "</compoundname>\n";
1774 writeInnerFiles(mod->getUsedFiles(),t);
1775 writeInnerClasses(mod->getClasses(),t);
1777 for (const auto &ml : mod->getMemberLists())
1778 {
1779 if (ml->listType().isDeclaration())
1780 {
1781 generateXMLSection(mod,ti,t,ml.get(),ml->listType().toXML());
1782 }
1783 }
1784 for (const auto &mg : mod->getMemberGroups())
1785 {
1786 generateXMLSection(mod,ti,t,&mg->members(),"user-defined",mg->header(),
1787 mg->documentation());
1788 }
1789 t << " <briefdescription>\n";
1790 writeXMLDocBlock(t,mod->briefFile(),mod->briefLine(),mod,nullptr,mod->briefDescription());
1791 t << " </briefdescription>\n";
1792 t << " <detaileddescription>\n";
1793 writeXMLDocBlock(t,mod->docFile(),mod->docLine(),mod,nullptr,mod->documentation());
1794 t << " </detaileddescription>\n";
1795 writeExports(mod->getExports(),t);
1796 writeRequirementRefs(mod,t);
1797 t << " <location file=\""
1798 << convertToXML(stripFromPath(mod->getDefFileName())) << "\" line=\""
1799 << mod->getDefLine() << "\"" << " column=\""
1800 << mod->getDefColumn() << "\"/>\n" ;
1801 t << " </compounddef>\n";
1802 t << "</doxygen>\n";
1803
1804 ti << " </compound>\n";
1805
1806}
1807
1809{
1810 // + contained class definitions
1811 // + contained namespace definitions
1812 // + member groups
1813 // + normal members
1814 // + brief desc
1815 // + detailed desc
1816 // + location
1817 // - files containing (parts of) the namespace definition
1818
1819 if (nd->isReference() || nd->isHidden()) return; // skip external references
1820
1821 ti << " <compound refid=\"" << nd->getOutputFileBase()
1822 << "\" kind=\"namespace\"" << "><name>"
1823 << convertToXML(nd->name()) << "</name>\n";
1824
1825 DString outputDirectory = Config_getString(XML_OUTPUT);
1826 DString fileName=outputDirectory+"/"+nd->getOutputFileBase()+".xml";
1827 std::ofstream f = Portable::openOutputStream(fileName);
1828 if (!f.is_open())
1829 {
1830 err("Cannot open file {} for writing!\n",fileName);
1831 return;
1832 }
1833 TextStream t(&f);
1834
1835 writeXMLHeader(t);
1836 t << " <compounddef id=\"" << nd->getOutputFileBase()
1837 << "\" kind=\"namespace\" "
1838 << (nd->isInline()?"inline=\"yes\" ":"")
1839 << "language=\""
1840 << to_string(nd->getLanguage()) << "\">\n";
1841 t << " <compoundname>";
1842 DString nameStr = nd->name();
1843 writeXMLString(t,nameStr);
1844 t << "</compoundname>\n";
1845
1849
1850 for (const auto &mg : nd->getMemberGroups())
1851 {
1852 generateXMLSection(nd,ti,t,&mg->members(),"user-defined",mg->header(),
1853 mg->documentation());
1854 }
1855
1856 for (const auto &ml : nd->getMemberLists())
1857 {
1858 if (ml->listType().isDeclaration())
1859 {
1860 generateXMLSection(nd,ti,t,ml.get(),ml->listType().toXML());
1861 }
1862 }
1863
1864 t << " <briefdescription>\n";
1865 writeXMLDocBlock(t,nd->briefFile(),nd->briefLine(),nd,nullptr,nd->briefDescription());
1866 t << " </briefdescription>\n";
1867 t << " <detaileddescription>\n";
1868 writeXMLDocBlock(t,nd->docFile(),nd->docLine(),nd,nullptr,nd->documentation());
1869 t << " </detaileddescription>\n";
1871 t << " <location file=\""
1872 << convertToXML(stripFromPath(nd->getDefFileName())) << "\" line=\""
1873 << nd->getDefLine() << "\"" << " column=\""
1874 << nd->getDefColumn() << "\"/>\n" ;
1875 t << " </compounddef>\n";
1876 t << "</doxygen>\n";
1877
1878 ti << " </compound>\n";
1879}
1880
1882{
1883 // + includes files
1884 // + includedby files
1885 // + include graph
1886 // + included by graph
1887 // + contained class definitions
1888 // + contained namespace definitions
1889 // + member groups
1890 // + normal members
1891 // + brief desc
1892 // + detailed desc
1893 // + source code
1894 // + location
1895 // - number of lines
1896
1897 if (fd->isReference()) return; // skip external references
1898
1899 ti << " <compound refid=\"" << fd->getOutputFileBase()
1900 << "\" kind=\"file\"><name>" << convertToXML(fd->name())
1901 << "</name>\n";
1902
1903 DString outputDirectory = Config_getString(XML_OUTPUT);
1904 DString fileName=outputDirectory+"/"+fd->getOutputFileBase()+".xml";
1905 std::ofstream f = Portable::openOutputStream(fileName);
1906 if (!f.is_open())
1907 {
1908 err("Cannot open file {} for writing!\n",fileName);
1909 return;
1910 }
1911 TextStream t(&f);
1912
1913 writeXMLHeader(t);
1914 t << " <compounddef id=\"" << fd->getOutputFileBase()
1915 << "\" kind=\"file\" language=\""
1916 << to_string(fd->getLanguage()) << "\">\n";
1917 t << " <compoundname>";
1918 writeXMLString(t,fd->name());
1919 t << "</compoundname>\n";
1920
1921 for (const auto &inc : fd->includeFileList())
1922 {
1923 t << " <includes";
1924 if (inc.fileDef && !inc.fileDef->isReference()) // TODO: support external references
1925 {
1926 t << " refid=\"" << inc.fileDef->getOutputFileBase() << "\"";
1927 }
1928 t << " local=\"" << ((inc.kind & IncludeKind_LocalMask) ? "yes" : "no") << "\">";
1929 t << convertToXML(inc.includeName);
1930 t << "</includes>\n";
1931 }
1932
1933 for (const auto &inc : fd->includedByFileList())
1934 {
1935 t << " <includedby";
1936 if (inc.fileDef && !inc.fileDef->isReference()) // TODO: support external references
1937 {
1938 t << " refid=\"" << inc.fileDef->getOutputFileBase() << "\"";
1939 }
1940 t << " local=\"" << ((inc.kind &IncludeKind_LocalMask) ? "yes" : "no") << "\">";
1941 t << convertToXML(inc.includeName);
1942 t << "</includedby>\n";
1943 }
1944
1945 DotInclDepGraph incDepGraph(fd,false);
1946 if (!incDepGraph.isTrivial())
1947 {
1948 t << " <incdepgraph>\n";
1949 incDepGraph.writeXML(t);
1950 t << " </incdepgraph>\n";
1951 }
1952
1953 DotInclDepGraph invIncDepGraph(fd,true);
1954 if (!invIncDepGraph.isTrivial())
1955 {
1956 t << " <invincdepgraph>\n";
1957 invIncDepGraph.writeXML(t);
1958 t << " </invincdepgraph>\n";
1959 }
1960
1964
1965 for (const auto &mg : fd->getMemberGroups())
1966 {
1967 generateXMLSection(fd,ti,t,&mg->members(),"user-defined",mg->header(),
1968 mg->documentation());
1969 }
1970
1971 for (const auto &ml : fd->getMemberLists())
1972 {
1973 if (ml->listType().isDeclaration())
1974 {
1975 generateXMLSection(fd,ti,t,ml.get(),ml->listType().toXML());
1976 }
1977 }
1978
1979 t << " <briefdescription>\n";
1980 writeXMLDocBlock(t,fd->briefFile(),fd->briefLine(),fd,nullptr,fd->briefDescription());
1981 t << " </briefdescription>\n";
1982 t << " <detaileddescription>\n";
1983 writeXMLDocBlock(t,fd->docFile(),fd->docLine(),fd,nullptr,fd->documentation());
1984 t << " </detaileddescription>\n";
1985 if (Config_getBool(XML_PROGRAMLISTING))
1986 {
1987 writeXMLCodeBlock(t,fd);
1988 }
1990 t << " <location file=\"" << convertToXML(stripFromPath(fd->getDefFileName())) << "\"/>\n";
1991 t << " </compounddef>\n";
1992 t << "</doxygen>\n";
1993
1994 ti << " </compound>\n";
1995}
1996
1997static void generateXMLForGroup(const GroupDef *gd,TextStream &ti)
1998{
1999 // + members
2000 // + member groups
2001 // + files
2002 // + classes
2003 // + namespaces
2004 // - packages
2005 // + pages
2006 // + child groups
2007 // - examples
2008 // + brief description
2009 // + detailed description
2010
2011 if (gd->isReference()) return; // skip external references
2012
2013 ti << " <compound refid=\"" << gd->getOutputFileBase()
2014 << "\" kind=\"group\"><name>" << convertToXML(gd->name()) << "</name>\n";
2015
2016 DString outputDirectory = Config_getString(XML_OUTPUT);
2017 DString fileName=outputDirectory+"/"+gd->getOutputFileBase()+".xml";
2018 std::ofstream f = Portable::openOutputStream(fileName);
2019 if (!f.is_open())
2020 {
2021 err("Cannot open file {} for writing!\n",fileName);
2022 return;
2023 }
2024 TextStream t(&f);
2025
2026 writeXMLHeader(t);
2027 t << " <compounddef id=\""
2028 << gd->getOutputFileBase() << "\" kind=\"group\">\n";
2029 t << " <compoundname>" << convertToXML(gd->name()) << "</compoundname>\n";
2030 t << " <title>" << convertToXML(gd->groupTitle()) << "</title>\n";
2031
2033 writeInnerFiles(gd->getFiles(),t);
2037 writeInnerPages(gd->getPages(),t);
2039
2040 for (const auto &mg : gd->getMemberGroups())
2041 {
2042 generateXMLSection(gd,ti,t,&mg->members(),"user-defined",mg->header(),
2043 mg->documentation());
2044 }
2045
2046 for (const auto &ml : gd->getMemberLists())
2047 {
2048 if (ml->listType().isDeclaration())
2049 {
2050 generateXMLSection(gd,ti,t,ml.get(),ml->listType().toXML());
2051 }
2052 }
2053
2054 t << " <briefdescription>\n";
2055 writeXMLDocBlock(t,gd->briefFile(),gd->briefLine(),gd,nullptr,gd->briefDescription());
2056 t << " </briefdescription>\n";
2057 t << " <detaileddescription>\n";
2058 writeXMLDocBlock(t,gd->docFile(),gd->docLine(),gd,nullptr,gd->documentation());
2059 t << " </detaileddescription>\n";
2061 t << " </compounddef>\n";
2062 t << "</doxygen>\n";
2063
2064 ti << " </compound>\n";
2065}
2066
2068{
2069 if (dd->isReference()) return; // skip external references
2070 ti << " <compound refid=\"" << dd->getOutputFileBase()
2071 << "\" kind=\"dir\"><name>" << convertToXML(dd->displayName())
2072 << "</name>\n";
2073
2074 DString outputDirectory = Config_getString(XML_OUTPUT);
2075 DString fileName=outputDirectory+"/"+dd->getOutputFileBase()+".xml";
2076 std::ofstream f = Portable::openOutputStream(fileName);
2077 if (!f.is_open())
2078 {
2079 err("Cannot open file {} for writing!\n",fileName);
2080 return;
2081 }
2082 TextStream t(&f);
2083
2084 writeXMLHeader(t);
2085 t << " <compounddef id=\""
2086 << dd->getOutputFileBase() << "\" kind=\"dir\">\n";
2087 t << " <compoundname>" << convertToXML(dd->displayName()) << "</compoundname>\n";
2088
2089 writeInnerDirs(&dd->subDirs(),t);
2090 writeInnerFiles(dd->getFiles(),t);
2091
2092 t << " <briefdescription>\n";
2093 writeXMLDocBlock(t,dd->briefFile(),dd->briefLine(),dd,nullptr,dd->briefDescription());
2094 t << " </briefdescription>\n";
2095 t << " <detaileddescription>\n";
2096 writeXMLDocBlock(t,dd->docFile(),dd->docLine(),dd,nullptr,dd->documentation());
2097 t << " </detaileddescription>\n";
2099 t << " <location file=\"" << convertToXML(stripFromPath(dd->name())) << "\"/>\n";
2100 t << " </compounddef>\n";
2101 t << "</doxygen>\n";
2102
2103 ti << " </compound>\n";
2104}
2105
2107{
2108 ti << " <compound refid=\"requirements\" kind=\"requirements\"><name>" << convertToXML(pd->name()) << "</name>\n";
2109 DString outputDirectory = Config_getString(XML_OUTPUT);
2110 DString fileName = outputDirectory+"/requirements.xml";
2111 std::ofstream f = Portable::openOutputStream(fileName);
2112 if (!f.is_open())
2113 {
2114 err("Cannot open file {} for writing!\n",fileName);
2115 return;
2116 }
2117 TextStream t(&f);
2118
2119 auto writeDefsForReq = [&t](const std::vector<const Definition *> &defs,const char *tagName)
2120 {
2121 for (const auto &def : defs)
2122 {
2123 t << " <" << tagName << " refid=\"";
2124 t << def->getOutputFileBase();
2125 if (def->definitionType()==Definition::TypeMember)
2126 {
2127 t << "_1" << def->anchor();
2128 }
2129 t << "\">";
2130 t << convertToXML(def->name());
2131 t << "</" << tagName<< ">\n";
2132 }
2133 };
2134
2135 writeXMLHeader(t);
2136 t << " <compounddef id=\"requirements\" kind=\"requirements\">\n";
2137 t << " <compoundname>" << convertToXML(pd->name()) << "</compoundname>\n";
2138 t << " <requirementslist>\n";
2140 for (const auto &req : reqs)
2141 {
2142 t << " <requirement refid=\"" << req->id();
2143 if (auto tagFile = req->getTagFile(); !tagFile.empty())
2144 {
2145 t << "\" tagfile=\"" << convertToXML(stripFromPath(tagFile)) << "\" page=\"" << convertToXML(req->getExtPage());
2146 }
2147 t << "\">\n";
2148 t << " <title>" << convertToXML(filterTitle(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(req->title()))) << "</title>\n";
2149 t << " <location file=\"" << convertToXML(stripFromPath(req->file())) << "\" line=\"" << req->line() << "\"/>\n" ;
2150 writeDefsForReq(req->satisfiedBy(),"satisfiedby");
2151 writeDefsForReq(req->verifiedBy(),"verifiedby");
2152 t << " </requirement>\n";
2153 }
2154 t << " </requirementslist>\n";
2155 t << " </compounddef>\n";
2156 t << "</doxygen>\n";
2157
2158 ti << " </compound>\n";
2159}
2160
2161static void generateXMLForPage(PageDef *pd,TextStream &ti,bool isExample)
2162{
2163 // + name
2164 // + title
2165 // + documentation
2166 // + location
2167
2168 const char *kindName = isExample ? "example" : "page";
2169
2170 if (pd->isReference()) return;
2171
2172 DString pageName = pd->getOutputFileBase();
2173 if (pd->getGroupDef())
2174 {
2175 pageName+=DString("_")+pd->name();
2176 }
2177 if (pageName=="index")
2178 {
2179 pageName="indexpage"; // to prevent overwriting the generated index page.
2180 }
2181 else if (pageName=="requirements")
2182 {
2184 return; // requirements are listed separately
2185 }
2186
2187 ti << " <compound refid=\"" << pageName
2188 << "\" kind=\"" << kindName << "\"><name>" << convertToXML(pd->name())
2189 << "</name>\n";
2190
2191 DString outputDirectory = Config_getString(XML_OUTPUT);
2192 DString fileName=outputDirectory+"/"+pageName+".xml";
2193 std::ofstream f = Portable::openOutputStream(fileName);
2194 if (!f.is_open())
2195 {
2196 err("Cannot open file {} for writing!\n",fileName);
2197 return;
2198 }
2199 TextStream t(&f);
2200
2201 writeXMLHeader(t);
2202 t << " <compounddef id=\"" << pageName;
2203 t << "\" kind=\"" << kindName << "\">\n";
2204 t << " <compoundname>" << convertToXML(pd->name())
2205 << "</compoundname>\n";
2206
2207 if (pd==Doxygen::mainPage.get()) // main page is special
2208 {
2209 DString title;
2210 if (mainPageHasTitle())
2211 {
2212 title = filterTitle(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(Doxygen::mainPage->title()));
2213 }
2214 else
2215 {
2216 title = Config_getString(PROJECT_NAME);
2217 }
2218 t << " <title>" << convertToXML(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(title))
2219 << "</title>\n";
2220 }
2221 else
2222 {
2223 const SectionInfo *si = SectionManager::instance().find(pd->name());
2224 if (si)
2225 {
2226 t << " <title>" << convertToXML(filterTitle(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(si->title())))
2227 << "</title>\n";
2228 }
2229 }
2231 const SectionRefs &sectionRefs = pd->getSectionRefs();
2232 if (pd->localToc().isXmlEnabled() && !sectionRefs.empty())
2233 {
2234 int level=1;
2235 int indent=0;
2236 auto writeIndent = [&]() { for (int i=0;i<4+indent*2;i++) t << " "; };
2237 auto incIndent = [&](const char *text) { writeIndent(); t << text << "\n"; indent++; };
2238 auto decIndent = [&](const char *text) { indent--; writeIndent(); t << text << "\n"; };
2239 incIndent("<tableofcontents>");
2240 int maxLevel = pd->localToc().xmlLevel();
2241 BoolVector inLi(maxLevel+1,false);
2242 for (const SectionInfo *si : sectionRefs)
2243 {
2244 if (si->type().isSection())
2245 {
2246 //printf(" level=%d title=%s\n",level,qPrint(si->title));
2247 int nextLevel = si->type().level();
2248 if (nextLevel>level)
2249 {
2250 for (int l=level;l<nextLevel;l++)
2251 {
2252 if (l < maxLevel) incIndent("<tableofcontents>");
2253 }
2254 }
2255 else if (nextLevel<level)
2256 {
2257 for (int l=level;l>nextLevel;l--)
2258 {
2259 if (l <= maxLevel && inLi[l]) decIndent("</tocsect>");
2260 inLi[l]=false;
2261 if (l <= maxLevel) decIndent("</tableofcontents>");
2262 }
2263 }
2264 if (nextLevel <= maxLevel)
2265 {
2266 if (inLi[nextLevel])
2267 {
2268 decIndent("</tocsect>");
2269 }
2270 else if (level>nextLevel)
2271 {
2272 decIndent("</tableofcontents>");
2273 incIndent("<tableofcontents>");
2274 }
2275 DString titleDoc = convertToXML(si->title());
2276 DString label = convertToXML(si->label());
2277 if (titleDoc.empty()) titleDoc = label;
2278 incIndent("<tocsect>");
2279 writeIndent(); t << "<name>" << titleDoc << "</name>\n"; // kept for backwards compatibility
2280 writeIndent(); t << "<docs>";
2281 if (!si->title().empty())
2282 {
2283 writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,nullptr,si->title());
2284 }
2285 t << "</docs>\n";
2286 writeIndent(); t << "<reference>" << convertToXML(pageName) << "_1" << label << "</reference>\n";
2287 inLi[nextLevel]=true;
2288 level = nextLevel;
2289 }
2290 }
2291 }
2292 while (level>1 && level <= maxLevel)
2293 {
2294 if (inLi[level]) decIndent("</tocsect>");
2295 inLi[level]=false;
2296 decIndent("</tableofcontents>");
2297 level--;
2298 }
2299 if (level <= maxLevel && inLi[level]) decIndent("</tocsect>");
2300 inLi[level]=false;
2301 decIndent("</tableofcontents>");
2302 }
2303 t << " <briefdescription>\n";
2304 writeXMLDocBlock(t,pd->briefFile(),pd->briefLine(),pd,nullptr,pd->briefDescription());
2305 t << " </briefdescription>\n";
2306 t << " <detaileddescription>\n";
2307 if (isExample)
2308 {
2309 writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,nullptr,
2310 pd->documentation()+"\n\\include "+pd->name());
2311 }
2312 else
2313 {
2314 writeXMLDocBlock(t,pd->docFile(),pd->docLine(),pd,nullptr,
2315 pd->documentation());
2316 }
2317 t << " </detaileddescription>\n";
2319
2320 t << " <location file=\"" << convertToXML(stripFromPath(pd->getDefFileName())) << "\"/>\n";
2321
2322 t << " </compounddef>\n";
2323 t << "</doxygen>\n";
2324
2325 ti << " </compound>\n";
2326}
2327
2329{
2330 DString pageName = xmlRequirementId(req->id());
2331 ti << " <compound refid=\"" << pageName << "\" kind=\"requirement\"><name>" << convertToXML(req->id()) << "</name>\n";
2332
2333 DString outputDirectory = Config_getString(XML_OUTPUT);
2334 DString fileName = outputDirectory+"/"+pageName+".xml";
2335 std::ofstream f = Portable::openOutputStream(fileName);
2336 if (!f.is_open())
2337 {
2338 err("Cannot open file {} for writing!\n",fileName);
2339 return;
2340 }
2341 TextStream t(&f);
2342 writeXMLHeader(t);
2343 t << " <compounddef id=\"" << pageName << "\" kind=\"requirement\">\n";
2344 t << " <compoundname>" << convertToXML(req->id()) << "</compoundname>\n";
2345 t << " <title>" << convertToXML(filterTitle(HtmlEntityMapper::instance().convertCharEntitiesToUTF8(req->title()))) << "</title>\n";
2346 t << " <detaileddescription>\n";
2347 writeXMLDocBlock(t,req->file(),req->line(),RequirementManager::instance().requirementsPage(),nullptr,req->doc());
2348 t << " </detaileddescription>\n";
2349 t << " <location file=\"" << convertToXML(stripFromPath(req->file())) << "\" line=\"" << req->line() << "\"/>\n" ;
2350 t << " </compounddef>\n";
2351 t << "</doxygen>\n";
2352
2353 ti << " </compound>\n";
2354}
2355
2356
2358{
2359 // + classes
2360 // + concepts
2361 // + namespaces
2362 // + files
2363 // + groups
2364 // + related pages
2365 // - examples
2366
2367 DString outputDirectory = Config_getString(XML_OUTPUT);
2368 Dir xmlDir(outputDirectory.str());
2369 createSubDirs(xmlDir);
2370
2371 ResourceMgr::instance().copyResource("xml.xsd",outputDirectory);
2372 ResourceMgr::instance().copyResource("index.xsd",outputDirectory);
2373
2374 DString fileName=outputDirectory+"/compound.xsd";
2375 std::ofstream f = Portable::openOutputStream(fileName);
2376 if (!f.is_open())
2377 {
2378 err("Cannot open file {} for writing!\n",fileName);
2379 return;
2380 }
2381 {
2382 TextStream t(&f);
2383
2384 // write compound.xsd, but replace special marker with the entities
2385 DString compound_xsd = ResourceMgr::instance().getAsString("compound.xsd");
2386 const char *startLine = compound_xsd.data();
2387 while (*startLine)
2388 {
2389 // find end of the line
2390 const char *endLine = startLine+1;
2391 while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n
2392 int len=static_cast<int>(endLine-startLine);
2393 if (len>0)
2394 {
2395 DString s(startLine,len);
2396 if (s.find("<!-- Automatically insert here the HTML entities -->")!=DString::npos)
2397 {
2399 }
2400 else
2401 {
2402 t.write(startLine,len);
2403 }
2404 }
2405 startLine=endLine;
2406 }
2407 }
2408 f.close();
2409
2410 fileName=outputDirectory+"/doxyfile.xsd";
2411 f = Portable::openOutputStream(fileName);
2412 if (!f.is_open())
2413 {
2414 err("Cannot open file {} for writing!\n",fileName);
2415 return;
2416 }
2417 {
2418 TextStream t(&f);
2419
2420 // write doxyfile.xsd, but replace special marker with the entities
2421 DString doxyfile_xsd = ResourceMgr::instance().getAsString("doxyfile.xsd");
2422 const char *startLine = doxyfile_xsd.data();
2423 while (*startLine)
2424 {
2425 // find end of the line
2426 const char *endLine = startLine+1;
2427 while (*endLine && *(endLine-1)!='\n') endLine++; // skip to end of the line including \n
2428 int len=static_cast<int>(endLine-startLine);
2429 if (len>0)
2430 {
2431 DString s(startLine,len);
2432 if (s.find("<!-- Automatically insert here the configuration settings -->")!=DString::npos)
2433 {
2435 }
2436 else
2437 {
2438 t.write(startLine,len);
2439 }
2440 }
2441 startLine=endLine;
2442 }
2443 }
2444 f.close();
2445
2446 fileName=outputDirectory+"/Doxyfile.xml";
2447 f = Portable::openOutputStream(fileName);
2448 if (!f.is_open())
2449 {
2450 err("Cannot open file {} for writing\n",fileName);
2451 return;
2452 }
2453 else
2454 {
2455 TextStream t(&f);
2457 }
2458 f.close();
2459
2460 fileName=outputDirectory+"/index.xml";
2461 f = Portable::openOutputStream(fileName);
2462 if (!f.is_open())
2463 {
2464 err("Cannot open file {} for writing!\n",fileName);
2465 return;
2466 }
2467 else
2468 {
2469 TextStream t(&f);
2470
2471 // write index header
2472 t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>\n";
2473 t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ";
2474 t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" ";
2475 t << "version=\"" << getDoxygenVersion() << "\" ";
2476 t << "xml:lang=\"" << theTranslator->trISOLang() << "\"";
2477 t << ">\n";
2478
2479 for (const auto &cd : *Doxygen::classLinkedMap)
2480 {
2481 generateXMLForClass(cd.get(),t);
2482 }
2483 for (const auto &cd : *Doxygen::conceptLinkedMap)
2484 {
2485 msg("Generating XML output for concept {}\n",cd->displayName());
2486 generateXMLForConcept(cd.get(),t);
2487 }
2488 for (const auto &nd : *Doxygen::namespaceLinkedMap)
2489 {
2490 msg("Generating XML output for namespace {}\n",nd->displayName());
2491 generateXMLForNamespace(nd.get(),t);
2492 }
2493 for (const auto &fn : *Doxygen::inputNameLinkedMap)
2494 {
2495 for (const auto &fd : *fn)
2496 {
2497 msg("Generating XML output for file {}\n",fd->name());
2498 generateXMLForFile(fd.get(),t);
2499 }
2500 }
2501 for (const auto &gd : *Doxygen::groupLinkedMap)
2502 {
2503 msg("Generating XML output for group {}\n",gd->name());
2504 generateXMLForGroup(gd.get(),t);
2505 }
2506 for (const auto &pd : *Doxygen::pageLinkedMap)
2507 {
2508 msg("Generating XML output for page {}\n",pd->name());
2509 generateXMLForPage(pd.get(),t,false);
2510 }
2511 for (const auto &req : RequirementManager::instance().requirements())
2512 {
2513 if (req->getTagFile().empty())
2514 {
2515 msg("Generating XML output for requirement {}\n", req->id());
2517 }
2518 }
2519 for (const auto &dd : *Doxygen::dirLinkedMap)
2520 {
2521 msg("Generate XML output for dir {}\n",dd->name());
2522 generateXMLForDir(dd.get(),t);
2523 }
2524 for (const auto &mod : ModuleManager::instance().modules())
2525 {
2526 msg("Generating XML output for module {}\n",mod->name());
2527 generateXMLForModule(mod.get(),t);
2528 }
2529 for (const auto &pd : *Doxygen::exampleLinkedMap)
2530 {
2531 msg("Generating XML output for example {}\n",pd->name());
2532 generateXMLForPage(pd.get(),t,true);
2533 }
2535 {
2536 msg("Generating XML output for the main page\n");
2538 }
2539
2540 //t << " </compoundlist>\n";
2541 t << "</doxygenindex>\n";
2542 }
2543
2545 clearSubDirs(xmlDir);
2546}
2547
2548
constexpr auto prefix
Definition anchor.cpp:47
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 MemberList * getMemberList(MemberListType lt) const =0
Returns the members in the list identified by lt.
virtual const ArgumentList & typeConstraints() const =0
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 bool isRef() const =0
Returns true if this class is a C# ref struct or a C++/CLI ref 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:84
void clear()
Definition dstring.h:214
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:244
DString fill(char c, size_t len)
Fills a string with a predefined character.
Definition dstring.h:278
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
DString & remove(size_t index, size_t len)
Definition dstring.h:535
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:178
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:686
size_t size() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:154
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
DString left(size_t len) const
Definition dstring.h:306
const std::string & str() const
Definition dstring.h:645
bool stripPrefix(const DString &prefix)
Definition dstring.h:290
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:157
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
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 const ClassDef * getClassDefOfAnonymousType() 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 isEnumerate() 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:126
MemberListType listType() const
Definition memberlist.h:131
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
Implements TextGeneratorIntf for an XML stream.
Definition xmlgen.cpp:187
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:181
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:783
constexpr uint32_t IncludeKind_LocalMask
Definition filedef.h:60
Translator * theTranslator
Definition language.cpp:76
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
#define ASSERT(x)
Definition message.h:142
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:681
size_t updateColumnCount(const char *s, size_t col)
Definition outputgen.cpp:58
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
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:201
Various UTF8 related helper functions.
bool mainPageHasTitle()
Definition util.cpp:4968
DString filterTitle(const DString &title)
Definition util.cpp:4463
DString insertTemplateSpecifierInScope(const DString &scope, const DString &templ)
Definition util.cpp:3085
DString convertNameToFile(const DString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:2872
void clearSubDirs(const Dir &d)
Definition util.cpp:3005
void createSubDirs(const Dir &d)
Definition util.cpp:2978
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4177
DString fileToString(const DString &name, bool filter, bool isSourceCode)
Definition util.cpp:1061
DString convertToXML(const DString &s, bool keepEntities, const bool citeEntry)
Definition util.cpp:3241
DString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Definition util.cpp:4638
DString stripFromPath(const DString &path)
Definition util.cpp:219
A bunch of utility functions.
static void generateXMLForGroup(const GroupDef *gd, TextStream &ti)
Definition xmlgen.cpp:1997
void generateXML()
Definition xmlgen.cpp:2357
static void writeInnerConcepts(const ConceptLinkedRefMap &cl, TextStream &t)
Definition xmlgen.cpp:1380
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:1461
static void stripQualifiers(DString &typeStr)
Definition xmlgen.cpp:536
static void writeInnerDirs(const DirList *dl, TextStream &t)
Definition xmlgen.cpp:1471
static DString memberOutputFileBase(const MemberDef *md)
Definition xmlgen.cpp:561
static void writeListOfAllMembers(const ClassDef *cd, TextStream &t)
Definition xmlgen.cpp:1340
static void writeTemplateArgumentList(TextStream &t, const ArgumentList &al, const Definition *scope, const FileDef *fileScope, int indent, const ArgumentList &typeConstraints=ArgumentList())
Definition xmlgen.cpp:375
#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:461
static void generateXMLForClass(const ClassDef *cd, TextStream &ti)
Definition xmlgen.cpp:1503
static void generateXMLForFile(FileDef *fd, TextStream &ti)
Definition xmlgen.cpp:1881
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:1303
static void writeMemberTemplateLists(const MemberDef *md, TextStream &t)
Definition xmlgen.cpp:446
void writeXMLCodeBlock(TextStream &t, FileDef *fd)
Definition xmlgen.cpp:494
static void writeTemplateList(const ClassDef *cd, TextStream &t)
Definition xmlgen.cpp:451
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:513
void generateXMLForRequirements(PageDef *pd, TextStream &ti)
Definition xmlgen.cpp:2106
static bool memberVisible(const Definition *d, const MemberDef *md)
Definition xmlgen.cpp:685
static void writeIncludeInfo(const IncludeInfo *ii, TextStream &t)
Definition xmlgen.cpp:1483
static void writeInnerPages(const PageLinkedRefMap &pl, TextStream &t)
Definition xmlgen.cpp:1448
DString xmlRequirementId(const DString &reqId)
Definition xmlgen.cpp:76
static void generateXMLForNamespace(const NamespaceDef *nd, TextStream &ti)
Definition xmlgen.cpp:1808
static void generateXMLForRequirement(const RequirementIntf *req, TextStream &ti)
Definition xmlgen.cpp:2328
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:1392
static void generateXMLForModule(const ModuleDef *mod, TextStream &ti)
Definition xmlgen.cpp:1752
static void generateXMLForConcept(const ConceptDef *cd, TextStream &ti)
Definition xmlgen.cpp:1674
static void writeExports(const ImportInfoMap &exportMap, TextStream &t)
Definition xmlgen.cpp:1417
static void writeInnerFiles(const FileList &fl, TextStream &t)
Definition xmlgen.cpp:1439
static bool stripKeyword(DString &str, const char *keyword, bool needSpace)
Definition xmlgen.cpp:575
static void generateXMLForMember(const MemberDef *md, TextStream &ti, TextStream &t, const Definition *def)
Definition xmlgen.cpp:692
static DString classOutputFileBase(const ClassDef *cd)
Definition xmlgen.cpp:552
static void writeRequirementRefs(const Definition *d, TextStream &t, const char *prefix="")
Definition xmlgen.cpp:661
static void writeInnerClasses(const ClassLinkedRefMap &cl, TextStream &t)
Definition xmlgen.cpp:1367
static DString extractNoExcept(DString &argsStr)
Definition xmlgen.cpp:619
static void writeInnerNamespaces(const NamespaceLinkedRefMap &nl, TextStream &t)
Definition xmlgen.cpp:1404
static void generateXMLForDir(DirDef *dd, TextStream &ti)
Definition xmlgen.cpp:2067
static void generateXMLForPage(PageDef *pd, TextStream &ti, bool isExample)
Definition xmlgen.cpp:2161
static void writeCombineScript()
Definition xmlgen.cpp:140