32 #include <qfileinfo.h>
33 #include <qtextstream.h>
36 #include "layout_default.xml.h"
39 #define ADD_OPTION(langId,text) "|"+QCString().setNum(langId)+"="+text
41 #define COMPILE_FOR_1_OPTION(def,langId1,text1) \
42 def+ADD_OPTION(langId1,text1)
44 #define COMPILE_FOR_2_OPTIONS(def,langId1,text1,langId2,text2) \
45 COMPILE_FOR_1_OPTION(def,langId1,text1)+ADD_OPTION(langId2,text2)
47 #define COMPILE_FOR_3_OPTIONS(def,langId1,text1,langId2,text2,langId3,text3) \
48 COMPILE_FOR_2_OPTIONS(def,langId1,text1,langId2,text2)+ADD_OPTION(langId3,text3)
50 #define COMPILE_FOR_4_OPTIONS(def,langId1,text1,langId2,text2,langId3,text3,langId4,text4) \
51 COMPILE_FOR_3_OPTIONS(def,langId1,text1,langId2,text2,langId3,text3)+ADD_OPTION(langId4,text4)
53 static bool elemIsVisible(
const QXmlAttributes &attrib,
bool defVal=TRUE)
55 QCString visible = attrib.value(
"visible").utf8();
56 if (visible.isEmpty())
return defVal;
57 if (visible.at(0)==
'$' && visible.length()>1)
59 QCString
id = visible.mid(1);
60 const ConfigValues::Info *opt = ConfigValues::instance().get(
id);
61 if (opt && opt->type==ConfigValues::Info::Bool)
63 return ConfigValues::instance().*((ConfigValues::InfoBool*)opt)->item;
67 err(
"found unsupported value %s for visible attribute in layout file\n",
71 return visible!=
"no" && visible!=
"0";
77 const char *file)
const
82 for (li.toFirst();(entry=li.current());++li)
86 result = entry->
find(kind,file);
87 if (result)
return result;
88 if (entry->
kind()==kind && (file==0 || entry->
baseFile()==file))
104 else if (url.left(5)==
"@ref " || url.left(5)==
"\\ref ")
109 if (
resolveLink(0,url.mid(5).stripWhiteSpace(),TRUE,&d,anchor))
111 if (d && d->isLinkable())
114 if (!anchor.isEmpty())
123 msg(
"explicit link request to '%s' in layout file '%s' could not be resolved\n",qPrint(url.mid(5)),qPrint(
Config_getString(LAYOUT_FILE)));
156 const QXmlAttributes &attrib);
173 const QXmlAttributes &attrib,
174 const QCString &title);
177 const QCString &title)
194 const QCString &title,
195 const QCString &subtitle);
201 const QCString &ss = QCString()
220 const QXmlAttributes &attrib,
221 const QCString &title);
290 m_sHandler.insert(
"class/detaileddescription",
307 m_sHandler.insert(
"class/memberdecl/membergroups",
309 m_sHandler.insert(
"class/memberdecl/nestedclasses",
316 m_sHandler.insert(
"class/memberdecl/services",
319 m_sHandler.insert(
"class/memberdecl/interfaces",
322 m_sHandler.insert(
"class/memberdecl/publictypes",
325 m_sHandler.insert(
"class/memberdecl/publicslots",
331 m_sHandler.insert(
"class/memberdecl/publicmethods",
338 m_sHandler.insert(
"class/memberdecl/publicstaticmethods",
345 m_sHandler.insert(
"class/memberdecl/publicattributes",
348 m_sHandler.insert(
"class/memberdecl/publicstaticattributes",
351 m_sHandler.insert(
"class/memberdecl/protectedtypes",
354 m_sHandler.insert(
"class/memberdecl/protectedslots",
357 m_sHandler.insert(
"class/memberdecl/protectedmethods",
360 m_sHandler.insert(
"class/memberdecl/protectedstaticmethods",
363 m_sHandler.insert(
"class/memberdecl/protectedattributes",
366 m_sHandler.insert(
"class/memberdecl/protectedstaticattributes",
369 m_sHandler.insert(
"class/memberdecl/packagetypes",
372 m_sHandler.insert(
"class/memberdecl/packagemethods",
375 m_sHandler.insert(
"class/memberdecl/packagestaticmethods",
378 m_sHandler.insert(
"class/memberdecl/packageattributes",
381 m_sHandler.insert(
"class/memberdecl/packagestaticattributes",
384 m_sHandler.insert(
"class/memberdecl/properties",
390 m_sHandler.insert(
"class/memberdecl/privatetypes",
393 m_sHandler.insert(
"class/memberdecl/privateslots",
396 m_sHandler.insert(
"class/memberdecl/privatemethods",
399 m_sHandler.insert(
"class/memberdecl/privatestaticmethods",
402 m_sHandler.insert(
"class/memberdecl/privateattributes",
405 m_sHandler.insert(
"class/memberdecl/privatestaticattributes",
419 m_sHandler.insert(
"class/memberdef/inlineclasses",
434 m_sHandler.insert(
"class/memberdef/interfaces",
437 m_sHandler.insert(
"class/memberdef/constructors",
440 m_sHandler.insert(
"class/memberdef/functions",
451 m_sHandler.insert(
"class/memberdef/variables",
454 m_sHandler.insert(
"class/memberdef/properties",
469 m_sHandler.insert(
"namespace/briefdescription",
471 m_sHandler.insert(
"namespace/detaileddescription",
478 m_sHandler.insert(
"namespace/memberdecl/nestednamespaces",
487 m_sHandler.insert(
"namespace/memberdecl/constantgroups",
490 m_sHandler.insert(
"namespace/memberdecl/classes",
497 m_sHandler.insert(
"namespace/memberdecl/membergroups",
499 m_sHandler.insert(
"namespace/memberdecl/typedefs",
502 m_sHandler.insert(
"namespace/memberdecl/enums",
505 m_sHandler.insert(
"namespace/memberdecl/functions",
513 m_sHandler.insert(
"namespace/memberdecl/variables",
520 m_sHandler.insert(
"namespace/memberdef/inlineclasses",
526 m_sHandler.insert(
"namespace/memberdef/typedefs",
529 m_sHandler.insert(
"namespace/memberdef/enums",
532 m_sHandler.insert(
"namespace/memberdef/functions",
539 m_sHandler.insert(
"namespace/memberdef/variables",
565 m_sHandler.insert(
"file/memberdecl/membergroups",
576 m_sHandler.insert(
"file/memberdecl/namespaces",
584 m_sHandler.insert(
"file/memberdecl/constantgroups",
596 m_sHandler.insert(
"file/memberdecl/functions",
604 m_sHandler.insert(
"file/memberdecl/variables",
612 m_sHandler.insert(
"file/memberdef/inlineclasses",
648 m_sHandler.insert(
"group/detaileddescription",
655 m_sHandler.insert(
"group/memberdecl/membergroups",
666 m_sHandler.insert(
"group/memberdecl/namespaces",
677 m_sHandler.insert(
"group/memberdecl/nestedgroups",
689 m_sHandler.insert(
"group/memberdecl/typedefs",
695 m_sHandler.insert(
"group/memberdecl/enumvalues",
698 m_sHandler.insert(
"group/memberdecl/functions",
706 m_sHandler.insert(
"group/memberdecl/variables",
712 m_sHandler.insert(
"group/memberdecl/publicslots",
715 m_sHandler.insert(
"group/memberdecl/protectedslots",
718 m_sHandler.insert(
"group/memberdecl/privateslots",
724 m_sHandler.insert(
"group/memberdecl/properties",
736 m_sHandler.insert(
"group/memberdef/inlineclasses",
751 m_sHandler.insert(
"group/memberdef/enumvalues",
754 m_sHandler.insert(
"group/memberdef/functions",
761 m_sHandler.insert(
"group/memberdef/variables",
767 m_sHandler.insert(
"group/memberdef/publicslots",
770 m_sHandler.insert(
"group/memberdef/protectedslots",
773 m_sHandler.insert(
"group/memberdef/privateslots",
779 m_sHandler.insert(
"group/memberdef/properties",
793 m_sHandler.insert(
"directory/briefdescription",
795 m_sHandler.insert(
"directory/detaileddescription",
802 m_sHandler.insert(
"directory/memberdecl/dirs",
804 m_sHandler.insert(
"directory/memberdecl/files",
815 if (
m_part!=-1 && isVisible)
823 const QCString &title)
826 QCString userTitle = attrib.value(
"title").utf8();
829 if (userTitle.isEmpty()) userTitle = title;
830 if (
m_part!=-1 && isVisible)
839 const QCString &title,
const QCString &subscript)
843 QCString userTitle = attrib.value(
"title").utf8();
844 QCString userSubscript = attrib.value(
"subtitle").utf8();
845 if (userTitle.isEmpty()) userTitle = title;
846 if (userSubscript.isEmpty()) userSubscript = subscript;
856 const QCString &title,
const QCString &)
858 QCString userTitle = attrib.value(
"title").utf8();
859 if (userTitle.isEmpty()) userTitle = title;
903 static struct NavEntryMap
948 {
"namespacemembers",
981 hasGraphicalHierarchy ?
"inherits" :
"hierarchy"
1050 QString type = attrib.value(
"type");
1051 while (mapping[i].typeStr)
1053 if (mapping[i].typeStr==type)
1055 kind = mapping[i].kind;
1060 if (mapping[i].typeStr==0)
1064 err(
"an entry tag within a navindex has no type attribute! Check your layout file!\n");
1068 err(
"the type '%s' is not supported for the entry tag within a navindex! Check your layout file!\n",type.data());
1073 QCString baseFile = mapping[i].baseFile;
1074 QCString title = attrib.value(
"title").utf8();
1076 if (title.isEmpty())
1078 title = mapping[i].mainName;
1081 title = mapping[i].subName;
1085 QCString intro = attrib.value(
"intro").utf8();
1086 if (intro.isEmpty())
1088 intro = mapping[i].intro;
1090 QCString url = attrib.value(
"url").utf8();
1194 int i=
m_scope.findRev(
"memberdef/");
1218 int i=
m_scope.findRev(
"memberdecl/");
1232 const QString& name,
const QXmlAttributes& attrib )
1242 err(
"Unexpected start tag `%s' found in scope='%s'!\n",
1247 bool endElement(
const QString&,
const QString&,
const QString& name )
1251 if (!
m_scope.isEmpty() &&
m_scope.right(name.length()+1)==name.utf8()+
"/")
1291 bool warning(
const QXmlParseException &exception )
1294 exception.lineNumber(),exception.columnNumber(),
fileName.data(),
1295 exception.message().data());
1298 bool error(
const QXmlParseException &exception )
1300 err(
"at line %d column %d of %s: %s\n",
1301 exception.lineNumber(),exception.columnNumber(),
fileName.data(),
1302 exception.message().data());
1307 err(
"fatal: at line %d column %d of %s: %s\n",
1308 exception.lineNumber(),exception.columnNumber(),
fileName.data(),
1309 exception.message().data());
1345 QXmlInputSource source;
1347 QXmlSimpleReader reader;
1349 reader.setErrorHandler( &errorHandler );
1350 reader.parse( source );
1362 return *theInstance;
1388 QXmlInputSource source( t );
1389 QXmlSimpleReader reader;
1391 reader.setErrorHandler( &errorHandler );
1392 reader.parse( source );
1403 err(
"Failed to open file %s for writing!\n",fileName);
1419 int i,s=0,e=input.find(
'|');
1420 if (e==-1)
return input;
1425 e=input.find(
'|',s);
1426 i=input.find(
'=',s);
1428 int key=input.mid(s,i-s).toInt();
1431 if (e==-1) e=input.length();
1432 return input.mid(i+1,e-i-1);
1435 return input.left(e1);