Doxygen
Loading...
Searching...
No Matches
layout.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2024 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#include <array>
17
18#include <assert.h>
19
20#include "types.h"
21#include "layout.h"
22#include "message.h"
23#include "language.h"
24#include "util.h"
25#include "doxygen.h"
26#include "version.h"
27#include "config.h"
28#include "xml.h"
29#include "resourcemgr.h"
30#include "docparser.h"
31#include "docnode.h"
32#include "debug.h"
33#include "regex.h"
34
36{
37 return def;
38}
39
40inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1)
41{
42 return compileOptions(def)+"|"+QCString().setNum(static_cast<long>(langId1))+"="+value1;
43}
44
45inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1,
46 SrcLangExt langId2,const QCString &value2)
47{
48 return compileOptions(def,langId1,value1)+
49 "|"+QCString().setNum(static_cast<long>(langId2))+"="+value2;
50}
51
52inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1,
53 SrcLangExt langId2,const QCString &value2,
54 SrcLangExt langId3,const QCString &value3)
55{
56 return compileOptions(def,langId1,value1,langId2,value2)+
57 "|"+QCString().setNum(static_cast<long>(langId3))+"="+value3;
58}
59
60inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1,
61 SrcLangExt langId2,const QCString &value2,
62 SrcLangExt langId3,const QCString &value3,
63 SrcLangExt langId4,const QCString &value4)
64{
65 return compileOptions(def,langId1,value1,langId2,value2,langId3,value3)+
66 "|"+QCString().setNum(static_cast<long>(langId4))+"="+value4;
67}
68
69inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1,
70 SrcLangExt langId2,const QCString &value2,
71 SrcLangExt langId3,const QCString &value3,
72 SrcLangExt langId4,const QCString &value4,
73 SrcLangExt langId5,const QCString &value5)
74{
75 return compileOptions(def,langId1,value1,langId2,value2,langId3,value3,langId4,value4)+
76 "|"+QCString().setNum(static_cast<long>(langId5))+"="+value5;
77}
78
79static bool elemIsVisible(const XMLHandlers::Attributes &attrib,bool defVal=TRUE)
80{
81 QCString visible = XMLHandlers::value(attrib,"visible");
82 //printf("visible_attribute=%s\n",qPrint(visible));
83 if (visible.isEmpty()) return defVal;
84 if (visible.at(0)=='$' && visible.length()>1)
85 {
86 QCString id = visible.mid(1);
87 const ConfigValues::Info *opt = ConfigValues::instance().get(id);
88 if (opt && opt->type==ConfigValues::Info::Bool)
89 {
90 return ConfigValues::instance().*(opt->value.b);
91 }
92 else if (opt && opt->type==ConfigValues::Info::String)
93 {
94 return opt->getBooleanRepresentation();
95 }
96 else if (!opt)
97 {
98 err("found unsupported value '{}' for visible attribute in layout file, reverting to '{}'\n",
99 visible,(defVal?"yes":"no"));
100 return defVal;
101 }
102 }
103 QCString visibleLow = visible.lower();
104 if (visibleLow=="no" || visibleLow=="false" || visibleLow=="0") return FALSE;
105 else if (visibleLow=="yes" || visibleLow=="true" || visibleLow=="1") return TRUE;
106 else
107 {
108 err("found unsupported value '{}' for visible attribute in layout file, reverting to '{}'\n",
109 visible,(defVal?"yes":"no"));
110 return defVal;
111 }
112}
113
114//---------------------------------------------------------------------------------
115
117{
118 m_visible = m_visible && (parent==nullptr || parent->visible());
119}
120
121void LayoutNavEntry::appendChild(std::unique_ptr<LayoutNavEntry> &&e)
122{
123 e->updateVisibility(this);
124 m_children.push_back(std::move(e));
125}
126
127void LayoutNavEntry::insertChild(size_t pos,std::unique_ptr<LayoutNavEntry> &&e)
128{
129 e->updateVisibility(this);
130 m_children.insert(m_children.begin()+pos,std::move(e));
131}
132
134 const QCString &file) const
135{
136 LayoutNavEntry *result=nullptr;
137 for (const auto &entry : m_children)
138 {
139 // depth first search, needed to find the entry furthest from the
140 // root in case an entry is in the tree twice
141 result = entry->find(kind,file);
142 if (result) return result;
143 if (entry->kind()==kind && (file==QCString() || entry->baseFile()==file))
144 {
145 return entry.get();
146 }
147 }
148 return result;
149}
150
152{
154 if ((kind()!=LayoutNavEntry::User && kind()!=LayoutNavEntry::UserGroup) ||
155 (kind()==LayoutNavEntry::UserGroup && url.startsWith("usergroup")))
156 {
158 }
159 else if (url.startsWith("@ref ") || url.startsWith("\\ref "))
160 {
161 bool found=false;
162 QCString relPath = "";
163 QCString context = QCString();
164 auto parser { createDocParser() };
165 auto dfAst { createRef( *parser.get(), url.mid(5).stripWhiteSpace(), context ) };
166 auto dfAstImpl = dynamic_cast<const DocNodeAST*>(dfAst.get());
167 const DocRef *df = std::get_if<DocRef>(&dfAstImpl->root);
168 if (!df->file().isEmpty() || !df->anchor().isEmpty())
169 {
170 found = true;
171 url=externalRef(relPath,df->ref(),TRUE);
172 if (!df->file().isEmpty())
173 {
174 QCString fn = df->file();
176 url += fn;
177 }
178 if (!df->anchor().isEmpty())
179 {
180 url += "#" + df->anchor();
181 }
182 }
183 if (!found)
184 {
185 msg("explicit link request to '{}' in layout file '{}' could not be resolved\n",url.mid(5),Config_getString(LAYOUT_FILE));
186 }
187 }
188 //printf("LayoutNavEntry::url()=%s\n",qPrint(url));
189 return url;
190}
191
192//---------------------------------------------------------------------------------
193
195{
196 public:
198
199 // =========== XMLHandler events
200 void setDocumentLocator(const XMLLocator *locator)
201 {
202 m_locator = locator;
203 }
204 void error( const std::string &fileName,int lineNr,const std::string &msg)
205 {
206 warn_layout(fileName,lineNr,"{}",msg);
207 }
208 void startElement( const std::string &name, const XMLHandlers::Attributes& attrib );
209 void endElement( const std::string &name );
210
211 void startSimpleEntry(LayoutDocEntry::Kind k,const std::string &id,const XMLHandlers::Attributes &attrib)
212 {
213 bool isVisible = m_visible && elemIsVisible(attrib);
214 if (m_part!=LayoutDocManager::Undefined)
215 {
216 auto elem = std::make_unique<LayoutDocEntrySimple>(k,id,isVisible);
217 //printf("startSimpleEntry(%s) isVisible=%d visible=%d\n",qPrint(elem->entryToString()),isVisible,elem->visible());
218 m_layoutDocManager.addEntry(m_part,std::move(elem));
219 }
220 }
221
222 // ============ Specific callbacks
223
224 void startSectionEntry(LayoutDocEntry::Kind k,const std::string &id,const XMLHandlers::Attributes &attrib,
225 const QCString &title)
226 {
227 bool isVisible = m_visible && elemIsVisible(attrib);
228 QCString userTitle = XMLHandlers::value(attrib,"title");
229 //printf("startSectionEntry: title='%s' userTitle='%s'\n",
230 // qPrint(title),qPrint(userTitle));
231 if (userTitle.isEmpty()) userTitle = title;
232 if (m_part!=LayoutDocManager::Undefined)
233 {
234 m_layoutDocManager.addEntry(m_part,std::make_unique<LayoutDocEntrySection>(k,id,userTitle,isVisible));
235 }
236 }
237
238
239 void startMemberDeclEntry(const std::string &id,const XMLHandlers::Attributes &attrib,MemberListType type,
240 const QCString &title,const QCString &subscript)
241 {
242 QCString userTitle = XMLHandlers::value(attrib,"title");
243 QCString userSubscript = XMLHandlers::value(attrib,"subtitle");
244 if (userTitle.isEmpty()) userTitle = title;
245 if (userSubscript.isEmpty()) userSubscript = subscript;
246 bool isVisible = m_visible && elemIsVisible(attrib);
247 if (m_part!=LayoutDocManager::Undefined)
248 {
249 m_layoutDocManager.addEntry(m_part,std::make_unique<LayoutDocEntryMemberDecl>(type,id,userTitle,userSubscript,isVisible));
250 }
251 }
252
253 void startMemberDefEntry(const std::string &id,const XMLHandlers::Attributes &attrib,MemberListType type,
254 const QCString &title,const QCString &)
255 {
256 QCString userTitle = XMLHandlers::value(attrib,"title");
257 if (userTitle.isEmpty()) userTitle = title;
258 //printf("memberdef: %s\n",qPrint(userTitle));
259 bool isVisible = m_visible && elemIsVisible(attrib);
260 if (m_part!=LayoutDocManager::Undefined)
261 {
262 m_layoutDocManager.addEntry(m_part,std::make_unique<LayoutDocEntryMemberDef>(type,id,userTitle,isVisible));
263 }
264 }
265
266 void startLayout(const std::string &,const XMLHandlers::Attributes &attrib)
267 {
268 // extract and store version number
269 QCString version = XMLHandlers::value(attrib,"version");
270 static const reg::Ex re(R"((\d+)\.(\d+))");
271 reg::Match match;
272 if (reg::match(version.view(),match,re))
273 {
274 m_majorVersion = atoi(match[1].str().c_str());
275 m_minorVersion = atoi(match[2].str().c_str());
276 //printf("layout version %d.%d\n",m_versionMajor,m_versionMinor);
277 }
278 }
279
280 void startNavIndex(const std::string &,const XMLHandlers::Attributes &)
281 {
282 m_scope="navindex/";
283 m_rootNav = m_layoutDocManager.rootNavEntry();
284 }
285
286 void endNavIndex(const std::string &)
287 {
288 m_scope="";
289 if (m_rootNav && !m_rootNav->find(LayoutNavEntry::MainPage))
290 {
291 // no MainPage node... add one as the first item of the root node...
292 m_rootNav->insertChild(0,std::make_unique<LayoutNavEntry>(m_rootNav,LayoutNavEntry::MainPage, TRUE,
293 "index",theTranslator->trMainPage(),""));
294 }
295 }
296
297 void startNavEntry(const std::string &,const XMLHandlers::Attributes &attrib)
298 {
299 bool javaOpt = Config_getBool(OPTIMIZE_OUTPUT_JAVA);
300 bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
301 bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
302 bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
303 bool hasGraphicalHierarchy = Config_getBool(HAVE_DOT) &&
304 Config_getBool(GRAPHICAL_HIERARCHY);
305 bool extractAll = Config_getBool(EXTRACT_ALL);
306 static struct NavEntryMap
307 {
308 const char *typeStr; // type attribute name in the XML file
309 LayoutNavEntry::Kind kind; // corresponding enum name
310 QCString mainName; // default title for an item if it has children
311 QCString subName; // optional name for an item if it is rendered as a child
312 QCString intro; // introduction text to be put on the index page
313 QCString baseFile; // base name of the file containing the index page
314 } mapping[] =
315 {
316 { "mainpage",
317 LayoutNavEntry::MainPage,
318 theTranslator->trMainPage(),
319 QCString(),
320 QCString(),
321 "index"
322 },
323 { "pages",
324 LayoutNavEntry::Pages,
325 theTranslator->trRelatedPages(),
326 QCString(),
327 theTranslator->trRelatedPagesDescription(),
328 "pages"
329 },
330 { "topics",
331 LayoutNavEntry::Topics,
332 theTranslator->trTopics(),
333 QCString(),
334 theTranslator->trTopicListDescription(),
335 "topics"
336 },
337 { "modules",
338 LayoutNavEntry::Modules,
339 theTranslator->trModules(),
340 theTranslator->trModulesList(),
341 theTranslator->trModulesDescription(),
342 "modules"
343 },
344 { "modulelist",
345 LayoutNavEntry::ModuleList,
346 theTranslator->trModulesList(),
347 QCString(),
348 theTranslator->trModulesListDescription(extractAll),
349 "modules"
350 },
351 { "modulemembers",
352 LayoutNavEntry::ModuleMembers,
353 theTranslator->trModulesMembers(),
354 QCString(),
355 theTranslator->trModulesMemberDescription(extractAll),
356 "modulemembers"
357 },
358 { "namespaces",
359 LayoutNavEntry::Namespaces,
360 javaOpt || vhdlOpt ? theTranslator->trPackages() : fortranOpt || sliceOpt ? theTranslator->trModules() : theTranslator->trNamespaces(),
361 javaOpt || vhdlOpt ? theTranslator->trPackageList() : fortranOpt || sliceOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
362 javaOpt || vhdlOpt ? theTranslator->trPackageListDescription() : fortranOpt || sliceOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
363 "namespaces"
364 },
365 { "namespacelist",
366 LayoutNavEntry::NamespaceList,
367 javaOpt || vhdlOpt ? theTranslator->trPackageList() : fortranOpt || sliceOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
368 QCString(),
369 javaOpt || vhdlOpt ? theTranslator->trPackageListDescription() : fortranOpt || sliceOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
370 "namespaces"
371 },
372 { "namespacemembers",
373 LayoutNavEntry::NamespaceMembers,
374 javaOpt || vhdlOpt ? theTranslator->trPackageMembers() : fortranOpt || sliceOpt ? theTranslator->trModulesMembers() : theTranslator->trNamespaceMembers(),
375 QCString(),
376 fortranOpt || sliceOpt ? theTranslator->trModulesMemberDescription(extractAll) : theTranslator->trNamespaceMemberDescription(extractAll),
377 "namespacemembers"
378 },
379 { "concepts",
380 LayoutNavEntry::Concepts,
381 theTranslator->trConcept(true,false),
382 theTranslator->trConceptList(),
383 theTranslator->trConceptListDescription(extractAll),
384 "concepts"
385 },
386 { "classindex",
387 LayoutNavEntry::ClassIndex,
388 fortranOpt ? theTranslator->trCompoundIndexFortran() : vhdlOpt ? theTranslator->trDesignUnitIndex() : theTranslator->trCompoundIndex(),
389 QCString(),
390 QCString(),
391 "classes"
392 },
393 { "classes",
394 LayoutNavEntry::Classes,
395 fortranOpt ? theTranslator->trDataTypes() : vhdlOpt ? theTranslator->trDesignUnits() : theTranslator->trClasses(),
396 theTranslator->trCompoundList(),
397 fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? theTranslator->trDesignUnitListDescription() : theTranslator->trCompoundListDescription(),
398 "annotated"
399 },
400 { "classlist",
401 LayoutNavEntry::ClassList,
402 fortranOpt ? theTranslator->trCompoundListFortran() : vhdlOpt ? theTranslator->trDesignUnitList() : theTranslator->trCompoundList(),
403 QCString(),
404 fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? theTranslator->trDesignUnitListDescription() : theTranslator->trCompoundListDescription(),
405 "annotated"
406 },
407 { "hierarchy",
408 LayoutNavEntry::ClassHierarchy,
409 vhdlOpt ? theTranslator->trDesignUnitHierarchy() : theTranslator->trClassHierarchy(),
410 QCString(),
411 theTranslator->trClassHierarchyDescription(),
412 hasGraphicalHierarchy ? "inherits" : "hierarchy"
413 },
414 { "classmembers",
415 LayoutNavEntry::ClassMembers,
416 fortranOpt ? theTranslator->trCompoundMembersFortran() : vhdlOpt ? theTranslator->trDesignUnitMembers() : theTranslator->trCompoundMembers(),
417 QCString(),
418 fortranOpt ? theTranslator->trCompoundMembersDescriptionFortran(extractAll) : theTranslator->trCompoundMembersDescription(extractAll),
419 "functions"
420 },
421 { "interfaceindex",
422 LayoutNavEntry::InterfaceIndex,
423 theTranslator->trInterfaceIndex(),
424 QCString(),
425 QCString(),
426 "interfaces"
427 },
428 { "interfaces",
429 LayoutNavEntry::Interfaces,
430 theTranslator->trSliceInterfaces(),
431 theTranslator->trInterfaceList(),
432 theTranslator->trInterfaceListDescription(),
433 "annotatedinterfaces"
434 },
435 { "interfacelist",
436 LayoutNavEntry::InterfaceList,
437 theTranslator->trInterfaceList(),
438 QCString(),
439 theTranslator->trInterfaceListDescription(),
440 "annotatedinterfaces"
441 },
442 { "interfacehierarchy",
443 LayoutNavEntry::InterfaceHierarchy,
444 theTranslator->trInterfaceHierarchy(),
445 QCString(),
446 theTranslator->trInterfaceHierarchyDescription(),
447 hasGraphicalHierarchy ? "interfaceinherits" : "interfacehierarchy"
448 },
449 { "structindex",
450 LayoutNavEntry::StructIndex,
451 theTranslator->trStructIndex(),
452 QCString(),
453 QCString(),
454 "structs"
455 },
456 { "structs",
457 LayoutNavEntry::Structs,
458 theTranslator->trStructs(),
459 theTranslator->trStructList(),
460 theTranslator->trStructListDescription(),
461 "annotatedstructs"
462 },
463 { "structlist",
464 LayoutNavEntry::StructList,
465 theTranslator->trStructList(),
466 QCString(),
467 theTranslator->trStructListDescription(),
468 "annotatedstructs"
469 },
470 { "exceptionindex",
471 LayoutNavEntry::ExceptionIndex,
472 theTranslator->trExceptionIndex(),
473 QCString(),
474 QCString(),
475 "exceptions"
476 },
477 { "exceptions",
478 LayoutNavEntry::Exceptions,
479 theTranslator->trExceptions(),
480 theTranslator->trExceptionList(),
481 theTranslator->trExceptionListDescription(),
482 "annotatedexceptions"
483 },
484 { "exceptionlist",
485 LayoutNavEntry::ExceptionList,
486 theTranslator->trExceptionList(),
487 QCString(),
488 theTranslator->trExceptionListDescription(),
489 "annotatedexceptions"
490 },
491 { "exceptionhierarchy",
492 LayoutNavEntry::ExceptionHierarchy,
493 theTranslator->trExceptionHierarchy(),
494 QCString(),
495 theTranslator->trExceptionHierarchyDescription(),
496 hasGraphicalHierarchy ? "exceptioninherits" : "exceptionhierarchy"
497 },
498 { "files",
499 LayoutNavEntry::Files,
500 theTranslator->trFile(TRUE,FALSE),
501 theTranslator->trFileList(),
502 theTranslator->trFileListDescription(extractAll),
503 "files"
504 },
505 { "filelist",
506 LayoutNavEntry::FileList,
507 theTranslator->trFileList(),
508 QCString(),
509 theTranslator->trFileListDescription(extractAll),
510 "files"
511 },
512 { "globals",
513 LayoutNavEntry::FileGlobals,
514 theTranslator->trFileMembers(),
515 QCString(),
516 theTranslator->trFileMembersDescription(extractAll),
517 "globals"
518 },
519 { "examples",
520 LayoutNavEntry::Examples,
521 theTranslator->trExamples(),
522 QCString(),
523 theTranslator->trExamplesDescription(),
524 "examples"
525 },
526 { "user",
527 LayoutNavEntry::User,
528 QCString(),
529 QCString(),
530 QCString(),
531 "user"
532 },
533 { "usergroup",
534 LayoutNavEntry::UserGroup,
535 QCString(),
536 QCString(),
537 QCString(),
538 "usergroup"
539 },
540 { nullptr, // end of list
541 static_cast<LayoutNavEntry::Kind>(0),
542 QCString(),
543 QCString(),
544 QCString(),
545 QCString()
546 }
547 };
548 // find type in the table
549 int i=0;
550 QCString type = XMLHandlers::value(attrib,"type");
551 while (mapping[i].typeStr)
552 {
553 if (mapping[i].typeStr==type)
554 break;
555 i++;
556 }
557 if (mapping[i].typeStr==nullptr)
558 {
559 QCString fileName = m_locator->fileName();
560 if (type.isEmpty())
561 {
562 warn_layout(fileName,m_locator->lineNr(),"an entry tag within a navindex has no type attribute! Check your layout file!");
563 }
564 else
565 {
566 warn_layout(fileName,m_locator->lineNr(),"the type '{}' is not supported for the entry tag within a navindex! Check your layout file!",type);
567 }
569 return;
570 }
571 LayoutNavEntry::Kind kind = mapping[i].kind;
572 QCString baseFile = mapping[i].baseFile;
573 QCString title = XMLHandlers::value(attrib,"title");
574 bool isVisible = m_visible && elemIsVisible(attrib);
575 if (title.isEmpty()) // use default title
576 {
577 title = mapping[i].mainName; // use title for main row
578 if (m_rootNav!=m_layoutDocManager.rootNavEntry() && !mapping[i].subName.isEmpty())
579 {
580 title = mapping[i].subName; // if this is a child of another row, use the subName if available
581 // this is mainly done to get compatible naming with older versions.
582 }
583 }
584 QCString intro = XMLHandlers::value(attrib,"intro");
585 if (intro.isEmpty()) // use default intro text
586 {
587 intro = mapping[i].intro;
588 }
589 QCString url = XMLHandlers::value(attrib,"url");
590 if (mapping[i].kind==LayoutNavEntry::User && !url.isEmpty())
591 {
592 baseFile=url;
593 }
594 else if (kind==LayoutNavEntry::UserGroup)
595 {
596 if (!url.isEmpty())
597 {
598 if (url == "[none]")
599 {
600 baseFile = QCString();
601 }
602 else
603 {
604 baseFile=url;
605 }
606 }
607 else
608 {
609 baseFile+=QCString().sprintf("%d",m_userGroupCount++);
610 }
611 }
612 // create new item and make it the new root
613 m_rootNav = m_layoutDocManager.createChildNavEntry(m_rootNav,kind,isVisible,baseFile,title,intro);
614 }
615
616 void endNavEntry(const std::string &)
617 {
618 // set the root back to the parent
619 if (m_rootNav && !m_invalidEntry) m_rootNav = m_rootNav->parent();
621 }
622
623 void startTop(const std::string &,const XMLHandlers::Attributes &attrib,LayoutDocManager::LayoutPart part,
624 const QCString &scope, LayoutNavEntry::Kind nav)
625 {
626 //printf("startTop(scope=%s)\n",qPrint(scope));
627 m_scope = scope;
628 m_part = part;
629 m_visible = elemIsVisible(attrib);
630 }
631
632 void endTop(const std::string &)
633 {
634 m_scope="";
635 m_part = LayoutDocManager::Undefined;
636 }
637
638 void startMemberDef(const std::string &id,const XMLHandlers::Attributes &attrib)
639 {
640 m_scope+="memberdef/";
641 bool isVisible = m_visible && elemIsVisible(attrib);
642 if (m_part!=LayoutDocManager::Undefined)
643 {
644 m_layoutDocManager.addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(LayoutDocEntry::MemberDefStart,id,isVisible));
645 }
646 }
647
648 void endMemberDef(const std::string &id)
649 {
650 QCString scopeOrg = m_scope;
651 int i=m_scope.findRev("memberdef/");
652 if (i!=-1)
653 {
654 m_scope=m_scope.left(i);
655 bool isVisible = true;
656 for (const auto &lde : m_layoutDocManager.docEntries(m_part))
657 {
658 if (lde->kind() == LayoutDocEntry::MemberDefStart)
659 {
660 isVisible = static_cast<const LayoutDocEntrySimple*>(lde.get())->visible();
661 break;
662 }
663 }
664 if (m_part!=LayoutDocManager::Undefined)
665 {
666 m_layoutDocManager.addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(LayoutDocEntry::MemberDefEnd,id,isVisible));
667 }
668 }
669 }
670
671 void startMemberDecl(const std::string &id,const XMLHandlers::Attributes &attrib)
672 {
673 m_scope+="memberdecl/";
674 bool isVisible = m_visible && elemIsVisible(attrib);
675 if (m_part!=LayoutDocManager::Undefined)
676 {
677 m_layoutDocManager.addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(LayoutDocEntry::MemberDeclStart,id,isVisible));
678 }
679 }
680
681 void endMemberDecl(const std::string &id)
682 {
683 int i=m_scope.findRev("memberdecl/");
684 if (i!=-1)
685 {
686 m_scope=m_scope.left(i);
687 bool isVisible = true;
688 for (const auto &lde : m_layoutDocManager.docEntries(m_part))
689 {
690 if (lde->kind() == LayoutDocEntry::MemberDeclStart)
691 {
692 isVisible = static_cast<const LayoutDocEntrySimple*>(lde.get())->visible();
693 break;
694 }
695 }
696 if (m_part!=LayoutDocManager::Undefined)
697 {
698 m_layoutDocManager.addEntry(m_part,std::make_unique<LayoutDocEntrySimple>(LayoutDocEntry::MemberDeclEnd,id,isVisible));
699 }
700 }
701 }
702
703 int majorVersion() const { return m_majorVersion; }
704 int minorVersion() const { return m_minorVersion; }
705
706 private:
709 LayoutDocManager::LayoutPart m_part = LayoutDocManager::Undefined;
711 bool m_invalidEntry = false;
712 bool m_visible = true;
714 const XMLLocator *m_locator = nullptr;
717};
718
719//---------------------------------------------------------------------------------
720
721namespace {
722
724{
725 using StartCallback = std::function<void(LayoutParser&,const std::string &,const XMLHandlers::Attributes&)>;
726 using EndCallback = std::function<void(LayoutParser&,const std::string &)>;
727
729 EndCallback endCb = [](LayoutParser &,const std::string &){};
730};
731
732template<class...Args>
733static auto startCb(void (LayoutParser::*fn)(Args...))
734{
735 return [=](LayoutParser &parser,const std::string &id,const XMLHandlers::Attributes &attr) { (parser.*fn)(id,attr); };
736}
737
738template<class...Args>
739static auto startCb(void (LayoutParser::*fn)(Args...),
741 )
742{
743 return [=](LayoutParser &parser,const std::string &id,const XMLHandlers::Attributes &attr) { (parser.*fn)(kind,id,attr); };
744}
745
746template<class...Args>
747static auto startCb(void (LayoutParser::*fn)(Args...),
749 const std::function<QCString()> &title
750 )
751{
752 return [=](LayoutParser &parser,const std::string &id,const XMLHandlers::Attributes &attr) { (parser.*fn)(kind,id,attr,title()); };
753}
754
755template<class...Args>
756static auto startCb(void (LayoutParser::*fn)(Args...),
757 MemberListType type,
758 const std::function<QCString()> &title
759 )
760{
761 return [=](LayoutParser &parser,const std::string &id,const XMLHandlers::Attributes &attr) { (parser.*fn)(id,attr,type,title(),QCString()); };
762}
763
764template<class...Args>
765static auto startCb(void (LayoutParser::*fn)(Args...),
766 MemberListType type,
767 const std::function<QCString()> &title,
768 const std::function<QCString()> &subtitle
769 )
770{
771 return [=](LayoutParser &parser,const std::string &id,const XMLHandlers::Attributes &attr) { (parser.*fn)(id,attr,type,title(),subtitle()); };
772}
773
774template<class...Args>
775static auto startCb(void (LayoutParser::*fn)(Args...),
777 const QCString &scope,
779 )
780{
781 return [=](LayoutParser &parser,const std::string &id,const XMLHandlers::Attributes &attr) { (parser.*fn)(id,attr,part,scope,nav); };
782}
783
784template<class...Args>
785static auto endCb(void (LayoutParser::*fn)(Args...))
786{
787 return [=](LayoutParser &parser,const std::string &id) { (parser.*fn)(id); };
788}
789
790// clang-format off
791static const std::map< std::string, ElementCallbacks > g_elementHandlers =
792{
793 // path/name
794 { "doxygenlayout", { startCb(&LayoutParser::startLayout) } },
796 { "navindex/tab", { startCb(&LayoutParser::startNavEntry),
798 } },
799
800 // class layout handlers
801 { "class", { startCb(&LayoutParser::startTop,LayoutDocManager::Class,"class/",LayoutNavEntry::Classes),
803 } },
804 { "class/briefdescription", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::BriefDesc) } },
805 { "class/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
806 [](){ return compileOptions(theTranslator->trDetailedDescription()); })
807 } },
808 { "class/authorsection", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::AuthorSection) } },
809 { "class/includes", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassIncludes) } },
810 { "class/inheritancegraph", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassInheritanceGraph) } },
811 { "class/collaborationgraph", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassCollaborationGraph) } },
812 { "class/allmemberslink", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassAllMembersLink) } },
813 { "class/usedfiles", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassUsedFiles) } },
815 { "class/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::MemberGroups) } },
816 { "class/memberdecl/nestedclasses", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::ClassNestedClasses,
817 []() { return compileOptions(/*default*/ theTranslator->trCompounds(),
818 SrcLangExt::VHDL, theTranslator->trVhdlType(VhdlSpecifier::ENTITY,FALSE),
819 SrcLangExt::Fortran,theTranslator->trDataTypes()); })
820 } },
821 { "class/memberdecl/services", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Services(),
822 []() { return compileOptions(theTranslator->trServices()); })
823 } },
824 { "class/memberdecl/interfaces", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Interfaces(),
825 []() { return compileOptions(theTranslator->trInterfaces()); })
826 } },
827 { "class/memberdecl/publictypes", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::PubTypes(),
828 []() { return compileOptions(theTranslator->trPublicTypes()); })
829 } },
830 { "class/memberdecl/publicslots", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::PubSlots(),
831 []() { return compileOptions(theTranslator->trPublicSlots()); })
832 } },
833 { "class/memberdecl/signals", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Signals(),
834 []() { return compileOptions(theTranslator->trSignals()); })
835 } },
836 { "class/memberdecl/publicmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubMethods(),
837 []() { return compileOptions(/* default */ theTranslator->trPublicMembers(),
838 SrcLangExt::ObjC, theTranslator->trInstanceMethods(),
839 SrcLangExt::Slice,theTranslator->trOperations()); })
840 } },
841 { "class/memberdecl/publicstaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubStaticMethods(),
842 []() { return compileOptions(/* default */ theTranslator->trStaticPublicMembers(),
843 SrcLangExt::ObjC, theTranslator->trClassMethods()); })
844 } },
845 { "class/memberdecl/publicattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubAttribs(),
846 []() { return compileOptions(/* default */ theTranslator->trPublicAttribs(),
847 SrcLangExt::Slice,theTranslator->trDataMembers()); })
848 } },
849 { "class/memberdecl/publicstaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubStaticAttribs(),
850 []() { return compileOptions(theTranslator->trStaticPublicAttribs()); })
851 } },
852 { "class/memberdecl/protectedtypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProTypes(),
853 []() { return compileOptions(theTranslator->trProtectedTypes()); })
854 } },
855 { "class/memberdecl/protectedslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProSlots(),
856 []() { return compileOptions(theTranslator->trProtectedSlots()); })
857 } },
858 { "class/memberdecl/protectedmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProMethods(),
859 []() { return compileOptions(theTranslator->trProtectedMembers()); })
860 } },
861 { "class/memberdecl/protectedstaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProStaticMethods(),
862 []() { return compileOptions(theTranslator->trStaticProtectedMembers()); })
863 } },
864 { "class/memberdecl/protectedattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProAttribs(),
865 []() { return compileOptions(theTranslator->trProtectedAttribs()); })
866 } },
867 { "class/memberdecl/protectedstaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProStaticAttribs(),
868 []() { return compileOptions(theTranslator->trStaticProtectedAttribs()); })
869 } },
870 { "class/memberdecl/packagetypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacTypes(),
871 []() { return compileOptions(theTranslator->trPackageTypes()); })
872 } },
873 { "class/memberdecl/packagemethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacMethods(),
874 []() { return compileOptions(theTranslator->trPackageFunctions()); })
875 } },
876 { "class/memberdecl/packagestaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacStaticMethods(),
877 []() { return compileOptions(theTranslator->trStaticPackageFunctions()); })
878 } },
879 { "class/memberdecl/packageattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacAttribs(),
880 []() { return compileOptions(theTranslator->trPackageAttribs()); })
881 } },
882 { "class/memberdecl/packagestaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacStaticAttribs(),
883 []() { return compileOptions(theTranslator->trStaticPackageAttribs()); })
884 } },
885 { "class/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(),
886 []() { return compileOptions(theTranslator->trProperties()); })
887 } },
888 { "class/memberdecl/events", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Events(),
889 []() { return compileOptions(theTranslator->trEvents()); })
890 } },
891 { "class/memberdecl/privatetypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriTypes(),
892 []() { return compileOptions(theTranslator->trPrivateTypes()); })
893 } },
894 { "class/memberdecl/privateslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriSlots(),
895 []() { return compileOptions(theTranslator->trPrivateSlots()); })
896 } },
897 { "class/memberdecl/privatemethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriMethods(),
898 []() { return compileOptions(theTranslator->trPrivateMembers()); })
899 } },
900 { "class/memberdecl/privatestaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriStaticMethods(),
901 []() { return compileOptions(theTranslator->trStaticPrivateMembers()); })
902 } },
903 { "class/memberdecl/privateattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriAttribs(),
904 []() { return compileOptions(theTranslator->trPrivateAttribs()); })
905 } },
906 { "class/memberdecl/privatestaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriStaticAttribs(),
907 []() { return compileOptions(theTranslator->trStaticPrivateAttribs()); })
908 } },
909 { "class/memberdecl/friends", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Friends(),
910 []() { return compileOptions(theTranslator->trFriends()); })
911 } },
912 { "class/memberdecl/related", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Related(),
913 []() { return compileOptions(theTranslator->trRelatedSymbols()); },
914 []() { return compileOptions(theTranslator->trRelatedSymbolsSubscript()); })
915 } },
917 { "class/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ClassInlineClasses,
918 []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(),
919 SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); })
920 } },
921 { "class/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::TypedefMembers(),
922 []() { return compileOptions(theTranslator->trMemberTypedefDocumentation()); })
923 } },
924 { "class/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::EnumMembers(),
925 []() { return compileOptions(theTranslator->trMemberEnumerationDocumentation()); })
926 } },
927 { "class/memberdef/services", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::ServiceMembers(),
928 []() { return compileOptions(theTranslator->trInterfaces()); })
929 } },
930 { "class/memberdef/interfaces", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::InterfaceMembers(),
931 []() { return compileOptions(theTranslator->trInterfaces()); })
932 } },
933 { "class/memberdef/constructors", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::Constructors(),
934 []() { return compileOptions(theTranslator->trConstructorDocumentation()); })
935 } },
936 { "class/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::FunctionMembers(),
937 []() { return compileOptions(/* default */ theTranslator->trMemberFunctionDocumentation(), SrcLangExt::ObjC, theTranslator->trMethodDocumentation(),
938 SrcLangExt::Fortran,theTranslator->trMemberFunctionDocumentationFortran(),
939 SrcLangExt::Slice, theTranslator->trOperationDocumentation()); })
940 } },
941 { "class/memberdef/related", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::RelatedMembers(),
942 []() { return compileOptions(theTranslator->trRelatedSymbolDocumentation()); })
943 } },
944 { "class/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::VariableMembers(),
945 []() { return compileOptions(/* default */ theTranslator->trMemberDataDocumentation(),
946 SrcLangExt::Slice, theTranslator->trDataMemberDocumentation()); })
947 } },
948 { "class/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(),
949 []() { return compileOptions(theTranslator->trPropertyDocumentation()); })
950 } },
951 { "class/memberdef/events", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::EventMembers(),
952 []() { return compileOptions(theTranslator->trEventDocumentation()); })
953 } },
954
955 // concept layout handlers
956 { "concept", { startCb(&LayoutParser::startTop,LayoutDocManager::Concept,"concept/",LayoutNavEntry::Concepts),
958 } },
959 { "concept/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
960 { "concept/definition", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ConceptDefinition,
961 []() { return compileOptions(theTranslator->trConceptDefinition()); }),
962 } },
963 { "concept/includes", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::ClassIncludes) } },
964 { "concept/sourcelink", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink) } },
965 { "concept/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
966 []() { return compileOptions(theTranslator->trDetailedDescription()); })
967 } },
968 { "concept/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
969 // namespace layout handlers
970 { "namespace", { startCb(&LayoutParser::startTop,LayoutDocManager::Namespace,"namespace/",LayoutNavEntry::Namespaces),
972 } },
973 { "namespace/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
974 { "namespace/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
975 []() { return compileOptions(theTranslator->trDetailedDescription()); })
976 } },
977 { "namespace/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
978 { "namespace/memberdecl", { startCb(&LayoutParser::startMemberDecl),
980 } },
981 { "namespace/memberdecl/nestednamespaces", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceNestedNamespaces,
982 []() { return compileOptions(/* default */ theTranslator->trNamespaces(),
983 SrcLangExt::Java, theTranslator->trPackages(),
984 SrcLangExt::VHDL, theTranslator->trPackages(),
985 SrcLangExt::IDL, theTranslator->trModules(),
986 SrcLangExt::Fortran,theTranslator->trModules(),
987 SrcLangExt::Slice,(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
988 theTranslator->trModules() :
989 theTranslator->trNamespaces())); })
990 } },
991 { "namespace/memberdecl/constantgroups", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceNestedConstantGroups,
992 []() { return compileOptions(theTranslator->trConstantGroups()); })
993 } },
994 { "namespace/memberdecl/interfaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceInterfaces,
995 []() { return compileOptions(theTranslator->trSliceInterfaces()); })
996 } },
997 { "namespace/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceClasses,
998 []() { return compileOptions(/* default */ theTranslator->trCompounds(),
999 SrcLangExt::VHDL, theTranslator->trVhdlType(VhdlSpecifier::ENTITY,FALSE),
1000 SrcLangExt::Fortran,theTranslator->trDataTypes()); })
1001 } },
1002 { "namespace/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceConcepts,
1003 []() { return compileOptions(theTranslator->trConcept(true,false)); })
1004 } },
1005 { "namespace/memberdecl/structs", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceStructs,
1006 []() { return compileOptions(theTranslator->trStructs()); })
1007 } },
1008 { "namespace/memberdecl/exceptions", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceExceptions,
1009 []() { return compileOptions(theTranslator->trExceptions()); })
1010 } },
1011 { "namespace/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::MemberGroups) } },
1012 { "namespace/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(),
1013 []() { return compileOptions(theTranslator->trTypedefs()); })
1014 } },
1015 { "namespace/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(),
1016 []() { return compileOptions(theTranslator->trSequences()); })
1017 } },
1018 { "namespace/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(),
1019 []() { return compileOptions(theTranslator->trDictionaries()); })
1020 } },
1021 { "namespace/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(),
1022 []() { return compileOptions(theTranslator->trEnumerations()); })
1023 } },
1024 { "namespace/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(),
1025 []() { return compileOptions(/* default */ theTranslator->trFunctions(),
1026 SrcLangExt::Fortran,theTranslator->trSubprograms(),
1027 SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); })
1028 } },
1029 { "namespace/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(),
1030 []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1031 theTranslator->trConstants() :
1032 theTranslator->trVariables()); })
1033 } },
1034 { "namespace/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(),
1035 []() { return compileOptions(theTranslator->trProperties()); })
1036 } },
1037 { "namespace/memberdef", { startCb(&LayoutParser::startMemberDef), endCb(&LayoutParser::endMemberDef) } },
1038 { "namespace/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceInlineClasses,
1039 []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(),
1040 SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); })
1041 } },
1042 { "namespace/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(),
1043 []() { return compileOptions(theTranslator->trTypedefDocumentation()); })
1044 } },
1045 { "namespace/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(),
1046 []() { return compileOptions(theTranslator->trSequenceDocumentation()); })
1047 } },
1048 { "namespace/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(),
1049 []() { return compileOptions(theTranslator->trDictionaryDocumentation()); })
1050 } },
1051 { "namespace/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(),
1052 []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); })
1053 } },
1054 { "namespace/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(),
1055 []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(),
1056 SrcLangExt::Fortran,theTranslator->trSubprogramDocumentation()); })
1057 } },
1058 { "namespace/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(),
1059 []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1060 theTranslator->trConstantDocumentation() :
1061 theTranslator->trVariableDocumentation()); })
1062 } },
1063 { "namespace/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(),
1064 []() { return compileOptions(theTranslator->trPropertyDocumentation()); })
1065 } },
1066
1067 // file layout handlers
1068 { "file", { startCb(&LayoutParser::startTop,LayoutDocManager::File,"file/",LayoutNavEntry::Files),
1070 } },
1071 { "file/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
1072 { "file/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
1073 []() { return compileOptions(theTranslator->trDetailedDescription()); })
1074 } },
1075 { "file/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
1076 { "file/includes", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludes) } },
1077 { "file/includegraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludeGraph) } },
1078 { "file/includedbygraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludedByGraph) } },
1079 { "file/sourcelink", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink) } },
1080 { "file/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } },
1082 { "file/memberdecl/interfaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileInterfaces,
1083 []() { return compileOptions(theTranslator->trSliceInterfaces()); })
1084 } },
1085 { "file/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileClasses,
1086 []() { return compileOptions(/* default */ theTranslator->trCompounds(),
1087 SrcLangExt::VHDL, theTranslator->trVhdlType(VhdlSpecifier::ENTITY,FALSE),
1088 SrcLangExt::Fortran,theTranslator->trDataTypes()); })
1089 } },
1090 { "file/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::FileConcepts,
1091 []() { return compileOptions(theTranslator->trConcept(true,false)); })
1092 } },
1093 { "file/memberdecl/structs", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileStructs,
1094 []() { return compileOptions(theTranslator->trStructs()); })
1095 } },
1096 { "file/memberdecl/exceptions", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileExceptions,
1097 []() { return compileOptions(theTranslator->trExceptions()); })
1098 } },
1099 { "file/memberdecl/namespaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileNamespaces,
1100 []() { return compileOptions(/* default */ theTranslator->trNamespaces(),
1101 SrcLangExt::Java, theTranslator->trPackages(),
1102 SrcLangExt::IDL, theTranslator->trModules(),
1103 SrcLangExt::Fortran,theTranslator->trModules(),
1104 SrcLangExt::Slice, theTranslator->trModules()); })
1105 } },
1106 { "file/memberdecl/constantgroups", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileConstantGroups,
1107 []() { return compileOptions(theTranslator->trConstantGroups()); })
1108 } },
1109 { "file/memberdecl/defines", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDefineMembers(),
1110 []() { return compileOptions(theTranslator->trDefines()); })
1111 } },
1112 { "file/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(),
1113 []() { return compileOptions(theTranslator->trTypedefs()); })
1114 } },
1115 { "file/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(),
1116 []() { return compileOptions(theTranslator->trSequences()); })
1117 } },
1118 { "file/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(),
1119 []() { return compileOptions(theTranslator->trDictionaries()); })
1120 } },
1121 { "file/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(),
1122 []() { return compileOptions(theTranslator->trEnumerations()); })
1123 } },
1124 { "file/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(),
1125 []() { return compileOptions(/* default */ theTranslator->trFunctions(),
1126 SrcLangExt::Fortran,theTranslator->trSubprograms(),
1127 SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); })
1128 } },
1129 { "file/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(),
1130 []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1131 theTranslator->trConstants() :
1132 theTranslator->trVariables()); })
1133 } },
1134 { "file/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(),
1135 []() { return compileOptions(theTranslator->trProperties()); })
1136 } },
1138
1139 { "file/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileInlineClasses,
1140 []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(),
1141 SrcLangExt::Fortran, theTranslator->trTypeDocumentation()); })
1142 } },
1143 { "file/memberdef/defines", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDefineMembers(),
1144 []() { return compileOptions(theTranslator->trDefineDocumentation()); })
1145 } },
1146 { "file/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(),
1147 []() { return compileOptions(theTranslator->trTypedefDocumentation()); })
1148 } },
1149 { "file/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(),
1150 []() { return compileOptions(theTranslator->trSequenceDocumentation()); })
1151 } },
1152 { "file/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(),
1153 []() { return compileOptions(theTranslator->trDictionaryDocumentation()); })
1154 } },
1155 { "file/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(),
1156 []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); })
1157 } },
1158 { "file/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(),
1159 []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(),
1160 SrcLangExt::Fortran, theTranslator->trSubprogramDocumentation()); })
1161 } },
1162 { "file/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(),
1163 []() { return compileOptions(theTranslator->trVariableDocumentation()); })
1164 } },
1165
1166 { "file/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(),
1167 []() { return compileOptions(theTranslator->trPropertyDocumentation()); })
1168 } },
1169 // group layout handlers
1170 { "group", { startCb(&LayoutParser::startTop,LayoutDocManager::Group,"group/",LayoutNavEntry::None),
1172 } },
1173 { "group/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
1174 { "group/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
1175 []() { return compileOptions(theTranslator->trDetailedDescription()); })
1176 } },
1177 { "group/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
1178 { "group/groupgraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::GroupGraph) } },
1180 { "group/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } },
1181 { "group/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupClasses,
1182 []() { return compileOptions(/* default */ theTranslator->trCompounds(),
1183 SrcLangExt::VHDL, theTranslator->trVhdlType(VhdlSpecifier::ENTITY,FALSE),
1184 SrcLangExt::Fortran, theTranslator->trDataTypes()); })
1185 } },
1186 { "group/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupConcepts,
1187 []() { return compileOptions(theTranslator->trConcept(true,false)); })
1188 } },
1189 { "group/memberdecl/modules", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupModules,
1190 []() { return compileOptions(theTranslator->trModule(true,false)); })
1191 } },
1192 { "group/memberdecl/namespaces", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNamespaces,
1193 []() { return compileOptions(/* default */ theTranslator->trNamespaces(),
1194 SrcLangExt::Java, theTranslator->trPackages(),
1195 SrcLangExt::Fortran, theTranslator->trModules()); })
1196 } },
1197 { "group/memberdecl/dirs", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupDirs,
1198 []() { return compileOptions(theTranslator->trDirectories()); })
1199 } },
1200 { "group/memberdecl/nestedgroups", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNestedGroups,
1201 []() { return compileOptions(theTranslator->trTopics()); })
1202 } },
1203 { "group/memberdecl/files", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupFiles,
1204 []() { return compileOptions(theTranslator->trFile(TRUE,FALSE)); })
1205 } },
1206 { "group/memberdecl/defines", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDefineMembers(),
1207 []() { return compileOptions(theTranslator->trDefines()); })
1208 } },
1209 { "group/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(),
1210 []() { return compileOptions(theTranslator->trTypedefs()); })
1211 } },
1212 { "group/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(),
1213 []() { return compileOptions(theTranslator->trSequences()); })
1214 } },
1215 { "group/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(),
1216 []() { return compileOptions(theTranslator->trDictionaries()); })
1217 } },
1218 { "group/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(),
1219 []() { return compileOptions(theTranslator->trEnumerations()); })
1220 } },
1221 { "group/memberdecl/enumvalues", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumValMembers(),
1222 []() { return compileOptions(theTranslator->trEnumerationValues()); })
1223 } },
1224 { "group/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(),
1225 []() { return compileOptions(/* default */ theTranslator->trFunctions(),
1226 SrcLangExt::Fortran,theTranslator->trSubprograms(),
1227 SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); })
1228 } },
1229 { "group/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(),
1230 []() { return compileOptions(theTranslator->trVariables()); })
1231 } },
1232 { "group/memberdecl/signals", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSignalMembers(),
1233 []() { return compileOptions(theTranslator->trSignals()); })
1234 } },
1235 { "group/memberdecl/publicslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPubSlotMembers(),
1236 []() { return compileOptions(theTranslator->trPublicSlots()); })
1237 } },
1238 { "group/memberdecl/protectedslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecProSlotMembers(),
1239 []() { return compileOptions(theTranslator->trProtectedSlots()); })
1240 } },
1241 { "group/memberdecl/privateslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPriSlotMembers(),
1242 []() { return compileOptions(theTranslator->trPrivateSlots()); })
1243 } },
1244 { "group/memberdecl/events", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEventMembers(),
1245 []() { return compileOptions(theTranslator->trEvents()); })
1246 } },
1247 { "group/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPropMembers(),
1248 []() { return compileOptions(theTranslator->trProperties()); })
1249 } },
1250 { "group/memberdecl/friends", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFriendMembers(),
1251 []() { return compileOptions(theTranslator->trFriends()); })
1252 } },
1254 { "group/memberdef/pagedocs", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::GroupPageDocs) } },
1255 { "group/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupInlineClasses,
1256 []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(),
1257 SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); })
1258 } },
1259 { "group/memberdef/defines", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDefineMembers(),
1260 []() { return compileOptions(theTranslator->trDefineDocumentation()); })
1261 } },
1262 { "group/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(),
1263 []() { return compileOptions(theTranslator->trTypedefDocumentation()); })
1264 } },
1265 { "group/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(),
1266 []() { return compileOptions(theTranslator->trSequenceDocumentation()); })
1267 } },
1268 { "group/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(),
1269 []() { return compileOptions(theTranslator->trDictionaryDocumentation()); })
1270 } },
1271 { "group/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(),
1272 []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); })
1273 } },
1274 { "group/memberdef/enumvalues", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumValMembers(),
1275 []() { return compileOptions(theTranslator->trEnumerationValueDocumentation()); })
1276 } },
1277 { "group/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(),
1278 []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(),
1279 SrcLangExt::Fortran,theTranslator->trSubprogramDocumentation()); })
1280 } },
1281 { "group/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(),
1282 []() { return compileOptions(theTranslator->trVariableDocumentation()); })
1283 } },
1284 { "group/memberdef/signals", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSignalMembers(),
1285 []() { return compileOptions(theTranslator->trSignals()); })
1286 } },
1287 { "group/memberdef/publicslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPubSlotMembers(),
1288 []() { return compileOptions(theTranslator->trPublicSlots()); })
1289 } },
1290 { "group/memberdef/protectedslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocProSlotMembers(),
1291 []() { return compileOptions(theTranslator->trProtectedSlots()); })
1292 } },
1293 { "group/memberdef/privateslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPriSlotMembers(),
1294 []() { return compileOptions(theTranslator->trPrivateSlots()); })
1295 } },
1296 { "group/memberdef/events", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEventMembers(),
1297 []() { return compileOptions(theTranslator->trEvents()); })
1298 } },
1299 { "group/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPropMembers(),
1300 []() { return compileOptions(theTranslator->trProperties()); })
1301 } },
1302 { "group/memberdef/friends", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFriendMembers(),
1303 []() { return compileOptions(theTranslator->trFriends()); })
1304 } },
1305
1306 // module layout handlers
1307 { "module", { startCb(&LayoutParser::startTop,LayoutDocManager::Module,"module/",LayoutNavEntry::Modules),
1309 } },
1310 { "module/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
1311 { "module/exportedmodules", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleExports,
1312 []() { return compileOptions(theTranslator->trExportedModules()); })
1313 } },
1314 { "module/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
1315 []() { return compileOptions(theTranslator->trDetailedDescription()); })
1316 } },
1317 { "module/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
1319 { "module/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleConcepts,
1320 []() { return compileOptions(theTranslator->trConcept(true,false)); })
1321 } },
1322 { "module/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleClasses,
1323 []() { return compileOptions(theTranslator->trCompounds()); })
1324 } },
1325 { "module/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(),
1326 []() { return compileOptions(theTranslator->trEnumerations()); })
1327 } },
1328 { "module/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(),
1329 []() { return compileOptions(theTranslator->trTypedefs()); })
1330 } },
1331 { "module/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(),
1332 []() { return compileOptions(theTranslator->trFunctions()); })
1333 } },
1334 { "module/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(),
1335 []() { return compileOptions(theTranslator->trVariables()); })
1336 } },
1337 { "module/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } },
1338 { "module/memberdecl/files", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleUsedFiles,
1339 []() { return compileOptions(theTranslator->trFile(TRUE,FALSE)); })
1340 } },
1341
1342 // directory layout handlers
1343 { "directory", { startCb(&LayoutParser::startTop,LayoutDocManager::Directory,"directory/",LayoutNavEntry::None),
1345 } },
1346 { "directory/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
1347 { "directory/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
1348 []() { return compileOptions(theTranslator->trDetailedDescription()); })
1349 } },
1350 { "directory/directorygraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirGraph) } },
1351 { "directory/memberdecl", { startCb(&LayoutParser::startMemberDecl), endCb(&LayoutParser::endMemberDecl) } },
1352 { "directory/memberdecl/dirs", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirSubDirs) } },
1353 { "directory/memberdecl/files", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirFiles) } },
1354};
1355// clang-format on
1356
1357} // namespace
1358
1359void LayoutParser::startElement( const std::string &name, const XMLHandlers::Attributes& attrib )
1360{
1361 //printf("startElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name));
1362 auto it = g_elementHandlers.find(m_scope.str()+name);
1363 if (it!=g_elementHandlers.end())
1364 {
1365 it->second.startCb(*this,it->first,attrib);
1366 }
1367 else
1368 {
1369 QCString fileName = m_locator->fileName();
1370 warn_layout(fileName,m_locator->lineNr(),"Unexpected start tag '{}' found in scope='{}'!",
1371 name,m_scope);
1372 }
1373}
1374
1375void LayoutParser::endElement( const std::string &name )
1376{
1377 //printf("endElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name));
1378 auto it=g_elementHandlers.end();
1379
1380 if (!m_scope.isEmpty() && m_scope.right(name.length()+1)==name+"/")
1381 { // element ends current scope
1382 it = g_elementHandlers.find(m_scope.left(m_scope.length()-1).str());
1383 }
1384 else // continue with current scope
1385 {
1386 it = g_elementHandlers.find(m_scope.str()+name);
1387 }
1388 if (it!=g_elementHandlers.end())
1389 {
1390 it->second.endCb(*this,it->first+" end"); // added end to id to make it unique
1391 }
1392}
1393
1394//---------------------------------------------------------------------------------
1395
1397
1398//---------------------------------------------------------------------------------
1399
1401{
1402 public:
1403 std::array<LayoutDocEntryList,LayoutDocManager::NrParts> docEntries;
1407};
1408
1410{
1411}
1412
1416
1418{
1420 XMLHandlers handlers;
1421 handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1422 handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1423 handlers.error = [&layoutParser](const std::string &fileName,int lineNr,const std::string &msg) { layoutParser.error(fileName,lineNr,msg); };
1424 XMLParser parser(handlers);
1425 layoutParser.setDocumentLocator(&parser);
1426 constexpr auto layoutFile = "layout_default.xml";
1427 QCString layout_default = ResourceMgr::instance().getAsString(layoutFile);
1428 parser.parse(layoutFile,layout_default.data(),Debug::isFlagSet(Debug::Lex_xml),
1429 [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",layoutFile); },
1430 [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",layoutFile); }
1431 );
1433 d->majorVersion = layoutParser.majorVersion();
1434 d->minorVersion = layoutParser.minorVersion();
1435}
1436
1438{
1439 static LayoutDocManager theInstance;
1440 return theInstance;
1441}
1442
1444{
1445 return d->docEntries[static_cast<int>(part)];
1446}
1447
1449{
1450 return &d->rootNav;
1451}
1452
1454 LayoutNavEntry::Kind k,bool vs,const QCString &bf,
1455 const QCString &tl,const QCString &intro)
1456{
1457 if (parent==nullptr) parent = &d->rootNav;
1458 auto ptr = std::make_unique<LayoutNavEntry>(parent,k,vs,bf,tl,intro);
1459 auto child = ptr.get();
1460 parent->appendChild(std::move(ptr));
1461 return child;
1462}
1463
1465{
1466 auto &docEntry = d->docEntries[static_cast<int>(p)];
1467 docEntry.push_back(std::move(e)); // add
1468}
1469
1470void LayoutDocManager::parse(const QCString &fileName, const char *data)
1471{
1472 //printf("============ LayoutDocManager::parse(%s)\n",qPrint(fileName));
1473 LayoutDocManager layoutDocManager;
1474 LayoutParser layoutParser(layoutDocManager);
1475 XMLHandlers handlers;
1476 handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1477 handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1478 handlers.error = [&layoutParser](const std::string &fn,int lineNr,const std::string &msg) { layoutParser.error(fn,lineNr,msg); };
1479 XMLParser parser(handlers);
1480 layoutParser.setDocumentLocator(&parser);
1481 parser.parse(fileName.data(),
1482 data ? data : fileToString(fileName).data(),
1484 [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",qPrint(fileName)); },
1485 [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",qPrint(fileName)); },
1487 );
1488
1489 // version in the user defined layout overrides default one
1490 d->majorVersion = layoutParser.majorVersion();
1491 d->minorVersion = layoutParser.minorVersion();
1492
1493 // merge missing parts of the default layout into the user defined layout
1494 // For now merging in defaults has been disabled for navigation entries
1495 // to avoid "extra entries" for projects that work with partial layout files.
1496 //mergeNavEntries(layoutDocManager);
1497
1498 // for compatibility reasons we only merge defaults when the user defined layout has at least version 2.0 or higher
1499 if (d->majorVersion>=2)
1500 {
1501 mergeDocEntries(fileName,layoutDocManager);
1502 }
1503
1504 layoutDocManager.removeInvisibleDocEntries();
1505
1506 // replace default layout with merged layout
1507 d->docEntries.swap(layoutDocManager.d->docEntries);
1508 d->rootNav.swap(layoutDocManager.d->rootNav);
1509}
1510
1512{
1513 // remove invisible entries
1514 for (auto &list : d->docEntries)
1515 {
1516 auto it = list.begin();
1517 while (it!=list.end())
1518 {
1519 if (*it==nullptr || !(*it)->visible())
1520 {
1521 it = list.erase(it);
1522 }
1523 else
1524 {
1525 ++it;
1526 }
1527 }
1528 }
1529}
1530
1532{
1533 return d->majorVersion;
1534}
1535
1537{
1538 return d->minorVersion;
1539}
1540
1541// search for candidate node in tree with root target. Returns the match target node if found, or nullptr otherwise.
1542static LayoutNavEntry *findNavEntryRec(LayoutNavEntry *root, const std::string &id)
1543{
1544 if (root)
1545 {
1546 if (root->id()==id) return root;
1547 for (auto &child : root->children())
1548 {
1549 LayoutNavEntry *childNavEntry = findNavEntryRec(child.get(),id);
1550 if (childNavEntry) return childNavEntry;
1551 }
1552 }
1553 return nullptr;
1554}
1555
1556// merge the missing nodes
1557static void mergeNavTreeNodesRec(LayoutNavEntry *targetTree,LayoutNavEntry *sourceTree)
1558{
1559 using IdSet = std::unordered_set<std::string>;
1560 using IdMap = std::unordered_map<std::string,size_t>;
1561
1562 auto prepareSet = [](const LayoutNavEntry *tree, IdSet &set) {
1563 for (const auto &e : tree->children())
1564 {
1565 set.insert(e->id());
1566 }
1567 };
1568
1569 auto prepareMap = [](const LayoutNavEntry *tree, const IdSet &set, IdMap &map) {
1570 for (size_t i=0; i<tree->children().size(); i++)
1571 {
1572 std::string id = tree->children()[i]->id();
1573 auto it = set.find(id);
1574 if (it != set.end())
1575 {
1576 map[id]=i;
1577 }
1578 }
1579 };
1580
1581 IdSet sourceSet, targetSet;
1582 prepareSet(sourceTree,sourceSet);
1583 prepareSet(targetTree,targetSet);
1584
1585 IdMap sourceMap, targetMap;
1586 prepareMap(targetTree,sourceSet,targetMap);
1587 prepareMap(sourceTree,targetSet,sourceMap);
1588
1589 // calculate list of insertion positions in the target list for each id in the source list
1590 std::vector<size_t> insertionList;
1591 for (size_t i=0; i<sourceTree->children().size(); i++)
1592 {
1593 std::string id = sourceTree->children()[i]->id();
1594 // If an id in the source list appears before a set of shared ids we want it also to
1595 // appear before these id in the target list. To do this find the lowest target index of all shared
1596 // ids that come after position i in the source list
1597 size_t minIdx = targetTree->children().size();
1598 for (const auto &kv : sourceMap) // iterator over shared ids
1599 {
1600 if (i < kv.second) // i appears before this shared id
1601 {
1602 size_t idx = targetMap[kv.first]; // get the corresponding index in the target list
1603 if (idx<minIdx) // update minimum
1604 {
1605 minIdx=idx;
1606 }
1607 }
1608 }
1609 insertionList.push_back(minIdx);
1610 }
1611
1612 // Insert the missing elements of the source list into the target list.
1613 // Work backwards so the calculated insertion points don't change due to insertions.
1614 size_t idx = sourceTree->children().size()-1;
1615 for (auto it=insertionList.rbegin(); it!=insertionList.rend(); ++it, idx--)
1616 {
1617 std::string id = sourceTree->children()[idx]->id();
1618 if (targetSet.find(id)==targetSet.end()) // need to add id
1619 {
1620 // for efficiency we move the elements from the source list to the target list, thus modifying the source list!
1621 targetTree->insertChild(*it, std::move(sourceTree->children()[idx]));
1622 }
1623 }
1624
1625 for (auto &targetChild : targetTree->children())
1626 {
1627 auto *node = findNavEntryRec(sourceTree,targetChild->id());
1628 if (node)
1629 {
1630 mergeNavTreeNodesRec(targetChild.get(),node);
1631 }
1632 }
1633}
1634
1639
1640static void mergeDocEntryLists(const QCString &fileName,LayoutDocEntryList &targetList,LayoutDocEntryList &sourceList)
1641{
1642 using IdSet = std::unordered_set<std::string>;
1643 using IdMap = std::unordered_map<std::string,size_t>;
1644
1645 auto prepareSet = [](const LayoutDocEntryList &list, IdSet &set) {
1646 //size_t idx=0;
1647 for (const auto &e : list)
1648 {
1649 //printf("idx=%zu set(%s)\n",idx,qPrint(e->id()));
1650 set.insert(e->id());
1651 //idx++;
1652 }
1653 };
1654
1655 auto prepareMap = [](const LayoutDocEntryList &list, const IdSet &set, IdMap &map) {
1656 for (size_t i=0; i<list.size(); i++)
1657 {
1658 std::string id = list[i]->id();
1659 auto it = set.find(id);
1660 if (it != set.end())
1661 {
1662 //printf("map %s->%zu\n",qPrint(id),i);
1663 map[id]=i;
1664 }
1665 }
1666 };
1667
1668 IdSet sourceSet, targetSet;
1669 //printf("---- sourceSet\n");
1670 prepareSet(sourceList,sourceSet);
1671 //printf("---- targetSet\n");
1672 prepareSet(targetList,targetSet);
1673
1674 IdMap sourceMap, targetMap;
1675 //printf("---- targetMap\n");
1676 prepareMap(targetList,sourceSet,targetMap);
1677 //printf("---- sourceMap\n");
1678 prepareMap(sourceList,targetSet,sourceMap);
1679
1680 // calculate list of insertion positions in the target list for each id in the source list
1681 std::vector<size_t> insertionList;
1682 for (size_t i=0; i<sourceList.size(); i++)
1683 {
1684 std::string id = sourceList[i]->id();
1685 // If an id in the source list appears before a set of shared ids we want it also to
1686 // appear before these id in the target list. To do this find the lowest target index of all shared
1687 // ids that come after position i in the source list
1688 size_t minIdx = targetList.size();
1689 for (const auto &kv : sourceMap) // iterator over shared ids
1690 {
1691 if (i < kv.second) // i appears before this shared id
1692 {
1693 size_t idx = targetMap[kv.first]; // get the corresponding index in the target list
1694 //printf(" evaluating %s->%zu min=%zu\n",qPrint(kv.first),idx,minIdx);
1695 if (idx<minIdx) // update minimum
1696 {
1697 minIdx=idx;
1698 }
1699 }
1700 }
1701 //printf("insertion %s->%zu\n",qPrint(id),minIdx);
1702 insertionList.push_back(minIdx);
1703 }
1704
1705 // Insert the missing elements of the source list into the target list.
1706 // Work backwards so the calculated insertion points don't change due to insertions.
1707 size_t idx = sourceList.size()-1;
1708 for (auto it=insertionList.rbegin(); it!=insertionList.rend(); ++it, idx--)
1709 {
1710 std::string id = sourceList[idx]->id();
1711 //printf("idx=%zu entry %s\n",idx,qPrint(id));
1712 if (targetSet.find(id)==targetSet.end()) // need to add id
1713 {
1714 // for efficiency we move the elements from the source list to the target list, thus modifying the source list!
1715 //printf("--> insert at %zu before %s\n",*it,qPrint(*it<targetList.size()?targetList[*it]->id():"none"));
1716 warn_layout(fileName,1,"User defined layout misses entry '{}'. Using default value.",id);
1717 targetList.insert(targetList.begin()+*it, std::move(sourceList[idx]));
1718 }
1719 }
1720
1721}
1722
1724{
1725 for (size_t i=0; i<d->docEntries.size(); i++)
1726 {
1727 //printf("========= part %zu\n",i);
1728 mergeDocEntryLists(fileName,other.d->docEntries[i],d->docEntries[i]);
1729 }
1730}
1731
1732//---------------------------------------------------------------------------------
1733
1735{
1736 std::ofstream f;
1737 if (openOutputFile(fileName,f))
1738 {
1739 TextStream t(&f);
1740 QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml");
1741 t << substitute(layout_default,"$doxygenversion",getDoxygenVersion());
1742 }
1743 else
1744 {
1745 err("Failed to open file {} for writing!\n",fileName);
1746 return;
1747 }
1748 f.close();
1749}
1750
1751//----------------------------------------------------------------------------------
1752
1753// Convert input to a title.
1754// The format of input can be a simple title "A title" or in case there are different
1755// titles for some programming languages they can take the following form:
1756// "A title|16=Another title|8=Yet Another title"
1757// where the number is a value of SrcLangExt in decimal notation (i.e. 16=Java, 8=IDL).
1759{
1760 int s=0,e=input.find('|');
1761 if (e==-1) return input; // simple title case
1762 int e1=e;
1763 while (e!=-1) // look for 'number=title' pattern separated by '|'
1764 {
1765 s=e+1;
1766 e=input.find('|',s);
1767 int i=input.find('=',s);
1768 assert(i>s);
1769 SrcLangExt key= static_cast<SrcLangExt>(input.mid(s,i-s).toUInt());
1770 if (key==lang) // found matching key
1771 {
1772 if (e==-1) e=static_cast<int>(input.length());
1773 return input.mid(i+1,e-i-1);
1774 }
1775 }
1776 return input.left(e1); // fallback, no explicit language key found
1777}
1778
1779//----------------------------------------------------------------------------------
1780
1785
1786//----------------------------------------------------------------------------------
1787
1792
1797
1798//----------------------------------------------------------------------------------
1799
1804
1805//----------------------------------------------------------------------------------
1806
1807static void printNavLayout(LayoutNavEntry *root,int indent)
1808{
1810 {
1811 QCString indentStr;
1812 indentStr.fill(' ',indent);
1813 Debug::print(Debug::Layout,0,"{}kind={} visible={} title='{}'\n",
1814 indentStr, root->navToString(), root->visible(), root->title());
1815 for (const auto &e : root->children())
1816 {
1817 printNavLayout(e.get(),indent+2);
1818 }
1819 }
1820}
1821
1823{
1824 bool extraIndent = false;
1825
1826 auto &mgr = LayoutDocManager::instance();
1827 Debug::print(Debug::Layout,0,"Layout version {}.{}\n",mgr.majorVersion(),mgr.minorVersion());
1828
1829 Debug::print(Debug::Layout,0,"Part: Navigation index\n");
1830 for (const auto &e : mgr.rootNavEntry()->children())
1831 {
1832 printNavLayout(e.get(),2);
1833 }
1834
1835 for (int i = 0; i < LayoutDocManager::NrParts; i++)
1836 {
1838 for (const auto &lde : mgr.docEntries(static_cast<LayoutDocManager::LayoutPart>(i)))
1839 {
1840 if (const LayoutDocEntrySimple *ldes = dynamic_cast<const LayoutDocEntrySimple*>(lde.get()))
1841 {
1842 if (lde->kind() == LayoutDocEntry::MemberDeclEnd || lde->kind() == LayoutDocEntry::MemberDefEnd) extraIndent = false;
1843 Debug::print(Debug::Layout,0," {}kind: {}, visible={}\n",
1844 extraIndent? " " : "",lde->entryToString(), ldes->visible());
1845 if (lde->kind() == LayoutDocEntry::MemberDeclStart || lde->kind() == LayoutDocEntry::MemberDefStart) extraIndent = true;
1846 }
1847 else if (const LayoutDocEntryMemberDecl *lmdecl = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()))
1848 {
1849 Debug::print(Debug::Layout,0," {}complex kind: {}, visible={}, type: {}\n",
1850 extraIndent? " " : "",lde->entryToString(),lmdecl->visible(),lmdecl->type.to_string());
1851 }
1852 else if (const LayoutDocEntryMemberDef *lmdef = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get()))
1853 {
1854 Debug::print(Debug::Layout,0," {}complex kind: {}, visible={}, type: {}\n",
1855 extraIndent? " " : "",lde->entryToString(),lmdef->visible(),lmdef->type.to_string());
1856 }
1857 else
1858 {
1859 // should not happen
1860 Debug::print(Debug::Layout,0," {}not handled kind: {}\n",extraIndent? " " : "",lde->entryToString());
1861 }
1862 }
1863 }
1864}
1865
1866
1867
@ Layout
Definition debug.h:50
@ Lex_xml
Definition debug.h:70
static bool isFlagSet(const DebugMask mask)
Definition debug.cpp:132
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
Definition debug.h:76
static void print(Debug::DebugMask mask, const char *state, const char *lexName, const char *fileName)
Definition debug.cpp:156
Class representing the abstract syntax tree of a documentation block.
Definition docnode.h:1466
Node representing a reference to some item.
Definition docnode.h:778
QCString anchor() const
Definition docnode.h:785
QCString file() const
Definition docnode.h:782
QCString ref() const
Definition docnode.h:784
std::array< LayoutDocEntryList, LayoutDocManager::NrParts > docEntries
Definition layout.cpp:1403
LayoutNavEntry rootNav
Definition layout.cpp:1404
Singleton providing access to the (user configurable) layout of the documentation.
Definition layout.h:262
void mergeNavEntries(LayoutDocManager &manager)
Definition layout.cpp:1635
static std::string partToString(int k)
Definition layout.h:273
std::unique_ptr< Private > d
Definition layout.h:305
LayoutNavEntry * createChildNavEntry(LayoutNavEntry *root, LayoutNavEntry::Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro)
append a new node as a child to root.
Definition layout.cpp:1453
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1437
void mergeDocEntries(const QCString &fileName, LayoutDocManager &manager)
Definition layout.cpp:1723
int majorVersion() const
Definition layout.cpp:1531
void parse(const QCString &fileName, const char *data=nullptr)
Parses a user provided layout.
Definition layout.cpp:1470
int minorVersion() const
Definition layout.cpp:1536
friend class LayoutParser
Definition layout.h:306
void addEntry(LayoutPart p, LayoutDocEntryPtr &&e)
Definition layout.cpp:1464
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition layout.cpp:1448
void removeInvisibleDocEntries()
Definition layout.cpp:1511
const LayoutDocEntryList & docEntries(LayoutPart part) const
Returns the list of LayoutDocEntry's in representation order for a given page identified by part.
Definition layout.cpp:1443
QCString m_scope
Definition layout.cpp:707
void startMemberDefEntry(const std::string &id, const XMLHandlers::Attributes &attrib, MemberListType type, const QCString &title, const QCString &)
Definition layout.cpp:253
void endTop(const std::string &)
Definition layout.cpp:632
void endNavIndex(const std::string &)
Definition layout.cpp:286
void setDocumentLocator(const XMLLocator *locator)
Definition layout.cpp:200
static int m_userGroupCount
Definition layout.cpp:713
void startSimpleEntry(LayoutDocEntry::Kind k, const std::string &id, const XMLHandlers::Attributes &attrib)
Definition layout.cpp:211
void startNavIndex(const std::string &, const XMLHandlers::Attributes &)
Definition layout.cpp:280
void startSectionEntry(LayoutDocEntry::Kind k, const std::string &id, const XMLHandlers::Attributes &attrib, const QCString &title)
Definition layout.cpp:224
LayoutParser(LayoutDocManager &manager)
Definition layout.cpp:197
void error(const std::string &fileName, int lineNr, const std::string &msg)
Definition layout.cpp:204
void startTop(const std::string &, const XMLHandlers::Attributes &attrib, LayoutDocManager::LayoutPart part, const QCString &scope, LayoutNavEntry::Kind nav)
Definition layout.cpp:623
const XMLLocator * m_locator
Definition layout.cpp:714
int m_minorVersion
Definition layout.cpp:716
int majorVersion() const
Definition layout.cpp:703
void startMemberDecl(const std::string &id, const XMLHandlers::Attributes &attrib)
Definition layout.cpp:671
void endMemberDecl(const std::string &id)
Definition layout.cpp:681
void endMemberDef(const std::string &id)
Definition layout.cpp:648
int minorVersion() const
Definition layout.cpp:704
bool m_invalidEntry
Definition layout.cpp:711
void endNavEntry(const std::string &)
Definition layout.cpp:616
LayoutDocManager & m_layoutDocManager
Definition layout.cpp:708
void startNavEntry(const std::string &, const XMLHandlers::Attributes &attrib)
Definition layout.cpp:297
void startMemberDef(const std::string &id, const XMLHandlers::Attributes &attrib)
Definition layout.cpp:638
bool m_visible
Definition layout.cpp:712
void endElement(const std::string &name)
Definition layout.cpp:1375
LayoutNavEntry * m_rootNav
Definition layout.cpp:710
void startLayout(const std::string &, const XMLHandlers::Attributes &attrib)
Definition layout.cpp:266
void startElement(const std::string &name, const XMLHandlers::Attributes &attrib)
Definition layout.cpp:1359
LayoutDocManager::LayoutPart m_part
Definition layout.cpp:709
int m_majorVersion
Definition layout.cpp:715
void startMemberDeclEntry(const std::string &id, const XMLHandlers::Attributes &attrib, MemberListType type, const QCString &title, const QCString &subscript)
Definition layout.cpp:239
Wrapper class for the MemberListType type.
Definition types.h:346
This is an alternative implementation of QCString.
Definition qcstring.h:101
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
QCString lower() const
Definition qcstring.h:249
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:593
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:260
QCString fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:193
QCString & setNum(short n)
Definition qcstring.h:459
QCString & sprintf(const char *format,...)
Definition qcstring.cpp:29
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:172
QCString left(size_t len) const
Definition qcstring.h:229
static ResourceMgr & instance()
Returns the one and only instance of this class.
QCString getAsString(const QCString &name) const
Gets the resource data as a C string.
Text streaming class that buffers data.
Definition textstream.h:36
Event handlers that can installed by the client and called while parsing a XML document.
Definition xml.h:27
std::unordered_map< std::string, std::string > Attributes
Definition xml.h:29
std::function< EndElementType > endElement
handler invoked when a closing tag has been found
Definition xml.h:40
std::function< StartElementType > startElement
handler invoked when an opening tag has been found
Definition xml.h:39
static std::string value(const Attributes &attrib, const std::string &key)
Definition xml.h:44
std::function< ErrorType > error
handler invoked when the parser encounters an error
Definition xml.h:42
void parse(const char *fileName, const char *inputString, bool debugEnabled, std::function< void()> debugStart, std::function< void()> debugEnd, std::function< Transcode > transcoder=[](std::string &s, const char *){ return true;})
Definition xml.l:447
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:151
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Definition docnode.h:1330
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:55
IDocNodeASTPtr createRef(IDocParser &parserIntf, const QCString &target, const QCString &context, const QCString &srcFile, int srcLine)
static void version(const bool extended)
Translator * theTranslator
Definition language.cpp:71
static void mergeNavTreeNodesRec(LayoutNavEntry *targetTree, LayoutNavEntry *sourceTree)
Definition layout.cpp:1557
static bool elemIsVisible(const XMLHandlers::Attributes &attrib, bool defVal=TRUE)
Definition layout.cpp:79
static LayoutNavEntry * findNavEntryRec(LayoutNavEntry *root, const std::string &id)
Definition layout.cpp:1542
void writeDefaultLayoutFile(const QCString &fileName)
Definition layout.cpp:1734
QCString compileOptions(const QCString &def)
Definition layout.cpp:35
void printLayout()
Definition layout.cpp:1822
static void printNavLayout(LayoutNavEntry *root, int indent)
Definition layout.cpp:1807
QCString extractLanguageSpecificTitle(const QCString &input, SrcLangExt lang)
Definition layout.cpp:1758
static void mergeDocEntryLists(const QCString &fileName, LayoutDocEntryList &targetList, LayoutDocEntryList &sourceList)
Definition layout.cpp:1640
std::unique_ptr< LayoutDocEntry > LayoutDocEntryPtr
Definition layout.h:147
std::vector< LayoutDocEntryPtr > LayoutDocEntryList
Definition layout.h:148
#define msg(fmt,...)
Definition message.h:94
#define err(fmt,...)
Definition message.h:127
#define warn_layout(file, line, fmt,...)
Definition message.h:117
static auto startCb(void(LayoutParser::*fn)(Args...))
Definition layout.cpp:733
static const std::map< std::string, ElementCallbacks > g_elementHandlers
Definition layout.cpp:791
static auto endCb(void(LayoutParser::*fn)(Args...))
Definition layout.cpp:785
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:853
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:482
const char * qPrint(const char *s)
Definition qcstring.h:687
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
Kind
Definition layout.h:67
Represents of a member declaration list with configurable title and subtitle.
Definition layout.h:112
QCString title(SrcLangExt lang) const
Definition layout.cpp:1788
QCString subtitle(SrcLangExt lang) const
Definition layout.cpp:1793
QCString m_subscript
Definition layout.h:126
QCString m_title
Definition layout.h:125
Represents of a member definition list with configurable title.
Definition layout.h:132
QCString m_title
Definition layout.h:143
QCString title(SrcLangExt lang) const
Definition layout.cpp:1800
QCString title(SrcLangExt lang) const
Definition layout.cpp:1781
QCString m_title
Definition layout.h:107
Represents of a piece of a documentation page without configurable parts.
Definition layout.h:89
bool visible() const override
Definition layout.h:93
Base class for the layout of a navigation item at the top of the HTML pages.
Definition layout.h:156
QCString title() const
Definition layout.h:216
bool m_visible
Definition layout.h:248
LayoutNavEntryList m_children
Definition layout.h:252
QCString url() const
Definition layout.cpp:151
const LayoutNavEntryList & children() const
Definition layout.h:219
std::string id() const
Definition layout.h:215
void updateVisibility(LayoutNavEntry *parent)
Definition layout.cpp:116
void appendChild(std::unique_ptr< LayoutNavEntry > &&e)
Definition layout.cpp:121
void insertChild(size_t pos, std::unique_ptr< LayoutNavEntry > &&e)
Definition layout.cpp:127
LayoutNavEntry * parent() const
Definition layout.h:212
QCString baseFile() const
Definition layout.h:214
LayoutNavEntry * find(LayoutNavEntry::Kind k, const QCString &file=QCString()) const
Definition layout.cpp:133
Kind kind() const
Definition layout.h:213
bool visible() const
Definition layout.h:222
Kind
Definition layout.h:193
LayoutNavEntry(LayoutNavEntry *parent, Kind k, bool vs, const QCString &bf, const QCString &tl, const QCString &intro)
Definition layout.h:209
std::string navToString() const
Definition layout.h:198
std::function< void(LayoutParser &, const std::string &)> EndCallback
Definition layout.cpp:726
std::function< void(LayoutParser &, const std::string &, const XMLHandlers::Attributes &)> StartCallback
Definition layout.cpp:725
This file contains a number of basic enums and types.
SrcLangExt
Definition types.h:207
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition util.cpp:5692
bool transcodeCharacterStringToUTF8(std::string &input, const char *inputEncoding)
Definition util.cpp:1401
bool openOutputFile(const QCString &outFile, std::ofstream &f)
Definition util.cpp:6233
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1439
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:4850
A bunch of utility functions.