diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2016-01-17 12:06:16 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2016-01-17 15:04:33 (GMT) |
commit | a93ec7221d1a258f0268e0c081782478372efe0b (patch) | |
tree | 5f7e41dd02582a699a6f6f6540c463c5d168983e /src/htmlgen.cpp | |
parent | 4dfc5887660284b345eb93b6c07dc1f91e780fac (diff) | |
download | Doxygen-a93ec7221d1a258f0268e0c081782478372efe0b.zip Doxygen-a93ec7221d1a258f0268e0c081782478372efe0b.tar.gz Doxygen-a93ec7221d1a258f0268e0c081782478372efe0b.tar.bz2 |
Changed configuration mechanism to directly access options in order to improve performance
Diffstat (limited to 'src/htmlgen.cpp')
-rw-r--r-- | src/htmlgen.cpp | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 9e02dee..239a9fe 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -74,7 +74,7 @@ static void writeClientSearchBox(FTextStream &t,const char *relPath) static void writeServerSearchBox(FTextStream &t,const char *relPath,bool highlightSearch) { - static bool externalSearch = Config_getBool("EXTERNAL_SEARCH"); + static bool externalSearch = Config_getBool(EXTERNAL_SEARCH); t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n"; t << " <div class=\"left\">\n"; t << " <form id=\"FSearchBox\" action=\"" << relPath; @@ -228,21 +228,21 @@ static QCString substituteHtmlKeywords(const QCString &s, QCString mathJaxJs; QCString extraCssText; - static QCString projectName = Config_getString("PROJECT_NAME"); - static bool timeStamp = Config_getBool("HTML_TIMESTAMP"); - static bool treeView = Config_getBool("GENERATE_TREEVIEW"); - static bool searchEngine = Config_getBool("SEARCHENGINE"); - static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH"); - static bool mathJax = Config_getBool("USE_MATHJAX"); - static QCString mathJaxFormat = Config_getEnum("MATHJAX_FORMAT"); - static bool disableIndex = Config_getBool("DISABLE_INDEX"); + static QCString projectName = Config_getString(PROJECT_NAME); + static bool timeStamp = Config_getBool(HTML_TIMESTAMP); + static bool treeView = Config_getBool(GENERATE_TREEVIEW); + static bool searchEngine = Config_getBool(SEARCHENGINE); + static bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); + static bool mathJax = Config_getBool(USE_MATHJAX); + static QCString mathJaxFormat = Config_getEnum(MATHJAX_FORMAT); + static bool disableIndex = Config_getBool(DISABLE_INDEX); static bool hasProjectName = !projectName.isEmpty(); - static bool hasProjectNumber = !Config_getString("PROJECT_NUMBER").isEmpty(); - static bool hasProjectBrief = !Config_getString("PROJECT_BRIEF").isEmpty(); - static bool hasProjectLogo = !Config_getString("PROJECT_LOGO").isEmpty(); + static bool hasProjectNumber = !Config_getString(PROJECT_NUMBER).isEmpty(); + static bool hasProjectBrief = !Config_getString(PROJECT_BRIEF).isEmpty(); + static bool hasProjectLogo = !Config_getString(PROJECT_LOGO).isEmpty(); static bool titleArea = (hasProjectName || hasProjectBrief || hasProjectLogo || (disableIndex && searchEngine)); - cssFile = Config_getString("HTML_STYLESHEET"); + cssFile = Config_getString(HTML_STYLESHEET); if (cssFile.isEmpty()) { cssFile = "doxygen.css"; @@ -261,7 +261,7 @@ static QCString substituteHtmlKeywords(const QCString &s, } extraCssText = ""; - extraCssFile = Config_getList("HTML_EXTRA_STYLESHEET"); + extraCssFile = Config_getList(HTML_EXTRA_STYLESHEET); for (uint i=0; i<extraCssFile.count(); ++i) { QCString fileName(extraCssFile.at(i)); @@ -277,7 +277,7 @@ static QCString substituteHtmlKeywords(const QCString &s, if (timeStamp) { - generatedBy = theTranslator->trGeneratedAt(dateToString(TRUE), convertToHtml(Config_getString("PROJECT_NAME"))); + generatedBy = theTranslator->trGeneratedAt(dateToString(TRUE), convertToHtml(Config_getString(PROJECT_NAME))); } else { @@ -332,7 +332,7 @@ static QCString substituteHtmlKeywords(const QCString &s, if (mathJax) { - QCString path = Config_getString("MATHJAX_RELPATH"); + QCString path = Config_getString(MATHJAX_RELPATH); if (path.isEmpty() || path.left(2)=="..") // relative path { path.prepend(relPath); @@ -340,7 +340,7 @@ static QCString substituteHtmlKeywords(const QCString &s, mathJaxJs = "<script type=\"text/x-mathjax-config\">\n" " MathJax.Hub.Config({\n" " extensions: [\"tex2jax.js\""; - QStrList &mathJaxExtensions = Config_getList("MATHJAX_EXTENSIONS"); + QStrList &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS); const char *s = mathJaxExtensions.first(); while (s) { @@ -365,9 +365,9 @@ static QCString substituteHtmlKeywords(const QCString &s, // first substitute generic keywords QCString result = substituteKeywords(s,title, - convertToHtml(Config_getString("PROJECT_NAME")), - convertToHtml(Config_getString("PROJECT_NUMBER")), - convertToHtml(Config_getString("PROJECT_BRIEF"))); + convertToHtml(Config_getString(PROJECT_NAME)), + convertToHtml(Config_getString(PROJECT_NUMBER)), + convertToHtml(Config_getString(PROJECT_BRIEF))); // additional HTML only keywords result = substitute(result,"$navpath",navPath); @@ -422,7 +422,7 @@ void HtmlCodeGenerator::setRelativePath(const QCString &path) void HtmlCodeGenerator::codify(const char *str) { - static int tabSize = Config_getInt("TAB_SIZE"); + static int tabSize = Config_getInt(TAB_SIZE); if (str && m_streamSet) { const char *p=str; @@ -671,7 +671,7 @@ void HtmlCodeGenerator::writeCodeAnchor(const char *anchor) HtmlGenerator::HtmlGenerator() : OutputGenerator() { - dir=Config_getString("HTML_OUTPUT"); + dir=Config_getString(HTML_OUTPUT); m_emptySection=FALSE; } @@ -682,7 +682,7 @@ HtmlGenerator::~HtmlGenerator() void HtmlGenerator::init() { - QCString dname=Config_getString("HTML_OUTPUT"); + QCString dname=Config_getString(HTML_OUTPUT); QDir d(dname); if (!d.exists() && !d.mkdir(dname)) { @@ -690,9 +690,9 @@ void HtmlGenerator::init() exit(1); } //writeLogo(dname); - if (!Config_getString("HTML_HEADER").isEmpty()) + if (!Config_getString(HTML_HEADER).isEmpty()) { - g_header=fileToString(Config_getString("HTML_HEADER")); + g_header=fileToString(Config_getString(HTML_HEADER)); //printf("g_header='%s'\n",g_header.data()); } else @@ -700,9 +700,9 @@ void HtmlGenerator::init() g_header = ResourceMgr::instance().getAsString("header.html"); } - if (!Config_getString("HTML_FOOTER").isEmpty()) + if (!Config_getString(HTML_FOOTER).isEmpty()) { - g_footer=fileToString(Config_getString("HTML_FOOTER")); + g_footer=fileToString(Config_getString(HTML_FOOTER)); //printf("g_footer='%s'\n",g_footer.data()); } else @@ -710,11 +710,11 @@ void HtmlGenerator::init() g_footer = ResourceMgr::instance().getAsString("footer.html"); } - if (Config_getBool("USE_MATHJAX")) + if (Config_getBool(USE_MATHJAX)) { - if (!Config_getString("MATHJAX_CODEFILE").isEmpty()) + if (!Config_getString(MATHJAX_CODEFILE).isEmpty()) { - g_mathjax_code=fileToString(Config_getString("MATHJAX_CODEFILE")); + g_mathjax_code=fileToString(Config_getString(MATHJAX_CODEFILE)); //printf("g_mathjax_code='%s'\n",g_mathjax_code.data()); } } @@ -723,7 +723,7 @@ void HtmlGenerator::init() ResourceMgr &mgr = ResourceMgr::instance(); mgr.copyResource("tabs.css",dname); mgr.copyResource("jquery.js",dname); - if (Config_getBool("INTERACTIVE_SVG")) + if (Config_getBool(INTERACTIVE_SVG)) { mgr.copyResource("svgpan.js",dname); } @@ -734,7 +734,7 @@ void HtmlGenerator::init() { FTextStream t(&f); t << mgr.getAsString("dynsections.js"); - if (Config_getBool("SOURCE_BROWSER") && Config_getBool("SOURCE_TOOLTIPS")) + if (Config_getBool(SOURCE_BROWSER) && Config_getBool(SOURCE_TOOLTIPS)) { t << endl << "$(document).ready(function() {\n" @@ -752,7 +752,7 @@ void HtmlGenerator::init() void HtmlGenerator::writeTabData() { Doxygen::indexList->addStyleSheetFile("tabs.css"); - QCString dname=Config_getString("HTML_OUTPUT"); + QCString dname=Config_getString(HTML_OUTPUT); ResourceMgr &mgr = ResourceMgr::instance(); //writeColoredImgData(dname,colored_tab_data); mgr.copyResource("tab_a.lum",dname); @@ -780,7 +780,7 @@ void HtmlGenerator::writeTabData() void HtmlGenerator::writeSearchData(const char *dir) { - static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH"); + static bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); //writeImgData(dir,serverBasedSearch ? search_server_data : search_client_data); ResourceMgr &mgr = ResourceMgr::instance(); @@ -803,14 +803,14 @@ void HtmlGenerator::writeSearchData(const char *dir) Doxygen::indexList->addImageFile("search/mag_sel.png"); } - QCString searchDirName = Config_getString("HTML_OUTPUT")+"/search"; + QCString searchDirName = Config_getString(HTML_OUTPUT)+"/search"; QFile f(searchDirName+"/search.css"); if (f.open(IO_WriteOnly)) { FTextStream t(&f); QCString searchCss = replaceColorMarkers(mgr.getAsString("search.css")); searchCss = substitute(searchCss,"$doxygenversion",versionString); - if (Config_getBool("DISABLE_INDEX")) + if (Config_getBool(DISABLE_INDEX)) { // move up the search box if there are no tabs searchCss = substitute(searchCss,"margin-top: 8px;","margin-top: 0px;"); @@ -862,8 +862,8 @@ void HtmlGenerator::startFile(const char *name,const char *, t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " << versionString << " -->" << endl; - //static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); - static bool searchEngine = Config_getBool("SEARCHENGINE"); + //static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); + static bool searchEngine = Config_getBool(SEARCHENGINE); if (searchEngine /*&& !generateTreeView*/) { t << "<script type=\"text/javascript\">\n"; @@ -877,8 +877,8 @@ void HtmlGenerator::startFile(const char *name,const char *, void HtmlGenerator::writeSearchInfo(FTextStream &t,const QCString &relPath) { - static bool searchEngine = Config_getBool("SEARCHENGINE"); - static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH"); + static bool searchEngine = Config_getBool(SEARCHENGINE); + static bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); if (searchEngine && !serverBasedSearch) { (void)relPath; @@ -907,13 +907,13 @@ void HtmlGenerator::writeSearchInfo() QCString HtmlGenerator::writeLogoAsString(const char *path) { - static bool timeStamp = Config_getBool("HTML_TIMESTAMP"); + static bool timeStamp = Config_getBool(HTML_TIMESTAMP); QCString result; if (timeStamp) { result += theTranslator->trGeneratedAt( dateToString(TRUE), - Config_getString("PROJECT_NAME") + Config_getString(PROJECT_NAME) ); } else @@ -965,7 +965,7 @@ void HtmlGenerator::writeStyleInfo(int part) //printf("writeStyleInfo(%d)\n",part); if (part==0) { - if (Config_getString("HTML_STYLESHEET").isEmpty()) // write default style sheet + if (Config_getString(HTML_STYLESHEET).isEmpty()) // write default style sheet { //printf("write doxygen.css\n"); startPlainFile("doxygen.css"); @@ -980,11 +980,11 @@ void HtmlGenerator::writeStyleInfo(int part) } else // write user defined style sheet { - QCString cssname=Config_getString("HTML_STYLESHEET"); + QCString cssname=Config_getString(HTML_STYLESHEET); QFileInfo cssfi(cssname); if (!cssfi.exists() || !cssfi.isFile() || !cssfi.isReadable()) { - err("style sheet %s does not exist or is not readable!", Config_getString("HTML_STYLESHEET").data()); + err("style sheet %s does not exist or is not readable!", Config_getString(HTML_STYLESHEET).data()); } else { @@ -997,7 +997,7 @@ void HtmlGenerator::writeStyleInfo(int part) } Doxygen::indexList->addStyleSheetFile(cssfi.fileName().utf8()); } - static QStrList extraCssFile = Config_getList("HTML_EXTRA_STYLESHEET"); + static QStrList extraCssFile = Config_getList(HTML_EXTRA_STYLESHEET); for (uint i=0; i<extraCssFile.count(); ++i) { QCString fileName(extraCssFile.at(i)); @@ -1137,7 +1137,7 @@ void HtmlGenerator::endTextLink() void HtmlGenerator::startHtmlLink(const char *url) { - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); + static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); t << "<a "; if (generateTreeView) t << "target=\"top\" "; t << "href=\""; @@ -1258,7 +1258,7 @@ static void startSectionHeader(FTextStream &t, const QCString &relPath,int sectionCount) { //t << "<!-- startSectionHeader -->"; - static bool dynamicSections = Config_getBool("HTML_DYNAMIC_SECTIONS"); + static bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); if (dynamicSections) { t << "<div id=\"dynsection-" << sectionCount << "\" " @@ -1283,7 +1283,7 @@ static void endSectionHeader(FTextStream &t) static void startSectionSummary(FTextStream &t,int sectionCount) { //t << "<!-- startSectionSummary -->"; - static bool dynamicSections = Config_getBool("HTML_DYNAMIC_SECTIONS"); + static bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); if (dynamicSections) { t << "<div id=\"dynsection-" << sectionCount << "-summary\" " @@ -1295,7 +1295,7 @@ static void startSectionSummary(FTextStream &t,int sectionCount) static void endSectionSummary(FTextStream &t) { //t << "<!-- endSectionSummary -->"; - static bool dynamicSections = Config_getBool("HTML_DYNAMIC_SECTIONS"); + static bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); if (dynamicSections) { t << "</div>" << endl; @@ -1305,7 +1305,7 @@ static void endSectionSummary(FTextStream &t) static void startSectionContent(FTextStream &t,int sectionCount) { //t << "<!-- startSectionContent -->"; - static bool dynamicSections = Config_getBool("HTML_DYNAMIC_SECTIONS"); + static bool dynamicSections = Config_getBool(HTML_DYNAMIC_SECTIONS); if (dynamicSections) { t << "<div id=\"dynsection-" << sectionCount << "-content\" " @@ -1685,8 +1685,8 @@ void HtmlGenerator::startDotGraph() void HtmlGenerator::endDotGraph(const DotClassGraph &g) { - bool generateLegend = Config_getBool("GENERATE_LEGEND"); - bool umlLook = Config_getBool("UML_LOOK"); + bool generateLegend = Config_getBool(GENERATE_LEGEND); + bool umlLook = Config_getBool(UML_LOOK); endSectionHeader(t); startSectionSummary(t,m_sectionCount); endSectionSummary(t); @@ -1936,8 +1936,8 @@ static void endQuickIndexItem(FTextStream &t,const char *l) static bool quickLinkVisible(LayoutNavEntry::Kind kind) { - static bool showFiles = Config_getBool("SHOW_FILES"); - static bool showNamespaces = Config_getBool("SHOW_NAMESPACES"); + static bool showFiles = Config_getBool(SHOW_FILES); + static bool showNamespaces = Config_getBool(SHOW_NAMESPACES); switch (kind) { case LayoutNavEntry::MainPage: return TRUE; @@ -2032,8 +2032,8 @@ static void renderQuickLinksAsTabs(FTextStream &t,const QCString &relPath, } if (hlEntry->parent()==LayoutDocManager::instance().rootNavEntry()) // first row is special as it contains the search box { - static bool searchEngine = Config_getBool("SEARCHENGINE"); - static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH"); + static bool searchEngine = Config_getBool(SEARCHENGINE); + static bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); if (searchEngine) { t << " <li>\n"; @@ -2137,7 +2137,7 @@ void HtmlGenerator::endQuickIndices() QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpath) { - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); + static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); QCString result; // write split bar if (generateTreeView) @@ -2192,10 +2192,10 @@ void HtmlGenerator::writeQuickLinks(bool compact,HighlightedItem hli,const char // PHP based search script void HtmlGenerator::writeSearchPage() { - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); - static bool disableIndex = Config_getBool("DISABLE_INDEX"); - static QCString projectName = Config_getString("PROJECT_NAME"); - static QCString htmlOutput = Config_getString("HTML_OUTPUT"); + static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); + static bool disableIndex = Config_getBool(DISABLE_INDEX); + static QCString projectName = Config_getString(PROJECT_NAME); + static QCString htmlOutput = Config_getString(HTML_OUTPUT); // OPENSEARCH_PROVIDER { QCString configFileName = htmlOutput+"/search_config.php"; @@ -2241,7 +2241,7 @@ void HtmlGenerator::writeSearchPage() t << "var searchBox = new SearchBox(\"searchBox\", \"" << "search\",false,'" << theTranslator->trSearch() << "');\n"; t << "</script>\n"; - if (!Config_getBool("DISABLE_INDEX")) + if (!Config_getBool(DISABLE_INDEX)) { writeDefaultQuickLinks(t,TRUE,HLI_Search,0,""); } @@ -2280,8 +2280,8 @@ void HtmlGenerator::writeSearchPage() void HtmlGenerator::writeExternalSearchPage() { - static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); - QCString fileName = Config_getString("HTML_OUTPUT")+"/search"+Doxygen::htmlFileExtension; + static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); + QCString fileName = Config_getString(HTML_OUTPUT)+"/search"+Doxygen::htmlFileExtension; QFile f(fileName); if (f.open(IO_WriteOnly)) { @@ -2294,7 +2294,7 @@ void HtmlGenerator::writeExternalSearchPage() t << "var searchBox = new SearchBox(\"searchBox\", \"" << "search\",false,'" << theTranslator->trSearch() << "');\n"; t << "</script>\n"; - if (!Config_getBool("DISABLE_INDEX")) + if (!Config_getBool(DISABLE_INDEX)) { writeDefaultQuickLinks(t,TRUE,HLI_Search,0,""); t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\"\" size=\"20\" accesskey=\"S\" onfocus=\"searchBox.OnSearchFieldFocus(true)\" onblur=\"searchBox.OnSearchFieldFocus(false)\"/>\n"; @@ -2328,7 +2328,7 @@ void HtmlGenerator::writeExternalSearchPage() writePageFooter(t,"Search","",""); } - QCString scriptName = Config_getString("HTML_OUTPUT")+"/search/search.js"; + QCString scriptName = Config_getString(HTML_OUTPUT)+"/search/search.js"; QFile sf(scriptName); if (sf.open(IO_WriteOnly)) { @@ -2337,11 +2337,11 @@ void HtmlGenerator::writeExternalSearchPage() << "\"" << theTranslator->trSearchResults(0) << "\"," << "\"" << theTranslator->trSearchResults(1) << "\"," << "\"" << theTranslator->trSearchResults(2) << "\"];" << endl; - t << "var serverUrl=\"" << Config_getString("SEARCHENGINE_URL") << "\";" << endl; + t << "var serverUrl=\"" << Config_getString(SEARCHENGINE_URL) << "\";" << endl; t << "var tagMap = {" << endl; bool first=TRUE; // add search mappings - QStrList &extraSearchMappings = Config_getList("EXTRA_SEARCH_MAPPINGS"); + QStrList &extraSearchMappings = Config_getList(EXTRA_SEARCH_MAPPINGS); char *ml=extraSearchMappings.first(); while (ml) { |