1 /******************************************************************************
2  *
3  *
4  *
5  *
6  * Copyright (C) 1997-2015 by Dimitri van Heesch.
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation under the terms of the GNU General Public License is hereby
10  * granted. No representations are made about the suitability of this software
11  * for any purpose. It is provided "as is" without express or implied warranty.
12  * See the GNU General Public License for more details.
13  *
14  * Documents produced by Doxygen are derivative works derived from the
15  * input used in their production; they are not affected by this license.
16  *
17  */
18 
19 #include <array>
20 
21 #include <assert.h>
22 
23 #include "layout.h"
24 #include "message.h"
25 #include "language.h"
26 #include "vhdldocgen.h"
27 #include "util.h"
28 #include "doxygen.h"
29 #include "version.h"
30 #include "config.h"
31 #include "xml.h"
32 #include "resourcemgr.h"
33 #include "debug.h"
34 
compileOptions(const QCString & def)35 inline QCString compileOptions(const QCString &def)
36 {
37   return def;
38 }
39 
compileOptions(const QCString & def,SrcLangExt langId1,const QCString & value1)40 inline QCString compileOptions(const QCString &def,SrcLangExt langId1,const QCString &value1)
41 {
42   return compileOptions(def)+"|"+QCString().setNum(langId1)+"="+value1;
43 }
44 
compileOptions(const QCString & def,SrcLangExt langId1,const QCString & value1,SrcLangExt langId2,const QCString & value2)45 inline 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(langId2)+"="+value2;
50 }
51 
compileOptions(const QCString & def,SrcLangExt langId1,const QCString & value1,SrcLangExt langId2,const QCString & value2,SrcLangExt langId3,const QCString & value3)52 inline 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(langId3)+"="+value3;
58 }
59 
compileOptions(const QCString & def,SrcLangExt langId1,const QCString & value1,SrcLangExt langId2,const QCString & value2,SrcLangExt langId3,const QCString & value3,SrcLangExt langId4,const QCString & value4)60 inline 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(langId4)+"="+value4;
67 }
68 
compileOptions(const QCString & def,SrcLangExt langId1,const QCString & value1,SrcLangExt langId2,const QCString & value2,SrcLangExt langId3,const QCString & value3,SrcLangExt langId4,const QCString & value4,SrcLangExt langId5,const QCString & value5)69 inline 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(langId5)+"="+value5;
77 }
78 
79 
elemIsVisible(const XMLHandlers::Attributes & attrib,bool defVal=TRUE)80 static bool elemIsVisible(const XMLHandlers::Attributes &attrib,bool defVal=TRUE)
81 {
82   QCString visible = XMLHandlers::value(attrib,"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 ConfigValues::instance().*(opt->value.s) != "NO";
95     }
96     else if (!opt)
97     {
98       err("found unsupported value %s for visible attribute in layout file\n",
99           qPrint(visible));
100     }
101   }
102   return visible!="no" && visible!="0";
103 }
104 
parentIsVisible(LayoutNavEntry * parent)105 static bool parentIsVisible(LayoutNavEntry *parent)
106 {
107   return parent==0 || parent->visible();
108 }
109 
110 //---------------------------------------------------------------------------------
111 
find(LayoutNavEntry::Kind kind,const QCString & file) const112 LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind,
113     const QCString &file) const
114 {
115   LayoutNavEntry *result=0;
116   for (const auto &entry : m_children)
117   {
118     // depth first search, needed to find the entry furthest from the
119     // root in case an entry is in the tree twice
120     result = entry->find(kind,file);
121     if (result) return result;
122     if (entry->kind()==kind && (file==QCString() || entry->baseFile()==file))
123     {
124       return entry.get();
125     }
126   }
127   return result;
128 }
129 
url() const130 QCString LayoutNavEntry::url() const
131 {
132   QCString url = baseFile().stripWhiteSpace();
133   if ((kind()!=LayoutNavEntry::User && kind()!=LayoutNavEntry::UserGroup) ||
134       (kind()==LayoutNavEntry::UserGroup && url.left(9)=="usergroup"))
135   {
136     url = addHtmlExtensionIfMissing(url);
137   }
138   else if (url.left(5)=="@ref " || url.left(5)=="\\ref ")
139   {
140     const Definition *d = 0;
141     QCString anchor;
142     bool found=FALSE;
143     if (resolveLink(QCString(),url.mid(5).stripWhiteSpace(),TRUE,&d,anchor))
144     {
145       if (d && d->isLinkable())
146       {
147         url=addHtmlExtensionIfMissing(d->getOutputFileBase());
148         if (!anchor.isEmpty())
149         {
150           url+="#"+anchor;
151         }
152         found=TRUE;
153       }
154     }
155     if (!found)
156     {
157       msg("explicit link request to '%s' in layout file '%s' could not be resolved\n",qPrint(url.mid(5)),qPrint(Config_getString(LAYOUT_FILE)));
158     }
159   }
160   //printf("LayoutNavEntry::url()=%s\n",qPrint(url));
161   return url;
162 }
163 
164 //---------------------------------------------------------------------------------
165 
166 class LayoutParser
167 {
168   public:
instance()169     static LayoutParser &instance()
170     {
171       static LayoutParser *theInstance = new LayoutParser;
172       return *theInstance;
173     }
174 
175     // =========== XMLHandler events
setDocumentLocator(const XMLLocator * locator)176     void setDocumentLocator(const XMLLocator *locator)
177     {
178       m_locator = locator;
179     }
error(const std::string & fileName,int lineNr,const std::string & msg)180     void error( const std::string &fileName,int lineNr,const std::string &msg)
181     {
182       ::warn(fileName.c_str(),lineNr,"%s",msg.c_str());
183     }
184     void startElement( const std::string &name, const XMLHandlers::Attributes& attrib );
185     void endElement( const std::string &name );
186 
startSimpleEntry(LayoutDocEntry::Kind k,const XMLHandlers::Attributes & attrib)187     void startSimpleEntry(LayoutDocEntry::Kind k,const XMLHandlers::Attributes &attrib)
188     {
189       bool isVisible = elemIsVisible(attrib) && parentIsVisible(m_rootNav);
190       if (m_part!=-1 && isVisible)
191       {
192         LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
193                                               new LayoutDocEntrySimple(k));
194       }
195     }
196 
197     // ============ Specific callbacks
198 
startSectionEntry(LayoutDocEntry::Kind k,const XMLHandlers::Attributes & attrib,const QCString & title)199     void startSectionEntry(LayoutDocEntry::Kind k,const XMLHandlers::Attributes &attrib,
200                            const QCString &title)
201     {
202       bool isVisible = elemIsVisible(attrib) && parentIsVisible(m_rootNav);
203       QCString userTitle = XMLHandlers::value(attrib,"title");
204       //printf("startSectionEntry: title='%s' userTitle='%s'\n",
205       //    qPrint(title),qPrint(userTitle));
206       if (userTitle.isEmpty())  userTitle = title;
207       if (m_part!=-1 && isVisible)
208       {
209         LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
210                                               new LayoutDocEntrySection(k,userTitle));
211       }
212     }
213 
214 
startMemberDeclEntry(const XMLHandlers::Attributes & attrib,MemberListType type,const QCString & title,const QCString & subscript)215     void startMemberDeclEntry(const XMLHandlers::Attributes &attrib,MemberListType type,
216                               const QCString &title,const QCString &subscript)
217     {
218       //QCString visible = convertToQCString(XMLHandlers::value(attrib,"visible"));
219       //bool isVisible = visible.isEmpty() || (visible!="no" && visible!="0");
220       QCString userTitle     = XMLHandlers::value(attrib,"title");
221       QCString userSubscript = XMLHandlers::value(attrib,"subtitle");
222       if (userTitle.isEmpty())     userTitle     = title;
223       if (userSubscript.isEmpty()) userSubscript = subscript;
224       //printf("memberdecl: %s\n",qPrint(userTitle));
225       if (m_part!=-1 /*&& isVisible*/)
226       {
227         LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
228                                               new LayoutDocEntryMemberDecl(type,userTitle,userSubscript));
229       }
230     }
231 
startMemberDefEntry(const XMLHandlers::Attributes & attrib,MemberListType type,const QCString & title,const QCString &)232     void startMemberDefEntry(const XMLHandlers::Attributes &attrib,MemberListType type,
233                              const QCString &title,const QCString &)
234     {
235       QCString userTitle = XMLHandlers::value(attrib,"title");
236       if (userTitle.isEmpty()) userTitle = title;
237       //printf("memberdef: %s\n",qPrint(userTitle));
238       if (m_part!=-1 /*&& isVisible*/)
239       {
240         LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
241                                               new LayoutDocEntryMemberDef(type,userTitle));
242       }
243     }
244 
startLayout(const XMLHandlers::Attributes &)245     void startLayout(const XMLHandlers::Attributes &)
246     {
247     }
248 
startNavIndex(const XMLHandlers::Attributes &)249     void startNavIndex(const XMLHandlers::Attributes &)
250     {
251       m_scope="navindex/";
252       m_rootNav = LayoutDocManager::instance().rootNavEntry();
253       if (m_rootNav)
254       {
255         m_rootNav->clear();
256       }
257     }
258 
endNavIndex()259     void endNavIndex()
260     {
261       m_scope="";
262       if (m_rootNav && !m_rootNav->find(LayoutNavEntry::MainPage))
263       {
264         // no MainPage node... add one as the first item of the root node...
265         new LayoutNavEntry(m_rootNav,LayoutNavEntry::MainPage, TRUE,
266             /*Config_getBool(GENERATE_TREEVIEW) ? "main" :*/ "index",
267             theTranslator->trMainPage(),"",TRUE);
268       }
269     }
270 
startNavEntry(const XMLHandlers::Attributes & attrib)271     void startNavEntry(const XMLHandlers::Attributes &attrib)
272     {
273       static bool javaOpt    = Config_getBool(OPTIMIZE_OUTPUT_JAVA);
274       static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN);
275       static bool vhdlOpt    = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
276       static bool sliceOpt   = Config_getBool(OPTIMIZE_OUTPUT_SLICE);
277       static bool hasGraphicalHierarchy = Config_getBool(HAVE_DOT) &&
278                                           Config_getBool(GRAPHICAL_HIERARCHY);
279       static bool extractAll = Config_getBool(EXTRACT_ALL);
280       static struct NavEntryMap
281       {
282         const char *typeStr;       // type attribute name in the XML file
283         LayoutNavEntry::Kind kind; // corresponding enum name
284         QCString mainName;         // default title for an item if it has children
285         QCString subName;          // optional name for an item if it is rendered as a child
286         QCString intro;            // introduction text to be put on the index page
287         QCString baseFile;         // base name of the file containing the index page
288       } mapping[] =
289       {
290         { "mainpage",
291           LayoutNavEntry::MainPage,
292           theTranslator->trMainPage(),
293           QCString(),
294           QCString(),
295           "index"
296         },
297         { "pages",
298           LayoutNavEntry::Pages,
299           theTranslator->trRelatedPages(),
300           QCString(),
301           theTranslator->trRelatedPagesDescription(),
302           "pages"
303         },
304         { "modules",
305           LayoutNavEntry::Modules,
306           theTranslator->trModules(),
307           QCString(),
308           theTranslator->trModulesDescription(),
309           "modules"
310         },
311         { "namespaces",
312           LayoutNavEntry::Namespaces,
313           javaOpt || vhdlOpt   ? theTranslator->trPackages() : fortranOpt || sliceOpt ? theTranslator->trModules() : theTranslator->trNamespaces(),
314           javaOpt || vhdlOpt   ? theTranslator->trPackages() : fortranOpt || sliceOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
315           javaOpt || vhdlOpt   ? theTranslator->trPackageListDescription() : fortranOpt || sliceOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
316           "namespaces"
317         },
318         { "namespacelist",
319           LayoutNavEntry::NamespaceList,
320           javaOpt || vhdlOpt   ? theTranslator->trPackages() : fortranOpt || sliceOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
321           QCString(),
322           javaOpt || vhdlOpt   ? theTranslator->trPackageListDescription() : fortranOpt || sliceOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
323           "namespaces"
324         },
325         { "namespacemembers",
326           LayoutNavEntry::NamespaceMembers,
327           javaOpt || vhdlOpt   ? theTranslator->trPackageMembers() : fortranOpt || sliceOpt ? theTranslator->trModulesMembers() : theTranslator->trNamespaceMembers(),
328           QCString(),
329           fortranOpt || sliceOpt ? theTranslator->trModulesMemberDescription(extractAll) : theTranslator->trNamespaceMemberDescription(extractAll),
330           "namespacemembers"
331         },
332         { "concepts",
333           LayoutNavEntry::Concepts,
334           theTranslator->trConcept(true,false),
335           theTranslator->trConceptList(),
336           theTranslator->trConceptListDescription(extractAll),
337           "concepts"
338         },
339         { "classindex",
340           LayoutNavEntry::ClassIndex,
341           fortranOpt ? theTranslator->trDataTypes() : vhdlOpt ? theTranslator->trDesignUnits() : theTranslator->trCompoundIndex(),
342           QCString(),
343           QCString(),
344           "classes"
345         },
346         { "classes",
347           LayoutNavEntry::Classes,
348           fortranOpt ? theTranslator->trCompoundListFortran() : vhdlOpt ? theTranslator->trDesignUnitList() : theTranslator->trClasses(),
349           theTranslator->trCompoundList(),
350           fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? theTranslator->trDesignUnitListDescription() : theTranslator->trCompoundListDescription(),
351           "annotated"
352         },
353         { "classlist",
354           LayoutNavEntry::ClassList,
355           fortranOpt ? theTranslator->trCompoundListFortran() : vhdlOpt ? theTranslator->trDesignUnitList() : theTranslator->trCompoundList(),
356           QCString(),
357           fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? theTranslator->trDesignUnitListDescription() : theTranslator->trCompoundListDescription(),
358           "annotated"
359         },
360         { "hierarchy",
361           LayoutNavEntry::ClassHierarchy,
362           vhdlOpt    ? theTranslator->trDesignUnitHierarchy() : theTranslator->trClassHierarchy(),
363           QCString(),
364           theTranslator->trClassHierarchyDescription(),
365           hasGraphicalHierarchy ? "inherits" : "hierarchy"
366         },
367         { "classmembers",
368           LayoutNavEntry::ClassMembers,
369           fortranOpt ? theTranslator->trCompoundMembersFortran() : vhdlOpt ? theTranslator->trDesignUnitMembers() : theTranslator->trCompoundMembers(),
370           QCString(),
371           fortranOpt ? theTranslator->trCompoundMembersDescriptionFortran(extractAll) : theTranslator->trCompoundMembersDescription(extractAll),
372           "functions"
373         },
374         { "interfaceindex",
375           LayoutNavEntry::InterfaceIndex,
376           theTranslator->trInterfaceIndex(),
377           QCString(),
378           QCString(),
379           "interfaces"
380         },
381         { "interfaces",
382           LayoutNavEntry::Interfaces,
383           theTranslator->trSliceInterfaces(),
384           theTranslator->trInterfaceList(),
385           theTranslator->trInterfaceListDescription(),
386           "annotatedinterfaces"
387         },
388         { "interfacelist",
389           LayoutNavEntry::InterfaceList,
390           theTranslator->trInterfaceList(),
391           QCString(),
392           theTranslator->trInterfaceListDescription(),
393           "annotatedinterfaces"
394         },
395         { "interfacehierarchy",
396           LayoutNavEntry::InterfaceHierarchy,
397           theTranslator->trInterfaceHierarchy(),
398           QCString(),
399           theTranslator->trInterfaceHierarchyDescription(),
400           hasGraphicalHierarchy ? "interfaceinherits" : "interfacehierarchy"
401         },
402         { "structindex",
403           LayoutNavEntry::StructIndex,
404           theTranslator->trStructIndex(),
405           QCString(),
406           QCString(),
407           "structs"
408         },
409         { "structs",
410           LayoutNavEntry::Structs,
411           theTranslator->trStructs(),
412           theTranslator->trStructList(),
413           theTranslator->trStructListDescription(),
414           "annotatedstructs"
415         },
416         { "structlist",
417           LayoutNavEntry::StructList,
418           theTranslator->trStructList(),
419           QCString(),
420           theTranslator->trStructListDescription(),
421           "annotatedstructs"
422         },
423         { "exceptionindex",
424           LayoutNavEntry::ExceptionIndex,
425           theTranslator->trExceptionIndex(),
426           QCString(),
427           QCString(),
428           "exceptions"
429         },
430         { "exceptions",
431           LayoutNavEntry::Exceptions,
432           theTranslator->trExceptions(),
433           theTranslator->trExceptionList(),
434           theTranslator->trExceptionListDescription(),
435           "annotatedexceptions"
436         },
437         { "exceptionlist",
438           LayoutNavEntry::ExceptionList,
439           theTranslator->trExceptionList(),
440           QCString(),
441           theTranslator->trExceptionListDescription(),
442           "annotatedexceptions"
443         },
444         { "exceptionhierarchy",
445           LayoutNavEntry::ExceptionHierarchy,
446           theTranslator->trExceptionHierarchy(),
447           QCString(),
448           theTranslator->trExceptionHierarchyDescription(),
449           hasGraphicalHierarchy ? "exceptioninherits" : "exceptionhierarchy"
450         },
451         { "files",
452           LayoutNavEntry::Files,
453           theTranslator->trFile(TRUE,FALSE),
454           theTranslator->trFileList(),
455           theTranslator->trFileListDescription(extractAll),
456           "files"
457         },
458         { "filelist",
459           LayoutNavEntry::FileList,
460           theTranslator->trFileList(),
461           QCString(),
462           theTranslator->trFileListDescription(extractAll),
463           "files"
464         },
465         { "globals",
466           LayoutNavEntry::FileGlobals,
467           theTranslator->trFileMembers(),
468           QCString(),
469           theTranslator->trFileMembersDescription(extractAll),
470           "globals"
471         },
472         //{ "dirs",
473         //  LayoutNavEntry::Dirs,
474         //  theTranslator->trDirectories(),
475         //  QCString(),
476         //  theTranslator->trDirDescription(),
477         //  "dirs"
478         //},
479         { "examples",
480           LayoutNavEntry::Examples,
481           theTranslator->trExamples(),
482           QCString(),
483           theTranslator->trExamplesDescription(),
484           "examples"
485         },
486         { "user",
487           LayoutNavEntry::User,
488           QCString(),
489           QCString(),
490           QCString(),
491           "user"
492         },
493         { "usergroup",
494           LayoutNavEntry::UserGroup,
495           QCString(),
496           QCString(),
497           QCString(),
498           "usergroup"
499         },
500         { 0, // end of list
501           (LayoutNavEntry::Kind)0,
502           QCString(),
503           QCString(),
504           QCString(),
505           QCString()
506         }
507       };
508       LayoutNavEntry::Kind kind;
509       // find type in the table
510       int i=0;
511       QCString type = XMLHandlers::value(attrib,"type");
512       while (mapping[i].typeStr)
513       {
514         if (mapping[i].typeStr==type)
515         {
516           kind = mapping[i].kind;
517           break;
518         }
519         i++;
520       }
521       if (mapping[i].typeStr==0)
522       {
523         std::string fileName = m_locator->fileName();
524         if (type.isEmpty())
525         {
526           ::warn(fileName.c_str(),m_locator->lineNr(),"an entry tag within a navindex has no type attribute! Check your layout file!\n");
527         }
528         else
529         {
530           ::warn(fileName.c_str(),m_locator->lineNr(),"the type '%s' is not supported for the entry tag within a navindex! Check your layout file!\n",qPrint(type));
531         }
532         m_invalidEntry=TRUE;
533         return;
534       }
535       QCString baseFile = mapping[i].baseFile;
536       QCString title = XMLHandlers::value(attrib,"title");
537       bool isVisible = elemIsVisible(attrib) && parentIsVisible(m_rootNav);
538       if (title.isEmpty()) // use default title
539       {
540         title = mapping[i].mainName; // use title for main row
541         if (m_rootNav!=LayoutDocManager::instance().rootNavEntry() && !mapping[i].subName.isEmpty())
542         {
543           title = mapping[i].subName; // if this is a child of another row, use the subName if available
544                                       // this is mainly done to get compatible naming with older versions.
545         }
546       }
547       QCString intro = XMLHandlers::value(attrib,"intro");
548       if (intro.isEmpty()) // use default intro text
549       {
550         intro = mapping[i].intro;
551       }
552       QCString url = XMLHandlers::value(attrib,"url");
553       if (mapping[i].kind==LayoutNavEntry::User && !url.isEmpty())
554       {
555         baseFile=url;
556       }
557       else if (kind==LayoutNavEntry::UserGroup)
558       {
559         if (!url.isEmpty())
560         {
561           if (url == "[none]")
562           {
563             baseFile = QCString();
564           }
565           else
566           {
567             baseFile=url;
568           }
569         }
570         else
571         {
572           baseFile+=QCString().sprintf("%d",m_userGroupCount++);
573         }
574       }
575       // create new item and make it the new root
576       m_rootNav = new LayoutNavEntry(m_rootNav,kind,isVisible,baseFile,title,intro);
577     }
578 
endNavEntry()579     void endNavEntry()
580     {
581       // set the root back to the parent
582       if (m_rootNav && !m_invalidEntry) m_rootNav = m_rootNav->parent();
583       m_invalidEntry=FALSE;
584     }
585 
startClass(const XMLHandlers::Attributes &)586     void startClass(const XMLHandlers::Attributes &)
587     {
588       LayoutDocManager::instance().clear(LayoutDocManager::Class);
589       m_scope="class/";
590       m_part = (int)LayoutDocManager::Class;
591     }
592 
endClass()593     void endClass()
594     {
595       m_scope="";
596       m_part = -1;
597     }
598 
startNamespace(const XMLHandlers::Attributes &)599     void startNamespace(const XMLHandlers::Attributes &)
600     {
601       LayoutDocManager::instance().clear(LayoutDocManager::Namespace);
602       m_scope="namespace/";
603       m_part = (int)LayoutDocManager::Namespace;
604     }
605 
endNamespace()606     void endNamespace()
607     {
608       m_scope="";
609       m_part = -1;
610     }
611 
startConcept(const XMLHandlers::Attributes &)612     void startConcept(const XMLHandlers::Attributes &)
613     {
614       LayoutDocManager::instance().clear(LayoutDocManager::Concept);
615       m_scope="concept/";
616       m_part = (int)LayoutDocManager::Concept;
617     }
618 
endConcept()619     void endConcept()
620     {
621       m_scope="";
622       m_part = -1;
623     }
624 
startFile(const XMLHandlers::Attributes &)625     void startFile(const XMLHandlers::Attributes &)
626     {
627       LayoutDocManager::instance().clear(LayoutDocManager::File);
628       m_scope="file/";
629       m_part = (int)LayoutDocManager::File;
630     }
631 
endFile()632     void endFile()
633     {
634       m_scope="";
635       m_part = -1;
636     }
637 
startGroup(const XMLHandlers::Attributes &)638     void startGroup(const XMLHandlers::Attributes &)
639     {
640       LayoutDocManager::instance().clear(LayoutDocManager::Group);
641       m_scope="group/";
642       m_part = (int)LayoutDocManager::Group;
643     }
644 
endGroup()645     void endGroup()
646     {
647       m_scope="";
648       m_part = -1;
649     }
650 
startDirectory(const XMLHandlers::Attributes &)651     void startDirectory(const XMLHandlers::Attributes &)
652     {
653       LayoutDocManager::instance().clear(LayoutDocManager::Directory);
654       m_scope="directory/";
655       m_part = (int)LayoutDocManager::Directory;
656     }
657 
endDirectory()658     void endDirectory()
659     {
660       m_scope="";
661       m_part = -1;
662     }
663 
startMemberDef(const XMLHandlers::Attributes &)664     void startMemberDef(const XMLHandlers::Attributes &)
665     {
666       m_scope+="memberdef/";
667       if (m_part!=-1)
668       {
669         LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
670                                               new LayoutDocEntrySimple(LayoutDocEntry::MemberDefStart));
671       }
672     }
673 
endMemberDef()674     void endMemberDef()
675     {
676       int i=m_scope.findRev("memberdef/");
677       if (i!=-1)
678       {
679         m_scope=m_scope.left(i);
680         if (m_part!=-1)
681         {
682           LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
683                                               new LayoutDocEntrySimple(LayoutDocEntry::MemberDefEnd));
684         }
685       }
686     }
687 
startMemberDecl(const XMLHandlers::Attributes &)688     void startMemberDecl(const XMLHandlers::Attributes &)
689     {
690       m_scope+="memberdecl/";
691       if (m_part!=-1)
692       {
693         LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
694                                               new LayoutDocEntrySimple(LayoutDocEntry::MemberDeclStart));
695       }
696     }
697 
endMemberDecl()698     void endMemberDecl()
699     {
700       int i=m_scope.findRev("memberdecl/");
701       if (i!=-1)
702       {
703         m_scope=m_scope.left(i);
704         if (m_part!=-1)
705         {
706           LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
707                                               new LayoutDocEntrySimple(LayoutDocEntry::MemberDeclEnd));
708         }
709       }
710     }
711 
712 
713   private:
LayoutParser()714     LayoutParser() { }
~LayoutParser()715    ~LayoutParser() { delete m_rootNav; }
716 
717     QCString m_scope;
718     int m_part = -1;
719     LayoutNavEntry *m_rootNav = 0;
720     bool m_invalidEntry = false;
721     static int m_userGroupCount;
722     const XMLLocator *m_locator = nullptr;
723 };
724 
725 //---------------------------------------------------------------------------------
726 
727 namespace {
728 
729 struct ElementCallbacks
730 {
731   using StartCallback = std::function<void(LayoutParser&,const XMLHandlers::Attributes&)>;
732   using EndCallback   = std::function<void(LayoutParser&)>;
733 
734   StartCallback startCb;
735   EndCallback   endCb;
736 };
737 
startCb(void (LayoutParser::* fn)(const XMLHandlers::Attributes &))738 static ElementCallbacks::StartCallback startCb(void (LayoutParser::*fn)(const XMLHandlers::Attributes &))
739 {
740   return [fn](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(attr); };
741 }
742 
startCb(void (LayoutParser::* fn)(LayoutDocEntry::Kind,const XMLHandlers::Attributes &),LayoutDocEntry::Kind kind)743 static ElementCallbacks::StartCallback startCb(void (LayoutParser::*fn)(LayoutDocEntry::Kind,const XMLHandlers::Attributes &),LayoutDocEntry::Kind kind)
744 {
745   return [fn,kind](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(kind,attr); };
746 }
747 
startCb(void (LayoutParser::* fn)(LayoutDocEntry::Kind,const XMLHandlers::Attributes &,const QCString &),LayoutDocEntry::Kind kind,std::function<QCString ()> title)748 static ElementCallbacks::StartCallback startCb(void (LayoutParser::*fn)(LayoutDocEntry::Kind,const XMLHandlers::Attributes &,const QCString &),
749                                         LayoutDocEntry::Kind kind,
750                                         std::function<QCString()> title
751                                        )
752 {
753   return [fn,kind,title](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(kind,attr,title()); };
754 }
755 
startCb(void (LayoutParser::* fn)(const XMLHandlers::Attributes &,MemberListType,const QCString &,const QCString &),MemberListType type,std::function<QCString ()> title)756 static ElementCallbacks::StartCallback startCb(void (LayoutParser::*fn)(const XMLHandlers::Attributes &,MemberListType,const QCString &,const QCString &),
757                                         MemberListType type,
758                                         std::function<QCString()> title
759                                        )
760 {
761   return [fn,type,title](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(attr,type,title(),QCString()); };
762 }
763 
startCb(void (LayoutParser::* fn)(const XMLHandlers::Attributes &,MemberListType,const QCString &,const QCString &),MemberListType type,std::function<QCString ()> title,std::function<QCString ()> subtitle)764 static ElementCallbacks::StartCallback startCb(void (LayoutParser::*fn)(const XMLHandlers::Attributes &,MemberListType,const QCString &,const QCString &),
765                                         MemberListType type,
766                                         std::function<QCString()> title,
767                                         std::function<QCString()> subtitle
768                                        )
769 {
770   return [fn,type,title,subtitle](LayoutParser &parser,const XMLHandlers::Attributes &attr) { (parser.*fn)(attr,type,title(),subtitle()); };
771 }
772 
773 
endCb(void (LayoutParser::* fn)())774 static ElementCallbacks::EndCallback endCb(void (LayoutParser::*fn)())
775 {
776   return [fn](LayoutParser &parser) { (parser.*fn)(); };
777 }
778 
endCb()779 static ElementCallbacks::EndCallback endCb()
780 {
781   return [](LayoutParser &){};
782 }
783 
784 static const std::map< std::string, ElementCallbacks > g_elementHandlers =
785 {
786   // path/name
787   { "doxygenlayout",                              { startCb(&LayoutParser::startLayout),
788                                                     endCb()
789                                                   } },
790   { "navindex",                                   { startCb(&LayoutParser::startNavIndex),
791                                                     endCb(&LayoutParser::endNavIndex)
792                                                   } },
793   { "navindex/tab",                               { startCb(&LayoutParser::startNavEntry),
794                                                     endCb(&LayoutParser::endNavEntry)
795                                                   } },
796 
797   // class layout handlers
798   { "class",                                      { startCb(&LayoutParser::startClass),
799                                                     endCb(&LayoutParser::endClass)
800                                                   } },
801   { "class/briefdescription",                     { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::BriefDesc),
802                                                     endCb()
803                                                   } },
804   { "class/detaileddescription",                  { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
__anona685d92f0902()805                                                             [](){ return compileOptions(theTranslator->trDetailedDescription()); }),
806                                                     endCb()
807                                                   } },
808   { "class/authorsection",                        { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::AuthorSection),
809                                                     endCb()
810                                                   } },
811   { "class/includes",                             { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassIncludes),
812                                                     endCb()
813                                                   } },
814   { "class/inheritancegraph",                     { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassInheritanceGraph),
815                                                     endCb()
816                                                   } },
817   { "class/collaborationgraph",                   { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassCollaborationGraph),
818                                                     endCb()
819                                                   } },
820   { "class/allmemberslink",                       { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassAllMembersLink),
821                                                     endCb()
822                                                   } },
823   { "class/usedfiles",                            { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::ClassUsedFiles),
824                                                     endCb()
825                                                   } },
826   { "class/memberdecl",                           { startCb(&LayoutParser::startMemberDecl),
827                                                     endCb(&LayoutParser::endMemberDecl)
828                                                   } },
829   { "class/memberdecl/membergroups",              { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::MemberGroups),
830                                                     endCb()
831                                                   } },
832   { "class/memberdecl/nestedclasses",             { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::ClassNestedClasses,
__anona685d92f0a02() 833                                                             []() { return compileOptions(/*default*/        theTranslator->trCompounds(),
834                                                                                          SrcLangExt_VHDL,   theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE),
835                                                                                          SrcLangExt_Fortran,theTranslator->trDataTypes()); }),
836                                                     endCb()
837                                                   } },
838   { "class/memberdecl/services",                  { startCb(&LayoutParser::startMemberDeclEntry,MemberListType_services,
__anona685d92f0b02() 839                                                             []() { return compileOptions(theTranslator->trServices()); }),
840                                                     endCb()
841                                                   } },
842   { "class/memberdecl/interfaces",                { startCb(&LayoutParser::startMemberDeclEntry,MemberListType_interfaces,
__anona685d92f0c02() 843                                                             []() { return compileOptions(theTranslator->trInterfaces()); }),
844                                                     endCb()
845                                                   } },
846   { "class/memberdecl/publictypes",               { startCb(&LayoutParser::startMemberDeclEntry,MemberListType_pubTypes,
__anona685d92f0d02() 847                                                             []() { return compileOptions(theTranslator->trPublicTypes()); }),
848                                                     endCb()
849                                                   } },
850   { "class/memberdecl/publicslots",               { startCb(&LayoutParser::startMemberDeclEntry,MemberListType_pubSlots,
__anona685d92f0e02() 851                                                             []() { return compileOptions(theTranslator->trPublicSlots()); }),
852                                                     endCb()
853                                                   } },
854   { "class/memberdecl/signals",                   { startCb(&LayoutParser::startMemberDeclEntry,MemberListType_signals,
__anona685d92f0f02() 855                                                             []() { return compileOptions(theTranslator->trSignals()); }),
856                                                     endCb()
857                                                   } },
858   { "class/memberdecl/publicmethods",             { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pubMethods,
__anona685d92f1002() 859                                                             []() { return compileOptions(/* default */    theTranslator->trPublicMembers(),
860                                                                                          SrcLangExt_ObjC, theTranslator->trInstanceMethods(),
861                                                                                          SrcLangExt_Slice,theTranslator->trOperations()); }),
862                                                      endCb()
863                                                   } },
864   { "class/memberdecl/publicstaticmethods",       { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pubStaticMethods,
__anona685d92f1102() 865                                                             []() { return compileOptions(/* default */    theTranslator->trStaticPublicMembers(),
866                                                                                          SrcLangExt_ObjC, theTranslator->trClassMethods()); }),
867                                                     endCb()
868                                                   } },
869   { "class/memberdecl/publicattributes",          { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pubAttribs,
__anona685d92f1202() 870                                                             []() { return compileOptions(/* default */    theTranslator->trPublicAttribs(),
871                                                                                          SrcLangExt_Slice,theTranslator->trDataMembers()); }),
872                                                     endCb()
873                                                   } },
874   { "class/memberdecl/publicstaticattributes",    { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pubStaticAttribs,
__anona685d92f1302() 875                                                             []() { return compileOptions(theTranslator->trStaticPublicAttribs()); }),
876                                                     endCb()
877                                                   } },
878   { "class/memberdecl/protectedtypes",            { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_proTypes,
__anona685d92f1402() 879                                                             []() { return compileOptions(theTranslator->trProtectedTypes()); }),
880                                                     endCb()
881                                                   } },
882   { "class/memberdecl/protectedslots",            { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_proSlots,
__anona685d92f1502() 883                                                             []() { return compileOptions(theTranslator->trProtectedSlots()); }),
884                                                     endCb()
885                                                   } },
886   { "class/memberdecl/protectedmethods",          { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_proMethods,
__anona685d92f1602() 887                                                             []() { return compileOptions(theTranslator->trProtectedMembers()); }),
888                                                     endCb()
889                                                   } },
890   { "class/memberdecl/protectedstaticmethods",    { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_proStaticMethods,
__anona685d92f1702() 891                                                             []() { return compileOptions(theTranslator->trStaticProtectedMembers()); }),
892                                                     endCb()
893                                                   } },
894   { "class/memberdecl/protectedattributes",       { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_proAttribs,
__anona685d92f1802() 895                                                             []() { return compileOptions(theTranslator->trProtectedAttribs()); }),
896                                                     endCb()
897                                                   } },
898   { "class/memberdecl/protectedstaticattributes", { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_proStaticAttribs,
__anona685d92f1902() 899                                                             []() { return compileOptions(theTranslator->trStaticProtectedAttribs()); }),
900                                                     endCb()
901                                                   } },
902   { "class/memberdecl/packagetypes",              { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pacTypes,
__anona685d92f1a02() 903                                                             []() { return compileOptions(theTranslator->trPackageTypes()); }),
904                                                     endCb()
905                                                   } },
906   { "class/memberdecl/packagemethods",            { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pacMethods,
__anona685d92f1b02() 907                                                             []() { return compileOptions(theTranslator->trPackageMembers()); }),
908                                                     endCb()
909                                                   } },
910   { "class/memberdecl/packagestaticmethods",      { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pacStaticMethods,
__anona685d92f1c02() 911                                                             []() { return compileOptions(theTranslator->trStaticPackageMembers()); }),
912                                                     endCb()
913                                                   } },
914   { "class/memberdecl/packageattributes",         { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pacAttribs,
__anona685d92f1d02() 915                                                             []() { return compileOptions(theTranslator->trPackageAttribs()); }),
916                                                     endCb()
917                                                   } },
918   { "class/memberdecl/packagestaticattributes",   { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_pacStaticAttribs,
__anona685d92f1e02() 919                                                             []() { return compileOptions(theTranslator->trStaticPackageAttribs()); }),
920                                                     endCb()
921                                                   } },
922   { "class/memberdecl/properties",                { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_properties,
__anona685d92f1f02() 923                                                             []() { return compileOptions(theTranslator->trProperties()); }),
924                                                     endCb()
925                                                   } },
926   { "class/memberdecl/events",                    { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_events,
__anona685d92f2002() 927                                                             []() { return compileOptions(theTranslator->trEvents()); }),
928                                                     endCb()
929                                                   } },
930   { "class/memberdecl/privatetypes",              { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_priTypes,
__anona685d92f2102() 931                                                             []() { return compileOptions(theTranslator->trPrivateTypes()); }),
932                                                     endCb()
933                                                   } },
934   { "class/memberdecl/privateslots",              { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_priSlots,
__anona685d92f2202() 935                                                             []() { return compileOptions(theTranslator->trPrivateSlots()); }),
936                                                     endCb()
937                                                   } },
938   { "class/memberdecl/privatemethods",            { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_priMethods,
__anona685d92f2302() 939                                                             []() { return compileOptions(theTranslator->trPrivateMembers()); }),
940                                                     endCb()
941                                                   } },
942   { "class/memberdecl/privatestaticmethods",      { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_priStaticMethods,
__anona685d92f2402() 943                                                             []() { return compileOptions(theTranslator->trStaticPrivateMembers()); }),
944                                                     endCb()
945                                                   } },
946   { "class/memberdecl/privateattributes",         { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_priAttribs,
__anona685d92f2502() 947                                                             []() { return compileOptions(theTranslator->trPrivateAttribs()); }),
948                                                     endCb()
949                                                   } },
950   { "class/memberdecl/privatestaticattributes",   { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_priStaticAttribs,
__anona685d92f2602() 951                                                             []() { return compileOptions(theTranslator->trStaticPrivateAttribs()); }),
952                                                     endCb()
953                                                   } },
954   { "class/memberdecl/friends",                   { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_friends,
__anona685d92f2702() 955                                                             []() { return compileOptions(theTranslator->trFriends()); }),
956                                                     endCb()
957                                                   } },
958   { "class/memberdecl/related",                   { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_related,
__anona685d92f2802() 959                                                             []() { return compileOptions(theTranslator->trRelatedFunctions()); },
__anona685d92f2902() 960                                                             []() { return compileOptions(theTranslator->trRelatedSubscript()); }),
961                                                     endCb()
962                                                   } },
963   { "class/memberdef",                            { startCb(&LayoutParser::startMemberDef),
964                                                     endCb(&LayoutParser::endMemberDef)
965                                                   } },
966   { "class/memberdef/inlineclasses",              { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ClassInlineClasses,
__anona685d92f2a02() 967                                                             []() { return compileOptions(/* default */      theTranslator->trClassDocumentation(),
968                                                                            SrcLangExt_Fortran,theTranslator->trTypeDocumentation()); }),
969                                                     endCb()
970                                                   } },
971   { "class/memberdef/typedefs",                   { startCb(&LayoutParser::startMemberDefEntry, MemberListType_typedefMembers,
__anona685d92f2b02() 972                                                             []() { return compileOptions(theTranslator->trMemberTypedefDocumentation()); }),
973                                                     endCb()
974                                                   } },
975   { "class/memberdef/enums",                      { startCb(&LayoutParser::startMemberDefEntry, MemberListType_enumMembers,
__anona685d92f2c02() 976                                                             []() { return compileOptions(theTranslator->trMemberEnumerationDocumentation()); }),
977                                                     endCb()
978                                                   } },
979   { "class/memberdef/services",                   { startCb(&LayoutParser::startMemberDefEntry, MemberListType_serviceMembers,
__anona685d92f2d02() 980                                                             []() { return compileOptions(theTranslator->trInterfaces()); }),
981                                                     endCb()
982                                                   } },
983   { "class/memberdef/interfaces",                 { startCb(&LayoutParser::startMemberDefEntry, MemberListType_interfaceMembers,
__anona685d92f2e02() 984                                                             []() { return compileOptions(theTranslator->trInterfaces()); }),
985                                                     endCb()
986                                                   } },
987   { "class/memberdef/constructors",               { startCb(&LayoutParser::startMemberDefEntry, MemberListType_constructors,
__anona685d92f2f02() 988                                                             []() { return compileOptions(theTranslator->trConstructorDocumentation()); }),
989                                                     endCb()
990                                                   } },
991   { "class/memberdef/functions",                  { startCb(&LayoutParser::startMemberDefEntry, MemberListType_functionMembers,
__anona685d92f3002() 992                                                             []() { return compileOptions(/* default */      theTranslator->trMemberFunctionDocumentation(), SrcLangExt_ObjC,   theTranslator->trMethodDocumentation(),
993                                                                            SrcLangExt_Fortran,theTranslator->trMemberFunctionDocumentationFortran(),
994                                                                            SrcLangExt_Slice,  theTranslator->trOperationDocumentation()); }),
995                                                     endCb()
996                                                   } },
997   { "class/memberdef/related",                    { startCb(&LayoutParser::startMemberDefEntry, MemberListType_relatedMembers,
__anona685d92f3102() 998                                                             []() { return compileOptions(theTranslator->trRelatedFunctionDocumentation()); }),
999                                                     endCb()
1000                                                   } },
1001   { "class/memberdef/variables",                  { startCb(&LayoutParser::startMemberDefEntry, MemberListType_variableMembers,
__anona685d92f3202() 1002                                                             []() { return compileOptions(/* default */      theTranslator->trMemberDataDocumentation(),
1003                                                                            SrcLangExt_Slice,  theTranslator->trDataMemberDocumentation()); }),
1004                                                     endCb()
1005                                                   } },
1006   { "class/memberdef/properties",                 { startCb(&LayoutParser::startMemberDefEntry, MemberListType_propertyMembers,
__anona685d92f3302() 1007                                                             []() { return compileOptions(theTranslator->trPropertyDocumentation()); }),
1008                                                     endCb()
1009                                                   } },
1010   { "class/memberdef/events",                     { startCb(&LayoutParser::startMemberDefEntry, MemberListType_eventMembers,
__anona685d92f3402() 1011                                                             []() { return compileOptions(theTranslator->trEventDocumentation()); }),
1012                                                     endCb()
1013                                                   } },
1014 
1015   // concept layout handlers
1016   { "concept",                                    { startCb(&LayoutParser::startConcept),
1017                                                     endCb(&LayoutParser::endConcept)
1018                                                   } },
1019 
1020   { "concept/briefdescription",                   { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc),
1021                                                     endCb()
1022                                                   } },
1023   { "concept/definition",                         { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::ConceptDefinition,
__anona685d92f3502() 1024                                                             []() { return compileOptions(theTranslator->trConceptDefinition()); }),
1025                                                     endCb()
1026                                                   } },
1027   { "concept/includes",                           { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::ClassIncludes),
1028                                                     endCb()
1029                                                   } },
1030   { "concept/sourcelink",                         { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink),
1031                                                     endCb()
1032                                                   } },
1033   { "concept/detaileddescription",                { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
__anona685d92f3602() 1034                                                             []() { return compileOptions(theTranslator->trDetailedDescription()); }),
1035                                                     endCb()
1036                                                   } },
1037   { "concept/authorsection",                      { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection),
1038                                                     endCb()
1039                                                   } },
1040   // namespace layout handlers
1041   { "namespace",                                  { startCb(&LayoutParser::startNamespace),
1042                                                     endCb(&LayoutParser::endNamespace)
1043                                                   } },
1044 
1045   { "namespace/briefdescription",                 { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc),
1046                                                     endCb()
1047                                                   } },
1048   { "namespace/detaileddescription",              { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::DetailedDesc,
__anona685d92f3702() 1049                                                             []() { return compileOptions(theTranslator->trDetailedDescription()); }),
1050                                                     endCb()
1051                                                   } },
1052   { "namespace/authorsection",                    { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection),
1053                                                     endCb()
1054                                                   } },
1055   { "namespace/memberdecl",                       { startCb(&LayoutParser::startMemberDecl),
1056                                                     endCb(&LayoutParser::endMemberDecl)
1057                                                   } },
1058   { "namespace/memberdecl/nestednamespaces",      { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceNestedNamespaces,
__anona685d92f3802() 1059                                                             []() { return compileOptions(/* default */      theTranslator->trNamespaces(),
1060                                                                            SrcLangExt_Java,   theTranslator->trPackages(),
1061                                                                            SrcLangExt_VHDL,   theTranslator->trPackages(),
1062                                                                            SrcLangExt_IDL,    theTranslator->trModules(),
1063                                                                            SrcLangExt_Fortran,theTranslator->trModules(),
1064                                                                            SrcLangExt_Slice,(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1065                                                                                               theTranslator->trModules() :
1066                                                                                               theTranslator->trNamespaces())); }),
1067                                                     endCb()
1068                                                   } },
1069   { "namespace/memberdecl/constantgroups",        { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceNestedConstantGroups,
__anona685d92f3902() 1070                                                             []() { return compileOptions(theTranslator->trConstantGroups()); }),
1071                                                     endCb()
1072                                                   } },
1073   { "namespace/memberdecl/interfaces",            { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceInterfaces,
__anona685d92f3a02() 1074                                                             []() { return compileOptions(theTranslator->trSliceInterfaces()); }),
1075                                                     endCb()
1076                                                   } },
1077   { "namespace/memberdecl/classes",               { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceClasses,
__anona685d92f3b02() 1078                                                             []() { return compileOptions(/* default */      theTranslator->trCompounds(),
1079                                                                            SrcLangExt_VHDL,   theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE),
1080                                                                            SrcLangExt_Fortran,theTranslator->trDataTypes()); }),
1081                                                     endCb()
1082                                                   } },
1083   { "namespace/memberdecl/concepts",              { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceConcepts,
__anona685d92f3c02() 1084                                                             []() { return compileOptions(theTranslator->trConcept(true,false)); }),
1085                                                     endCb()
1086                                                   } },
1087   { "namespace/memberdecl/structs",               { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceStructs,
__anona685d92f3d02() 1088                                                             []() { return compileOptions(theTranslator->trStructs()); }),
1089                                                     endCb()
1090                                                   } },
1091   { "namespace/memberdecl/exceptions",            { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::NamespaceExceptions,
__anona685d92f3e02() 1092                                                             []() { return compileOptions(theTranslator->trExceptions()); }),
1093                                                     endCb()
1094                                                   } },
1095   { "namespace/memberdecl/membergroups",          { startCb(&LayoutParser::startSimpleEntry,LayoutDocEntry::MemberGroups),
1096                                                     endCb()
1097                                                   } },
1098   { "namespace/memberdecl/typedefs",              { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decTypedefMembers,
__anona685d92f3f02() 1099                                                             []() { return compileOptions(theTranslator->trTypedefs()); }),
1100                                                     endCb()
1101                                                   } },
1102   { "namespace/memberdecl/sequences",             { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decSequenceMembers,
__anona685d92f4002() 1103                                                             []() { return compileOptions(theTranslator->trSequences()); }),
1104                                                     endCb()
1105                                                   } },
1106   { "namespace/memberdecl/dictionaries",          { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decDictionaryMembers,
__anona685d92f4102() 1107                                                             []() { return compileOptions(theTranslator->trDictionaries()); }),
1108                                                     endCb()
1109                                                   } },
1110   { "namespace/memberdecl/enums",                 { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decEnumMembers,
__anona685d92f4202() 1111                                                             []() { return compileOptions(theTranslator->trEnumerations()); }),
1112                                                     endCb()
1113                                                   } },
1114   { "namespace/memberdecl/functions",             { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decFuncMembers,
__anona685d92f4302() 1115                                                             []() { return compileOptions(/* default */      theTranslator->trFunctions(),
1116                                                                            SrcLangExt_Fortran,theTranslator->trSubprograms(),
1117                                                                            SrcLangExt_VHDL,   theTranslator->trFunctionAndProc()); }),
1118                                                     endCb()
1119                                                   } },
1120   { "namespace/memberdecl/variables",             { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decVarMembers,
__anona685d92f4402() 1121                                                             []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1122                                                                                               theTranslator->trConstants() :
1123                                                                                               theTranslator->trVariables()); }),
1124                                                     endCb()
1125                                                   } },
1126   { "namespace/memberdef",                        { startCb(&LayoutParser::startMemberDef),
1127                                                     endCb(&LayoutParser::endMemberDef)
1128                                                   } },
1129   { "namespace/memberdef/inlineclasses",          { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::NamespaceInlineClasses,
__anona685d92f4502() 1130                                                             []() { return compileOptions(/* default */      theTranslator->trClassDocumentation(),
1131                                                                            SrcLangExt_Fortran,theTranslator->trTypeDocumentation()); }),
1132                                                     endCb()
1133                                                   } },
1134   { "namespace/memberdef/typedefs",               { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docTypedefMembers,
__anona685d92f4602() 1135                                                             []() { return compileOptions(theTranslator->trTypedefDocumentation()); }),
1136                                                     endCb()
1137                                                   } },
1138   { "namespace/memberdef/sequences",              { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docSequenceMembers,
__anona685d92f4702() 1139                                                             []() { return compileOptions(theTranslator->trSequenceDocumentation()); }),
1140                                                     endCb()
1141                                                   } },
1142   { "namespace/memberdef/dictionaries",           { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docDictionaryMembers,
__anona685d92f4802() 1143                                                             []() { return compileOptions(theTranslator->trDictionaryDocumentation()); }),
1144                                                     endCb()
1145                                                   } },
1146   { "namespace/memberdef/enums",                  { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docEnumMembers,
__anona685d92f4902() 1147                                                             []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); }),
1148                                                     endCb()
1149                                                   } },
1150   { "namespace/memberdef/functions",              { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docFuncMembers,
__anona685d92f4a02() 1151                                                             []() { return compileOptions(/* default */      theTranslator->trFunctionDocumentation(),
1152                                                                            SrcLangExt_Fortran,theTranslator->trSubprogramDocumentation()); }),
1153                                                     endCb()
1154                                                   } },
1155   { "namespace/memberdef/variables",              { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docVarMembers,
__anona685d92f4b02() 1156                                                             []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1157                                                                                               theTranslator->trConstantDocumentation() :
1158                                                                                               theTranslator->trVariableDocumentation()); }),
1159                                                     endCb()
1160                                                   } },
1161 
1162   // file layout handlers
1163   { "file",                                       { startCb(&LayoutParser::startFile),
1164                                                     endCb(&LayoutParser::endFile)
1165                                                   } },
1166 
1167   { "file/briefdescription",                      { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc),
1168                                                     endCb()
1169                                                   } },
1170   { "file/detaileddescription",                   { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
__anona685d92f4c02() 1171                                                             []() { return compileOptions(theTranslator->trDetailedDescription()); }),
1172                                                     endCb()
1173                                                   } },
1174   { "file/authorsection",                         { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection),
1175                                                     endCb()
1176                                                   } },
1177   { "file/includes",                              { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludes),
1178                                                     endCb()
1179                                                   } },
1180   { "file/includegraph",                          { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludeGraph),
1181                                                     endCb()
1182                                                   } },
1183   { "file/includedbygraph",                       { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileIncludedByGraph),
1184                                                     endCb()
1185                                                   } },
1186   { "file/sourcelink",                            { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::FileSourceLink),
1187                                                     endCb()
1188                                                   } },
1189   { "file/memberdecl/membergroups",               { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups),
1190                                                     endCb()
1191                                                   } },
1192   { "file/memberdecl",                            { startCb(&LayoutParser::startMemberDecl),
1193                                                     endCb(&LayoutParser::endMemberDecl)
1194                                                   } },
1195 
1196   { "file/memberdecl/interfaces",                 { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileInterfaces,
__anona685d92f4d02() 1197                                                             []() { return compileOptions(theTranslator->trSliceInterfaces()); }),
1198                                                     endCb()
1199                                                   } },
1200   { "file/memberdecl/classes",                    { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileClasses,
__anona685d92f4e02() 1201                                                             []() { return compileOptions(/* default */      theTranslator->trCompounds(),
1202                                                                                          SrcLangExt_VHDL,   theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE),
1203                                                                                          SrcLangExt_Fortran,theTranslator->trDataTypes()); }),
1204                                                     endCb()
1205                                                   } },
1206   { "file/memberdecl/concepts",                   { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::FileConcepts,
__anona685d92f4f02() 1207                                                             []() { return compileOptions(theTranslator->trConcept(true,false)); }),
1208                                                     endCb()
1209                                                   } },
1210   { "file/memberdecl/structs",                    { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileStructs,
__anona685d92f5002() 1211                                                             []() { return compileOptions(theTranslator->trStructs()); }),
1212                                                     endCb()
1213                                                   } },
1214   { "file/memberdecl/exceptions",                 { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileExceptions,
__anona685d92f5102() 1215                                                             []() { return compileOptions(theTranslator->trExceptions()); }),
1216                                                     endCb()
1217                                                   } },
1218   { "file/memberdecl/namespaces",                 { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileNamespaces,
__anona685d92f5202() 1219                                                             []() { return compileOptions(/* default */      theTranslator->trNamespaces(),
1220                                                                                          SrcLangExt_Java,   theTranslator->trPackages(),
1221                                                                                          SrcLangExt_IDL,    theTranslator->trModules(),
1222                                                                                          SrcLangExt_Fortran,theTranslator->trModules(),
1223                                                                                          SrcLangExt_Slice,  theTranslator->trModules()); }),
1224                                                      endCb()
1225                                                   } },
1226   { "file/memberdecl/constantgroups",             { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileConstantGroups,
__anona685d92f5302() 1227                                                             []() { return compileOptions(theTranslator->trConstantGroups()); }),
1228                                                     endCb()
1229                                                   } },
1230   { "file/memberdecl/defines",                    { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decDefineMembers,
__anona685d92f5402() 1231                                                             []() { return compileOptions(theTranslator->trDefines()); }),
1232                                                     endCb()
1233                                                   } },
1234   { "file/memberdecl/typedefs",                   { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decTypedefMembers,
__anona685d92f5502() 1235                                                             []() { return compileOptions(theTranslator->trTypedefs()); }),
1236                                                     endCb()
1237                                                   } },
1238   { "file/memberdecl/sequences",                  { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decSequenceMembers,
__anona685d92f5602() 1239                                                             []() { return compileOptions(theTranslator->trSequences()); }),
1240                                                     endCb()
1241                                                   } },
1242   { "file/memberdecl/dictionaries",               { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decDictionaryMembers,
__anona685d92f5702() 1243                                                             []() { return compileOptions(theTranslator->trDictionaries()); }),
1244                                                     endCb()
1245                                                   } },
1246   { "file/memberdecl/enums",                      { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decEnumMembers,
__anona685d92f5802() 1247                                                             []() { return compileOptions(theTranslator->trEnumerations()); }),
1248                                                     endCb()
1249                                                   } },
1250   { "file/memberdecl/functions",                  { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decFuncMembers,
__anona685d92f5902() 1251                                                             []() { return compileOptions(/* default */      theTranslator->trFunctions(),
1252                                                                                          SrcLangExt_Fortran,theTranslator->trSubprograms(),
1253                                                                                          SrcLangExt_VHDL,   theTranslator->trFunctionAndProc()); }),
1254                                                     endCb()
1255                                                   } },
1256   { "file/memberdecl/variables",                  { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decVarMembers,
__anona685d92f5a02() 1257                                                             []() { return compileOptions(Config_getBool(OPTIMIZE_OUTPUT_SLICE) ?
1258                                                                                                             theTranslator->trConstants() :
1259                                                                                                             theTranslator->trVariables()); }),
1260                                                     endCb()
1261                                                   } },
1262   { "file/memberdef",                             { startCb(&LayoutParser::startMemberDef),
1263                                                     endCb(&LayoutParser::endMemberDef)
1264                                                   } },
1265 
1266   { "file/memberdef/inlineclasses",               { startCb(&LayoutParser::startSectionEntry,LayoutDocEntry::FileInlineClasses,
__anona685d92f5b02() 1267                                                             []() { return compileOptions(/* default */       theTranslator->trClassDocumentation(),
1268                                                                                          SrcLangExt_Fortran, theTranslator->trTypeDocumentation()); }),
1269                                                     endCb()
1270                                                   } },
1271   { "file/memberdef/defines",                     { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docDefineMembers,
__anona685d92f5c02() 1272                                                             []() { return compileOptions(theTranslator->trDefineDocumentation()); }),
1273                                                     endCb()
1274                                                   } },
1275   { "file/memberdef/typedefs",                    { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docTypedefMembers,
__anona685d92f5d02() 1276                                                             []() { return compileOptions(theTranslator->trTypedefDocumentation()); }),
1277                                                     endCb()
1278                                                   } },
1279   { "file/memberdef/sequences",                   { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docSequenceMembers,
__anona685d92f5e02() 1280                                                             []() { return compileOptions(theTranslator->trSequenceDocumentation()); }),
1281                                                     endCb()
1282                                                   } },
1283   { "file/memberdef/dictionaries",                { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docDictionaryMembers,
__anona685d92f5f02() 1284                                                             []() { return compileOptions(theTranslator->trDictionaryDocumentation()); }),
1285                                                     endCb()
1286                                                   } },
1287   { "file/memberdef/enums",                       { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docEnumMembers,
__anona685d92f6002() 1288                                                             []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); }),
1289                                                     endCb()
1290                                                   } },
1291   { "file/memberdef/functions",                   { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docFuncMembers,
__anona685d92f6102() 1292                                                             []() { return compileOptions(/* default */       theTranslator->trFunctionDocumentation(),
1293                                                                                          SrcLangExt_Fortran, theTranslator->trSubprogramDocumentation()); }),
1294                                                     endCb()
1295                                                   } },
1296   { "file/memberdef/variables",                   { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docVarMembers,
__anona685d92f6202() 1297                                                             []() { return compileOptions(theTranslator->trVariableDocumentation()); }),
1298                                                     endCb()
1299                                                   } },
1300 
1301   // group layout handlers
1302   { "group",                                      { startCb(&LayoutParser::startGroup),
1303                                                     endCb(&LayoutParser::endGroup)
1304                                                   } },
1305   { "group/briefdescription",                     { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc),
1306                                                     endCb()
1307                                                   } },
1308   { "group/detaileddescription",                  { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
__anona685d92f6302() 1309                                                             []() { return compileOptions(theTranslator->trDetailedDescription()); }),
1310                                                     endCb()
1311                                                   } },
1312   { "group/authorsection",                        { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::AuthorSection),
1313                                                     endCb()
1314                                                   } },
1315   { "group/groupgraph",                           { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::GroupGraph),
1316                                                     endCb()
1317                                                   } },
1318   { "group/memberdecl/membergroups",              { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::MemberGroups),
1319                                                     endCb()
1320                                                   } },
1321 
1322   { "group/memberdecl",                           { startCb(&LayoutParser::startMemberDecl),
1323                                                     endCb(&LayoutParser::endMemberDecl)
1324                                                   } },
1325 
1326   { "group/memberdecl/classes",                   { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupClasses,
__anona685d92f6402() 1327                                                             []() { return compileOptions(/* default */       theTranslator->trCompounds(),
1328                                                                                          SrcLangExt_VHDL,    theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE),
1329                                                                                          SrcLangExt_Fortran, theTranslator->trDataTypes()); }),
1330                                                     endCb()
1331                                                   } },
1332   { "group/memberdecl/concepts",                  { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupConcepts,
__anona685d92f6502() 1333                                                             []() { return compileOptions(theTranslator->trConcept(true,false)); }),
1334                                                    endCb()
1335                                                   } },
1336   { "group/memberdecl/namespaces",                { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNamespaces,
__anona685d92f6602() 1337                                                             []() { return compileOptions(/* default */       theTranslator->trNamespaces(),
1338                                                                                          SrcLangExt_Java,    theTranslator->trPackages(),
1339                                                                                          SrcLangExt_Fortran, theTranslator->trModules()); }),
1340                                                     endCb()
1341                                                   } },
1342   { "group/memberdecl/dirs",                      { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupDirs,
__anona685d92f6702() 1343                                                             []() { return compileOptions(theTranslator->trDirectories()); }),
1344                                                     endCb()
1345                                                   } },
1346   { "group/memberdecl/nestedgroups",              { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupNestedGroups,
__anona685d92f6802() 1347                                                             []() { return compileOptions(theTranslator->trModules()); }),
1348                                                     endCb()
1349                                                   } },
1350   { "group/memberdecl/files",                     { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupFiles,
__anona685d92f6902() 1351                                                             []() { return compileOptions(theTranslator->trFile(TRUE,FALSE)); }),
1352                                                     endCb()
1353                                                   } },
1354   { "group/memberdecl/defines",                   { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decDefineMembers,
__anona685d92f6a02() 1355                                                             []() { return compileOptions(theTranslator->trDefines()); }),
1356                                                     endCb()
1357                                                   } },
1358   { "group/memberdecl/typedefs",                  { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decTypedefMembers,
__anona685d92f6b02() 1359                                                             []() { return compileOptions(theTranslator->trTypedefs()); }),
1360                                                     endCb()
1361                                                   } },
1362   { "group/memberdecl/sequences",                 { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decSequenceMembers,
__anona685d92f6c02() 1363                                                             []() { return compileOptions(theTranslator->trSequences()); }),
1364                                                     endCb()
1365                                                   } },
1366   { "group/memberdecl/dictionaries",              { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decDictionaryMembers,
__anona685d92f6d02() 1367                                                             []() { return compileOptions(theTranslator->trDictionaries()); }),
1368                                                     endCb()
1369                                                   } },
1370   { "group/memberdecl/enums",                     { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decEnumMembers,
__anona685d92f6e02() 1371                                                             []() { return compileOptions(theTranslator->trEnumerations()); }),
1372                                                     endCb()
1373                                                   } },
1374   { "group/memberdecl/enumvalues",                { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decEnumValMembers,
__anona685d92f6f02() 1375                                                             []() { return compileOptions(theTranslator->trEnumerationValues()); }),
1376                                                     endCb()
1377                                                   } },
1378   { "group/memberdecl/functions",                 { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decFuncMembers,
__anona685d92f7002() 1379                                                             []() { return compileOptions(/* default */      theTranslator->trFunctions(),
1380                                                                                          SrcLangExt_Fortran,theTranslator->trSubprograms(),
1381                                                                                          SrcLangExt_VHDL,   theTranslator->trFunctionAndProc()); }),
1382                                                     endCb()
1383                                                   } },
1384   { "group/memberdecl/variables",                 { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decVarMembers,
__anona685d92f7102() 1385                                                             []() { return compileOptions(theTranslator->trVariables()); }),
1386                                                     endCb()
1387                                                   } },
1388   { "group/memberdecl/signals",                   { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decSignalMembers,
__anona685d92f7202() 1389                                                             []() { return compileOptions(theTranslator->trSignals()); }),
1390                                                     endCb()
1391                                                   } },
1392   { "group/memberdecl/publicslots",               { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decPubSlotMembers,
__anona685d92f7302() 1393                                                             []() { return compileOptions(theTranslator->trPublicSlots()); }),
1394                                                     endCb()
1395                                                   } },
1396   { "group/memberdecl/protectedslots",            { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decProSlotMembers,
__anona685d92f7402() 1397                                                             []() { return compileOptions(theTranslator->trProtectedSlots()); }),
1398                                                     endCb()
1399                                                   } },
1400   { "group/memberdecl/privateslots",              { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decPriSlotMembers,
__anona685d92f7502() 1401                                                             []() { return compileOptions(theTranslator->trPrivateSlots()); }),
1402                                                     endCb()
1403                                                   } },
1404   { "group/memberdecl/events",                    { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decEventMembers,
__anona685d92f7602() 1405                                                             []() { return compileOptions(theTranslator->trEvents()); }),
1406                                                     endCb()
1407                                                   } },
1408   { "group/memberdecl/properties",                { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decPropMembers,
__anona685d92f7702() 1409                                                             []() { return compileOptions(theTranslator->trProperties()); }),
1410                                                     endCb()
1411                                                   } },
1412   { "group/memberdecl/friends",                   { startCb(&LayoutParser::startMemberDeclEntry, MemberListType_decFriendMembers,
__anona685d92f7802() 1413                                                             []() { return compileOptions(theTranslator->trFriends()); }),
1414                                                     endCb()
1415                                                   } },
1416   { "group/memberdef",                            { startCb(&LayoutParser::startMemberDef),
1417                                                     endCb(&LayoutParser::endMemberDef)
1418                                                   } },
1419 
1420   { "group/memberdef/pagedocs",                   { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::GroupPageDocs),
1421                                                     endCb()
1422                                                   } },
1423   { "group/memberdef/inlineclasses",              { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::GroupInlineClasses,
__anona685d92f7902() 1424                                                             []() { return compileOptions(/* default */      theTranslator->trClassDocumentation(),
1425                                                                                          SrcLangExt_Fortran,theTranslator->trTypeDocumentation()); }),
1426                                                     endCb()
1427                                                   } },
1428   { "group/memberdef/defines",                    { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docDefineMembers,
__anona685d92f7a02() 1429                                                             []() { return compileOptions(theTranslator->trDefineDocumentation()); }),
1430                                                     endCb()
1431                                                   } },
1432   { "group/memberdef/typedefs",                   { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docTypedefMembers,
__anona685d92f7b02() 1433                                                             []() { return compileOptions(theTranslator->trTypedefDocumentation()); }),
1434                                                     endCb()
1435                                                   } },
1436   { "group/memberdef/sequences",                  { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docSequenceMembers,
__anona685d92f7c02() 1437                                                             []() { return compileOptions(theTranslator->trSequenceDocumentation()); }),
1438                                                     endCb()
1439                                                   } },
1440   { "group/memberdef/dictionaries",               { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docDictionaryMembers,
__anona685d92f7d02() 1441                                                             []() { return compileOptions(theTranslator->trDictionaryDocumentation()); }),
1442                                                     endCb()
1443                                                   } },
1444   { "group/memberdef/enums",                      { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docEnumMembers,
__anona685d92f7e02() 1445                                                             []() { return compileOptions(theTranslator->trEnumerationTypeDocumentation()); }),
1446                                                     endCb()
1447                                                   } },
1448   { "group/memberdef/enumvalues",                 { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docEnumValMembers,
__anona685d92f7f02() 1449                                                             []() { return compileOptions(theTranslator->trEnumerationValueDocumentation()); }),
1450                                                     endCb()
1451                                                   } },
1452   { "group/memberdef/functions",                  { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docFuncMembers,
__anona685d92f8002() 1453                                                             []() { return compileOptions(/* default */      theTranslator->trFunctionDocumentation(),
1454                                                                                          SrcLangExt_Fortran,theTranslator->trSubprogramDocumentation()); }),
1455                                                     endCb()
1456                                                   } },
1457   { "group/memberdef/variables",                  { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docVarMembers,
__anona685d92f8102() 1458                                                             []() { return compileOptions(theTranslator->trVariableDocumentation()); }),
1459                                                     endCb()
1460                                                   } },
1461   { "group/memberdef/signals",                    { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docSignalMembers,
__anona685d92f8202() 1462                                                             []() { return compileOptions(theTranslator->trSignals()); }),
1463                                                     endCb()
1464                                                   } },
1465   { "group/memberdef/publicslots",                { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docPubSlotMembers,
__anona685d92f8302() 1466                                                             []() { return compileOptions(theTranslator->trPublicSlots()); }),
1467                                                     endCb()
1468                                                   } },
1469   { "group/memberdef/protectedslots",             { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docProSlotMembers,
__anona685d92f8402() 1470                                                             []() { return compileOptions(theTranslator->trProtectedSlots()); }),
1471                                                     endCb()
1472                                                   } },
1473   { "group/memberdef/privateslots",               { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docPriSlotMembers,
__anona685d92f8502() 1474                                                             []() { return compileOptions(theTranslator->trPrivateSlots()); }),
1475                                                     endCb()
1476                                                   } },
1477   { "group/memberdef/events",                     { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docEventMembers,
__anona685d92f8602() 1478                                                             []() { return compileOptions(theTranslator->trEvents()); }),
1479                                                     endCb()
1480                                                   } },
1481   { "group/memberdef/properties",                 { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docPropMembers,
__anona685d92f8702() 1482                                                             []() { return compileOptions(theTranslator->trProperties()); }),
1483                                                     endCb()
1484                                                   } }, { "group/memberdef/friends",                    { startCb(&LayoutParser::startMemberDefEntry, MemberListType_docFriendMembers,
__anona685d92f8802() 1485                                                             []() { return compileOptions(theTranslator->trFriends()); }),
1486                                                     endCb()
1487                                                   } },
1488 
1489   // directory layout handlers
1490   { "directory",                                  { startCb(&LayoutParser::startDirectory),
1491                                                     endCb(&LayoutParser::endDirectory)
1492                                                   } },
1493 
1494   { "directory/briefdescription",                 { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::BriefDesc),
1495                                                     endCb()
1496                                                   } },
1497   { "directory/detaileddescription",              { startCb(&LayoutParser::startSectionEntry, LayoutDocEntry::DetailedDesc,
__anona685d92f8902() 1498                                                             []() { return compileOptions(theTranslator->trDetailedDescription()); }),
1499                                                     endCb()
1500                                                   } },
1501   { "directory/directorygraph",                   { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirGraph),
1502                                                     endCb()
1503                                                   } },
1504   { "directory/memberdecl",                       { startCb(&LayoutParser::startMemberDecl),
1505                                                     endCb(&LayoutParser::endMemberDecl)
1506                                                   } },
1507 
1508   { "directory/memberdecl/dirs",                  { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirSubDirs),
1509                                                     endCb()
1510                                                   } },
1511   { "directory/memberdecl/files",                 { startCb(&LayoutParser::startSimpleEntry, LayoutDocEntry::DirFiles),
1512                                                     endCb()
1513                                                   } },
1514 
1515 };
1516 
1517 
1518 } // namespace
1519 
startElement(const std::string & name,const XMLHandlers::Attributes & attrib)1520 void LayoutParser::startElement( const std::string &name, const XMLHandlers::Attributes& attrib )
1521 {
1522   //printf("startElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name));
1523   auto it = g_elementHandlers.find(m_scope.str()+name);
1524   if (it!=g_elementHandlers.end())
1525   {
1526     it->second.startCb(*this,attrib);
1527   }
1528   else
1529   {
1530     std::string fileName = m_locator->fileName();
1531     ::warn(fileName.c_str(),m_locator->lineNr(),"Unexpected start tag '%s' found in scope='%s'!\n",
1532         qPrint(name),qPrint(m_scope));
1533   }
1534 }
1535 
endElement(const std::string & name)1536 void LayoutParser::endElement( const std::string &name )
1537 {
1538   //printf("endElement [%s]::[%s]\n",qPrint(m_scope),qPrint(name));
1539   auto it=g_elementHandlers.end();
1540 
1541   if (!m_scope.isEmpty() && m_scope.right(static_cast<uint>(name.length())+1)==name+"/")
1542   { // element ends current scope
1543     it = g_elementHandlers.find(m_scope.left(m_scope.length()-1).str());
1544   }
1545   else // continue with current scope
1546   {
1547     it = g_elementHandlers.find(m_scope.str()+name);
1548   }
1549   if (it!=g_elementHandlers.end())
1550   {
1551     it->second.endCb(*this);
1552   }
1553 }
1554 
1555 //---------------------------------------------------------------------------------
1556 
1557 int LayoutParser::m_userGroupCount=0;
1558 
1559 //---------------------------------------------------------------------------------
1560 
1561 class LayoutDocManager::Private
1562 {
1563   public:
1564     std::array<LayoutDocEntryList,LayoutDocManager::NrParts> docEntries;
1565     LayoutNavEntry *rootNav;
1566 };
1567 
LayoutDocManager()1568 LayoutDocManager::LayoutDocManager() : d(std::make_unique<Private>())
1569 {
1570   d->rootNav = new LayoutNavEntry;
1571 }
1572 
1573 
init()1574 void LayoutDocManager::init()
1575 {
1576   LayoutParser &layoutParser = LayoutParser::instance();
1577   XMLHandlers handlers;
1578   handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1579   handlers.endElement   = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1580   handlers.error        = [&layoutParser](const std::string &fileName,int lineNr,const std::string &msg) { layoutParser.error(fileName,lineNr,msg); };
1581   XMLParser parser(handlers);
1582   layoutParser.setDocumentLocator(&parser);
1583   QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml");
1584   parser.parse("layout_default.xml",layout_default.data(),Debug::isFlagSet(Debug::Lex));
1585 }
1586 
~LayoutDocManager()1587 LayoutDocManager::~LayoutDocManager()
1588 {
1589   delete d->rootNav;
1590 }
1591 
instance()1592 LayoutDocManager & LayoutDocManager::instance()
1593 {
1594   static LayoutDocManager *theInstance = new LayoutDocManager;
1595   return *theInstance;
1596 }
1597 
docEntries(LayoutDocManager::LayoutPart part) const1598 const LayoutDocEntryList &LayoutDocManager::docEntries(LayoutDocManager::LayoutPart part) const
1599 {
1600   return d->docEntries[(int)part];
1601 }
1602 
rootNavEntry() const1603 LayoutNavEntry* LayoutDocManager::rootNavEntry() const
1604 {
1605   return d->rootNav;
1606 }
1607 
addEntry(LayoutDocManager::LayoutPart p,LayoutDocEntry * e)1608 void LayoutDocManager::addEntry(LayoutDocManager::LayoutPart p,LayoutDocEntry *e)
1609 {
1610   d->docEntries[(int)p].push_back(std::unique_ptr<LayoutDocEntry>(e));
1611 }
1612 
clear(LayoutDocManager::LayoutPart p)1613 void LayoutDocManager::clear(LayoutDocManager::LayoutPart p)
1614 {
1615   d->docEntries[(int)p].clear();
1616 }
1617 
parse(const QCString & fileName)1618 void LayoutDocManager::parse(const QCString &fileName)
1619 {
1620   LayoutParser &layoutParser = LayoutParser::instance();
1621   XMLHandlers handlers;
1622   handlers.startElement = [&layoutParser](const std::string &name,const XMLHandlers::Attributes &attrs) { layoutParser.startElement(name,attrs); };
1623   handlers.endElement   = [&layoutParser](const std::string &name) { layoutParser.endElement(name); };
1624   handlers.error        = [&layoutParser](const std::string &fn,int lineNr,const std::string &msg) { layoutParser.error(fn,lineNr,msg); };
1625   XMLParser parser(handlers);
1626   layoutParser.setDocumentLocator(&parser);
1627   parser.parse(fileName.data(),fileToString(fileName).data(),Debug::isFlagSet(Debug::Lex));
1628 }
1629 
1630 //---------------------------------------------------------------------------------
1631 
writeDefaultLayoutFile(const QCString & fileName)1632 void writeDefaultLayoutFile(const QCString &fileName)
1633 {
1634   std::ofstream f;
1635   if (openOutputFile(fileName,f))
1636   {
1637     TextStream t(&f);
1638     QCString layout_default = ResourceMgr::instance().getAsString("layout_default.xml");
1639     t << substitute(layout_default,"$doxygenversion",getDoxygenVersion());
1640   }
1641   else
1642   {
1643     err("Failed to open file %s for writing!\n",qPrint(fileName));
1644     return;
1645   }
1646   f.close();
1647 }
1648 
1649 //----------------------------------------------------------------------------------
1650 
1651 // Convert input to a title.
1652 // The format of input can be a simple title "A title" or in case there are different
1653 // titles for some programming languages they can take the following form:
1654 // "A title|16=Another title|8=Yet Another title"
1655 // where the number is a value of SrcLangExt in decimal notation (i.e. 16=Java, 8=IDL).
extractLanguageSpecificTitle(const QCString & input,SrcLangExt lang)1656 QCString extractLanguageSpecificTitle(const QCString &input,SrcLangExt lang)
1657 {
1658   int i,s=0,e=input.find('|');
1659   if (e==-1) return input; // simple title case
1660   int e1=e;
1661   while (e!=-1) // look for 'number=title' pattern separated by '|'
1662   {
1663     s=e+1;
1664     e=input.find('|',s);
1665     i=input.find('=',s);
1666     assert(i>s);
1667     int key=input.mid(s,i-s).toInt();
1668     if (key==(int)lang) // found matching key
1669     {
1670       if (e==-1) e=input.length();
1671       return input.mid(i+1,e-i-1);
1672     }
1673   }
1674   return input.left(e1); // fallback, no explicit language key found
1675 }
1676 
1677 //----------------------------------------------------------------------------------
1678 
title(SrcLangExt lang) const1679 QCString LayoutDocEntrySection::title(SrcLangExt lang) const
1680 {
1681   return extractLanguageSpecificTitle(m_title,lang);
1682 }
1683 
1684 //----------------------------------------------------------------------------------
1685 
title(SrcLangExt lang) const1686 QCString LayoutDocEntryMemberDecl::title(SrcLangExt lang) const
1687 {
1688   return extractLanguageSpecificTitle(m_title,lang);
1689 }
1690 
subtitle(SrcLangExt lang) const1691 QCString LayoutDocEntryMemberDecl::subtitle(SrcLangExt lang) const
1692 {
1693   return extractLanguageSpecificTitle(m_subscript,lang);
1694 }
1695 
1696 //----------------------------------------------------------------------------------
1697 
title(SrcLangExt lang) const1698 QCString LayoutDocEntryMemberDef::title(SrcLangExt lang) const
1699 {
1700   return extractLanguageSpecificTitle(m_title,lang);
1701 }
1702 
1703 
1704 
1705 
1706