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.c_str(),lineNr,"{}",msg.c_str());
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 std::string fileName = m_locator->fileName();
560 if (type.isEmpty())
561 {
562 warn_layout(fileName.c_str(),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.c_str(),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
790static const std::map< std::string, ElementCallbacks > g_elementHandlers =
791{
792 // path/name
793 { "doxygenlayout", { startCb(&LayoutParser::startLayout) } },
795 { "navindex/tab", { startCb(&LayoutParser::startNavEntry),
797 } },
798
799 // class layout handlers
800 { "class", { startCb(&LayoutParser::startTop,LayoutDocManager::Class,"class/",LayoutNavEntry::Classes),
802 } },
803 { "class/briefdescription", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::BriefDesc) } },
804 { "class/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
805 [](){ return compileOptions(theTranslator->trDetailedDescription()); })
806 } },
807 { "class/authorsection", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::AuthorSection) } },
808 { "class/includes", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassIncludes) } },
809 { "class/inheritancegraph", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassInheritanceGraph) } },
810 { "class/collaborationgraph", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassCollaborationGraph) } },
811 { "class/allmemberslink", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassAllMembersLink) } },
812 { "class/usedfiles", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassUsedFiles) } },
814 { "class/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::MemberGroups) } },
815 { "class/memberdecl/nestedclasses", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::ClassNestedClasses,
816 []() { return compileOptions(/*default*/ theTranslator->trCompounds(),
818 SrcLangExt::Fortran,theTranslator->trDataTypes()); })
819 } },
820 { "class/memberdecl/services", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Services(),
821 []() { return compileOptions(theTranslator->trServices()); })
822 } },
823 { "class/memberdecl/interfaces", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Interfaces(),
824 []() { return compileOptions(theTranslator->trInterfaces()); })
825 } },
826 { "class/memberdecl/publictypes", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::PubTypes(),
827 []() { return compileOptions(theTranslator->trPublicTypes()); })
828 } },
829 { "class/memberdecl/publicslots", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::PubSlots(),
830 []() { return compileOptions(theTranslator->trPublicSlots()); })
831 } },
832 { "class/memberdecl/signals", { startCb(&LayoutParser::startMemberDeclEntry,MemberListType::Signals(),
833 []() { return compileOptions(theTranslator->trSignals()); })
834 } },
835 { "class/memberdecl/publicmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubMethods(),
836 []() { return compileOptions(/* default */ theTranslator->trPublicMembers(),
837 SrcLangExt::ObjC, theTranslator->trInstanceMethods(),
838 SrcLangExt::Slice,theTranslator->trOperations()); })
839 } },
840 { "class/memberdecl/publicstaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubStaticMethods(),
841 []() { return compileOptions(/* default */ theTranslator->trStaticPublicMembers(),
842 SrcLangExt::ObjC, theTranslator->trClassMethods()); })
843 } },
844 { "class/memberdecl/publicattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubAttribs(),
845 []() { return compileOptions(/* default */ theTranslator->trPublicAttribs(),
846 SrcLangExt::Slice,theTranslator->trDataMembers()); })
847 } },
848 { "class/memberdecl/publicstaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PubStaticAttribs(),
849 []() { return compileOptions(theTranslator->trStaticPublicAttribs()); })
850 } },
851 { "class/memberdecl/protectedtypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProTypes(),
852 []() { return compileOptions(theTranslator->trProtectedTypes()); })
853 } },
854 { "class/memberdecl/protectedslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProSlots(),
855 []() { return compileOptions(theTranslator->trProtectedSlots()); })
856 } },
857 { "class/memberdecl/protectedmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProMethods(),
858 []() { return compileOptions(theTranslator->trProtectedMembers()); })
859 } },
860 { "class/memberdecl/protectedstaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProStaticMethods(),
861 []() { return compileOptions(theTranslator->trStaticProtectedMembers()); })
862 } },
863 { "class/memberdecl/protectedattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProAttribs(),
864 []() { return compileOptions(theTranslator->trProtectedAttribs()); })
865 } },
866 { "class/memberdecl/protectedstaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::ProStaticAttribs(),
867 []() { return compileOptions(theTranslator->trStaticProtectedAttribs()); })
868 } },
869 { "class/memberdecl/packagetypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacTypes(),
870 []() { return compileOptions(theTranslator->trPackageTypes()); })
871 } },
872 { "class/memberdecl/packagemethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacMethods(),
873 []() { return compileOptions(theTranslator->trPackageFunctions()); })
874 } },
875 { "class/memberdecl/packagestaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacStaticMethods(),
876 []() { return compileOptions(theTranslator->trStaticPackageFunctions()); })
877 } },
878 { "class/memberdecl/packageattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacAttribs(),
879 []() { return compileOptions(theTranslator->trPackageAttribs()); })
880 } },
881 { "class/memberdecl/packagestaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PacStaticAttribs(),
882 []() { return compileOptions(theTranslator->trStaticPackageAttribs()); })
883 } },
884 { "class/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(),
885 []() { return compileOptions(theTranslator->trProperties()); })
886 } },
887 { "class/memberdecl/events", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Events(),
888 []() { return compileOptions(theTranslator->trEvents()); })
889 } },
890 { "class/memberdecl/privatetypes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriTypes(),
891 []() { return compileOptions(theTranslator->trPrivateTypes()); })
892 } },
893 { "class/memberdecl/privateslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriSlots(),
894 []() { return compileOptions(theTranslator->trPrivateSlots()); })
895 } },
896 { "class/memberdecl/privatemethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriMethods(),
897 []() { return compileOptions(theTranslator->trPrivateMembers()); })
898 } },
899 { "class/memberdecl/privatestaticmethods", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriStaticMethods(),
900 []() { return compileOptions(theTranslator->trStaticPrivateMembers()); })
901 } },
902 { "class/memberdecl/privateattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriAttribs(),
903 []() { return compileOptions(theTranslator->trPrivateAttribs()); })
904 } },
905 { "class/memberdecl/privatestaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::PriStaticAttribs(),
906 []() { return compileOptions(theTranslator->trStaticPrivateAttribs()); })
907 } },
908 { "class/memberdecl/friends", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Friends(),
909 []() { return compileOptions(theTranslator->trFriends()); })
910 } },
911 { "class/memberdecl/related", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Related(),
912 []() { return compileOptions(theTranslator->trRelatedSymbols()); },
913 []() { return compileOptions(theTranslator->trRelatedSymbolsSubscript()); })
914 } },
916 { "class/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ClassInlineClasses,
917 []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(),
918 SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); })
919 } },
920 { "class/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::TypedefMembers(),
921 []() { return compileOptions(theTranslator->trMemberTypedefDocumentation()); })
922 } },
923 { "class/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::EnumMembers(),
924 []() { return compileOptions(theTranslator->trMemberEnumerationDocumentation()); })
925 } },
926 { "class/memberdef/services", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::ServiceMembers(),
927 []() { return compileOptions(theTranslator->trInterfaces()); })
928 } },
929 { "class/memberdef/interfaces", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::InterfaceMembers(),
930 []() { return compileOptions(theTranslator->trInterfaces()); })
931 } },
932 { "class/memberdef/constructors", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::Constructors(),
933 []() { return compileOptions(theTranslator->trConstructorDocumentation()); })
934 } },
935 { "class/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::FunctionMembers(),
936 []() { return compileOptions(/* default */ theTranslator->trMemberFunctionDocumentation(), SrcLangExt::ObjC, theTranslator->trMethodDocumentation(),
937 SrcLangExt::Fortran,theTranslator->trMemberFunctionDocumentationFortran(),
938 SrcLangExt::Slice, theTranslator->trOperationDocumentation()); })
939 } },
940 { "class/memberdef/related", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::RelatedMembers(),
941 []() { return compileOptions(theTranslator->trRelatedSymbolDocumentation()); })
942 } },
943 { "class/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::VariableMembers(),
944 []() { return compileOptions(/* default */ theTranslator->trMemberDataDocumentation(),
945 SrcLangExt::Slice, theTranslator->trDataMemberDocumentation()); })
946 } },
947 { "class/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(),
948 []() { return compileOptions(theTranslator->trPropertyDocumentation()); })
949 } },
950 { "class/memberdef/events", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::EventMembers(),
951 []() { return compileOptions(theTranslator->trEventDocumentation()); })
952 } },
953
954 // concept layout handlers
955 { "concept", { startCb(&LayoutParser::startTop,LayoutDocManager::Concept,"concept/",LayoutNavEntry::Concepts),
957 } },
958 { "concept/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
959 { "concept/definition", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ConceptDefinition,
960 []() { return compileOptions(theTranslator->trConceptDefinition()); }),
961 } },
962 { "concept/includes", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::ClassIncludes) } },
963 { "concept/sourcelink", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink) } },
964 { "concept/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
965 []() { return compileOptions(theTranslator->trDetailedDescription()); })
966 } },
967 { "concept/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
968 // namespace layout handlers
969 { "namespace", { startCb(&LayoutParser::startTop,LayoutDocManager::Namespace,"namespace/",LayoutNavEntry::Namespaces),
971 } },
972 { "namespace/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
973 { "namespace/detaileddescription", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
974 []() { return compileOptions(theTranslator->trDetailedDescription()); })
975 } },
976 { "namespace/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
977 { "namespace/memberdecl", { startCb(&LayoutParser::startMemberDecl),
979 } },
980 { "namespace/memberdecl/nestednamespaces", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceNestedNamespaces,
981 []() { return compileOptions(/* default */ theTranslator->trNamespaces(),
982 SrcLangExt::Java, theTranslator->trPackages(),
983 SrcLangExt::VHDL, theTranslator->trPackages(),
984 SrcLangExt::IDL, theTranslator->trModules(),
986 SrcLangExt::Slice,(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
987 theTranslator->trModules() :
988 theTranslator->trNamespaces())); })
989 } },
990 { "namespace/memberdecl/constantgroups", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceNestedConstantGroups,
991 []() { return compileOptions(theTranslator->trConstantGroups()); })
992 } },
993 { "namespace/memberdecl/interfaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceInterfaces,
994 []() { return compileOptions(theTranslator->trSliceInterfaces()); })
995 } },
996 { "namespace/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceClasses,
997 []() { return compileOptions(/* default */ theTranslator->trCompounds(),
999 SrcLangExt::Fortran,theTranslator->trDataTypes()); })
1000 } },
1001 { "namespace/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceConcepts,
1002 []() { return compileOptions(theTranslator->trConcept(true,false)); })
1003 } },
1004 { "namespace/memberdecl/structs", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceStructs,
1005 []() { return compileOptions(theTranslator->trStructs()); })
1006 } },
1007 { "namespace/memberdecl/exceptions", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceExceptions,
1008 []() { return compileOptions(theTranslator->trExceptions()); })
1009 } },
1010 { "namespace/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::MemberGroups) } },
1011 { "namespace/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(),
1012 []() { return compileOptions(theTranslator->trTypedefs()); })
1013 } },
1014 { "namespace/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(),
1015 []() { return compileOptions(theTranslator->trSequences()); })
1016 } },
1017 { "namespace/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(),
1018 []() { return compileOptions(theTranslator->trDictionaries()); })
1019 } },
1020 { "namespace/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(),
1021 []() { return compileOptions(theTranslator->trEnumerations()); })
1022 } },
1023 { "namespace/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(),
1024 []() { return compileOptions(/* default */ theTranslator->trFunctions(),
1025 SrcLangExt::Fortran,theTranslator->trSubprograms(),
1026 SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); })
1027 } },
1028 { "namespace/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(),
1029 []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1030 theTranslator->trConstants() :
1031 theTranslator->trVariables()); })
1032 } },
1033 { "namespace/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(),
1034 []() { return compileOptions(theTranslator->trProperties()); })
1035 } },
1036 { "namespace/memberdef", { startCb(&LayoutParser::startMemberDef), endCb(&LayoutParser::endMemberDef) } },
1037 { "namespace/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceInlineClasses,
1038 []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(),
1039 SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); })
1040 } },
1041 { "namespace/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(),
1042 []() { return compileOptions(theTranslator->trTypedefDocumentation()); })
1043 } },
1044 { "namespace/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(),
1045 []() { return compileOptions(theTranslator->trSequenceDocumentation()); })
1046 } },
1047 { "namespace/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(),
1048 []() { return compileOptions(theTranslator->trDictionaryDocumentation()); })
1049 } },
1050 { "namespace/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(),
1051 []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); })
1052 } },
1053 { "namespace/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(),
1054 []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(),
1055 SrcLangExt::Fortran,theTranslator->trSubprogramDocumentation()); })
1056 } },
1057 { "namespace/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(),
1058 []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1059 theTranslator->trConstantDocumentation() :
1060 theTranslator->trVariableDocumentation()); })
1061 } },
1062 { "namespace/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(),
1063 []() { return compileOptions(theTranslator->trPropertyDocumentation()); })
1064 } },
1065
1066 // file layout handlers
1067 { "file", { startCb(&LayoutParser::startTop,LayoutDocManager::File,"file/",LayoutNavEntry::Files),
1069 } },
1070 { "file/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
1071 { "file/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
1072 []() { return compileOptions(theTranslator->trDetailedDescription()); })
1073 } },
1074 { "file/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
1075 { "file/includes", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludes) } },
1076 { "file/includegraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludeGraph) } },
1077 { "file/includedbygraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludedByGraph) } },
1078 { "file/sourcelink", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink) } },
1079 { "file/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } },
1081 { "file/memberdecl/interfaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileInterfaces,
1082 []() { return compileOptions(theTranslator->trSliceInterfaces()); })
1083 } },
1084 { "file/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileClasses,
1085 []() { return compileOptions(/* default */ theTranslator->trCompounds(),
1087 SrcLangExt::Fortran,theTranslator->trDataTypes()); })
1088 } },
1089 { "file/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::FileConcepts,
1090 []() { return compileOptions(theTranslator->trConcept(true,false)); })
1091 } },
1092 { "file/memberdecl/structs", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileStructs,
1093 []() { return compileOptions(theTranslator->trStructs()); })
1094 } },
1095 { "file/memberdecl/exceptions", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileExceptions,
1096 []() { return compileOptions(theTranslator->trExceptions()); })
1097 } },
1098 { "file/memberdecl/namespaces", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileNamespaces,
1099 []() { return compileOptions(/* default */ theTranslator->trNamespaces(),
1100 SrcLangExt::Java, theTranslator->trPackages(),
1101 SrcLangExt::IDL, theTranslator->trModules(),
1103 SrcLangExt::Slice, theTranslator->trModules()); })
1104 } },
1105 { "file/memberdecl/constantgroups", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileConstantGroups,
1106 []() { return compileOptions(theTranslator->trConstantGroups()); })
1107 } },
1108 { "file/memberdecl/defines", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDefineMembers(),
1109 []() { return compileOptions(theTranslator->trDefines()); })
1110 } },
1111 { "file/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(),
1112 []() { return compileOptions(theTranslator->trTypedefs()); })
1113 } },
1114 { "file/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(),
1115 []() { return compileOptions(theTranslator->trSequences()); })
1116 } },
1117 { "file/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(),
1118 []() { return compileOptions(theTranslator->trDictionaries()); })
1119 } },
1120 { "file/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(),
1121 []() { return compileOptions(theTranslator->trEnumerations()); })
1122 } },
1123 { "file/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(),
1124 []() { return compileOptions(/* default */ theTranslator->trFunctions(),
1125 SrcLangExt::Fortran,theTranslator->trSubprograms(),
1126 SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); })
1127 } },
1128 { "file/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(),
1129 []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1130 theTranslator->trConstants() :
1131 theTranslator->trVariables()); })
1132 } },
1133 { "file/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::Properties(),
1134 []() { return compileOptions(theTranslator->trProperties()); })
1135 } },
1137
1138 { "file/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileInlineClasses,
1139 []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(),
1140 SrcLangExt::Fortran, theTranslator->trTypeDocumentation()); })
1141 } },
1142 { "file/memberdef/defines", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDefineMembers(),
1143 []() { return compileOptions(theTranslator->trDefineDocumentation()); })
1144 } },
1145 { "file/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(),
1146 []() { return compileOptions(theTranslator->trTypedefDocumentation()); })
1147 } },
1148 { "file/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(),
1149 []() { return compileOptions(theTranslator->trSequenceDocumentation()); })
1150 } },
1151 { "file/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(),
1152 []() { return compileOptions(theTranslator->trDictionaryDocumentation()); })
1153 } },
1154 { "file/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(),
1155 []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); })
1156 } },
1157 { "file/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(),
1158 []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(),
1159 SrcLangExt::Fortran, theTranslator->trSubprogramDocumentation()); })
1160 } },
1161 { "file/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(),
1162 []() { return compileOptions(theTranslator->trVariableDocumentation()); })
1163 } },
1164
1165 { "file/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::PropertyMembers(),
1166 []() { return compileOptions(theTranslator->trPropertyDocumentation()); })
1167 } },
1168 // group layout handlers
1169 { "group", { startCb(&LayoutParser::startTop,LayoutDocManager::Group,"group/",LayoutNavEntry::None),
1171 } },
1172 { "group/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
1173 { "group/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
1174 []() { return compileOptions(theTranslator->trDetailedDescription()); })
1175 } },
1176 { "group/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
1177 { "group/groupgraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::GroupGraph) } },
1179 { "group/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } },
1180 { "group/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupClasses,
1181 []() { return compileOptions(/* default */ theTranslator->trCompounds(),
1183 SrcLangExt::Fortran, theTranslator->trDataTypes()); })
1184 } },
1185 { "group/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupConcepts,
1186 []() { return compileOptions(theTranslator->trConcept(true,false)); })
1187 } },
1188 { "group/memberdecl/modules", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupModules,
1189 []() { return compileOptions(theTranslator->trModule(true,false)); })
1190 } },
1191 { "group/memberdecl/namespaces", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNamespaces,
1192 []() { return compileOptions(/* default */ theTranslator->trNamespaces(),
1193 SrcLangExt::Java, theTranslator->trPackages(),
1194 SrcLangExt::Fortran, theTranslator->trModules()); })
1195 } },
1196 { "group/memberdecl/dirs", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupDirs,
1197 []() { return compileOptions(theTranslator->trDirectories()); })
1198 } },
1199 { "group/memberdecl/nestedgroups", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNestedGroups,
1200 []() { return compileOptions(theTranslator->trTopics()); })
1201 } },
1202 { "group/memberdecl/files", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupFiles,
1203 []() { return compileOptions(theTranslator->trFile(TRUE,FALSE)); })
1204 } },
1205 { "group/memberdecl/defines", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDefineMembers(),
1206 []() { return compileOptions(theTranslator->trDefines()); })
1207 } },
1208 { "group/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(),
1209 []() { return compileOptions(theTranslator->trTypedefs()); })
1210 } },
1211 { "group/memberdecl/sequences", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSequenceMembers(),
1212 []() { return compileOptions(theTranslator->trSequences()); })
1213 } },
1214 { "group/memberdecl/dictionaries", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecDictionaryMembers(),
1215 []() { return compileOptions(theTranslator->trDictionaries()); })
1216 } },
1217 { "group/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(),
1218 []() { return compileOptions(theTranslator->trEnumerations()); })
1219 } },
1220 { "group/memberdecl/enumvalues", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumValMembers(),
1221 []() { return compileOptions(theTranslator->trEnumerationValues()); })
1222 } },
1223 { "group/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(),
1224 []() { return compileOptions(/* default */ theTranslator->trFunctions(),
1225 SrcLangExt::Fortran,theTranslator->trSubprograms(),
1226 SrcLangExt::VHDL, theTranslator->trFunctionAndProc()); })
1227 } },
1228 { "group/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(),
1229 []() { return compileOptions(theTranslator->trVariables()); })
1230 } },
1231 { "group/memberdecl/signals", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecSignalMembers(),
1232 []() { return compileOptions(theTranslator->trSignals()); })
1233 } },
1234 { "group/memberdecl/publicslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPubSlotMembers(),
1235 []() { return compileOptions(theTranslator->trPublicSlots()); })
1236 } },
1237 { "group/memberdecl/protectedslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecProSlotMembers(),
1238 []() { return compileOptions(theTranslator->trProtectedSlots()); })
1239 } },
1240 { "group/memberdecl/privateslots", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPriSlotMembers(),
1241 []() { return compileOptions(theTranslator->trPrivateSlots()); })
1242 } },
1243 { "group/memberdecl/events", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEventMembers(),
1244 []() { return compileOptions(theTranslator->trEvents()); })
1245 } },
1246 { "group/memberdecl/properties", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecPropMembers(),
1247 []() { return compileOptions(theTranslator->trProperties()); })
1248 } },
1249 { "group/memberdecl/friends", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFriendMembers(),
1250 []() { return compileOptions(theTranslator->trFriends()); })
1251 } },
1253 { "group/memberdef/pagedocs", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::GroupPageDocs) } },
1254 { "group/memberdef/inlineclasses", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupInlineClasses,
1255 []() { return compileOptions(/* default */ theTranslator->trClassDocumentation(),
1256 SrcLangExt::Fortran,theTranslator->trTypeDocumentation()); })
1257 } },
1258 { "group/memberdef/defines", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDefineMembers(),
1259 []() { return compileOptions(theTranslator->trDefineDocumentation()); })
1260 } },
1261 { "group/memberdef/typedefs", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocTypedefMembers(),
1262 []() { return compileOptions(theTranslator->trTypedefDocumentation()); })
1263 } },
1264 { "group/memberdef/sequences", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSequenceMembers(),
1265 []() { return compileOptions(theTranslator->trSequenceDocumentation()); })
1266 } },
1267 { "group/memberdef/dictionaries", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocDictionaryMembers(),
1268 []() { return compileOptions(theTranslator->trDictionaryDocumentation()); })
1269 } },
1270 { "group/memberdef/enums", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumMembers(),
1271 []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); })
1272 } },
1273 { "group/memberdef/enumvalues", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEnumValMembers(),
1274 []() { return compileOptions(theTranslator->trEnumerationValueDocumentation()); })
1275 } },
1276 { "group/memberdef/functions", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFuncMembers(),
1277 []() { return compileOptions(/* default */ theTranslator->trFunctionDocumentation(),
1278 SrcLangExt::Fortran,theTranslator->trSubprogramDocumentation()); })
1279 } },
1280 { "group/memberdef/variables", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocVarMembers(),
1281 []() { return compileOptions(theTranslator->trVariableDocumentation()); })
1282 } },
1283 { "group/memberdef/signals", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocSignalMembers(),
1284 []() { return compileOptions(theTranslator->trSignals()); })
1285 } },
1286 { "group/memberdef/publicslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPubSlotMembers(),
1287 []() { return compileOptions(theTranslator->trPublicSlots()); })
1288 } },
1289 { "group/memberdef/protectedslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocProSlotMembers(),
1290 []() { return compileOptions(theTranslator->trProtectedSlots()); })
1291 } },
1292 { "group/memberdef/privateslots", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPriSlotMembers(),
1293 []() { return compileOptions(theTranslator->trPrivateSlots()); })
1294 } },
1295 { "group/memberdef/events", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocEventMembers(),
1296 []() { return compileOptions(theTranslator->trEvents()); })
1297 } },
1298 { "group/memberdef/properties", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocPropMembers(),
1299 []() { return compileOptions(theTranslator->trProperties()); })
1300 } },
1301 { "group/memberdef/friends", { startCb(&LayoutParser::startMemberDefEntry, MemberListType::DocFriendMembers(),
1302 []() { return compileOptions(theTranslator->trFriends()); })
1303 } },
1304
1305 // module layout handlers
1306 { "module", { startCb(&LayoutParser::startTop,LayoutDocManager::Module,"module/",LayoutNavEntry::Modules),
1308 } },
1309 { "module/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
1310 { "module/exportedmodules", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleExports,
1311 []() { return compileOptions(theTranslator->trExportedModules()); })
1312 } },
1313 { "module/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
1314 []() { return compileOptions(theTranslator->trDetailedDescription()); })
1315 } },
1316 { "module/authorsection", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection) } },
1318 { "module/memberdecl/concepts", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleConcepts,
1319 []() { return compileOptions(theTranslator->trConcept(true,false)); })
1320 } },
1321 { "module/memberdecl/classes", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleClasses,
1322 []() { return compileOptions(theTranslator->trCompounds()); })
1323 } },
1324 { "module/memberdecl/enums", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecEnumMembers(),
1325 []() { return compileOptions(theTranslator->trEnumerations()); })
1326 } },
1327 { "module/memberdecl/typedefs", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecTypedefMembers(),
1328 []() { return compileOptions(theTranslator->trTypedefs()); })
1329 } },
1330 { "module/memberdecl/functions", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecFuncMembers(),
1331 []() { return compileOptions(theTranslator->trFunctions()); })
1332 } },
1333 { "module/memberdecl/variables", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType::DecVarMembers(),
1334 []() { return compileOptions(theTranslator->trVariables()); })
1335 } },
1336 { "module/memberdecl/membergroups", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups) } },
1337 { "module/memberdecl/files", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ModuleUsedFiles,
1338 []() { return compileOptions(theTranslator->trFile(TRUE,FALSE)); })
1339 } },
1340
1341 // directory layout handlers
1342 { "directory", { startCb(&LayoutParser::startTop,LayoutDocManager::Directory,"directory/",LayoutNavEntry::None),
1344 } },
1345 { "directory/briefdescription", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc) } },
1346 { "directory/detaileddescription", { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
1347 []() { return compileOptions(theTranslator->trDetailedDescription()); })
1348 } },
1349 { "directory/directorygraph", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirGraph) } },
1350 { "directory/memberdecl", { startCb(&LayoutParser::startMemberDecl), endCb(&LayoutParser::endMemberDecl) } },
1351 { "directory/memberdecl/dirs", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirSubDirs) } },
1352 { "directory/memberdecl/files", { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirFiles) } },
1353};
1354
1355} // namespace
1356
1357void LayoutParser::startElement( const std::string &name, const XMLHandlers::Attributes& attrib )
1358{
1359 //printf("startElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name));
1360 auto it = g_elementHandlers.find(m_scope.str()+name);
1361 if (it!=g_elementHandlers.end())
1362 {
1363 it->second.startCb(*this,it->first,attrib);
1364 }
1365 else
1366 {
1367 std::string fileName = m_locator->fileName();
1368 warn_layout(fileName.c_str(),m_locator->lineNr(),"Unexpected start tag '{}' found in scope='{}'!",
1369 name,m_scope);
1370 }
1371}
1372
1373void LayoutParser::endElement( const std::string &name )
1374{
1375 //printf("endElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name));
1376 auto it=g_elementHandlers.end();
1377
1378 if (!m_scope.isEmpty() && m_scope.right(name.length()+1)==name+"/")
1379 { // element ends current scope
1380 it = g_elementHandlers.find(m_scope.left(m_scope.length()-1).str());
1381 }
1382 else // continue with current scope
1383 {
1384 it = g_elementHandlers.find(m_scope.str()+name);
1385 }
1386 if (it!=g_elementHandlers.end())
1387 {
1388 it->second.endCb(*this,it->first+" end"); // added end to id to make it unique
1389 }
1390}
1391
1392//---------------------------------------------------------------------------------
1393
1395
1396//---------------------------------------------------------------------------------
1397
1399{
1400 public:
1401 std::array<LayoutDocEntryList,LayoutDocManager::NrParts> docEntries;
1405};
1406
1408{
1409}
1410
1414
1416{
1418 XMLHandlers handlers;
1419 handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1420 handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1421 handlers.error = [&layoutParser](const std::string &fileName,int lineNr,const std::string &msg) { layoutParser.error(fileName,lineNr,msg); };
1422 XMLParser parser(handlers);
1423 layoutParser.setDocumentLocator(&parser);
1424 constexpr auto layoutFile = "layout_default.xml";
1425 QCString layout_default = ResourceMgr::instance().getAsString(layoutFile);
1426 parser.parse(layoutFile,layout_default.data(),Debug::isFlagSet(Debug::Lex_xml),
1427 [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",layoutFile); },
1428 [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",layoutFile); }
1429 );
1431 d->majorVersion = layoutParser.majorVersion();
1432 d->minorVersion = layoutParser.minorVersion();
1433}
1434
1436{
1437 static LayoutDocManager theInstance;
1438 return theInstance;
1439}
1440
1442{
1443 return d->docEntries[static_cast<int>(part)];
1444}
1445
1447{
1448 return &d->rootNav;
1449}
1450
1452 LayoutNavEntry::Kind k,bool vs,const QCString &bf,
1453 const QCString &tl,const QCString &intro)
1454{
1455 if (parent==nullptr) parent = &d->rootNav;
1456 auto ptr = std::make_unique<LayoutNavEntry>(parent,k,vs,bf,tl,intro);
1457 auto child = ptr.get();
1458 parent->appendChild(std::move(ptr));
1459 return child;
1460}
1461
1463{
1464 auto &docEntry = d->docEntries[static_cast<int>(p)];
1465 docEntry.push_back(std::move(e)); // add
1466}
1467
1468void LayoutDocManager::parse(const QCString &fileName, const char *data)
1469{
1470 //printf("============ LayoutDocManager::parse(%s)\n",qPrint(fileName));
1471 LayoutDocManager layoutDocManager;
1472 LayoutParser layoutParser(layoutDocManager);
1473 XMLHandlers handlers;
1474 handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1475 handlers.endElement = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1476 handlers.error = [&layoutParser](const std::string &fn,int lineNr,const std::string &msg) { layoutParser.error(fn,lineNr,msg); };
1477 XMLParser parser(handlers);
1478 layoutParser.setDocumentLocator(&parser);
1479 parser.parse(fileName.data(),
1480 data ? data : fileToString(fileName).data(),
1482 [&]() { DebugLex::print(Debug::Lex_xml,"Entering","libxml/xml.l",qPrint(fileName)); },
1483 [&]() { DebugLex::print(Debug::Lex_xml,"Finished", "libxml/xml.l",qPrint(fileName)); },
1485 );
1486
1487 // version in the user defined layout overrides default one
1488 d->majorVersion = layoutParser.majorVersion();
1489 d->minorVersion = layoutParser.minorVersion();
1490
1491 // merge missing parts of the default layout into the user defined layout
1492 // For now merging in defaults has been disabled for navigation entries
1493 // to avoid "extra entries" for projects that work with partial layout files.
1494 //mergeNavEntries(layoutDocManager);
1495
1496 // for compatibility reasons we only merge defaults when the user defined layout has at least version 2.0 or higher
1497 if (d->majorVersion>=2)
1498 {
1499 mergeDocEntries(fileName,layoutDocManager);
1500 }
1501
1502 layoutDocManager.removeInvisibleDocEntries();
1503
1504 // replace default layout with merged layout
1505 d->docEntries.swap(layoutDocManager.d->docEntries);
1506 d->rootNav.swap(layoutDocManager.d->rootNav);
1507}
1508
1510{
1511 // remove invisible entries
1512 for (auto &list : d->docEntries)
1513 {
1514 auto it = list.begin();
1515 while (it!=list.end())
1516 {
1517 if (*it==nullptr || !(*it)->visible())
1518 {
1519 it = list.erase(it);
1520 }
1521 else
1522 {
1523 ++it;
1524 }
1525 }
1526 }
1527}
1528
1530{
1531 return d->majorVersion;
1532}
1533
1535{
1536 return d->minorVersion;
1537}
1538
1539// search for candidate node in tree with root target. Returns the match target node if found, or nullptr otherwise.
1540static LayoutNavEntry *findNavEntryRec(LayoutNavEntry *root, const std::string &id)
1541{
1542 if (root)
1543 {
1544 if (root->id()==id) return root;
1545 for (auto &child : root->children())
1546 {
1547 LayoutNavEntry *childNavEntry = findNavEntryRec(child.get(),id);
1548 if (childNavEntry) return childNavEntry;
1549 }
1550 }
1551 return nullptr;
1552}
1553
1554// merge the missing nodes
1555static void mergeNavTreeNodesRec(LayoutNavEntry *targetTree,LayoutNavEntry *sourceTree)
1556{
1557 using IdSet = std::unordered_set<std::string>;
1558 using IdMap = std::unordered_map<std::string,size_t>;
1559
1560 auto prepareSet = [](const LayoutNavEntry *tree, IdSet &set) {
1561 for (const auto &e : tree->children())
1562 {
1563 set.insert(e->id());
1564 }
1565 };
1566
1567 auto prepareMap = [](const LayoutNavEntry *tree, const IdSet &set, IdMap &map) {
1568 for (size_t i=0; i<tree->children().size(); i++)
1569 {
1570 std::string id = tree->children()[i]->id();
1571 auto it = set.find(id);
1572 if (it != set.end())
1573 {
1574 map[id]=i;
1575 }
1576 }
1577 };
1578
1579 IdSet sourceSet, targetSet;
1580 prepareSet(sourceTree,sourceSet);
1581 prepareSet(targetTree,targetSet);
1582
1583 IdMap sourceMap, targetMap;
1584 prepareMap(targetTree,sourceSet,targetMap);
1585 prepareMap(sourceTree,targetSet,sourceMap);
1586
1587 // calculate list of insertion positions in the target list for each id in the source list
1588 std::vector<size_t> insertionList;
1589 for (size_t i=0; i<sourceTree->children().size(); i++)
1590 {
1591 std::string id = sourceTree->children()[i]->id();
1592 // If an id in the source list appears before a set of shared ids we want it also to
1593 // appear before these id in the target list. To do this find the lowest target index of all shared
1594 // ids that come after position i in the source list
1595 size_t minIdx = targetTree->children().size();
1596 for (const auto &kv : sourceMap) // iterator over shared ids
1597 {
1598 if (i < kv.second) // i appears before this shared id
1599 {
1600 size_t idx = targetMap[kv.first]; // get the corresponding index in the target list
1601 if (idx<minIdx) // update minimum
1602 {
1603 minIdx=idx;
1604 }
1605 }
1606 }
1607 insertionList.push_back(minIdx);
1608 }
1609
1610 // Insert the missing elements of the source list into the target list.
1611 // Work backwards so the calculated insertion points don't change due to insertions.
1612 size_t idx = sourceTree->children().size()-1;
1613 for (auto it=insertionList.rbegin(); it!=insertionList.rend(); ++it, idx--)
1614 {
1615 std::string id = sourceTree->children()[idx]->id();
1616 if (targetSet.find(id)==targetSet.end()) // need to add id
1617 {
1618 // for efficiency we move the elements from the source list to the target list, thus modifying the source list!
1619 targetTree->insertChild(*it, std::move(sourceTree->children()[idx]));
1620 }
1621 }
1622
1623 for (auto &targetChild : targetTree->children())
1624 {
1625 auto *node = findNavEntryRec(sourceTree,targetChild->id());
1626 if (node)
1627 {
1628 mergeNavTreeNodesRec(targetChild.get(),node);
1629 }
1630 }
1631}
1632
1637
1638static void mergeDocEntryLists(const QCString &fileName,LayoutDocEntryList &targetList,LayoutDocEntryList &sourceList)
1639{
1640 using IdSet = std::unordered_set<std::string>;
1641 using IdMap = std::unordered_map<std::string,size_t>;
1642
1643 auto prepareSet = [](const LayoutDocEntryList &list, IdSet &set) {
1644 //size_t idx=0;
1645 for (const auto &e : list)
1646 {
1647 //printf("idx=%zu set(%s)\n",idx,qPrint(e->id()));
1648 set.insert(e->id());
1649 //idx++;
1650 }
1651 };
1652
1653 auto prepareMap = [](const LayoutDocEntryList &list, const IdSet &set, IdMap &map) {
1654 for (size_t i=0; i<list.size(); i++)
1655 {
1656 std::string id = list[i]->id();
1657 auto it = set.find(id);
1658 if (it != set.end())
1659 {
1660 //printf("map %s->%zu\n",qPrint(id),i);
1661 map[id]=i;
1662 }
1663 }
1664 };
1665
1666 IdSet sourceSet, targetSet;
1667 //printf("---- sourceSet\n");
1668 prepareSet(sourceList,sourceSet);
1669 //printf("---- targetSet\n");
1670 prepareSet(targetList,targetSet);
1671
1672 IdMap sourceMap, targetMap;
1673 //printf("---- targetMap\n");
1674 prepareMap(targetList,sourceSet,targetMap);
1675 //printf("---- sourceMap\n");
1676 prepareMap(sourceList,targetSet,sourceMap);
1677
1678 // calculate list of insertion positions in the target list for each id in the source list
1679 std::vector<size_t> insertionList;
1680 for (size_t i=0; i<sourceList.size(); i++)
1681 {
1682 std::string id = sourceList[i]->id();
1683 // If an id in the source list appears before a set of shared ids we want it also to
1684 // appear before these id in the target list. To do this find the lowest target index of all shared
1685 // ids that come after position i in the source list
1686 size_t minIdx = targetList.size();
1687 for (const auto &kv : sourceMap) // iterator over shared ids
1688 {
1689 if (i < kv.second) // i appears before this shared id
1690 {
1691 size_t idx = targetMap[kv.first]; // get the corresponding index in the target list
1692 //printf(" evaluating %s->%zu min=%zu\n",qPrint(kv.first),idx,minIdx);
1693 if (idx<minIdx) // update minimum
1694 {
1695 minIdx=idx;
1696 }
1697 }
1698 }
1699 //printf("insertion %s->%zu\n",qPrint(id),minIdx);
1700 insertionList.push_back(minIdx);
1701 }
1702
1703 // Insert the missing elements of the source list into the target list.
1704 // Work backwards so the calculated insertion points don't change due to insertions.
1705 size_t idx = sourceList.size()-1;
1706 for (auto it=insertionList.rbegin(); it!=insertionList.rend(); ++it, idx--)
1707 {
1708 std::string id = sourceList[idx]->id();
1709 //printf("idx=%zu entry %s\n",idx,qPrint(id));
1710 if (targetSet.find(id)==targetSet.end()) // need to add id
1711 {
1712 // for efficiency we move the elements from the source list to the target list, thus modifying the source list!
1713 //printf("--> insert at %zu before %s\n",*it,qPrint(*it<targetList.size()?targetList[*it]->id():"none"));
1714 warn_layout(fileName,1,"User defined layout misses entry '{}'. Using default value.",id);
1715 targetList.insert(targetList.begin()+*it, std::move(sourceList[idx]));
1716 }
1717 }
1718
1719}
1720
1722{
1723 for (size_t i=0; i<d->docEntries.size(); i++)
1724 {
1725 //printf("========= part %zu\n",i);
1726 mergeDocEntryLists(fileName,other.d->docEntries[i],d->docEntries[i]);
1727 }
1728}
1729
1730//---------------------------------------------------------------------------------
1731
1733{
1734 std::ofstream f;
1735 if (openOutputFile(fileName,f))
1736 {
1737 TextStream t(&f);
1738 QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml");
1739 t << substitute(layout_default,"$doxygenversion",getDoxygenVersion());
1740 }
1741 else
1742 {
1743 err("Failed to open file {} for writing!\n",fileName);
1744 return;
1745 }
1746 f.close();
1747}
1748
1749//----------------------------------------------------------------------------------
1750
1751// Convert input to a title.
1752// The format of input can be a simple title "A title" or in case there are different
1753// titles for some programming languages they can take the following form:
1754// "A title|16=Another title|8=Yet Another title"
1755// where the number is a value of SrcLangExt in decimal notation (i.e. 16=Java, 8=IDL).
1757{
1758 int s=0,e=input.find('|');
1759 if (e==-1) return input; // simple title case
1760 int e1=e;
1761 while (e!=-1) // look for 'number=title' pattern separated by '|'
1762 {
1763 s=e+1;
1764 e=input.find('|',s);
1765 int i=input.find('=',s);
1766 assert(i>s);
1767 SrcLangExt key= static_cast<SrcLangExt>(input.mid(s,i-s).toUInt());
1768 if (key==lang) // found matching key
1769 {
1770 if (e==-1) e=static_cast<int>(input.length());
1771 return input.mid(i+1,e-i-1);
1772 }
1773 }
1774 return input.left(e1); // fallback, no explicit language key found
1775}
1776
1777//----------------------------------------------------------------------------------
1778
1783
1784//----------------------------------------------------------------------------------
1785
1790
1795
1796//----------------------------------------------------------------------------------
1797
1802
1803//----------------------------------------------------------------------------------
1804
1805static void printNavLayout(LayoutNavEntry *root,int indent)
1806{
1808 {
1809 QCString indentStr;
1810 indentStr.fill(' ',indent);
1811 Debug::print(Debug::Layout,0,"{}kind={} visible={} title='{}'\n",
1812 indentStr, root->navToString(), root->visible(), root->title());
1813 for (const auto &e : root->children())
1814 {
1815 printNavLayout(e.get(),indent+2);
1816 }
1817 }
1818}
1819
1821{
1822 bool extraIndent = false;
1823
1824 auto &mgr = LayoutDocManager::instance();
1825 Debug::print(Debug::Layout,0,"Layout version {}.{}\n",mgr.majorVersion(),mgr.minorVersion());
1826
1827 Debug::print(Debug::Layout,0,"Part: Navigation index\n");
1828 for (const auto &e : mgr.rootNavEntry()->children())
1829 {
1830 printNavLayout(e.get(),2);
1831 }
1832
1833 for (int i = 0; i < LayoutDocManager::NrParts; i++)
1834 {
1836 for (const auto &lde : mgr.docEntries(static_cast<LayoutDocManager::LayoutPart>(i)))
1837 {
1838 if (const LayoutDocEntrySimple *ldes = dynamic_cast<const LayoutDocEntrySimple*>(lde.get()))
1839 {
1840 if (lde->kind() == LayoutDocEntry::MemberDeclEnd || lde->kind() == LayoutDocEntry::MemberDefEnd) extraIndent = false;
1841 Debug::print(Debug::Layout,0," {}kind: {}, visible={}\n",
1842 extraIndent? " " : "",lde->entryToString(), ldes->visible());
1843 if (lde->kind() == LayoutDocEntry::MemberDeclStart || lde->kind() == LayoutDocEntry::MemberDefStart) extraIndent = true;
1844 }
1845 else if (const LayoutDocEntryMemberDecl *lmdecl = dynamic_cast<const LayoutDocEntryMemberDecl*>(lde.get()))
1846 {
1847 Debug::print(Debug::Layout,0," {}complex kind: {}, visible={}, type: {}\n",
1848 extraIndent? " " : "",lde->entryToString(),lmdecl->visible(),lmdecl->type.to_string());
1849 }
1850 else if (const LayoutDocEntryMemberDef *lmdef = dynamic_cast<const LayoutDocEntryMemberDef*>(lde.get()))
1851 {
1852 Debug::print(Debug::Layout,0," {}complex kind: {}, visible={}, type: {}\n",
1853 extraIndent? " " : "",lde->entryToString(),lmdef->visible(),lmdef->type.to_string());
1854 }
1855 else
1856 {
1857 // should not happen
1858 Debug::print(Debug::Layout,0," {}not handled kind: {}\n",extraIndent? " " : "",lde->entryToString());
1859 }
1860 }
1861 }
1862}
1863
1864
1865
@ 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:1460
Node representing a reference to some item.
Definition docnode.h:772
QCString anchor() const
Definition docnode.h:779
QCString file() const
Definition docnode.h:776
QCString ref() const
Definition docnode.h:778
std::array< LayoutDocEntryList, LayoutDocManager::NrParts > docEntries
Definition layout.cpp:1401
LayoutNavEntry rootNav
Definition layout.cpp:1402
Singleton providing access to the (user configurable) layout of the documentation.
Definition layout.h:262
void mergeNavEntries(LayoutDocManager &manager)
Definition layout.cpp:1633
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:1451
static LayoutDocManager & instance()
Returns a reference to this singleton.
Definition layout.cpp:1435
void mergeDocEntries(const QCString &fileName, LayoutDocManager &manager)
Definition layout.cpp:1721
int majorVersion() const
Definition layout.cpp:1529
void parse(const QCString &fileName, const char *data=nullptr)
Parses a user provided layout.
Definition layout.cpp:1468
int minorVersion() const
Definition layout.cpp:1534
friend class LayoutParser
Definition layout.h:306
void addEntry(LayoutPart p, LayoutDocEntryPtr &&e)
Definition layout.cpp:1462
LayoutNavEntry * rootNavEntry() const
returns the (invisible) root of the navigation tree.
Definition layout.cpp:1446
void removeInvisibleDocEntries()
Definition layout.cpp:1509
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:1441
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:1373
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:1357
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:184
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
void fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:180
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
QCString lower() const
Definition qcstring.h:234
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:578
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245
QCString & setNum(short n)
Definition qcstring.h:444
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:159
QCString left(size_t len) const
Definition qcstring.h:214
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:153
#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:1324
IDocParserPtr createDocParser()
factory function to create a parser
Definition docparser.cpp:54
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:1555
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:1540
void writeDefaultLayoutFile(const QCString &fileName)
Definition layout.cpp:1732
QCString compileOptions(const QCString &def)
Definition layout.cpp:35
void printLayout()
Definition layout.cpp:1820
static void printNavLayout(LayoutNavEntry *root, int indent)
Definition layout.cpp:1805
QCString extractLanguageSpecificTitle(const QCString &input, SrcLangExt lang)
Definition layout.cpp:1756
static void mergeDocEntryLists(const QCString &fileName, LayoutDocEntryList &targetList, LayoutDocEntryList &sourceList)
Definition layout.cpp:1638
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:790
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:759
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477
const char * qPrint(const char *s)
Definition qcstring.h:672
#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:1786
QCString subtitle(SrcLangExt lang) const
Definition layout.cpp:1791
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:1798
QCString title(SrcLangExt lang) const
Definition layout.cpp:1779
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
Language as given by extension.
Definition types.h:42
@ Fortran
Definition types.h:53
@ Slice
Definition types.h:59
QCString externalRef(const QCString &relPath, const QCString &ref, bool href)
Definition util.cpp:6162
bool transcodeCharacterStringToUTF8(std::string &input, const char *inputEncoding)
Definition util.cpp:1376
bool openOutputFile(const QCString &outFile, std::ofstream &f)
Definition util.cpp:6720
bool found
Definition util.cpp:984
QCString fileToString(const QCString &name, bool filter, bool isSourceCode)
Definition util.cpp:1414
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:5339
A bunch of utility functions.