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