1 /******************************************************************************
3 * $Id: layout.cpp,v 1.2 2001/03/19 19:27:41 root Exp $
6 * Copyright (C) 1997-2012 by Dimitri van Heesch.
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.
14 * Documents produced by Doxygen are derivative works derived from the
15 * input used in their production; they are not affected by this license.
22 #include "vhdldocgen.h"
30 #include <qfileinfo.h>
31 #include <qtextstream.h>
33 static const char layout_default[] =
34 #include "layout_default.h"
37 #define ADD_OPTION(langId,text) "|"+QCString().setNum(langId)+"="+text
39 #define COMPILE_FOR_1_OPTION(def,langId1,text1) \
40 def+ADD_OPTION(langId1,text1)
42 #define COMPILE_FOR_2_OPTIONS(def,langId1,text1,langId2,text2) \
43 COMPILE_FOR_1_OPTION(def,langId1,text1)+ADD_OPTION(langId2,text2)
45 #define COMPILE_FOR_3_OPTIONS(def,langId1,text1,langId2,text2,langId3,text3) \
46 COMPILE_FOR_2_OPTIONS(def,langId1,text1,langId2,text2)+ADD_OPTION(langId3,text3)
48 #define COMPILE_FOR_4_OPTIONS(def,langId1,text1,langId2,text2,langId3,text3,langId4,text4) \
49 COMPILE_FOR_3_OPTIONS(def,langId1,text1,langId2,text2,langId3,text3)+ADD_OPTION(langId4,text4)
51 static bool elemIsVisible(const QXmlAttributes &attrib,bool defVal=TRUE)
53 QCString visible = convertToQCString(attrib.value("visible"));
54 if (visible.isEmpty()) return defVal;
55 if (visible.at(0)=='$' && visible.length()>1)
57 QCString id = visible.mid(1);
58 ConfigOption *opt = Config::instance()->get(id);
59 if (opt && opt->kind()==ConfigOption::O_Bool)
61 return *((ConfigBool *)opt)->valueRef();
65 err("error: found unsupported value %s for visible attribute in layout file\n",
69 return visible!="no" && visible!="0";
72 //---------------------------------------------------------------------------------
74 LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind,
75 const char *file) const
77 LayoutNavEntry *result=0;
78 QListIterator<LayoutNavEntry> li(m_children);
79 LayoutNavEntry *entry;
80 for (li.toFirst();(entry=li.current());++li)
82 // depth first search, needed to find the entry furthest from the
83 // root in case an entry is in the tree twice
84 result = entry->find(kind,file);
85 if (result) return result;
86 if (entry->kind()==kind && (file==0 || entry->baseFile()==file))
94 QCString LayoutNavEntry::url() const
96 QCString url = baseFile().stripWhiteSpace();
97 if (kind()!=LayoutNavEntry::User)
99 url+=Doxygen::htmlFileExtension;
101 else if (url.left(5)=="@ref " || url.left(5)=="\\ref ")
106 if (resolveLink(0,url.mid(5).stripWhiteSpace(),TRUE,&d,anchor))
108 if (d && d->isLinkable())
110 url=d->getOutputFileBase()+Doxygen::htmlFileExtension;
111 if (!anchor.isEmpty())
120 msg("warning: explicit link request to '%s' in layout file '%s' could not be resolved\n",qPrint(url.mid(5)),qPrint(Config_getString("LAYOUT_FILE")));
123 //printf("LayoutNavEntry::url()=%s\n",url.data());
127 //---------------------------------------------------------------------------------
129 class LayoutParser : public QXmlDefaultHandler
132 class StartElementHandler
134 typedef void (LayoutParser::*Handler)(const QXmlAttributes &attrib);
136 StartElementHandler(LayoutParser *parent, Handler h)
137 : m_parent(parent), m_handler(h) {}
138 virtual ~StartElementHandler() {}
139 virtual void operator()(const QXmlAttributes &attrib)
141 (m_parent->*m_handler)(attrib);
144 StartElementHandler() : m_parent(0), m_handler(0) {}
146 LayoutParser *m_parent;
150 class StartElementHandlerKind : public StartElementHandler
152 typedef void (LayoutParser::*Handler)(LayoutDocEntry::Kind kind,
153 const QXmlAttributes &attrib);
155 StartElementHandlerKind(LayoutParser *parent, LayoutDocEntry::Kind k,Handler h)
156 : m_parent(parent), m_kind(k), m_handler(h) {}
157 void operator()(const QXmlAttributes &attrib)
159 (m_parent->*m_handler)(m_kind,attrib);
162 LayoutParser *m_parent;
163 LayoutDocEntry::Kind m_kind;
167 class StartElementHandlerSection : public StartElementHandler
169 typedef void (LayoutParser::*Handler)(LayoutDocEntry::Kind kind,
170 const QXmlAttributes &attrib,
171 const QCString &title);
173 StartElementHandlerSection(LayoutParser *parent, LayoutDocEntry::Kind k,Handler h,
174 const QCString &title)
175 : m_parent(parent), m_kind(k), m_handler(h), m_title(title) {}
176 void operator()(const QXmlAttributes &attrib)
178 (m_parent->*m_handler)(m_kind,attrib,m_title);
181 LayoutParser *m_parent;
182 LayoutDocEntry::Kind m_kind;
187 class StartElementHandlerMember : public StartElementHandler
189 typedef void (LayoutParser::*Handler)(const QXmlAttributes &attrib,
190 MemberList::ListType type,
191 const QCString &title,
192 const QCString &subtitle);
194 StartElementHandlerMember(LayoutParser *parent,
196 MemberList::ListType type,
198 const QCString &ss = QCString()
200 : m_parent(parent), m_handler(h), m_type(type),
201 m_title(tl), m_subscript(ss) {}
202 void operator()(const QXmlAttributes &attrib)
204 (m_parent->*m_handler)(attrib,m_type,m_title,m_subscript);
207 LayoutParser *m_parent;
209 MemberList::ListType m_type;
211 QCString m_subscript;
214 class StartElementHandlerNavEntry : public StartElementHandler
216 typedef void (LayoutParser::*Handler)(LayoutNavEntry::Kind kind,
217 const QXmlAttributes &attrib,
218 const QCString &title);
220 StartElementHandlerNavEntry(LayoutParser *parent,
221 LayoutNavEntry::Kind kind,
225 : m_parent(parent), m_kind(kind), m_handler(h), m_title(tl) {}
226 void operator()(const QXmlAttributes &attrib)
228 (m_parent->*m_handler)(m_kind,attrib,m_title);
231 LayoutParser *m_parent;
232 LayoutNavEntry::Kind m_kind;
237 class EndElementHandler
239 typedef void (LayoutParser::*Handler)();
241 EndElementHandler(LayoutParser *parent, Handler h) : m_parent(parent), m_handler(h) {}
242 void operator()() { (m_parent->*m_handler)(); }
244 LayoutParser *m_parent;
250 static LayoutParser &instance()
252 static LayoutParser *theInstance = new LayoutParser;
257 m_sHandler.setAutoDelete(TRUE);
258 m_eHandler.setAutoDelete(TRUE);
259 m_part = -1; // invalid
262 //bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
263 //bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
264 //bool javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
266 // start & end handlers
267 m_sHandler.insert("doxygenlayout",
268 new StartElementHandler(this,&LayoutParser::startLayout));
269 m_eHandler.insert("doxygenlayout",
270 new EndElementHandler(this,&LayoutParser::endLayout));
272 // class layout handlers
273 m_sHandler.insert("navindex",
274 new StartElementHandler(this,&LayoutParser::startNavIndex));
275 m_sHandler.insert("navindex/tab",
276 new StartElementHandler(this,&LayoutParser::startNavEntry));
277 m_eHandler.insert("navindex/tab",
278 new EndElementHandler(this,&LayoutParser::endNavEntry));
279 m_eHandler.insert("navindex",
280 new EndElementHandler(this,&LayoutParser::endNavIndex));
282 // class layout handlers
283 m_sHandler.insert("class",
284 new StartElementHandler(this,&LayoutParser::startClass));
285 m_sHandler.insert("class/briefdescription",
286 new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry));
287 m_sHandler.insert("class/detaileddescription",
288 new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry,
289 theTranslator->trDetailedDescription()));
290 m_sHandler.insert("class/authorsection",
291 new StartElementHandlerKind(this,LayoutDocEntry::AuthorSection,&LayoutParser::startSimpleEntry));
292 m_sHandler.insert("class/includes",
293 new StartElementHandlerKind(this,LayoutDocEntry::ClassIncludes,&LayoutParser::startSimpleEntry));
294 m_sHandler.insert("class/inheritancegraph",
295 new StartElementHandlerKind(this,LayoutDocEntry::ClassInheritanceGraph,&LayoutParser::startSimpleEntry));
296 m_sHandler.insert("class/collaborationgraph",
297 new StartElementHandlerKind(this,LayoutDocEntry::ClassCollaborationGraph,&LayoutParser::startSimpleEntry));
298 m_sHandler.insert("class/allmemberslink",
299 new StartElementHandlerKind(this,LayoutDocEntry::ClassAllMembersLink,&LayoutParser::startSimpleEntry));
300 m_sHandler.insert("class/usedfiles",
301 new StartElementHandlerKind(this,LayoutDocEntry::ClassUsedFiles,&LayoutParser::startSimpleEntry));
302 m_sHandler.insert("class/memberdecl",
303 new StartElementHandler(this,&LayoutParser::startMemberDecl));
304 m_sHandler.insert("class/memberdecl/membergroups",
305 new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry));
306 m_sHandler.insert("class/memberdecl/nestedclasses",
307 new StartElementHandlerSection(this,LayoutDocEntry::ClassNestedClasses,&LayoutParser::startSectionEntry,
308 COMPILE_FOR_2_OPTIONS(
309 theTranslator->trCompounds(),
310 SrcLangExt_VHDL,VhdlDocGen::trVhdlType(VhdlDocGen::ENTITY,FALSE),
311 SrcLangExt_Fortran,theTranslator->trDataTypes()
313 m_sHandler.insert("class/memberdecl/publictypes",
314 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
315 MemberList::pubTypes,theTranslator->trPublicTypes()));
316 m_sHandler.insert("class/memberdecl/publicslots",
317 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
318 MemberList::pubSlots,theTranslator->trPublicSlots()));
319 m_sHandler.insert("class/memberdecl/signals",
320 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
321 MemberList::signals,theTranslator->trSignals()));
322 m_sHandler.insert("class/memberdecl/publicmethods",
323 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
324 MemberList::pubMethods,
325 COMPILE_FOR_1_OPTION(
326 theTranslator->trPublicMembers(),
327 SrcLangExt_ObjC,theTranslator->trInstanceMethods()
329 m_sHandler.insert("class/memberdecl/publicstaticmethods",
330 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
331 MemberList::pubStaticMethods,
332 COMPILE_FOR_1_OPTION(
333 theTranslator->trStaticPublicMembers(),
334 SrcLangExt_ObjC,theTranslator->trClassMethods()
336 m_sHandler.insert("class/memberdecl/publicattributes",
337 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
338 MemberList::pubAttribs,theTranslator->trPublicAttribs()));
339 m_sHandler.insert("class/memberdecl/publicstaticattributes",
340 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
341 MemberList::pubStaticAttribs,theTranslator->trStaticPublicAttribs()));
342 m_sHandler.insert("class/memberdecl/protectedtypes",
343 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
344 MemberList::proTypes,theTranslator->trProtectedTypes()));
345 m_sHandler.insert("class/memberdecl/protectedslots",
346 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
347 MemberList::proSlots,theTranslator->trProtectedSlots()));
348 m_sHandler.insert("class/memberdecl/protectedmethods",
349 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
350 MemberList::proMethods,theTranslator->trProtectedMembers()));
351 m_sHandler.insert("class/memberdecl/protectedstaticmethods",
352 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
353 MemberList::proStaticMethods,theTranslator->trStaticProtectedMembers()));
354 m_sHandler.insert("class/memberdecl/protectedattributes",
355 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
356 MemberList::proAttribs,theTranslator->trProtectedAttribs()));
357 m_sHandler.insert("class/memberdecl/protectedstaticattributes",
358 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
359 MemberList::proStaticAttribs,theTranslator->trStaticProtectedAttribs()));
360 m_sHandler.insert("class/memberdecl/packagetypes",
361 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
362 MemberList::pacTypes,theTranslator->trPackageTypes()));
363 m_sHandler.insert("class/memberdecl/packagemethods",
364 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
365 MemberList::pacMethods,theTranslator->trPackageMembers()));
366 m_sHandler.insert("class/memberdecl/packagestaticmethods",
367 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
368 MemberList::pacStaticMethods,theTranslator->trStaticPackageMembers()));
369 m_sHandler.insert("class/memberdecl/packageattributes",
370 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
371 MemberList::pacAttribs,theTranslator->trPackageAttribs()));
372 m_sHandler.insert("class/memberdecl/packagestaticattributes",
373 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
374 MemberList::pacStaticAttribs,theTranslator->trStaticPackageAttribs()));
375 m_sHandler.insert("class/memberdecl/properties",
376 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
377 MemberList::properties,theTranslator->trProperties()));
378 m_sHandler.insert("class/memberdecl/events",
379 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
380 MemberList::events,theTranslator->trEvents()));
381 m_sHandler.insert("class/memberdecl/privatetypes",
382 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
383 MemberList::priTypes,theTranslator->trPrivateTypes()));
384 m_sHandler.insert("class/memberdecl/privateslots",
385 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
386 MemberList::priSlots,theTranslator->trPrivateSlots()));
387 m_sHandler.insert("class/memberdecl/privatemethods",
388 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
389 MemberList::priMethods,theTranslator->trPrivateMembers()));
390 m_sHandler.insert("class/memberdecl/privatestaticmethods",
391 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
392 MemberList::priStaticMethods,theTranslator->trStaticPrivateMembers()));
393 m_sHandler.insert("class/memberdecl/privateattributes",
394 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
395 MemberList::priAttribs,theTranslator->trPrivateAttribs()));
396 m_sHandler.insert("class/memberdecl/privatestaticattributes",
397 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
398 MemberList::priStaticAttribs,theTranslator->trStaticPrivateAttribs()));
399 m_sHandler.insert("class/memberdecl/friends",
400 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
401 MemberList::friends,theTranslator->trFriends()));
402 m_sHandler.insert("class/memberdecl/related",
403 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
404 MemberList::related,theTranslator->trRelatedFunctions(),
405 theTranslator->trRelatedSubscript()));
406 m_eHandler.insert("class/memberdecl",
407 new EndElementHandler(this,&LayoutParser::endMemberDecl));
408 m_sHandler.insert("class/memberdef",
409 new StartElementHandler(this,&LayoutParser::startMemberDef));
410 m_sHandler.insert("class/memberdef/inlineclasses",
411 new StartElementHandlerSection(this,LayoutDocEntry::ClassInlineClasses,&LayoutParser::startSectionEntry,
412 COMPILE_FOR_1_OPTION(
413 theTranslator->trClassDocumentation(),
414 SrcLangExt_Fortran,theTranslator->trTypeDocumentation()
416 m_sHandler.insert("class/memberdef/typedefs",
417 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
418 MemberList::typedefMembers,theTranslator->trMemberTypedefDocumentation()));
419 m_sHandler.insert("class/memberdef/enums",
420 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
421 MemberList::enumMembers,theTranslator->trMemberEnumerationDocumentation()));
422 m_sHandler.insert("class/memberdef/constructors",
423 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
424 MemberList::constructors,theTranslator->trConstructorDocumentation()));
425 m_sHandler.insert("class/memberdef/functions",
426 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
427 MemberList::functionMembers,
428 COMPILE_FOR_2_OPTIONS(
429 theTranslator->trMemberFunctionDocumentation(),
430 SrcLangExt_ObjC,theTranslator->trMethodDocumentation(),
431 SrcLangExt_Fortran,theTranslator->trMemberFunctionDocumentationFortran()
433 m_sHandler.insert("class/memberdef/related",
434 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
435 MemberList::relatedMembers,theTranslator->trRelatedFunctionDocumentation()));
436 m_sHandler.insert("class/memberdef/variables",
437 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
438 MemberList::variableMembers,theTranslator->trMemberDataDocumentation()));
439 m_sHandler.insert("class/memberdef/properties",
440 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
441 MemberList::propertyMembers,theTranslator->trPropertyDocumentation()));
442 m_sHandler.insert("class/memberdef/events",
443 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
444 MemberList::eventMembers,theTranslator->trEventDocumentation()));
445 m_eHandler.insert("class/memberdef",
446 new EndElementHandler(this,&LayoutParser::endMemberDef));
447 m_eHandler.insert("class",
448 new EndElementHandler(this,&LayoutParser::endClass));
451 // namespace layout handlers
452 m_sHandler.insert("namespace",
453 new StartElementHandler(this,&LayoutParser::startNamespace));
454 m_sHandler.insert("namespace/briefdescription",
455 new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry));
456 m_sHandler.insert("namespace/detaileddescription",
457 new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry,
458 theTranslator->trDetailedDescription()));
459 m_sHandler.insert("namespace/authorsection",
460 new StartElementHandlerKind(this,LayoutDocEntry::AuthorSection,&LayoutParser::startSimpleEntry));
461 m_sHandler.insert("namespace/memberdecl",
462 new StartElementHandler(this,&LayoutParser::startMemberDecl));
463 m_sHandler.insert("namespace/memberdecl/nestednamespaces",
464 new StartElementHandlerSection(this,LayoutDocEntry::NamespaceNestedNamespaces,&LayoutParser::startSectionEntry,
465 COMPILE_FOR_3_OPTIONS(
466 theTranslator->trNamespaces(),
467 SrcLangExt_Java,theTranslator->trPackages(),
468 SrcLangExt_VHDL,theTranslator->trPackages(),
469 SrcLangExt_Fortran,theTranslator->trModules()
471 m_sHandler.insert("namespace/memberdecl/classes",
472 new StartElementHandlerSection(this,LayoutDocEntry::NamespaceClasses,&LayoutParser::startSectionEntry,
473 COMPILE_FOR_2_OPTIONS(
474 theTranslator->trCompounds(),
475 SrcLangExt_VHDL,VhdlDocGen::trVhdlType(VhdlDocGen::ENTITY,FALSE),
476 SrcLangExt_Fortran,theTranslator->trDataTypes()
478 m_sHandler.insert("namespace/memberdecl/membergroups",
479 new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry));
480 m_sHandler.insert("namespace/memberdecl/typedefs",
481 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
482 MemberList::decTypedefMembers,theTranslator->trTypedefs()));
483 m_sHandler.insert("namespace/memberdecl/enums",
484 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
485 MemberList::decEnumMembers,theTranslator->trEnumerations()));
486 m_sHandler.insert("namespace/memberdecl/functions",
487 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
488 MemberList::decFuncMembers,
489 COMPILE_FOR_2_OPTIONS(
490 theTranslator->trFunctions(),
491 SrcLangExt_Fortran,theTranslator->trSubprograms(),
492 SrcLangExt_VHDL,VhdlDocGen::trFunctionAndProc()
494 m_sHandler.insert("namespace/memberdecl/variables",
495 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
496 MemberList::decVarMembers,theTranslator->trVariables()));
497 m_eHandler.insert("namespace/memberdecl",
498 new EndElementHandler(this,&LayoutParser::endMemberDecl));
499 m_sHandler.insert("namespace/memberdef",
500 new StartElementHandler(this,&LayoutParser::startMemberDef));
501 m_sHandler.insert("namespace/memberdef/inlineclasses",
502 new StartElementHandlerSection(this,LayoutDocEntry::NamespaceInlineClasses,&LayoutParser::startSectionEntry,
503 COMPILE_FOR_1_OPTION(
504 theTranslator->trClassDocumentation(),
505 SrcLangExt_Fortran,theTranslator->trTypeDocumentation()
507 m_sHandler.insert("namespace/memberdef/typedefs",
508 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
509 MemberList::docTypedefMembers,theTranslator->trTypedefDocumentation()));
510 m_sHandler.insert("namespace/memberdef/enums",
511 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
512 MemberList::docEnumMembers,theTranslator->trEnumerationTypeDocumentation()));
513 m_sHandler.insert("namespace/memberdef/functions",
514 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
515 MemberList::docFuncMembers,
516 COMPILE_FOR_1_OPTION(
517 theTranslator->trFunctionDocumentation(),
518 SrcLangExt_Fortran,theTranslator->trSubprogramDocumentation()
520 m_sHandler.insert("namespace/memberdef/variables",
521 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
522 MemberList::docVarMembers,theTranslator->trVariableDocumentation()));
523 m_eHandler.insert("namespace/memberdef",
524 new EndElementHandler(this,&LayoutParser::endMemberDef));
525 m_eHandler.insert("namespace",
526 new EndElementHandler(this,&LayoutParser::endNamespace));
528 // file layout handlers
529 m_sHandler.insert("file",
530 new StartElementHandler(this,&LayoutParser::startFile));
531 m_sHandler.insert("file/briefdescription",
532 new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry));
533 m_sHandler.insert("file/detaileddescription",
534 new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry,
535 theTranslator->trDetailedDescription()));
536 m_sHandler.insert("file/authorsection",
537 new StartElementHandlerKind(this,LayoutDocEntry::AuthorSection,&LayoutParser::startSimpleEntry));
538 m_sHandler.insert("file/includes",
539 new StartElementHandlerKind(this,LayoutDocEntry::FileIncludes,&LayoutParser::startSimpleEntry));
540 m_sHandler.insert("file/includegraph",
541 new StartElementHandlerKind(this,LayoutDocEntry::FileIncludeGraph,&LayoutParser::startSimpleEntry));
542 m_sHandler.insert("file/includedbygraph",
543 new StartElementHandlerKind(this,LayoutDocEntry::FileIncludedByGraph,&LayoutParser::startSimpleEntry));
544 m_sHandler.insert("file/sourcelink",
545 new StartElementHandlerKind(this,LayoutDocEntry::FileSourceLink,&LayoutParser::startSimpleEntry));
546 m_sHandler.insert("file/memberdecl/membergroups",
547 new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry));
548 m_sHandler.insert("file/memberdecl",
549 new StartElementHandler(this,&LayoutParser::startMemberDecl));
550 m_sHandler.insert("file/memberdecl/classes",
551 new StartElementHandlerSection(this,LayoutDocEntry::FileClasses,&LayoutParser::startSectionEntry,
552 COMPILE_FOR_2_OPTIONS(
553 theTranslator->trCompounds(),
554 SrcLangExt_VHDL,VhdlDocGen::trVhdlType(VhdlDocGen::ENTITY,FALSE),
555 SrcLangExt_Fortran,theTranslator->trDataTypes()
557 m_sHandler.insert("file/memberdecl/namespaces",
558 new StartElementHandlerSection(this,LayoutDocEntry::FileNamespaces,&LayoutParser::startSectionEntry,
559 COMPILE_FOR_2_OPTIONS(
560 theTranslator->trNamespaces(),
561 SrcLangExt_Java,theTranslator->trPackages(),
562 SrcLangExt_Fortran,theTranslator->trModules()
564 m_sHandler.insert("file/memberdecl/defines",
565 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
566 MemberList::decDefineMembers,theTranslator->trDefines()));
567 m_sHandler.insert("file/memberdecl/typedefs",
568 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
569 MemberList::decTypedefMembers,theTranslator->trTypedefs()));
570 m_sHandler.insert("file/memberdecl/enums",
571 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
572 MemberList::decEnumMembers,theTranslator->trEnumerations()));
573 m_sHandler.insert("file/memberdecl/functions",
574 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
575 MemberList::decFuncMembers,
576 COMPILE_FOR_2_OPTIONS(
577 theTranslator->trFunctions(),
578 SrcLangExt_Fortran,theTranslator->trSubprograms(),
579 SrcLangExt_VHDL,VhdlDocGen::trFunctionAndProc()
581 m_sHandler.insert("file/memberdecl/variables",
582 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
583 MemberList::decVarMembers,theTranslator->trVariables()));
585 m_eHandler.insert("file/memberdecl",
586 new EndElementHandler(this,&LayoutParser::endMemberDecl));
587 m_sHandler.insert("file/memberdef",
588 new StartElementHandler(this,&LayoutParser::startMemberDef));
589 m_sHandler.insert("file/memberdef/inlineclasses",
590 new StartElementHandlerSection(this,LayoutDocEntry::FileInlineClasses,&LayoutParser::startSectionEntry,
591 COMPILE_FOR_1_OPTION(
592 theTranslator->trClassDocumentation(),
593 SrcLangExt_Fortran,theTranslator->trTypeDocumentation()
595 m_sHandler.insert("file/memberdef/defines",
596 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
597 MemberList::docDefineMembers,theTranslator->trDefineDocumentation()));
598 m_sHandler.insert("file/memberdef/typedefs",
599 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
600 MemberList::docTypedefMembers,theTranslator->trTypedefDocumentation()));
601 m_sHandler.insert("file/memberdef/enums",
602 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
603 MemberList::docEnumMembers,
604 theTranslator->trEnumerationTypeDocumentation()));
605 m_sHandler.insert("file/memberdef/functions",
606 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
607 MemberList::docFuncMembers,
608 COMPILE_FOR_1_OPTION(
609 theTranslator->trFunctionDocumentation(),
610 SrcLangExt_Fortran,theTranslator->trSubprogramDocumentation()
612 m_sHandler.insert("file/memberdef/variables",
613 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
614 MemberList::docVarMembers,theTranslator->trVariableDocumentation()));
615 m_eHandler.insert("file/memberdef",
616 new EndElementHandler(this,&LayoutParser::endMemberDef));
617 m_eHandler.insert("file",
618 new EndElementHandler(this,&LayoutParser::endFile));
620 // group layout handlers
621 m_sHandler.insert("group",
622 new StartElementHandler(this,&LayoutParser::startGroup));
623 m_sHandler.insert("group/briefdescription",
624 new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry));
625 m_sHandler.insert("group/detaileddescription",
626 new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry,
627 theTranslator->trDetailedDescription()));
628 m_sHandler.insert("group/authorsection",
629 new StartElementHandlerKind(this,LayoutDocEntry::AuthorSection,&LayoutParser::startSimpleEntry));
630 m_sHandler.insert("group/groupgraph",
631 new StartElementHandlerKind(this,LayoutDocEntry::GroupGraph,&LayoutParser::startSimpleEntry));
632 m_sHandler.insert("group/memberdecl/membergroups",
633 new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry));
634 m_sHandler.insert("group/memberdecl",
635 new StartElementHandler(this,&LayoutParser::startMemberDecl));
636 m_sHandler.insert("group/memberdecl/classes",
637 new StartElementHandlerSection(this,LayoutDocEntry::GroupClasses,&LayoutParser::startSectionEntry,
638 COMPILE_FOR_2_OPTIONS(
639 theTranslator->trCompounds(),
640 SrcLangExt_VHDL,VhdlDocGen::trVhdlType(VhdlDocGen::ENTITY,FALSE),
641 SrcLangExt_Fortran,theTranslator->trDataTypes()
643 m_sHandler.insert("group/memberdecl/namespaces",
644 new StartElementHandlerSection(this,LayoutDocEntry::GroupNamespaces,&LayoutParser::startSectionEntry,
645 COMPILE_FOR_2_OPTIONS(
646 theTranslator->trNamespaces(),
647 SrcLangExt_Java,theTranslator->trPackages(),
648 SrcLangExt_Fortran,theTranslator->trModules()
650 m_sHandler.insert("group/memberdecl/dirs",
651 new StartElementHandlerSection(this,LayoutDocEntry::GroupDirs,&LayoutParser::startSectionEntry,
652 theTranslator->trDirectories()
654 m_sHandler.insert("group/memberdecl/nestedgroups",
655 new StartElementHandlerSection(this,LayoutDocEntry::GroupNestedGroups,&LayoutParser::startSectionEntry,
656 theTranslator->trModules()
658 m_sHandler.insert("group/memberdecl/files",
659 new StartElementHandlerSection(this,LayoutDocEntry::GroupFiles,&LayoutParser::startSectionEntry,
660 theTranslator->trFile(TRUE,FALSE)
663 m_sHandler.insert("group/memberdecl/defines",
664 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
665 MemberList::decDefineMembers,theTranslator->trDefines()));
666 m_sHandler.insert("group/memberdecl/typedefs",
667 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
668 MemberList::decTypedefMembers,theTranslator->trTypedefs()));
669 m_sHandler.insert("group/memberdecl/enums",
670 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
671 MemberList::decEnumMembers,theTranslator->trEnumerations()));
672 m_sHandler.insert("group/memberdecl/enumvalues",
673 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
674 MemberList::decEnumValMembers,theTranslator->trEnumerationValues()));
675 m_sHandler.insert("group/memberdecl/functions",
676 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
677 MemberList::decFuncMembers,
678 COMPILE_FOR_2_OPTIONS(
679 theTranslator->trFunctions(),
680 SrcLangExt_Fortran,theTranslator->trSubprograms(),
681 SrcLangExt_VHDL,VhdlDocGen::trFunctionAndProc()
683 m_sHandler.insert("group/memberdecl/variables",
684 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
685 MemberList::decVarMembers,theTranslator->trVariables()));
686 m_sHandler.insert("group/memberdecl/signals",
687 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
688 MemberList::decSignalMembers,theTranslator->trSignals()));
689 m_sHandler.insert("group/memberdecl/publicslots",
690 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
691 MemberList::decPubSlotMembers,theTranslator->trPublicSlots()));
692 m_sHandler.insert("group/memberdecl/protectedslots",
693 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
694 MemberList::decProSlotMembers,theTranslator->trProtectedSlots()));
695 m_sHandler.insert("group/memberdecl/privateslots",
696 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
697 MemberList::decPriSlotMembers,theTranslator->trPrivateSlots()));
698 m_sHandler.insert("group/memberdecl/events",
699 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
700 MemberList::decEventMembers,theTranslator->trEvents()));
701 m_sHandler.insert("group/memberdecl/properties",
702 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
703 MemberList::decPropMembers,theTranslator->trProperties()));
704 m_sHandler.insert("group/memberdecl/friends",
705 new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry,
706 MemberList::decFriendMembers,theTranslator->trFriends()));
707 m_eHandler.insert("group/memberdecl",
708 new EndElementHandler(this,&LayoutParser::endMemberDecl));
709 m_sHandler.insert("group/memberdef",
710 new StartElementHandler(this,&LayoutParser::startMemberDef));
711 m_sHandler.insert("group/memberdef/pagedocs",
712 new StartElementHandlerKind(this,LayoutDocEntry::GroupPageDocs,&LayoutParser::startSimpleEntry));
713 m_sHandler.insert("group/memberdef/inlineclasses",
714 new StartElementHandlerSection(this,LayoutDocEntry::GroupInlineClasses,&LayoutParser::startSectionEntry,
715 COMPILE_FOR_1_OPTION(
716 theTranslator->trClassDocumentation(),
717 SrcLangExt_Fortran,theTranslator->trTypeDocumentation()
719 m_sHandler.insert("group/memberdef/defines",
720 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
721 MemberList::docDefineMembers,theTranslator->trDefineDocumentation()));
722 m_sHandler.insert("group/memberdef/typedefs",
723 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
724 MemberList::docTypedefMembers,theTranslator->trTypedefDocumentation()));
725 m_sHandler.insert("group/memberdef/enums",
726 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
727 MemberList::docEnumMembers,theTranslator->trEnumerationTypeDocumentation()));
728 m_sHandler.insert("group/memberdef/enumvalues",
729 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
730 MemberList::docEnumValMembers,theTranslator->trEnumerationValueDocumentation()));
731 m_sHandler.insert("group/memberdef/functions",
732 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
733 MemberList::docFuncMembers,
734 COMPILE_FOR_1_OPTION(
735 theTranslator->trFunctionDocumentation(),
736 SrcLangExt_Fortran,theTranslator->trSubprogramDocumentation()
738 m_sHandler.insert("group/memberdef/variables",
739 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
740 MemberList::docVarMembers,theTranslator->trVariableDocumentation()));
741 m_sHandler.insert("group/memberdef/signals",
742 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
743 MemberList::docSignalMembers,theTranslator->trSignals()));
744 m_sHandler.insert("group/memberdef/publicslots",
745 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
746 MemberList::docPubSlotMembers,theTranslator->trPublicSlots()));
747 m_sHandler.insert("group/memberdef/protectedslots",
748 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
749 MemberList::docProSlotMembers,theTranslator->trProtectedSlots()));
750 m_sHandler.insert("group/memberdef/privateslots",
751 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
752 MemberList::docPriSlotMembers,theTranslator->trPrivateSlots()));
753 m_sHandler.insert("group/memberdef/events",
754 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
755 MemberList::docEventMembers,theTranslator->trEvents()));
756 m_sHandler.insert("group/memberdef/properties",
757 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
758 MemberList::docPropMembers,theTranslator->trProperties()));
759 m_sHandler.insert("group/memberdef/friends",
760 new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry,
761 MemberList::docFriendMembers,theTranslator->trFriends()));
762 m_eHandler.insert("group/memberdef",
763 new EndElementHandler(this,&LayoutParser::endMemberDef));
764 m_eHandler.insert("group",
765 new EndElementHandler(this,&LayoutParser::endGroup));
767 // directory layout handlers
768 m_sHandler.insert("directory",
769 new StartElementHandler(this,&LayoutParser::startDirectory));
770 m_sHandler.insert("directory/briefdescription",
771 new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry));
772 m_sHandler.insert("directory/detaileddescription",
773 new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry,
774 theTranslator->trDetailedDescription()));
775 m_sHandler.insert("directory/directorygraph",
776 new StartElementHandlerKind(this,LayoutDocEntry::DirGraph,&LayoutParser::startSimpleEntry));
777 m_sHandler.insert("directory/memberdecl",
778 new StartElementHandler(this,&LayoutParser::startMemberDecl));
779 m_sHandler.insert("directory/memberdecl/dirs",
780 new StartElementHandlerKind(this,LayoutDocEntry::DirSubDirs,&LayoutParser::startSimpleEntry));
781 m_sHandler.insert("directory/memberdecl/files",
782 new StartElementHandlerKind(this,LayoutDocEntry::DirFiles,&LayoutParser::startSimpleEntry));
783 m_eHandler.insert("directory/memberdecl",
784 new EndElementHandler(this,&LayoutParser::endMemberDecl));
785 m_eHandler.insert("directory",
786 new EndElementHandler(this,&LayoutParser::endDirectory));
789 void startSimpleEntry(LayoutDocEntry::Kind k,const QXmlAttributes &attrib)
791 bool isVisible = elemIsVisible(attrib);
792 if (m_part!=-1 && isVisible)
794 LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
795 new LayoutDocEntrySimple(k));
799 void startSectionEntry(LayoutDocEntry::Kind k,const QXmlAttributes &attrib,
800 const QCString &title)
802 bool isVisible = elemIsVisible(attrib);
803 QCString userTitle = convertToQCString(attrib.value("title"));
804 //printf("startSectionEntry: title='%s' userTitle='%s'\n",
805 // title.data(),userTitle.data());
806 if (userTitle.isEmpty()) userTitle = title;
807 if (m_part!=-1 && isVisible)
809 LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
810 new LayoutDocEntrySection(k,userTitle));
815 void startMemberDeclEntry(const QXmlAttributes &attrib,MemberList::ListType type,
816 const QCString &title,const QCString &subscript)
818 //QCString visible = convertToQCString(attrib.value("visible"));
819 //bool isVisible = visible.isEmpty() || (visible!="no" && visible!="0");
820 QCString userTitle = convertToQCString(attrib.value("title"));
821 QCString userSubscript = convertToQCString(attrib.value("subtitle"));
822 if (userTitle.isEmpty()) userTitle = title;
823 if (userSubscript.isEmpty()) userSubscript = subscript;
824 //printf("memberdecl: %s\n",userTitle.data());
825 if (m_part!=-1 /*&& isVisible*/)
827 LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
828 new LayoutDocEntryMemberDecl(type,userTitle,userSubscript));
832 void startMemberDefEntry(const QXmlAttributes &attrib,MemberList::ListType type,
833 const QCString &title,const QCString &)
835 QCString userTitle = convertToQCString(attrib.value("title"));
836 if (userTitle.isEmpty()) userTitle = title;
837 //printf("memberdef: %s\n",userTitle.data());
838 if (m_part!=-1 /*&& isVisible*/)
840 LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
841 new LayoutDocEntryMemberDef(type,userTitle));
845 void startLayout(const QXmlAttributes &)
853 void startNavIndex(const QXmlAttributes &)
856 m_rootNav = LayoutDocManager::instance().rootNavEntry();
857 if (m_rootNav) m_rootNav->clear();
863 if (m_rootNav && !m_rootNav->find(LayoutNavEntry::MainPage))
865 // no MainPage node... add one as the first item of the root node...
866 new LayoutNavEntry(m_rootNav,LayoutNavEntry::MainPage, TRUE,
867 /*Config_getBool("GENERATE_TREEVIEW") ? "main" :*/ "index",
868 theTranslator->trMainPage(),TRUE);
872 void startNavEntry(const QXmlAttributes &attrib)
874 static bool javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
875 static bool fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
876 static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
877 static bool hasGraphicalHierarchy = Config_getBool("HAVE_DOT") &&
878 Config_getBool("GRAPHICAL_HIERARCHY");
879 static bool extractAll = Config_getBool("EXTRACT_ALL");
880 static struct NavEntryMap
882 const char *typeStr; // type attribute name in the XML file
883 LayoutNavEntry::Kind kind; // corresponding enum name
884 QCString mainName; // default title for an item if it has children
885 QCString subName; // optional name for an item if it is rendered as a child
886 QCString intro; // introduction text to be put on the index page
887 QCString baseFile; // base name of the file containing the index page
891 LayoutNavEntry::MainPage,
892 theTranslator->trMainPage(),
898 LayoutNavEntry::Pages,
899 theTranslator->trRelatedPages(),
901 theTranslator->trRelatedPagesDescription(),
905 LayoutNavEntry::Modules,
906 theTranslator->trModules(),
908 theTranslator->trModulesDescription(),
912 LayoutNavEntry::Namespaces,
913 javaOpt || vhdlOpt ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModules() : theTranslator->trNamespaces(),
914 javaOpt || vhdlOpt ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
915 javaOpt || vhdlOpt ? theTranslator->trPackageListDescription() : fortranOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
919 LayoutNavEntry::NamespaceList,
920 javaOpt || vhdlOpt ? theTranslator->trPackages() : fortranOpt ? theTranslator->trModulesList() : theTranslator->trNamespaceList(),
922 javaOpt || vhdlOpt ? theTranslator->trPackageListDescription() : fortranOpt ? theTranslator->trModulesListDescription(extractAll) : theTranslator->trNamespaceListDescription(extractAll),
925 { "namespacemembers",
926 LayoutNavEntry::NamespaceMembers,
927 javaOpt || vhdlOpt ? theTranslator->trPackageMembers() : fortranOpt ? theTranslator->trModulesMembers() : theTranslator->trNamespaceMembers(),
929 fortranOpt ? theTranslator->trModulesMemberDescription(extractAll) : theTranslator->trNamespaceMemberDescription(extractAll),
933 LayoutNavEntry::ClassIndex,
934 fortranOpt ? theTranslator->trDataTypes() : vhdlOpt ? VhdlDocGen::trDesignUnits() : theTranslator->trCompoundIndex(),
940 LayoutNavEntry::Classes,
941 fortranOpt ? theTranslator->trCompoundListFortran() : vhdlOpt ? VhdlDocGen::trDesignUnitList() : theTranslator->trClasses(),
942 theTranslator->trCompoundList(),
943 fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? VhdlDocGen::trDesignUnitListDescription() : theTranslator->trCompoundListDescription(),
947 LayoutNavEntry::ClassList,
948 fortranOpt ? theTranslator->trCompoundListFortran() : vhdlOpt ? VhdlDocGen::trDesignUnitList() : theTranslator->trCompoundList(),
950 fortranOpt ? theTranslator->trCompoundListDescriptionFortran() : vhdlOpt ? VhdlDocGen::trDesignUnitListDescription() : theTranslator->trCompoundListDescription(),
954 LayoutNavEntry::ClassHierarchy,
955 vhdlOpt ? VhdlDocGen::trDesignUnitHierarchy() : theTranslator->trClassHierarchy(),
957 theTranslator->trClassHierarchyDescription(),
958 hasGraphicalHierarchy ? "inherits" : "hierarchy"
961 LayoutNavEntry::ClassMembers,
962 fortranOpt ? theTranslator->trCompoundMembersFortran() : vhdlOpt ? VhdlDocGen::trDesignUnitMembers() : theTranslator->trCompoundMembers(),
964 fortranOpt ? theTranslator->trCompoundMembersDescriptionFortran(extractAll) : theTranslator->trCompoundMembersDescription(extractAll),
968 LayoutNavEntry::Files,
969 theTranslator->trFile(TRUE,FALSE),
970 theTranslator->trFileList(),
971 theTranslator->trFileListDescription(extractAll),
975 LayoutNavEntry::FileList,
976 theTranslator->trFileList(),
978 theTranslator->trFileListDescription(extractAll),
982 LayoutNavEntry::FileGlobals,
983 theTranslator->trFileMembers(),
985 theTranslator->trFileMembersDescription(extractAll),
989 // LayoutNavEntry::Dirs,
990 // theTranslator->trDirectories(),
992 // theTranslator->trDirDescription(),
996 LayoutNavEntry::Examples,
997 theTranslator->trExamples(),
999 theTranslator->trExamplesDescription(),
1003 LayoutNavEntry::User,
1010 LayoutNavEntry::UserGroup,
1017 (LayoutNavEntry::Kind)0,
1024 LayoutNavEntry::Kind kind;
1025 // find type in the table
1027 QString type = attrib.value("type");
1028 while (mapping[i].typeStr)
1030 if (mapping[i].typeStr==type)
1032 kind = mapping[i].kind;
1037 if (mapping[i].typeStr==0)
1041 err("error: an entry tag within a navindex has no type attribute! Check your layout file!\n");
1045 err("error: the type '%s' is not supported for the entry tag within a navindex! Check your layout file!\n",type.data());
1047 m_invalidEntry=TRUE;
1050 QCString baseFile = mapping[i].baseFile;
1051 QCString title = convertToQCString(attrib.value("title"));
1052 bool isVisible = elemIsVisible(attrib);
1053 if (title.isEmpty()) // use default title
1055 title = mapping[i].mainName; // use title for main row
1056 if (m_rootNav!=LayoutDocManager::instance().rootNavEntry() && !mapping[i].subName.isEmpty())
1058 title = mapping[i].subName; // if this is a child of another row, use the subName if available
1059 // this is mainly done to get compatible naming with older versions.
1062 QCString intro = convertToQCString(attrib.value("intro"));
1063 if (intro.isEmpty()) // use default intro text
1065 intro = mapping[i].intro;
1067 QCString url = convertToQCString(attrib.value("url"));
1068 if (mapping[i].kind==LayoutNavEntry::User && !url.isEmpty())
1072 else if (kind==LayoutNavEntry::UserGroup)
1074 baseFile+=QCString().sprintf("%d",m_userGroupCount++);
1076 // create new item and make it the new root
1077 m_rootNav = new LayoutNavEntry(m_rootNav,kind,kind==LayoutNavEntry::MainPage?TRUE:isVisible,baseFile,title,intro);
1082 // set the root back to the parent
1083 if (m_rootNav && !m_invalidEntry) m_rootNav = m_rootNav->parent();
1084 m_invalidEntry=FALSE;
1087 void startClass(const QXmlAttributes &)
1089 LayoutDocManager::instance().clear(LayoutDocManager::Class);
1091 m_part = (int)LayoutDocManager::Class;
1100 void startNamespace(const QXmlAttributes &)
1102 LayoutDocManager::instance().clear(LayoutDocManager::Namespace);
1103 m_scope="namespace/";
1104 m_part = (int)LayoutDocManager::Namespace;
1113 void startFile(const QXmlAttributes &)
1115 LayoutDocManager::instance().clear(LayoutDocManager::File);
1117 m_part = (int)LayoutDocManager::File;
1126 void startGroup(const QXmlAttributes &)
1128 LayoutDocManager::instance().clear(LayoutDocManager::Group);
1130 m_part = (int)LayoutDocManager::Group;
1139 void startDirectory(const QXmlAttributes &)
1141 LayoutDocManager::instance().clear(LayoutDocManager::Directory);
1142 m_scope="directory/";
1143 m_part = (int)LayoutDocManager::Directory;
1152 void startMemberDef(const QXmlAttributes &)
1154 m_scope+="memberdef/";
1157 LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
1158 new LayoutDocEntrySimple(LayoutDocEntry::MemberDefStart));
1164 int i=m_scope.findRev("memberdef/");
1167 m_scope=m_scope.left(i);
1170 LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
1171 new LayoutDocEntrySimple(LayoutDocEntry::MemberDefEnd));
1176 void startMemberDecl(const QXmlAttributes &)
1178 m_scope+="memberdecl/";
1181 LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
1182 new LayoutDocEntrySimple(LayoutDocEntry::MemberDeclStart));
1186 void endMemberDecl()
1188 int i=m_scope.findRev("memberdecl/");
1191 m_scope=m_scope.left(i);
1194 LayoutDocManager::instance().addEntry((LayoutDocManager::LayoutPart)m_part,
1195 new LayoutDocEntrySimple(LayoutDocEntry::MemberDeclEnd));
1200 // reimplemented from QXmlDefaultHandler
1201 bool startElement( const QString&, const QString&,
1202 const QString& name, const QXmlAttributes& attrib )
1204 //printf("startElement [%s]::[%s]\n",m_scope.data(),name.data());
1205 StartElementHandler *handler = m_sHandler[m_scope+name.utf8()];
1212 err("error: Unexpected start tag `%s' found in scope='%s'!\n",
1213 name.data(),m_scope.data());
1217 bool endElement( const QString&, const QString&, const QString& name )
1219 //printf("endElement [%s]::[%s]\n",m_scope.data(),name.data());
1220 EndElementHandler *handler;
1221 if (!m_scope.isEmpty() && m_scope.right(name.length()+1)==name.utf8()+"/")
1222 { // element ends current scope
1223 handler = m_eHandler[m_scope.left(m_scope.length()-1)];
1225 else // continue with current scope
1227 handler = m_eHandler[m_scope+name.utf8()];
1235 bool startDocument()
1241 LayoutParser() : m_sHandler(163), m_eHandler(17), m_invalidEntry(FALSE) { }
1243 QDict<StartElementHandler> m_sHandler;
1244 QDict<EndElementHandler> m_eHandler;
1247 LayoutNavEntry *m_rootNav;
1248 bool m_invalidEntry;
1249 static int m_userGroupCount;
1252 int LayoutParser::m_userGroupCount=0;
1254 //---------------------------------------------------------------------------------
1256 class LayoutErrorHandler : public QXmlErrorHandler
1259 LayoutErrorHandler(const char *fn) : fileName(fn) {}
1260 bool warning( const QXmlParseException &exception )
1262 err("warning: at line %d column %d of %s: %s\n",
1263 exception.lineNumber(),exception.columnNumber(),fileName.data(),
1264 exception.message().data());
1267 bool error( const QXmlParseException &exception )
1269 err("error: at line %d column %d of %s: %s\n",
1270 exception.lineNumber(),exception.columnNumber(),fileName.data(),
1271 exception.message().data());
1274 bool fatalError( const QXmlParseException &exception )
1276 err("fatal error: at line %d column %d of %s: %s\n",
1277 exception.lineNumber(),exception.columnNumber(),fileName.data(),
1278 exception.message().data());
1281 QString errorString() { return ""; }
1288 //---------------------------------------------------------------------------------
1290 class LayoutDocManager::Private
1293 QList<LayoutDocEntry> docEntries[LayoutDocManager::NrParts];
1294 LayoutNavEntry *rootNav;
1297 LayoutDocManager::LayoutDocManager()
1301 for (i=0;i<LayoutDocManager::NrParts;i++)
1303 d->docEntries[i].setAutoDelete(TRUE);
1305 d->rootNav = new LayoutNavEntry;
1306 LayoutParser::instance().init();
1310 void LayoutDocManager::init()
1312 // parse the default layout
1313 LayoutErrorHandler errorHandler( "layout_default.xml" );
1314 QXmlInputSource source;
1315 source.setData( layout_default );
1316 QXmlSimpleReader reader;
1317 reader.setContentHandler( &LayoutParser::instance() );
1318 reader.setErrorHandler( &errorHandler );
1319 reader.parse( source );
1322 LayoutDocManager::~LayoutDocManager()
1328 LayoutDocManager & LayoutDocManager::instance()
1330 static LayoutDocManager *theInstance = new LayoutDocManager;
1331 return *theInstance;
1334 const QList<LayoutDocEntry> &LayoutDocManager::docEntries(LayoutDocManager::LayoutPart part) const
1336 return d->docEntries[(int)part];
1339 LayoutNavEntry* LayoutDocManager::rootNavEntry() const
1344 void LayoutDocManager::addEntry(LayoutDocManager::LayoutPart p,LayoutDocEntry *e)
1346 d->docEntries[(int)p].append(e);
1349 void LayoutDocManager::clear(LayoutDocManager::LayoutPart p)
1351 d->docEntries[(int)p].clear();
1354 void LayoutDocManager::parse(QTextStream &t,const char *fileName)
1356 LayoutErrorHandler errorHandler(fileName);
1357 QXmlInputSource source( t );
1358 QXmlSimpleReader reader;
1359 reader.setContentHandler( &LayoutParser::instance() );
1360 reader.setErrorHandler( &errorHandler );
1361 reader.parse( source );
1364 //---------------------------------------------------------------------------------
1366 void writeDefaultLayoutFile(const char *fileName)
1369 if (!f.open(IO_WriteOnly))
1371 err("Failed to open file %s for writing!\n",fileName);
1375 t << layout_default;
1378 //----------------------------------------------------------------------------------
1380 // Convert input to a title.
1381 // The format of input can be a simple title "A title" or in case there are different
1382 // titles for some programming languages they can take the following form:
1383 // "A title|16=Another title|8=Yet Another title"
1384 // where the number is a value of SrcLangExt in decimal notation (i.e. 16=Java, 8=IDL).
1385 QCString extractLanguageSpecificTitle(const QCString &input,SrcLangExt lang)
1387 int i,s=0,e=input.find('|');
1388 if (e==-1) return input; // simple title case
1390 while (e!=-1) // look for 'number=title' pattern separated by '|'
1393 e=input.find('|',s);
1394 i=input.find('=',s);
1396 int key=input.mid(s,i-s).toInt();
1397 if (key==(int)lang) // found matching key
1399 if (e==-1) e=input.length();
1400 return input.mid(i+1,e-i-1);
1403 return input.left(e1); // fallback, no explicit language key found
1406 //----------------------------------------------------------------------------------
1408 QCString LayoutDocEntrySection::title(SrcLangExt lang) const
1410 return extractLanguageSpecificTitle(m_title,lang);
1413 //----------------------------------------------------------------------------------
1415 QCString LayoutDocEntryMemberDecl::title(SrcLangExt lang) const
1417 return extractLanguageSpecificTitle(m_title,lang);
1420 QCString LayoutDocEntryMemberDecl::subtitle(SrcLangExt lang) const
1422 return extractLanguageSpecificTitle(m_subscript,lang);
1425 //----------------------------------------------------------------------------------
1427 QCString LayoutDocEntryMemberDef::title(SrcLangExt lang) const
1429 return extractLanguageSpecificTitle(m_title,lang);