From 0df1623c9363d52a2b04457233dcf2c64319b03c Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 2 Jun 2020 11:13:43 +0200 Subject: Refactor: modernize configuration values --- addon/doxyapp/doxyapp.cpp | 31 +-- addon/doxyparse/doxyparse.cpp | 52 ++-- src/cite.cpp | 40 ++- src/clangparser.cpp | 20 +- src/classdef.cpp | 10 +- src/condparser.cpp | 16 +- src/config.h | 32 ++- src/configgen.py | 117 +++++---- src/configimpl.h | 91 +++---- src/configimpl.l | 562 ++++++++++++++++++++---------------------- src/context.cpp | 18 +- src/definition.cpp | 18 +- src/dirdef.cpp | 12 +- src/docparser.cpp | 10 +- src/doxygen.cpp | 243 +++++++++--------- src/doxygen.h | 4 +- src/ftvhelp.cpp | 2 +- src/htags.cpp | 32 +-- src/htmlgen.cpp | 29 +-- src/index.cpp | 12 +- src/latexgen.cpp | 10 +- src/layout.cpp | 496 ++++++++++++++++++------------------- src/mangen.cpp | 158 ++++++------ src/plantuml.cpp | 28 ++- src/pre.l | 20 +- src/rtfgen.cpp | 4 +- src/util.cpp | 52 ++-- src/util.h | 3 +- src/vhdldocgen.cpp | 7 +- 29 files changed, 1041 insertions(+), 1088 deletions(-) diff --git a/addon/doxyapp/doxyapp.cpp b/addon/doxyapp/doxyapp.cpp index 1153ce3..97f3755 100644 --- a/addon/doxyapp/doxyapp.cpp +++ b/addon/doxyapp/doxyapp.cpp @@ -264,31 +264,32 @@ int main(int argc,char **argv) checkConfiguration(); adjustConfiguration(); // we need a place to put intermediate files - Config_getString(OUTPUT_DIRECTORY)="/tmp/doxygen"; + Config_updateString(OUTPUT_DIRECTORY,"/tmp/doxygen"); // disable html output - Config_getBool(GENERATE_HTML)=FALSE; + Config_updateBool(GENERATE_HTML,FALSE); // disable latex output - Config_getBool(GENERATE_LATEX)=FALSE; + Config_updateBool(GENERATE_LATEX,FALSE); // be quiet - Config_getBool(QUIET)=TRUE; + Config_updateBool(QUIET,TRUE); // turn off warnings - Config_getBool(WARNINGS)=FALSE; - Config_getBool(WARN_IF_UNDOCUMENTED)=FALSE; - Config_getBool(WARN_IF_DOC_ERROR)=FALSE; + Config_updateBool(WARNINGS,FALSE); + Config_updateBool(WARN_IF_UNDOCUMENTED,FALSE); + Config_updateBool(WARN_IF_DOC_ERROR,FALSE); // Extract as much as possible - Config_getBool(EXTRACT_ALL)=TRUE; - Config_getBool(EXTRACT_STATIC)=TRUE; - Config_getBool(EXTRACT_PRIVATE)=TRUE; - Config_getBool(EXTRACT_LOCAL_METHODS)=TRUE; + Config_updateBool(EXTRACT_ALL,TRUE); + Config_updateBool(EXTRACT_STATIC,TRUE); + Config_updateBool(EXTRACT_PRIVATE,TRUE); + Config_updateBool(EXTRACT_LOCAL_METHODS,TRUE); // Extract source browse information, needed // to make doxygen gather the cross reference info - Config_getBool(SOURCE_BROWSER)=TRUE; + Config_updateBool(SOURCE_BROWSER,TRUE); // In case of a directory take all files on directory and its subdirectories - Config_getBool(RECURSIVE)=TRUE; + Config_updateBool(RECURSIVE,TRUE); // set the input - Config_getList(INPUT).clear(); - Config_getList(INPUT).append(argv[1]); + StringVector inputList; + inputList.push_back(argv[1]); + Config_updateList(INPUT,inputList); // parse the files parseInput(); diff --git a/addon/doxyparse/doxyparse.cpp b/addon/doxyparse/doxyparse.cpp index 2fcf9ac..c06eb1c 100644 --- a/addon/doxyparse/doxyparse.cpp +++ b/addon/doxyparse/doxyparse.cpp @@ -462,44 +462,35 @@ int main(int argc,char **argv) { else tmpdir << "doxyparse-" << pid; - Config_getString(OUTPUT_DIRECTORY)= tmpdir.str().c_str(); + Config_updateString(OUTPUT_DIRECTORY,tmpdir.str().c_str()); // enable HTML (fake) output to omit warning about missing output format - Config_getBool(GENERATE_HTML)=TRUE; + Config_updateBool(GENERATE_HTML,TRUE); // disable latex output - Config_getBool(GENERATE_LATEX)=FALSE; + Config_updateBool(GENERATE_LATEX,FALSE); // be quiet - Config_getBool(QUIET)=TRUE; + Config_updateBool(QUIET,TRUE); // turn off warnings - Config_getBool(WARNINGS)=FALSE; - Config_getBool(WARN_IF_UNDOCUMENTED)=FALSE; - Config_getBool(WARN_IF_DOC_ERROR)=FALSE; + Config_updateBool(WARNINGS,FALSE); + Config_updateBool(WARN_IF_UNDOCUMENTED,FALSE); + Config_updateBool(WARN_IF_DOC_ERROR,FALSE); // Extract as much as possible - Config_getBool(EXTRACT_ALL)=TRUE; - Config_getBool(EXTRACT_STATIC)=TRUE; - Config_getBool(EXTRACT_PRIVATE)=TRUE; - Config_getBool(EXTRACT_LOCAL_METHODS)=TRUE; - Config_getBool(EXTRACT_PACKAGE)=TRUE; + Config_updateBool(EXTRACT_ALL,TRUE); + Config_updateBool(EXTRACT_STATIC,TRUE); + Config_updateBool(EXTRACT_PRIVATE,TRUE); + Config_updateBool(EXTRACT_LOCAL_METHODS,TRUE); + Config_updateBool(EXTRACT_PACKAGE,TRUE); // Extract source browse information, needed // to make doxygen gather the cross reference info - Config_getBool(SOURCE_BROWSER)=TRUE; + Config_updateBool(SOURCE_BROWSER,TRUE); // find functions call between modules - Config_getBool(CALL_GRAPH)=TRUE; + Config_updateBool(CALL_GRAPH,TRUE); // loop recursive over input files - Config_getBool(RECURSIVE)=TRUE; + Config_updateBool(RECURSIVE,TRUE); // add file extensions - Config_getList(FILE_PATTERNS).append("*.cc"); - Config_getList(FILE_PATTERNS).append("*.cxx"); - Config_getList(FILE_PATTERNS).append("*.cpp"); - Config_getList(FILE_PATTERNS).append("*.java"); - Config_getList(FILE_PATTERNS).append("*.py"); - Config_getList(FILE_PATTERNS).append("*.pyw"); - Config_getList(FILE_PATTERNS).append("*.cs"); - Config_getList(FILE_PATTERNS).append("*.c"); - Config_getList(FILE_PATTERNS).append("*.h"); - Config_getList(FILE_PATTERNS).append("*.hh"); - Config_getList(FILE_PATTERNS).append("*.hpp"); + Config_updateList(FILE_PATTERNS, { "*.cc", "*.cxx", "*.cpp", "*.java", + "*.py", "*.pyw", "*.cs", "*.c", "*.h", "*.hh", "*.hpp"}); // set the input - Config_getList(INPUT).clear(); + StringVector inputList; for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "-") == 0) { char filename[1024]; @@ -508,13 +499,14 @@ int main(int argc,char **argv) { if (feof(stdin)) { break; } - Config_getList(INPUT).append(filename); + inputList.push_back(filename); } } else { - Config_getList(INPUT).append(argv[i]); + inputList.push_back(argv[i]); } } - if (Config_getList(INPUT).isEmpty()) { + Config_updateList(INPUT,inputList); + if (inputList.empty()) { exit(0); } diff --git a/src/cite.cpp b/src/cite.cpp index dac2bcd..7b6452e 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -4,8 +4,8 @@ * Based on a patch by David Munger * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -94,7 +94,7 @@ void CitationManager::clear() bool CitationManager::isEmpty() const { - uint numFiles = Config_getList(CITE_BIB_FILES).count(); + size_t numFiles = Config_getList(CITE_BIB_FILES).size(); return (numFiles==0 || p->entries.empty()); } @@ -117,12 +117,10 @@ void CitationManager::generatePage() // 0. add cross references from the bib files to the cite dictionary QFile f; - const QStrList &citeDataList = Config_getList(CITE_BIB_FILES); - QStrListIterator li(citeDataList); - const char *bibdata = 0; - for (li.toFirst() ; (bibdata = li.current()) ; ++li) + const StringVector &citeDataList = Config_getList(CITE_BIB_FILES); + for (const auto &bibdata : citeDataList) { - QCString bibFile = bibdata; + QCString bibFile = bibdata.c_str(); if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; QFileInfo fi(bibFile); if (fi.exists()) @@ -130,7 +128,7 @@ void CitationManager::generatePage() if (!bibFile.isEmpty()) { f.setName(bibFile); - if (!f.open(IO_ReadOnly)) + if (!f.open(IO_ReadOnly)) { err("could not open file %s for reading\n",bibFile.data()); } @@ -173,7 +171,7 @@ void CitationManager::generatePage() QCString outputDir = Config_getString(OUTPUT_DIRECTORY); QCString citeListFile = outputDir+"/citelist.doc"; f.setName(citeListFile); - if (!f.open(IO_WriteOnly)) + if (!f.open(IO_WriteOnly)) { err("could not open file %s for writing\n",citeListFile.data()); } @@ -207,9 +205,9 @@ void CitationManager::generatePage() QDir thisDir; thisDir.mkdir(bibOutputDir); int i = 0; - for (li.toFirst() ; (bibdata = li.current()) ; ++li) + for (const auto &bibdata : citeDataList) { - QCString bibFile = bibdata; + QCString bibFile = bibdata.c_str(); if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; QFileInfo fi(bibFile); if (fi.exists()) @@ -242,7 +240,7 @@ void CitationManager::generatePage() // 6. read back the file f.setName(citeListFile); - if (!f.open(IO_ReadOnly)) + if (!f.open(IO_ReadOnly)) { err("could not open file %s for reading\n",citeListFile.data()); } @@ -294,16 +292,16 @@ void CitationManager::generatePage() // 7. add it as a page addRelatedPage(fileName(),theTranslator->trCiteReferences(),doc,fileName(),1); - // 8. for latex we just copy the bib files to the output and let + // 8. for latex we just copy the bib files to the output and let // latex do this work. if (Config_getBool(GENERATE_LATEX)) { // copy bib files to the latex output dir QCString latexOutputDir = Config_getString(LATEX_OUTPUT)+"/"; i = 0; - for (li.toFirst() ; (bibdata = li.current()) ; ++li) + for (const auto &bibdata : citeDataList) { - QCString bibFile = bibdata; + QCString bibFile = bibdata.c_str(); // Note: file can now have multiple dots if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; fi.setFile(bibFile); @@ -333,7 +331,7 @@ void CitationManager::generatePage() // we might try to remove too many files as empty files didn't get a corresponding new file // but the remove function does not emit an error for it and we don't catch the error return // so no problem. - for (unsigned int j = 1; j <= citeDataList.count(); j++) + for (size_t j = 1; j <= citeDataList.size(); j++) { thisDir.remove(bibOutputDir + bibTmpFile + QCString().setNum(j) + ".bib"); } @@ -370,13 +368,11 @@ void CitationManager::writeLatexBibliography(FTextStream &t) const } t << "\\bibliographystyle{" << style << "}\n" "\\bibliography{"; - QStrList &citeDataList = Config_getList(CITE_BIB_FILES); + const StringVector &citeDataList = Config_getList(CITE_BIB_FILES); int i = 0; - QStrListIterator li(citeDataList); - const char *bibdata = 0; - for (li.toFirst() ; (bibdata = li.current()) ; ++li) + for (const auto &bibdata : citeDataList) { - QCString bibFile = bibdata; + QCString bibFile = bibdata.c_str(); // Note: file can now have multiple dots if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; QFileInfo fi(bibFile); diff --git a/src/clangparser.cpp b/src/clangparser.cpp index 0754888..e0a1640 100644 --- a/src/clangparser.cpp +++ b/src/clangparser.cpp @@ -159,10 +159,10 @@ void ClangParser::determineInputFilesInSameTu(QStrList &files) void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit) { - static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING); - static QStrList &includePath = Config_getList(INCLUDE_PATH); - static QStrList clangOptions = Config_getList(CLANG_OPTIONS); - static QCString clangCompileDatabase = Config_getString(CLANG_DATABASE_PATH); + bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING); + const StringVector &includePath = Config_getList(INCLUDE_PATH); + const StringVector &clangOptions = Config_getList(CLANG_OPTIONS); + QCString clangCompileDatabase = Config_getString(CLANG_DATABASE_PATH); if (!clangAssistedParsing) return; //printf("ClangParser::start(%s)\n",fileName); p->fileName = fileName; @@ -198,8 +198,8 @@ void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit) } char **argv = (char**)malloc(sizeof(char*)* (4+Doxygen::inputPaths.size()+ - includePath.count()+ - clangOptions.count()+ + includePath.size()+ + clangOptions.size()+ clang_option_len)); if (!command.empty() ) { @@ -222,15 +222,15 @@ void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit) //printf("argv[%d]=%s\n",argc,argv[argc]); } // add external include paths - for (uint i=0;iincInfo) { QCString nm; - QStrList paths = Config_getList(STRIP_FROM_PATH); - if (!paths.isEmpty() && m_impl->incInfo->fileDef) + const StringVector &paths = Config_getList(STRIP_FROM_PATH); + if (!paths.empty() && m_impl->incInfo->fileDef) { QCString abs = m_impl->incInfo->fileDef->absFilePath(); - const char *s = paths.first(); QCString potential; unsigned int length = 0; - while (s) + for (const auto &s : paths) { - QFileInfo info(s); + QFileInfo info(s.c_str()); if (info.exists()) { QCString prefix = info.absFilePath().utf8(); @@ -1872,7 +1871,6 @@ void ClassDefImpl::writeIncludeFilesForSlice(OutputList &ol) const length = prefix.length(); potential = abs.right(abs.length() - prefix.length()); } - s = paths.next(); } } diff --git a/src/condparser.cpp b/src/condparser.cpp index e76b164..ac6ff61 100644 --- a/src/condparser.cpp +++ b/src/condparser.cpp @@ -2,8 +2,8 @@ * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -19,6 +19,8 @@ * ! NOT operator */ +#include + #include "condparser.h" #include "config.h" #include "message.h" @@ -27,7 +29,7 @@ /** * parses and evaluates the given expression. - * @returns + * @returns * - On error, an error message is returned. * - On success, the result of the expression is either "1" or "0". */ @@ -123,13 +125,13 @@ int CondParser::getOperatorId(const QCString &opName) /** * Get next token in the current string expr. - * Uses the data in m_expr pointed to by m_e to + * Uses the data in m_expr pointed to by m_e to * produce m_tokenType and m_token, set m_err in case of an error */ void CondParser::getToken() { m_tokenType = NOTHING; - m_token.resize(0); + m_token.resize(0); //printf("\tgetToken e:{%c}, ascii=%i, col=%i\n", *e, *e, e-expr); @@ -303,7 +305,7 @@ bool CondParser::evalOperator(int opId, bool lhs, bool rhs) */ bool CondParser::evalVariable(const char *varName) { - if (Config_getList(ENABLED_SECTIONS).find(varName)==-1) return FALSE; - return TRUE; + const StringVector &list = Config_getList(ENABLED_SECTIONS); + return std::find(list.begin(),list.end(),varName)!=list.end(); } diff --git a/src/config.h b/src/config.h index 1b79b1e..845a369 100644 --- a/src/config.h +++ b/src/config.h @@ -24,19 +24,25 @@ class FTextStream; //! @{ //! some convenience macros for accessing the config options //! mainly done like this for backward compatibility -#if DYNAMIC_LOOKUP // for debug purposes -#define Config_getString(val) (ConfigValues::instance().*((ConfigValues::InfoString*)ConfigValues::instance().get(#val))->item) -#define Config_getBool(val) (ConfigValues::instance().*((ConfigValues::InfoBool*)ConfigValues::instance().get(#val))->item) -#define Config_getInt(val) (ConfigValues::instance().*((ConfigValues::InfoInt*)ConfigValues::instance().get(#val))->item) -#define Config_getEnum(val) (ConfigValues::instance().*((ConfigValues::InfoString*)ConfigValues::instance().get(#val))->item) -#define Config_getList(val) (ConfigValues::instance().*((ConfigValues::InfoList*)ConfigValues::instance().get(#val))->item) -#else // direct access -#define Config_getString(val) (ConfigValues::instance().val) -#define Config_getBool(val) (ConfigValues::instance().val) -#define Config_getInt(val) (ConfigValues::instance().val) -#define Config_getEnum(val) (ConfigValues::instance().val) -#define Config_getList(val) (ConfigValues::instance().val) -#endif +//#if DYNAMIC_LOOKUP // for debug purposes +//#define Config_getString(val) (ConfigValues::instance().*((ConfigValues::InfoString*)ConfigValues::instance().get(#val))->item) +//#define Config_getBool(val) (ConfigValues::instance().*((ConfigValues::InfoBool*)ConfigValues::instance().get(#val))->item) +//#define Config_getInt(val) (ConfigValues::instance().*((ConfigValues::InfoInt*)ConfigValues::instance().get(#val))->item) +//#define Config_getEnum(val) (ConfigValues::instance().*((ConfigValues::InfoString*)ConfigValues::instance().get(#val))->item) +//#define Config_getList(val) (ConfigValues::instance().*((ConfigValues::InfoList*)ConfigValues::instance().get(#val))->item) +//#else // direct access +#define Config_getString(name) (ConfigValues::instance().name()) +#define Config_getBool(name) (ConfigValues::instance().name()) +#define Config_getInt(name) (ConfigValues::instance().name()) +#define Config_getEnum(name) (ConfigValues::instance().name()) +#define Config_getList(name) (ConfigValues::instance().name()) +#define Config_updateString(name,value) (ConfigValues::instance().update_##name(value)); +#define Config_updateBool(name,value) (ConfigValues::instance().update_##name(value)); +#define Config_updateInt(name,value) (ConfigValues::instance().update_##name(value)); +#define Config_updateEnum(name,value) (ConfigValues::instance().update_##name(value)); +#define Config_updateList(name,...) (ConfigValues::instance().update_##name(__VA_ARGS__)); +#define Config_setterFunc(name) (std::bind(&ConfigValues::update_##name,ConfigValues::instance(),std::placeholders::_1)) +//#endif //! @} /** \brief Public function to deal with the configuration file. */ diff --git a/src/configgen.py b/src/configgen.py index 6720116..89eff6d 100755 --- a/src/configgen.py +++ b/src/configgen.py @@ -355,8 +355,23 @@ def parseGroups(node): if n.nodeType == Node.ELEMENT_NODE: parseOption(n) -def parseGroupMap(node): - map = { 'bool':'bool', 'string':'QCString', 'enum':'QCString', 'int':'int', 'list':'QStrList' } + +def parseGroupMapGetter(node): + map = { 'bool':'bool', 'string':'const QCString &', 'enum':'const QCString &', 'int':'int', 'list':'const StringVector &' } + for n in node.childNodes: + if n.nodeType == Node.ELEMENT_NODE: + setting = n.getAttribute('setting') + if len(setting) > 0: + print("#if %s" % (setting)) + type = n.getAttribute('type') + name = n.getAttribute('id') + if type in map: + print(" %-20s %-30s const { return m_%s; }" % (map[type],name+'()',name)) + if len(setting) > 0: + print("#endif") + +def parseGroupMapSetter(node): + map = { 'bool':'bool', 'string':'const QCString &', 'enum':'const QCString &', 'int':'int', 'list':'const StringVector &' } for n in node.childNodes: if n.nodeType == Node.ELEMENT_NODE: setting = n.getAttribute('setting') @@ -365,7 +380,21 @@ def parseGroupMap(node): type = n.getAttribute('type') name = n.getAttribute('id') if type in map: - print(" %-8s %s;" % (map[type],name)) + print(" %-20s update_%-46s { m_%s = v; return m_%s; }" % (map[type],name+'('+map[type]+' v)',name,name)) + if len(setting) > 0: + print("#endif") + +def parseGroupMapVar(node): + map = { 'bool':'bool', 'string':'QCString', 'enum':'QCString', 'int':'int', 'list':'StringVector' } + for n in node.childNodes: + if n.nodeType == Node.ELEMENT_NODE: + setting = n.getAttribute('setting') + if len(setting) > 0: + print("#if %s" % (setting)) + type = n.getAttribute('type') + name = n.getAttribute('id') + if type in map: + print(" %-12s m_%s;" % (map[type],name)) if len(setting) > 0: print("#endif") @@ -379,7 +408,7 @@ def parseGroupInit(node): type = n.getAttribute('type') name = n.getAttribute('id') if type in map: - print(" %-25s = ConfigImpl::instance()->get%s(__FILE__,__LINE__,\"%s\");" % (name,map[type],name)) + print(" %-25s = ConfigImpl::instance()->get%s(__FILE__,__LINE__,\"%s\");" % ('m_'+name,map[type],name)) if len(setting) > 0: print("#endif") @@ -393,7 +422,7 @@ def parseGroupMapInit(node): type = n.getAttribute('type') name = n.getAttribute('id') if type in map: - print(" m_map.insert(\"%s\",new Info%s(&ConfigValues::%s));" % (name,map[type],name)) + print(" { %-25s Info{ %-13s &ConfigValues::m_%s }}," % ('\"'+name+'\",','Info::'+map[type]+',',name)) if len(setting) > 0: print("#endif") @@ -652,6 +681,7 @@ def main(): print("#include ") print("#include ") print("#include ") + print("#include \"containers.h\"") print("#include \"settings.h\"") print("") print("class ConfigValues") @@ -661,42 +691,38 @@ def main(): for n in elem.childNodes: if n.nodeType == Node.ELEMENT_NODE: if (n.nodeName == "group"): - parseGroupMap(n) + parseGroupMapGetter(n) + for n in elem.childNodes: + if n.nodeType == Node.ELEMENT_NODE: + if (n.nodeName == "group"): + parseGroupMapSetter(n) print(" void init();") - print(" struct Info") - print(" {") - print(" enum Type { Bool, Int, String, List, Unknown };") - print(" Info(Type t) : type(t) {}") - print(" virtual ~Info() {}") - print(" Type type;") - print(" };") - print(" struct InfoBool : public Info") - print(" {") - print(" InfoBool(bool ConfigValues::*ptm) : Info(Info::Bool), item(ptm) {}") - print(" bool ConfigValues::*item;") - print(" };") - print(" struct InfoInt : public Info") - print(" {") - print(" InfoInt(int ConfigValues::*ptm) : Info(Info::Int), item(ptm) {}") - print(" int ConfigValues::*item;") - print(" };") - print(" struct InfoString : public Info") - print(" {") - print(" InfoString(QCString ConfigValues::*ptm) : Info(Info::String), item(ptm) {}") - print(" QCString ConfigValues::*item;") - print(" };") - print(" struct InfoList : public Info") - print(" {") - print(" InfoList(QStrList ConfigValues::*ptm) : Info(Info::List), item(ptm) {}") - print(" QStrList ConfigValues::*item;") - print(" };") - print(" const Info *get(const char *tag) const") - print(" {") - print(" return m_map.find(tag);") - print(" }") + print(" struct Info"); + print(" {"); + print(" enum Type { Bool, Int, String, List, Unknown };"); + print(" Info(Type t,bool ConfigValues::*b) : type(t), value(b) {}"); + print(" Info(Type t,int ConfigValues::*i) : type(t), value(i) {}"); + print(" Info(Type t,QCString ConfigValues::*s) : type(t), value(s) {}"); + print(" Info(Type t,StringVector ConfigValues::*l) : type(t), value(l) {}"); + print(" Type type;"); + print(" union Item"); + print(" {"); + print(" Item(bool ConfigValues::*v) : b(v) {}"); + print(" Item(int ConfigValues::*v) : i(v) {}"); + print(" Item(QCString ConfigValues::*v) : s(v) {}"); + print(" Item(StringVector ConfigValues::*v) : l(v) {}"); + print(" bool ConfigValues::*b;"); + print(" int ConfigValues::*i;"); + print(" QCString ConfigValues::*s;"); + print(" StringVector ConfigValues::*l;"); + print(" } value;"); + print(" };"); + print(" const Info *get(const char *tag) const;"); print(" private:") - print(" ConfigValues();") - print(" QDict m_map;") + for n in elem.childNodes: + if n.nodeType == Node.ELEMENT_NODE: + if (n.nodeName == "group"): + parseGroupMapVar(n) print("};") print("") print("#endif") @@ -707,15 +733,20 @@ def main(): print(" */") print("#include \"configvalues.h\"") print("#include \"configimpl.h\"") + print("#include ") print("") - print("ConfigValues::ConfigValues() : m_map(257)") - print("{") - print(" m_map.setAutoDelete(TRUE);") + print("const ConfigValues::Info *ConfigValues::get(const char *tag) const"); + print("{"); + print(" static const std::unordered_map< std::string, Info > configMap ="); + print(" {"); for n in elem.childNodes: if n.nodeType == Node.ELEMENT_NODE: if (n.nodeName == "group"): parseGroupMapInit(n) - print("}") + print(" };"); + print(" auto it = configMap.find(tag);"); + print(" return it!=configMap.end() ? &it->second : nullptr;"); + print("}"); print("") print("void ConfigValues::init()") print("{") diff --git a/src/configimpl.h b/src/configimpl.h index 6134088..a267cc6 100644 --- a/src/configimpl.h +++ b/src/configimpl.h @@ -1,13 +1,13 @@ /****************************************************************************** * - * + * * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -24,6 +24,7 @@ #include #include #include "ftextstream.h" +#include "containers.h" /** Abstract base class for any configuration option. @@ -35,8 +36,8 @@ class ConfigOption public: /*! The type of option */ - enum OptionType - { + enum OptionType + { O_Info, //!< A section header O_List, //!< A list of items O_Enum, //!< A fixed set of items @@ -46,14 +47,14 @@ class ConfigOption O_Obsolete, //!< An obsolete option O_Disabled //!< Disabled compile time option }; - enum - { - /*! Maximum length of an option in the config file. Used for + enum + { + /*! Maximum length of an option in the config file. Used for * alignment purposes. */ - MAX_OPTION_LENGTH = 23 + MAX_OPTION_LENGTH = 23 }; - ConfigOption(OptionType t) : m_kind(t) + ConfigOption(OptionType t) : m_kind(t) { m_spaces.fill(' ',40); } @@ -81,8 +82,8 @@ class ConfigOption void writeBoolValue(FTextStream &t,bool v); void writeIntValue(FTextStream &t,int i); - void writeStringValue(FTextStream &t,QCString &s); - void writeStringList(FTextStream &t,QStrList &l); + void writeStringValue(FTextStream &t,const QCString &s); + void writeStringList(FTextStream &t,const StringVector &l); QCString m_spaces; QCString m_name; @@ -98,7 +99,7 @@ class ConfigOption class ConfigInfo : public ConfigOption { public: - ConfigInfo(const char *name,const char *doc) + ConfigInfo(const char *name,const char *doc) : ConfigOption(O_Info) { m_name = name; @@ -115,25 +116,25 @@ class ConfigList : public ConfigOption { public: enum WidgetType { String, File, Dir, FileAndDir }; - ConfigList(const char *name,const char *doc) + ConfigList(const char *name,const char *doc) : ConfigOption(O_List) { m_name = name; m_doc = doc; m_widgetType = String; } - void addValue(const char *v) { m_defaultValue.append(v); } + void addValue(const char *v) { m_defaultValue.push_back(v); } void setWidgetType(WidgetType w) { m_widgetType = w; } WidgetType widgetType() const { return m_widgetType; } - QStrList *valueRef() { return &m_value; } - QStrList getDefault() { return m_defaultValue; } + StringVector *valueRef() { return &m_value; } + StringVector getDefault() { return m_defaultValue; } void writeTemplate(FTextStream &t,bool sl,bool); void compareDoxyfile(FTextStream &t); void substEnvVars(); void init() { m_value = m_defaultValue; } private: - QStrList m_value; - QStrList m_defaultValue; + StringVector m_value; + StringVector m_defaultValue; WidgetType m_widgetType; }; @@ -142,7 +143,7 @@ class ConfigList : public ConfigOption class ConfigEnum : public ConfigOption { public: - ConfigEnum(const char *name,const char *doc,const char *defVal) + ConfigEnum(const char *name,const char *doc,const char *defVal) : ConfigOption(O_Enum) { m_name = name; @@ -151,7 +152,7 @@ class ConfigEnum : public ConfigOption m_defValue = defVal; } void addValue(const char *v) { m_valueRange.append(v); } - QStrListIterator iterator() + QStrListIterator iterator() { return QStrListIterator(m_valueRange); } @@ -174,7 +175,7 @@ class ConfigString : public ConfigOption { public: enum WidgetType { String, File, Dir, Image }; - ConfigString(const char *name,const char *doc) + ConfigString(const char *name,const char *doc) : ConfigOption(O_String) { m_name = name; @@ -193,7 +194,7 @@ class ConfigString : public ConfigOption void substEnvVars(); void init() { m_value = m_defValue.copy(); } void emptyValueToDefault() { if(m_value.isEmpty()) m_value=m_defValue; }; - + private: QCString m_value; QCString m_defValue; @@ -205,7 +206,7 @@ class ConfigString : public ConfigOption class ConfigInt : public ConfigOption { public: - ConfigInt(const char *name,const char *doc,int minVal,int maxVal,int defVal) + ConfigInt(const char *name,const char *doc,int minVal,int maxVal,int defVal) : ConfigOption(O_Int) { m_name = name; @@ -237,7 +238,7 @@ class ConfigInt : public ConfigOption class ConfigBool : public ConfigOption { public: - ConfigBool(const char *name,const char *doc,bool defVal) + ConfigBool(const char *name,const char *doc,bool defVal) : ConfigOption(O_Bool) { m_name = name; @@ -264,7 +265,7 @@ class ConfigBool : public ConfigOption class ConfigObsolete : public ConfigOption { public: - ConfigObsolete(const char *name) : ConfigOption(O_Obsolete) + ConfigObsolete(const char *name) : ConfigOption(O_Obsolete) { m_name = name; } void writeTemplate(FTextStream &,bool,bool); void compareDoxyfile(FTextStream &) {} @@ -276,7 +277,7 @@ class ConfigObsolete : public ConfigOption class ConfigDisabled : public ConfigOption { public: - ConfigDisabled(const char *name) : ConfigOption(O_Disabled) + ConfigDisabled(const char *name) : ConfigOption(O_Disabled) { m_name = name; } void writeTemplate(FTextStream &,bool,bool); void compareDoxyfile(FTextStream &) {} @@ -297,7 +298,7 @@ class ConfigDisabled : public ConfigOption * read from a user-supplied configuration file. * The static member instance() can be used to get * a pointer to the one and only instance. - * + * * Set all variables to their default values by * calling Config::instance()->init() * @@ -321,8 +322,8 @@ class ConfigImpl delete m_instance; m_instance=0; } - - /*! Returns an iterator that can by used to iterate over the + + /*! Returns an iterator that can by used to iterate over the * configuration options. */ QListIterator iterator() @@ -330,36 +331,36 @@ class ConfigImpl return QListIterator(*m_options); } - /*! + /*! * @name Getting configuration values. * @{ */ - /*! Returns the value of the string option with name \a fileName. + /*! Returns the value of the string option with name \a fileName. * The arguments \a num and \a name are for debugging purposes only. * There is a convenience function Config_getString() for this. */ QCString &getString(const char *fileName,int num,const char *name) const; - /*! Returns the value of the list option with name \a fileName. + /*! Returns the value of the list option with name \a fileName. * The arguments \a num and \a name are for debugging purposes only. * There is a convenience function Config_getList() for this. */ - QStrList &getList(const char *fileName,int num,const char *name) const; + StringVector &getList(const char *fileName,int num,const char *name) const; - /*! Returns the value of the enum option with name \a fileName. + /*! Returns the value of the enum option with name \a fileName. * The arguments \a num and \a name are for debugging purposes only. * There is a convenience function Config_getEnum() for this. */ QCString &getEnum(const char *fileName,int num,const char *name) const; - /*! Returns the value of the integer option with name \a fileName. + /*! Returns the value of the integer option with name \a fileName. * The arguments \a num and \a name are for debugging purposes only. * There is a convenience function Config_getInt() for this. */ int &getInt(const char *fileName,int num,const char *name) const; - /*! Returns the value of the boolean option with name \a fileName. + /*! Returns the value of the boolean option with name \a fileName. * The arguments \a num and \a name are for debugging purposes only. * There is a convenience function Config_getBool() for this. */ @@ -370,12 +371,12 @@ class ConfigImpl */ ConfigOption *get(const char *name) const { - return m_dict->find(name); + return m_dict->find(name); } /* @} */ - /*! - * @name Adding configuration options. + /*! + * @name Adding configuration options. * @{ */ @@ -402,7 +403,7 @@ class ConfigImpl } /*! Adds a new enumeration option with \a name and documentation \a doc - * and initial value \a defVal. + * and initial value \a defVal. * \returns An object representing the option. */ ConfigEnum *addEnum(const char *name, @@ -510,18 +511,18 @@ class ConfigImpl /*! Parse a configuration data in string \a str. * \returns TRUE if successful, or FALSE if the string could not be * parsed. - */ + */ //bool parseString(const char *fn,const char *str); bool parseString(const char *fn,const char *str,bool upd = FALSE); /*! Parse a configuration file with name \a fn. - * \returns TRUE if successful, FALSE if the file could not be + * \returns TRUE if successful, FALSE if the file could not be * opened or read. - */ + */ bool parse(const char *fn,bool upd = FALSE); /*! Called from the constructor, will add doxygen's default options - * to the configuration object + * to the configuration object */ void create(); diff --git a/src/configimpl.l b/src/configimpl.l index da94484..9cea61b 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -1,10 +1,10 @@ /****************************************************************************** * - * Copyright (C) 1997-2015 by Dimitri van Heesch. + * Copyright (C) 1997-2020 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -29,11 +29,12 @@ #include #include -#include #include #include #include + #include +#include #include "configimpl.h" #include "version.h" @@ -61,7 +62,7 @@ void config_err(const char *fmt, ...) va_list args; va_start(args, fmt); vfprintf(stderr, (QCString(error_str) + fmt).data(), args); - va_end(args); + va_end(args); } void config_term(const char *fmt, ...) { @@ -141,7 +142,7 @@ void ConfigOption::writeIntValue(FTextStream &t,int i) t << " " << i; } -void ConfigOption::writeStringValue(FTextStream &t,QCString &s) +void ConfigOption::writeStringValue(FTextStream &t,const QCString &s) { char c; bool needsEscaping=FALSE; @@ -151,10 +152,10 @@ void ConfigOption::writeStringValue(FTextStream &t,QCString &s) if (p) { t << " "; - while ((c=*p++)!=0 && !needsEscaping) + while ((c=*p++)!=0 && !needsEscaping) needsEscaping = (c==' ' || c=='\n' || c=='\t' || c=='"' || c=='#'); if (needsEscaping) - { + { t << "\""; p=se.data(); while (*p) @@ -172,19 +173,17 @@ void ConfigOption::writeStringValue(FTextStream &t,QCString &s) } } -void ConfigOption::writeStringList(FTextStream &t,QStrList &l) +void ConfigOption::writeStringList(FTextStream &t,const StringVector &l) { - const char *p = l.first(); bool first=TRUE; - while (p) + for (const auto &p : l) { - QCString s=p; + if (!first) t << " \\" << endl; + QCString s=p.c_str(); if (!first) t << " "; - first=FALSE; writeStringValue(t,s); - p = l.next(); - if (p) t << " \\" << endl; + first=FALSE; } } @@ -193,7 +192,7 @@ void ConfigOption::writeStringList(FTextStream &t,QStrList &l) ConfigImpl *ConfigImpl::m_instance = 0; -void ConfigInt::convertStrToVal() +void ConfigInt::convertStrToVal() { if (!m_valueString.isEmpty()) { @@ -216,7 +215,7 @@ void ConfigBool::convertStrToVal() QCString val = m_valueString.stripWhiteSpace().lower(); if (!val.isEmpty()) { - if (val=="yes" || val=="true" || val=="1" || val=="all") + if (val=="yes" || val=="true" || val=="1" || val=="all") { m_value=TRUE; } @@ -259,7 +258,7 @@ void ConfigEnum::convertStrToVal() QCString &ConfigImpl::getString(const char *fileName,int num,const char *name) const { ConfigOption *opt = m_dict->find(name); - if (opt==0) + if (opt==0) { config_term("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } @@ -270,10 +269,10 @@ QCString &ConfigImpl::getString(const char *fileName,int num,const char *name) c return *((ConfigString *)opt)->valueRef(); } -QStrList &ConfigImpl::getList(const char *fileName,int num,const char *name) const +StringVector &ConfigImpl::getList(const char *fileName,int num,const char *name) const { ConfigOption *opt = m_dict->find(name); - if (opt==0) + if (opt==0) { config_term("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } @@ -287,7 +286,7 @@ QStrList &ConfigImpl::getList(const char *fileName,int num,const char *name) con QCString &ConfigImpl::getEnum(const char *fileName,int num,const char *name) const { ConfigOption *opt = m_dict->find(name); - if (opt==0) + if (opt==0) { config_term("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } @@ -301,7 +300,7 @@ QCString &ConfigImpl::getEnum(const char *fileName,int num,const char *name) con int &ConfigImpl::getInt(const char *fileName,int num,const char *name) const { ConfigOption *opt = m_dict->find(name); - if (opt==0) + if (opt==0) { config_term("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } @@ -315,7 +314,7 @@ int &ConfigImpl::getInt(const char *fileName,int num,const char *name) const bool &ConfigImpl::getBool(const char *fileName,int num,const char *name) const { ConfigOption *opt = m_dict->find(name); - if (opt==0) + if (opt==0) { config_term("%s<%d>: Internal error: Requested unknown option %s!\n",fileName,num,name); } @@ -358,71 +357,33 @@ void ConfigList::writeTemplate(FTextStream &t,bool sl,bool) void ConfigList::compareDoxyfile(FTextStream &t) { - const char *p = m_value.first(); - const char *q = m_defaultValue.first(); - int defCnt = 0; - int valCnt = 0; - - // count non empty elements - while (p) - { - QCString s=p; - if (!s.stripWhiteSpace().isEmpty()) valCnt += 1; - p = m_value.next(); - } - - while (q) - { - QCString s=q; - if (!s.stripWhiteSpace().isEmpty()) defCnt += 1; - q = m_defaultValue.next(); - } + auto get_stripped = [](std::string s) { return QCString(s.c_str()).stripWhiteSpace(); }; + auto is_not_empty = [get_stripped](std::string s) { return !get_stripped(s).isEmpty(); }; + int defCnt = std::count_if( m_value.begin(), m_value.end(),is_not_empty); + int valCnt = std::count_if(m_defaultValue.begin(),m_defaultValue.end(),is_not_empty); if ( valCnt != defCnt) { writeTemplate(t,TRUE,TRUE); return; } - - // get first non empry element - q = m_defaultValue.first(); - p = m_value.first(); - QCString sp = p; - while (p && sp.stripWhiteSpace().isEmpty()) + auto it1 = m_value.begin(); + auto it2 = m_defaultValue.begin(); + while (it1!=m_value.end() && it2!=m_defaultValue.end()) { - p = m_value.next(); - sp = p; - } - QCString sq = q; - while (q && sq.stripWhiteSpace().isEmpty()) - { - q = m_value.next(); - sq = q; - } - while (p) - { - // skip empty elements - sp = p; - while (p && sp.stripWhiteSpace().isEmpty()) + // skip over empty values + while (it1!=m_value.end() && !is_not_empty(*it1)) { - p = m_value.next(); - sp = p; + ++it1; } - sq = q; - while (q && sq.stripWhiteSpace().isEmpty()) + if (it1!=m_value.end()) // non-empty value { - q = m_value.next(); - sq = q; - } - // be sure we have still an element (p and q have same number of 'filled' elements) - if (p) - { - if (sp.stripWhiteSpace() != sq.stripWhiteSpace()) + if (get_stripped(*it1) != get_stripped(*it2)) // not the default, write as difference { writeTemplate(t,TRUE,TRUE); return; } - p = m_value.next(); - q = m_defaultValue.next(); + ++it1; + ++it2; } } } @@ -544,7 +505,7 @@ struct ConfigFileState YY_BUFFER_STATE oldState; YY_BUFFER_STATE newState; QCString fileName; -}; +}; static const char *g_inputString; static int g_inputPosition; @@ -553,11 +514,11 @@ static QCString g_yyFileName; static QCString g_tmpString; static QCString *g_string=0; static bool *g_bool=0; -static QStrList *g_list=0; +static StringVector *g_list=0; static int g_lastState; static QCString g_elemStr; -static QStrList g_includePathList; -static QStack g_includeStack; +static StringVector g_includePathList; +static QStack g_includeStack; static int g_includeDepth; static bool g_configUpdate = FALSE; static QCString g_encoding; @@ -571,7 +532,7 @@ static ConfigImpl *g_config; static yy_size_t yyread(char *buf,yy_size_t max_size) { // no file included - if (g_includeStack.isEmpty()) + if (g_includeStack.isEmpty()) { yy_size_t c=0; if (g_inputString==0) return c; @@ -602,7 +563,7 @@ static QCString configStringRecode( int outputSize=inputSize*4+1; QCString output(outputSize); void *cd = portable_iconv_open(outputEncoding,inputEncoding); - if (cd==(void *)(-1)) + if (cd==(void *)(-1)) { config_term("Error: unsupported character conversion: '%s'->'%s'\n", inputEncoding.data(),outputEncoding.data()); @@ -646,7 +607,7 @@ static FILE *tryPath(const char *path,const char *fileName) return 0; } -static void substEnvVarsInStrList(QStrList &sl); +static void substEnvVarsInStrList(StringVector &sl); static void substEnvVarsInString(QCString &s); static FILE *findFile(const char *fileName) @@ -660,13 +621,11 @@ static FILE *findFile(const char *fileName) return tryPath(NULL, fileName); } substEnvVarsInStrList(g_includePathList); - char *s=g_includePathList.first(); - while (s) // try each of the include paths + for (const auto &s : g_includePathList) { - FILE *f = tryPath(s,fileName); + FILE *f = tryPath(s.c_str(),fileName); if (f) return f; - s=g_includePathList.next(); - } + } // try cwd if g_includePathList fails return tryPath(".",fileName); } @@ -676,7 +635,7 @@ static void readIncludeFile(const char *incName) if (g_includeDepth==MAX_INCLUDE_DEPTH) { config_term("maximum include depth (%d) reached, %s is not included. Aborting...\n", MAX_INCLUDE_DEPTH,incName); - } + } QCString inc = incName; substEnvVarsInString(inc); @@ -697,7 +656,7 @@ static void readIncludeFile(const char *incName) msg("@INCLUDE = %s: parsing...\n",inc.data()); #endif - // store the state of the old file + // store the state of the old file ConfigFileState *fs=new ConfigFileState; fs->oldState=YY_CURRENT_BUFFER; fs->lineNr=g_yyLineNr; @@ -710,7 +669,7 @@ static void readIncludeFile(const char *incName) fs->newState=YY_CURRENT_BUFFER; g_yyFileName=inc; g_includeDepth++; - } + } else { config_term("@INCLUDE = %s: not found!\n",inc.data()); @@ -745,12 +704,12 @@ static void readIncludeFile(const char *incName) "##".*"\n" { g_config->appendUserComment(yytext);g_yyLineNr++;} "#" { BEGIN(SkipComment); } [a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { QCString cmd=yytext; - cmd=cmd.left(cmd.length()-1).stripWhiteSpace(); + cmd=cmd.left(cmd.length()-1).stripWhiteSpace(); ConfigOption *option = g_config->get(cmd); if (option==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - cmd.data(),g_yyLineNr,g_yyFileName.data()); + cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); } else // known tag @@ -806,7 +765,7 @@ static void readIncludeFile(const char *incName) { config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n" " To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); + "file or upgrade it using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } BEGIN(SkipInvalid); break; @@ -820,7 +779,7 @@ static void readIncludeFile(const char *incName) { config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n" " To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); + "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } BEGIN(SkipInvalid); break; @@ -828,12 +787,12 @@ static void readIncludeFile(const char *incName) } } [a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { QCString cmd=yytext; - cmd=cmd.left(cmd.length()-2).stripWhiteSpace(); + cmd=cmd.left(cmd.length()-2).stripWhiteSpace(); ConfigOption *option = g_config->get(cmd); if (option==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - cmd.data(),g_yyLineNr,g_yyFileName.data()); + cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); } else // known tag @@ -862,19 +821,19 @@ static void readIncludeFile(const char *incName) case ConfigOption::O_Int: case ConfigOption::O_Bool: config_warn("operator += not supported for '%s'. Ignoring line at line %d, file %s\n", - yytext,g_yyLineNr,g_yyFileName.data()); + yytext,g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; case ConfigOption::O_Obsolete: config_warn("Tag '%s' at line %d of file %s has become obsolete.\n" "To avoid this warning please update your configuration " - "file using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); + "file using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; case ConfigOption::O_Disabled: config_warn("Tag '%s' at line %d of file %s belongs to an option that was not enabled at compile time.\n" "To avoid this warning please remove this line from your configuration " - "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); + "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; } @@ -883,8 +842,8 @@ static void readIncludeFile(const char *incName) "@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); g_list=&g_includePathList; g_list->clear(); g_elemStr=""; } /* include a g_config file */ "@INCLUDE"[ \t]*"=" { BEGIN(Include);} -([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { - readIncludeFile(configStringRecode(yytext,g_encoding,"UTF-8")); +([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { + readIncludeFile(configStringRecode(yytext,g_encoding,"UTF-8")); BEGIN(Start); } <> { @@ -912,19 +871,19 @@ static void readIncludeFile(const char *incName) [a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,g_yyLineNr,g_yyFileName.data()); } \n { g_yyLineNr++; BEGIN(Start); } \n { - g_yyLineNr++; + g_yyLineNr++; if (!g_elemStr.isEmpty()) { //printf("elemStr1='%s'\n",g_elemStr.data()); - g_list->append(g_elemStr); + g_list->push_back(g_elemStr.data()); } - BEGIN(Start); + BEGIN(Start); } [ \t]+ { if (!g_elemStr.isEmpty()) { //printf("elemStr2='%s'\n",g_elemStr.data()); - g_list->append(g_elemStr); + g_list->push_back(g_elemStr.data()); } g_elemStr.resize(0); } @@ -932,18 +891,18 @@ static void readIncludeFile(const char *incName) if (!g_elemStr.isEmpty()) { //printf("elemStr2='%s'\n",g_elemStr.data()); - g_list->append(g_elemStr); + g_list->push_back(g_elemStr.data()); } g_elemStr.resize(0); } -[^ \"\t\r\n]+ { (*g_string)+=configStringRecode(yytext,g_encoding,"UTF-8"); +[^ \"\t\r\n]+ { (*g_string)+=configStringRecode(yytext,g_encoding,"UTF-8"); checkEncoding(); } "\"" { g_lastState=YY_START; - BEGIN(GetQuotedString); - g_tmpString.resize(0); + BEGIN(GetQuotedString); + g_tmpString.resize(0); } -"\""|"\n" { +"\""|"\n" { // we add a bogus space to signal that the string was quoted. This space will be stripped later on. g_tmpString+=" "; //printf("Quoted String = '%s'\n",g_tmpString.data()); @@ -967,16 +926,16 @@ static void readIncludeFile(const char *incName) g_tmpString+='"'; } . { g_tmpString+=*yytext; } -[a-zA-Z]+ { - QCString bs=yytext; +[a-zA-Z]+ { + QCString bs=yytext; bs=bs.upper(); if (bs=="YES" || bs=="1") *g_bool=TRUE; else if (bs=="NO" || bs=="0") *g_bool=FALSE; - else + else { - *g_bool=FALSE; + *g_bool=FALSE; config_warn("Invalid value '%s' for " "boolean tag in line %d, file %s; use YES or NO\n", bs.data(),g_yyLineNr,g_yyFileName.data()); @@ -991,7 +950,7 @@ static void readIncludeFile(const char *incName) \n { g_yyLineNr++; BEGIN(Start); } \\[ \r\t]*\n { g_yyLineNr++; BEGIN(Start); } <*>\\[ \r\t]*\n { g_yyLineNr++; } -<*>. +<*>. <*>\n { g_yyLineNr++ ; } %% @@ -1004,7 +963,7 @@ void ConfigImpl::writeTemplate(FTextStream &t,bool sl,bool upd) /* print first lines of user comment that were at the beginning of the file, might have special meaning for editors */ if (m_startComment) { - t << takeStartComment() << endl; + t << takeStartComment() << endl; } t << "# Doxyfile " << getDoxygenVersion() << endl << endl; if (!sl) @@ -1078,12 +1037,12 @@ static void substEnvVarsInString(QCString &s) //printf("substEnvVarInString(%s) end\n",s.data()); } -static void substEnvVarsInStrList(QStrList &sl) +static void substEnvVarsInStrList(StringVector &sl) { - char *s = sl.first(); - while (s) + StringVector results; + for (const auto &s : sl) { - QCString result(s); + QCString result = s.c_str(); // an argument with quotes will have an extra space at the end, so wasQuoted will be TRUE. bool wasQuoted = (result.find(' ')!=-1) || (result.find('\t')!=-1); // here we strip the quote again @@ -1093,8 +1052,8 @@ static void substEnvVarsInStrList(QStrList &sl) if (!wasQuoted) /* as a result of the expansion, a single string may have expanded into a list, which we'll - add to sl. If the original string already - contained multiple elements no further + add to sl. If the original string already + contained multiple elements no further splitting is done to allow quoted items with spaces! */ { int l=result.length(); @@ -1105,7 +1064,7 @@ static void substEnvVarsInStrList(QStrList &sl) { char c=0; // skip until start of new word - while (iinit(); } -static void checkList(QStrList &list,const char *name, bool equalRequired,bool valueRequired) +static void checkList(const StringVector &list,const char *name, bool equalRequired,bool valueRequired) { - const char *s=list.first(); - while (s) + for (const auto &s: list) { - QCString item=s; + QCString item=s.c_str(); item=item.stripWhiteSpace(); int i=item.find('='); if (i==-1 && equalRequired) @@ -1403,7 +1331,6 @@ static void checkList(QStrList &list,const char *name, bool equalRequired,bool v } } } - s=list.next(); } } @@ -1411,17 +1338,18 @@ void Config::checkAndCorrect() { ConfigValues::instance().init(); - QCString &warnFormat = Config_getString(WARN_FORMAT); + //------------------------ + // check WARN_FORMAT + QCString warnFormat = Config_getString(WARN_FORMAT); if (warnFormat.stripWhiteSpace().isEmpty()) { - warnFormat="$file:$line $text"; + Config_updateString(WARN_FORMAT,"$file:$line $text"); } else { if (warnFormat.find("$file")==-1) { warn_uncond("warning format does not contain a $file tag!\n"); - } if (warnFormat.find("$line")==-1) { @@ -1433,15 +1361,17 @@ void Config::checkAndCorrect() } } - QCString &manExtension = Config_getString(MAN_EXTENSION); - + //------------------------ // set default man page extension if non is given by the user + QCString manExtension = Config_getString(MAN_EXTENSION); if (manExtension.isEmpty()) { - manExtension=".3"; + Config_updateString(MAN_EXTENSION,".3"); } - QCString &paperType = Config_getEnum(PAPER_TYPE); + //------------------------ + // check and correct PAPER_TYPE + QCString paperType = Config_getEnum(PAPER_TYPE); paperType=paperType.lower().stripWhiteSpace(); if (paperType.isEmpty() || paperType=="a4wide") { @@ -1453,42 +1383,53 @@ void Config::checkAndCorrect() err("Unknown page type specified\n"); paperType="a4"; } + Config_updateEnum(PAPER_TYPE,paperType); - QCString &outputLanguage=Config_getEnum(OUTPUT_LANGUAGE); + //------------------------ + // check & correct OUTPUT_LANGUAGE + QCString outputLanguage=Config_getEnum(OUTPUT_LANGUAGE); outputLanguage=outputLanguage.stripWhiteSpace(); if (outputLanguage.isEmpty()) { outputLanguage = "English"; } + Config_updateEnum(OUTPUT_LANGUAGE,outputLanguage); - QCString &htmlFileExtension=Config_getString(HTML_FILE_EXTENSION); + //------------------------ + // check & correct HTML_FILE_EXTENSION + QCString htmlFileExtension=Config_getString(HTML_FILE_EXTENSION); htmlFileExtension=htmlFileExtension.stripWhiteSpace(); if (htmlFileExtension.isEmpty()) { htmlFileExtension = ".html"; } + Config_updateString(HTML_FILE_EXTENSION,htmlFileExtension); - // expand the relative stripFromPath values - QStrList &stripFromPath = Config_getList(STRIP_FROM_PATH); - char *sfp = stripFromPath.first(); - if (sfp==0) // by default use the current path + //------------------------ + // check & correct STRIP_FROM_PATH + StringVector stripFromPath = Config_getList(STRIP_FROM_PATH); + if (stripFromPath.empty()) // by default use the current path { QString p = QDir::currentDirPath(); if (p.at(p.length()-1)!='/') p.append('/'); - stripFromPath.append(p.utf8()); + stripFromPath.push_back(p.utf8().data()); } else { cleanUpPaths(stripFromPath); } + Config_updateList(STRIP_FROM_PATH,stripFromPath); - // expand the relative stripFromPath values - QStrList &stripFromIncPath = Config_getList(STRIP_FROM_INC_PATH); + //------------------------ + // check & correct STRIP_FROM_INC_PATH + StringVector stripFromIncPath = Config_getList(STRIP_FROM_INC_PATH); cleanUpPaths(stripFromIncPath); + Config_updateList(STRIP_FROM_INC_PATH,stripFromIncPath); + //------------------------ // Test to see if HTML header is valid - QCString &headerFile = Config_getString(HTML_HEADER); + QCString headerFile = Config_getString(HTML_HEADER); if (!headerFile.isEmpty()) { QFileInfo fi(headerFile); @@ -1498,8 +1439,10 @@ void Config::checkAndCorrect() "does not exist\n",headerFile.data()); } } + + //------------------------ // Test to see if HTML footer is valid - QCString &footerFile = Config_getString(HTML_FOOTER); + QCString footerFile = Config_getString(HTML_FOOTER); if (!footerFile.isEmpty()) { QFileInfo fi(footerFile); @@ -1510,29 +1453,31 @@ void Config::checkAndCorrect() } } + //------------------------ // Test to see if MathJax code file is valid if (Config_getBool(USE_MATHJAX)) { - QCString &MathJaxCodefile = Config_getString(MATHJAX_CODEFILE); - if (!MathJaxCodefile.isEmpty()) + QCString mathJaxCodefile = Config_getString(MATHJAX_CODEFILE); + if (!mathJaxCodefile.isEmpty()) { - QFileInfo fi(MathJaxCodefile); + QFileInfo fi(mathJaxCodefile); if (!fi.exists()) { config_term("tag MATHJAX_CODEFILE file '%s' " - "does not exist\n",MathJaxCodefile.data()); + "does not exist\n",mathJaxCodefile.data()); } } - QCString &path = Config_getString(MATHJAX_RELPATH); + QCString path = Config_getString(MATHJAX_RELPATH); if (!path.isEmpty() && path.at(path.length()-1)!='/') { path+="/"; } - + Config_updateString(MATHJAX_RELPATH,path); } + //------------------------ // Test to see if LaTeX header is valid - QCString &latexHeaderFile = Config_getString(LATEX_HEADER); + QCString latexHeaderFile = Config_getString(LATEX_HEADER); if (!latexHeaderFile.isEmpty()) { QFileInfo fi(latexHeaderFile); @@ -1542,8 +1487,10 @@ void Config::checkAndCorrect() "does not exist\n",latexHeaderFile.data()); } } + + //------------------------ // Test to see if LaTeX footer is valid - QCString &latexFooterFile = Config_getString(LATEX_FOOTER); + QCString latexFooterFile = Config_getString(LATEX_FOOTER); if (!latexFooterFile.isEmpty()) { QFileInfo fi(latexFooterFile); @@ -1554,25 +1501,24 @@ void Config::checkAndCorrect() } } + //------------------------ // check include path - QStrList &includePath = Config_getList(INCLUDE_PATH); - char *s=includePath.first(); - while (s) + const StringVector &includePath = Config_getList(INCLUDE_PATH); + for (const auto &s : includePath) { - QFileInfo fi(s); + QFileInfo fi(s.c_str()); if (!fi.exists()) warn_uncond("tag INCLUDE_PATH: include path '%s' " - "does not exist\n",s); - s=includePath.next(); + "does not exist\n",s.c_str()); } + //------------------------ // check PREDEFINED if (Config_getBool(ENABLE_PREPROCESSING)) { - QStrList &predefList = Config_getList(PREDEFINED); - s=predefList.first(); - while (s) + const StringVector &predefList = Config_getList(PREDEFINED); + for (const auto &s : predefList) { - QCString predef=s; + QCString predef=s.c_str(); predef=predef.stripWhiteSpace(); int i_equals=predef.find('='); int i_obrace=predef.find('('); @@ -1580,79 +1526,85 @@ void Config::checkAndCorrect() { err("Illegal PREDEFINED format '%s', no define name specified\n",predef.data()); } - s=predefList.next(); } } + //------------------------ // check ALIASES - QStrList &aliasList = Config_getList(ALIASES); - s=aliasList.first(); - while (s) + const StringVector &aliasList = Config_getList(ALIASES); + for (const auto &s : aliasList) { QRegExp re1("[a-z_A-Z][a-z_A-Z0-9]*[ \t]*="); // alias without argument QRegExp re2("[a-z_A-Z][a-z_A-Z0-9]*{[0-9]+}[ \t]*="); // alias with argument - QCString alias=s; + QCString alias=s.c_str(); alias=alias.stripWhiteSpace(); if (alias.find(re1)!=0 && alias.find(re2)!=0) { err("Illegal ALIASES format '%s'. Use \"name=value\" or \"name{n}=value\", where n is the number of arguments\n", alias.data()); } - s=aliasList.next(); } + //------------------------ // check EXTENSION_MAPPING checkList(Config_getList(EXTENSION_MAPPING),"EXTENSION_MAPPING",TRUE,TRUE); + //------------------------ // check FILTER_PATTERNS checkList(Config_getList(FILTER_PATTERNS),"FILTER_PATTERNS",TRUE,TRUE); + //------------------------ // check FILTER_SOURCE_PATTERNS checkList(Config_getList(FILTER_SOURCE_PATTERNS),"FILTER_SOURCE_PATTERNS",FALSE,FALSE); + //------------------------ // check TAGFILES checkList(Config_getList(TAGFILES),"TAGFILES",FALSE,TRUE); + //------------------------ // check EXTRA_SEARCH_MAPPINGS if (Config_getBool(SEARCHENGINE) && Config_getBool(GENERATE_HTML)) { checkList(Config_getList(EXTRA_SEARCH_MAPPINGS),"EXTRA_SEARCH_MAPPING",TRUE,TRUE); } + //------------------------ // check if GENERATE_TREEVIEW and GENERATE_HTMLHELP are both enabled if (Config_getBool(GENERATE_TREEVIEW) && Config_getBool(GENERATE_HTMLHELP)) { err("When enabling GENERATE_HTMLHELP the tree view (GENERATE_TREEVIEW) should be disabled. I'll do it for you.\n"); - Config_getBool(GENERATE_TREEVIEW)=FALSE; + Config_updateBool(GENERATE_TREEVIEW,FALSE); } + + //------------------------ + // check if SEARCHENGINE and GENERATE_HTMLHELP are both enabled if (Config_getBool(SEARCHENGINE) && Config_getBool(GENERATE_HTMLHELP)) { err("When enabling GENERATE_HTMLHELP the search engine (SEARCHENGINE) should be disabled. I'll do it for you.\n"); - Config_getBool(SEARCHENGINE)=FALSE; + Config_updateBool(SEARCHENGINE,FALSE); } + //------------------------ // check if SEPARATE_MEMBER_PAGES and INLINE_GROUPED_CLASSES are both enabled if (Config_getBool(SEPARATE_MEMBER_PAGES) && Config_getBool(INLINE_GROUPED_CLASSES)) { err("When enabling INLINE_GROUPED_CLASSES the SEPARATE_MEMBER_PAGES option should be disabled. I'll do it for you.\n"); - Config_getBool(SEPARATE_MEMBER_PAGES)=FALSE; + Config_updateBool(SEPARATE_MEMBER_PAGES,FALSE); } - // check dot image format - QCString &dotImageFormat=Config_getEnum(DOT_IMAGE_FORMAT); + //------------------------ + // check and correct DOT_IMAGE_FORMAT + QCString dotImageFormat=Config_getEnum(DOT_IMAGE_FORMAT); dotImageFormat=dotImageFormat.stripWhiteSpace(); if (dotImageFormat.isEmpty()) { dotImageFormat = "png"; } - //else if (dotImageFormat!="gif" && dotImageFormat!="png" && dotImageFormat!="jpg") - //{ - // err("Invalid value for DOT_IMAGE_FORMAT: '%s'. Using the default.\n",dotImageFormat.data()); - // dotImageFormat = "png"; - //} + Config_updateEnum(DOT_IMAGE_FORMAT,dotImageFormat); + //------------------------ // correct DOT_FONTNAME if needed - QCString &dotFontName=Config_getString(DOT_FONTNAME); + QCString dotFontName=Config_getString(DOT_FONTNAME); if (dotFontName=="FreeSans" || dotFontName=="FreeSans.ttf") { warn_uncond("doxygen no longer ships with the FreeSans font.\n" @@ -1663,9 +1615,11 @@ void Config::checkAndCorrect() { dotFontName = "Helvetica"; } + Config_updateString(DOT_FONTNAME,dotFontName); + //------------------------ // clip dotFontSize against the maximum bounds - int &dotFontSize = Config_getInt(DOT_FONTSIZE); + int dotFontSize = Config_getInt(DOT_FONTSIZE); if (dotFontSize<4) { dotFontSize=4; @@ -1674,9 +1628,11 @@ void Config::checkAndCorrect() { dotFontSize=24; } + Config_updateInt(DOT_FONTSIZE,dotFontSize); + //------------------------ // clip number of threads - int &dotNumThreads = Config_getInt(DOT_NUM_THREADS); + int dotNumThreads = Config_getInt(DOT_NUM_THREADS); if (dotNumThreads>32) { dotNumThreads=32; @@ -1685,9 +1641,11 @@ void Config::checkAndCorrect() { dotNumThreads=QMAX(2,std::thread::hardware_concurrency()+1); } + Config_updateInt(DOT_NUM_THREADS,dotNumThreads); + //------------------------ // check dot path - QCString &dotPath = Config_getString(DOT_PATH); + QCString dotPath = Config_getString(DOT_PATH); if (!dotPath.isEmpty()) { QFileInfo fi(dotPath); @@ -1717,9 +1675,11 @@ void Config::checkAndCorrect() { dotPath=""; } + Config_updateString(DOT_PATH,dotPath); + //------------------------ // check plantuml path - QCString &plantumlJarPath = Config_getString(PLANTUML_JAR_PATH); + QCString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH); if (!plantumlJarPath.isEmpty()) { QFileInfo pu(plantumlJarPath); @@ -1748,9 +1708,11 @@ void Config::checkAndCorrect() plantumlJarPath=""; } } + Config_updateString(PLANTUML_JAR_PATH,plantumlJarPath); + //------------------------ // check dia path - QCString &diaPath = Config_getString(DIA_PATH); + QCString diaPath = Config_getString(DIA_PATH); if (!diaPath.isEmpty()) { QFileInfo dp(diaPath+"/dia"+Portable::commandExtension()); @@ -1772,52 +1734,52 @@ void Config::checkAndCorrect() { diaPath=""; } + Config_updateString(DIA_PATH,diaPath); - // check input - QStrList &inputSources=Config_getList(INPUT); - if (inputSources.count()==0) + //------------------------ + // check INPUT + StringVector inputSources=Config_getList(INPUT); + if (inputSources.empty()) { // use current dir as the default - inputSources.append(QDir::currentDirPath().utf8()); + inputSources.push_back(QDir::currentDirPath().utf8().data()); } else { - s=inputSources.first(); - while (s) + for (const auto &s : inputSources) { - QFileInfo fi(s); + QFileInfo fi(s.c_str()); if (!fi.exists()) { - warn_uncond("tag INPUT: input source '%s' does not exist\n",s); + warn_uncond("tag INPUT: input source '%s' does not exist\n",s.c_str()); } - s=inputSources.next(); } } + Config_updateList(INPUT,inputSources); + //------------------------ // add default file patterns if needed - QStrList &filePatternList = Config_getList(FILE_PATTERNS); - if (filePatternList.isEmpty()) + StringVector filePatternList = Config_getList(FILE_PATTERNS); + if (filePatternList.empty()) { ConfigOption * opt = ConfigImpl::instance()->get("FILE_PATTERNS"); if (opt->kind()==ConfigOption::O_List) { - QStrList l = ((ConfigList*)opt)->getDefault(); - const char *p = l.first(); - while (p) - { - filePatternList.append(p); - p = l.next(); - } + filePatternList = ((ConfigList*)opt)->getDefault(); } } + Config_updateList(FILE_PATTERNS,filePatternList); + //------------------------ // add default pattern if needed - QStrList &examplePatternList = Config_getList(EXAMPLE_PATTERNS); - if (examplePatternList.isEmpty()) + StringVector examplePatternList = Config_getList(EXAMPLE_PATTERNS); + if (examplePatternList.empty()) { - examplePatternList.append("*"); + examplePatternList.push_back("*"); + Config_updateList(EXAMPLE_PATTERNS,examplePatternList); } + //------------------------ // if no output format is enabled, warn the user if (!Config_getBool(GENERATE_HTML) && !Config_getBool(GENERATE_LATEX) && @@ -1834,6 +1796,7 @@ void Config::checkAndCorrect() warn_uncond("No output formats selected! Set at least one of the main GENERATE_* options to YES.\n"); } + //------------------------ // check HTMLHELP creation requirements if (!Config_getBool(GENERATE_HTML) && Config_getBool(GENERATE_HTMLHELP)) @@ -1841,36 +1804,40 @@ void Config::checkAndCorrect() warn_uncond("GENERATE_HTMLHELP=YES requires GENERATE_HTML=YES.\n"); } + //------------------------ // check QHP creation requirements if (Config_getBool(GENERATE_QHP)) { if (Config_getString(QHP_NAMESPACE).isEmpty()) { err("GENERATE_QHP=YES requires QHP_NAMESPACE to be set. Using 'org.doxygen.doc' as default!.\n"); - Config_getString(QHP_NAMESPACE)="org.doxygen.doc"; + Config_updateString(QHP_NAMESPACE,"org.doxygen.doc"); } if (Config_getString(QHP_VIRTUAL_FOLDER).isEmpty()) { err("GENERATE_QHP=YES requires QHP_VIRTUAL_FOLDER to be set. Using 'doc' as default!\n"); - Config_getString(QHP_VIRTUAL_FOLDER)="doc"; + Config_updateString(QHP_VIRTUAL_FOLDER,"doc"); } } + //------------------------ if (Config_getBool(OPTIMIZE_OUTPUT_JAVA) && Config_getBool(INLINE_INFO)) { // don't show inline info for Java output, since Java has no inline // concept. - Config_getBool(INLINE_INFO)=FALSE; + Config_updateBool(INLINE_INFO,FALSE); } - int &depth = Config_getInt(MAX_DOT_GRAPH_DEPTH); + //------------------------ + int depth = Config_getInt(MAX_DOT_GRAPH_DEPTH); if (depth==0) { - depth=1000; + Config_updateInt(MAX_DOT_GRAPH_DEPTH,1000); } - int &hue = Config_getInt(HTML_COLORSTYLE_HUE); + //------------------------ + int hue = Config_getInt(HTML_COLORSTYLE_HUE); if (hue<0) { hue=0; @@ -1879,8 +1846,10 @@ void Config::checkAndCorrect() { hue=hue%360; } + Config_updateInt(HTML_COLORSTYLE_HUE,hue); - int &sat = Config_getInt(HTML_COLORSTYLE_SAT); + //------------------------ + int sat = Config_getInt(HTML_COLORSTYLE_SAT); if (sat<0) { sat=0; @@ -1889,7 +1858,11 @@ void Config::checkAndCorrect() { sat=255; } - int &gamma = Config_getInt(HTML_COLORSTYLE_GAMMA); + Config_updateInt(HTML_COLORSTYLE_SAT,sat); + + + //------------------------ + int gamma = Config_getInt(HTML_COLORSTYLE_GAMMA); if (gamma<40) { gamma=40; @@ -1898,32 +1871,30 @@ void Config::checkAndCorrect() { gamma=240; } + Config_updateInt(HTML_COLORSTYLE_GAMMA,gamma); + //------------------------ QCString mathJaxFormat = Config_getEnum(MATHJAX_FORMAT); if (!mathJaxFormat.isEmpty() && mathJaxFormat!="HTML-CSS" && mathJaxFormat!="NativeMML" && mathJaxFormat!="SVG") { err("Unsupported value for MATHJAX_FORMAT: Should be one of HTML-CSS, NativeMML, or SVG\n"); - Config_getEnum(MATHJAX_FORMAT)="HTML-CSS"; + Config_updateEnum(MATHJAX_FORMAT,"HTML-CSS"); } + //------------------------ // add default words if needed - QStrList &annotationFromBrief = Config_getList(ABBREVIATE_BRIEF); - if (annotationFromBrief.isEmpty()) - { - annotationFromBrief.append("The $name class"); - annotationFromBrief.append("The $name widget"); - annotationFromBrief.append("The $name file"); - annotationFromBrief.append("is"); - annotationFromBrief.append("provides"); - annotationFromBrief.append("specifies"); - annotationFromBrief.append("contains"); - annotationFromBrief.append("represents"); - annotationFromBrief.append("a"); - annotationFromBrief.append("an"); - annotationFromBrief.append("the"); + const StringVector &annotationFromBrief = Config_getList(ABBREVIATE_BRIEF); + if (annotationFromBrief.empty()) + { + Config_updateList(ABBREVIATE_BRIEF, + { "The $name class", "The $name widget", + "The $name file", "is", "provides", "specifies", + "contains", "represents", "a", "an", "the" + }); } + //------------------------ // some default settings for vhdl if (Config_getBool(OPTIMIZE_OUTPUT_VHDL) && (Config_getBool(INLINE_INHERITED_MEMB) || @@ -1953,15 +1924,18 @@ void Config::checkAndCorrect() "%s%s%s%s%s%s",s1,s2,s3,s4,s5,s6 ); - Config_getBool(INLINE_INHERITED_MEMB) = FALSE; - Config_getBool(INHERIT_DOCS) = FALSE; - Config_getBool(HIDE_SCOPE_NAMES) = TRUE; - Config_getBool(EXTRACT_PRIVATE) = TRUE; - Config_getBool(ENABLE_PREPROCESSING) = FALSE; - Config_getBool(EXTRACT_PACKAGE) = TRUE; + Config_updateBool(INLINE_INHERITED_MEMB, FALSE); + Config_updateBool(INHERIT_DOCS, FALSE); + Config_updateBool(HIDE_SCOPE_NAMES, TRUE); + Config_updateBool(EXTRACT_PRIVATE, TRUE); + Config_updateBool(ENABLE_PREPROCESSING, FALSE); + Config_updateBool(EXTRACT_PACKAGE, TRUE); } - checkFileName(Config_getString(GENERATE_TAGFILE),"GENERATE_TAGFILE"); + if (!checkFileName(Config_getString(GENERATE_TAGFILE),"GENERATE_TAGFILE")) + { + Config_updateString(GENERATE_TAGFILE,""); + } #if 0 // TODO: this breaks test 25; SOURCEBROWSER = NO and SOURCE_TOOLTIPS = YES. // So this and other regressions should be analysed and fixed before this can be enabled @@ -2016,10 +1990,10 @@ void Config::postProcess(bool clearHeaderAndFooter, bool compare) // refers to the files that we are supposed to parse. if (clearHeaderAndFooter) { - Config_getString(HTML_HEADER)=""; - Config_getString(HTML_FOOTER)=""; - Config_getString(LATEX_HEADER)=""; - Config_getString(LATEX_FOOTER)=""; + Config_updateString(HTML_HEADER ,""); + Config_updateString(HTML_FOOTER ,""); + Config_updateString(LATEX_HEADER,""); + Config_updateString(LATEX_FOOTER,""); } } diff --git a/src/context.cpp b/src/context.cpp index 9684870..d21b1d0 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -298,18 +298,16 @@ class ConfigContext::Private public: Private() { m_cachedLists.setAutoDelete(TRUE); } virtual ~Private() { } - TemplateVariant fetchList(const QCString &name,const QStrList *list) + TemplateVariant fetchList(const QCString &name,const StringVector &list) { TemplateVariant *v = m_cachedLists.find(name); if (v==0) { TemplateList *tlist = TemplateList::alloc(); m_cachedLists.insert(name,new TemplateVariant(tlist)); - QStrListIterator li(*list); - char *s; - for (li.toFirst();(s=li.current());++li) + for (const auto &s : list) { - tlist->append(s); + tlist->append(s.c_str()); } return tlist; } @@ -345,23 +343,23 @@ TemplateVariant ConfigContext::get(const char *name) const { case ConfigValues::Info::Bool: { - bool b = ConfigValues::instance().*((ConfigValues::InfoBool*)option)->item; + bool b = ConfigValues::instance().*(option->value.b); return TemplateVariant(b); } case ConfigValues::Info::Int: { - int i = ConfigValues::instance().*((ConfigValues::InfoInt*)option)->item; + int i = ConfigValues::instance().*(option->value.i); return TemplateVariant(i); } case ConfigValues::Info::String: { - QCString s = ConfigValues::instance().*((ConfigValues::InfoString*)option)->item; + QCString s = ConfigValues::instance().*(option->value.s); return TemplateVariant(s); } case ConfigValues::Info::List: { - const QStrList &l = ConfigValues::instance().*((ConfigValues::InfoList*)option)->item; - return p->fetchList(name,&l); + const StringVector &l = ConfigValues::instance().*(option->value.l); + return p->fetchList(name,l); } default: break; diff --git a/src/definition.cpp b/src/definition.cpp index 09b4f56..c398b61 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -159,13 +159,12 @@ void DefinitionImpl::setDefFile(const QCString &df,int defLine,int defCol) static bool matchExcludedSymbols(const char *name) { - static QStrList &exclSyms = Config_getList(EXCLUDE_SYMBOLS); - if (exclSyms.count()==0) return FALSE; // nothing specified - const char *pat = exclSyms.first(); + const StringVector &exclSyms = Config_getList(EXCLUDE_SYMBOLS); + if (exclSyms.empty()) return FALSE; // nothing specified QCString symName = name; - while (pat) + for (const auto &pat : exclSyms) { - QCString pattern = pat; + QCString pattern = pat.c_str(); bool forceStart=FALSE; bool forceEnd=FALSE; if (pattern.at(0)=='^') @@ -210,7 +209,6 @@ static bool matchExcludedSymbols(const char *name) } } } - pat = exclSyms.next(); } //printf("--> name=%s: no match\n",name); return FALSE; @@ -1930,15 +1928,13 @@ QCString abbreviate(const char *s,const char *name) result=result.left(result.length()-1); // strip any predefined prefix - QStrList &briefDescAbbrev = Config_getList(ABBREVIATE_BRIEF); - const char *p = briefDescAbbrev.first(); - while (p) + const StringVector &briefDescAbbrev = Config_getList(ABBREVIATE_BRIEF); + for (const auto &p : briefDescAbbrev) { - QCString str = p; + QCString str = p.c_str(); str.replace(QRegExp("\\$name"), scopelessName); // replace $name with entity name str += " "; stripWord(result,str); - p = briefDescAbbrev.next(); } // capitalize first word diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 0f8f04b..7f0b524 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -69,7 +69,7 @@ class DirDefImpl : public DefinitionImpl, public DirDef void endMemberDeclarations(OutputList &ol); static DirDef *createNewDir(const char *path); - static bool matchPath(const QCString &path,QStrList &l); + static bool matchPath(const QCString &path,const StringVector &l); DirList m_subdirs; QCString m_dispName; @@ -792,17 +792,15 @@ DirDef *DirDefImpl::createNewDir(const char *path) return dir; } -bool DirDefImpl::matchPath(const QCString &path,QStrList &l) +bool DirDefImpl::matchPath(const QCString &path,const StringVector &l) { - const char *s=l.first(); - while (s) + for (const auto &s : l) { - QCString prefix = s; - if (qstricmp(prefix.left(path.length()),path)==0) // case insensitive compare + std::string prefix = s.substr(0,path.length()); + if (qstricmp(prefix.c_str(),path)==0) // case insensitive compare { return TRUE; } - s = l.next(); } return FALSE; } diff --git a/src/docparser.cpp b/src/docparser.cpp index 00f287c..0ed7f50 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1846,18 +1846,16 @@ static void readTextFileByName(const QCString &file,QCString &text) return; } } - QStrList &examplePathList = Config_getList(EXAMPLE_PATH); - char *s=examplePathList.first(); - while (s) + const StringVector &examplePathList = Config_getList(EXAMPLE_PATH); + for (const auto &s : examplePathList) { - QCString absFileName = QCString(s)+Portable::pathSeparator()+file; + QCString absFileName = QCString(s.c_str())+Portable::pathSeparator()+file; QFileInfo fi(absFileName); if (fi.exists()) { text = fileToString(absFileName,Config_getBool(FILTER_SOURCE_FILES)); return; } - s=examplePathList.next(); } // as a fallback we also look in the exampleNameDict @@ -2569,7 +2567,7 @@ void DocRef::parse() DocCite::DocCite(DocNode *parent,const QCString &target,const QCString &) //context) { - static uint numBibFiles = Config_getList(CITE_BIB_FILES).count(); + size_t numBibFiles = Config_getList(CITE_BIB_FILES).size(); m_parent = parent; //printf("DocCite::DocCite(target=%s)\n",target.data()); ASSERT(!target.isEmpty()); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 1824ceb..ddaa3f1 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -628,7 +628,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,const Entry *root) iName=fd->name(); } } - else if (!Config_getList(STRIP_FROM_INC_PATH).isEmpty()) + else if (!Config_getList(STRIP_FROM_INC_PATH).empty()) { iName=stripFromIncludePath(fd->absFilePath()); } @@ -8856,10 +8856,10 @@ static void readTagFile(const std::shared_ptr &root,const char *tl) //---------------------------------------------------------------------------- static void copyLatexStyleSheet() { - QStrList latexExtraStyleSheet = Config_getList(LATEX_EXTRA_STYLESHEET); - for (uint i=0; i parseFile(OutlineParserInterface &parser, parser.needsPreprocessing(extension)) { Preprocessor preprocessor; - QStrList &includePath = Config_getList(INCLUDE_PATH); - char *s=includePath.first(); - while (s) + const StringVector &includePath = Config_getList(INCLUDE_PATH); + for (const auto &s : includePath) { - preprocessor.addSearchDir(QFileInfo(s).absFilePath().utf8()); - s=includePath.next(); + preprocessor.addSearchDir(QFileInfo(s.c_str()).absFilePath().utf8()); } BufStr inBuf(fi.size()+4096); msg("Preprocessing %s...\n",fn); @@ -9318,8 +9314,8 @@ static QDict g_pathsVisited(1009); static int readDir(QFileInfo *fi, FileNameLinkedMap *fnMap, StringUnorderedSet *exclSet, - QStrList *patList, - QStrList *exclPatList, + const StringVector *patList, + const StringVector *exclPatList, StringVector *resultList, StringUnorderedSet *resultSet, bool errorIfNotExist, @@ -9366,8 +9362,8 @@ static int readDir(QFileInfo *fi, } else if (cfi->isFile() && (!Config_getBool(EXCLUDE_SYMLINKS) || !cfi->isSymLink()) && - (patList==0 || patternMatch(*cfi,patList)) && - !patternMatch(*cfi,exclPatList) && + (patList==0 || patternMatch(*cfi,*patList)) && + (exclPatList==0 || !patternMatch(*cfi,*exclPatList)) && (killSet==0 || killSet->find(cfi->absFilePath().utf8().data())==killSet->end()) ) { @@ -9391,7 +9387,7 @@ static int readDir(QFileInfo *fi, else if (recursive && (!Config_getBool(EXCLUDE_SYMLINKS) || !cfi->isSymLink()) && cfi->isDir() && - !patternMatch(*cfi,exclPatList) && + (exclPatList==0 || !patternMatch(*cfi,*exclPatList)) && cfi->fileName().at(0)!='.') // skip "." ".." and ".dir" { cfi->setFile(cfi->absFilePath()); @@ -9414,8 +9410,8 @@ static int readDir(QFileInfo *fi, int readFileOrDirectory(const char *s, FileNameLinkedMap *fnMap, StringUnorderedSet *exclSet, - QStrList *patList, - QStrList *exclPatList, + const StringVector *patList, + const StringVector *exclPatList, StringVector *resultList, StringUnorderedSet *resultSet, bool recursive, @@ -9554,13 +9550,12 @@ void readAliases() { // add aliases to a dictionary Doxygen::aliasDict.setAutoDelete(TRUE); - QStrList &aliasList = Config_getList(ALIASES); - const char *s=aliasList.first(); - while (s) + const StringVector &aliasList = Config_getList(ALIASES); + for (const auto &s : aliasList) { - if (Doxygen::aliasDict[s]==0) + QCString alias=s.c_str(); + if (Doxygen::aliasDict[alias]==0) { - QCString alias=s; int i=alias.find('='); if (i>0) { @@ -9581,7 +9576,6 @@ void readAliases() } } } - s=aliasList.next(); } expandAliases(); escapeAliases(); @@ -10308,15 +10302,13 @@ void adjustConfiguration() * Add custom extension mappings **************************************************************************/ - QStrList &extMaps = Config_getList(EXTENSION_MAPPING); - char *mapping = extMaps.first(); - while (mapping) + const StringVector &extMaps = Config_getList(EXTENSION_MAPPING); + for (const auto &mapping : extMaps) { - QCString mapStr = mapping; + QCString mapStr = mapping.c_str(); int i=mapStr.find('='); if (i==-1) { - mapping = extMaps.next(); continue; } else @@ -10325,7 +10317,6 @@ void adjustConfiguration() QCString language = mapStr.mid(i+1).stripWhiteSpace().lower(); if (ext.isEmpty() || language.isEmpty()) { - mapping = extMaps.next(); continue; } @@ -10341,23 +10332,20 @@ void adjustConfiguration() ext.data(),language.data()); } } - mapping = extMaps.next(); } // add predefined macro name to a dictionary - QStrList &expandAsDefinedList =Config_getList(EXPAND_AS_DEFINED); - char *s=expandAsDefinedList.first(); - while (s) + const StringVector &expandAsDefinedList =Config_getList(EXPAND_AS_DEFINED); + for (const auto &s : expandAsDefinedList) { - Doxygen::expandAsDefinedSet.insert(s); - s=expandAsDefinedList.next(); + Doxygen::expandAsDefinedSet.insert(s.c_str()); } // read aliases and store them in a dictionary readAliases(); // store number of spaces in a tab into Doxygen::spaces - int &tabSize = Config_getInt(TAB_SIZE); + int tabSize = Config_getInt(TAB_SIZE); Doxygen::spaces.resize(tabSize+1); int sp;for (sp=0;sp updateConfig) { + QCString result = formatDirName; // Note the & on the next line, we modify the formatDirOption! - if (formatDirName.isEmpty()) + if (result.isEmpty()) { - formatDirName = baseDirName + defaultDirName; + result = baseDirName + defaultDirName; + updateConfig(result); } else if (formatDirName[0]!='/' && (formatDirName.length()==1 || formatDirName[1]!=':')) { - formatDirName.prepend(baseDirName+'/'); + result.prepend(baseDirName+'/'); + updateConfig(result); } - QDir formatDir(formatDirName); - if (!formatDir.exists() && !formatDir.mkdir(formatDirName)) + QDir formatDir(result); + if (!formatDir.exists() && !formatDir.mkdir(result)) { - err("Could not create output directory %s\n", formatDirName.data()); + err("Could not create output directory %s\n", result.data()); cleanUpDoxygen(); exit(1); } - return formatDirName; + return result; } static QCString getQchFileName() @@ -10533,23 +10525,20 @@ void searchInputFiles() { StringUnorderedSet killSet; - QStrList &exclPatterns = Config_getList(EXCLUDE_PATTERNS); + const StringVector &exclPatterns = Config_getList(EXCLUDE_PATTERNS); bool alwaysRecursive = Config_getBool(RECURSIVE); StringUnorderedSet excludeNameSet; // gather names of all files in the include path g_s.begin("Searching for include files...\n"); killSet.clear(); - QStrList &includePathList = Config_getList(INCLUDE_PATH); - char *s=includePathList.first(); - while (s) + const StringVector &includePathList = Config_getList(INCLUDE_PATH); + for (const auto &s : includePathList) { - QStrList &pl = Config_getList(INCLUDE_FILE_PATTERNS); - if (pl.count()==0) - { - pl = Config_getList(FILE_PATTERNS); - } - readFileOrDirectory(s, // s + size_t plSize = Config_getList(INCLUDE_FILE_PATTERNS).size(); + const StringVector &pl = plSize==0 ? Config_getList(FILE_PATTERNS) : + Config_getList(INCLUDE_FILE_PATTERNS); + readFileOrDirectory(s.c_str(), // s Doxygen::includeNameLinkedMap, // fnDict 0, // exclSet &pl, // patList @@ -10559,17 +10548,15 @@ void searchInputFiles() alwaysRecursive, // recursive TRUE, // errorIfNotExist &killSet); // killSet - s=includePathList.next(); } g_s.end(); g_s.begin("Searching for example files...\n"); killSet.clear(); - QStrList &examplePathList = Config_getList(EXAMPLE_PATH); - s=examplePathList.first(); - while (s) + const StringVector &examplePathList = Config_getList(EXAMPLE_PATH); + for (const auto &s : examplePathList) { - readFileOrDirectory(s, // s + readFileOrDirectory(s.c_str(), // s Doxygen::exampleNameLinkedMap, // fnDict 0, // exclSet &Config_getList(EXAMPLE_PATTERNS), // patList @@ -10579,17 +10566,15 @@ void searchInputFiles() (alwaysRecursive || Config_getBool(EXAMPLE_RECURSIVE)), // recursive TRUE, // errorIfNotExist &killSet); // killSet - s=examplePathList.next(); } g_s.end(); g_s.begin("Searching for images...\n"); killSet.clear(); - QStrList &imagePathList=Config_getList(IMAGE_PATH); - s=imagePathList.first(); - while (s) + const StringVector &imagePathList=Config_getList(IMAGE_PATH); + for (const auto &s : imagePathList) { - readFileOrDirectory(s, // s + readFileOrDirectory(s.c_str(), // s Doxygen::imageNameLinkedMap, // fnDict 0, // exclSet 0, // patList @@ -10599,17 +10584,15 @@ void searchInputFiles() alwaysRecursive, // recursive TRUE, // errorIfNotExist &killSet); // killSet - s=imagePathList.next(); } g_s.end(); g_s.begin("Searching for dot files...\n"); killSet.clear(); - QStrList &dotFileList=Config_getList(DOTFILE_DIRS); - s=dotFileList.first(); - while (s) + const StringVector &dotFileList=Config_getList(DOTFILE_DIRS); + for (const auto &s : dotFileList) { - readFileOrDirectory(s, // s + readFileOrDirectory(s.c_str(), // s Doxygen::dotFileNameLinkedMap, // fnDict 0, // exclSet 0, // patList @@ -10619,17 +10602,15 @@ void searchInputFiles() alwaysRecursive, // recursive TRUE, // errorIfNotExist &killSet); // killSet - s=dotFileList.next(); } g_s.end(); g_s.begin("Searching for msc files...\n"); killSet.clear(); - QStrList &mscFileList=Config_getList(MSCFILE_DIRS); - s=mscFileList.first(); - while (s) + const StringVector &mscFileList=Config_getList(MSCFILE_DIRS); + for (const auto &s : mscFileList) { - readFileOrDirectory(s, // s + readFileOrDirectory(s.c_str(), // s Doxygen::mscFileNameLinkedMap, // fnDict 0, // exclSet 0, // patList @@ -10639,17 +10620,15 @@ void searchInputFiles() alwaysRecursive, // recursive TRUE, // errorIfNotExist &killSet); // killSet - s=mscFileList.next(); } g_s.end(); g_s.begin("Searching for dia files...\n"); killSet.clear(); - QStrList &diaFileList=Config_getList(DIAFILE_DIRS); - s=diaFileList.first(); - while (s) + const StringVector &diaFileList=Config_getList(DIAFILE_DIRS); + for (const auto &s : diaFileList) { - readFileOrDirectory(s, // s + readFileOrDirectory(s.c_str(), // s Doxygen::diaFileNameLinkedMap, // fnDict 0, // exclSet 0, // patList @@ -10659,16 +10638,14 @@ void searchInputFiles() alwaysRecursive, // recursive TRUE, // errorIfNotExist &killSet); // killSet - s=diaFileList.next(); } g_s.end(); g_s.begin("Searching for files to exclude\n"); - QStrList &excludeList = Config_getList(EXCLUDE); - s=excludeList.first(); - while (s) + const StringVector &excludeList = Config_getList(EXCLUDE); + for (const auto &s : excludeList) { - readFileOrDirectory(s, // s + readFileOrDirectory(s.c_str(), // s 0, // fnDict 0, // exclSet &Config_getList(FILE_PATTERNS), // patList @@ -10677,7 +10654,6 @@ void searchInputFiles() &excludeNameSet, // resultSet alwaysRecursive, // recursive FALSE); // errorIfNotExist - s=excludeList.next(); // killSet } g_s.end(); @@ -10688,11 +10664,10 @@ void searchInputFiles() g_s.begin("Searching INPUT for files to process...\n"); killSet.clear(); Doxygen::inputPaths.clear(); - QStrList &inputList=Config_getList(INPUT); - s=inputList.first(); - while (s) + const StringVector &inputList=Config_getList(INPUT); + for (const auto &s : inputList) { - QCString path=s; + QCString path=s.c_str(); uint l = path.length(); if (l>0) { @@ -10712,7 +10687,6 @@ void searchInputFiles() &killSet, // killSet &Doxygen::inputPaths); // paths } - s=inputList.next(); } std::sort(Doxygen::inputNameLinkedMap->begin(), Doxygen::inputNameLinkedMap->end(), @@ -10738,10 +10712,10 @@ void parseInput() /************************************************************************** * Make sure the output directory exists **************************************************************************/ - QCString &outputDirectory = Config_getString(OUTPUT_DIRECTORY); + QCString outputDirectory = Config_getString(OUTPUT_DIRECTORY); if (outputDirectory.isEmpty()) { - outputDirectory=QDir::currentDirPath().utf8(); + outputDirectory = Config_updateString(OUTPUT_DIRECTORY,QDir::currentDirPath().utf8()); } else { @@ -10763,7 +10737,7 @@ void parseInput() } dir.cd(outputDirectory); } - outputDirectory=dir.absPath().utf8(); + outputDirectory = Config_updateString(OUTPUT_DIRECTORY,dir.absPath().utf8()); } /************************************************************************** @@ -10795,34 +10769,40 @@ void parseInput() **************************************************************************/ QCString htmlOutput; - bool &generateHtml = Config_getBool(GENERATE_HTML); + bool generateHtml = Config_getBool(GENERATE_HTML); if (generateHtml || g_useOutputTemplate /* TODO: temp hack */) - htmlOutput = createOutputDirectory(outputDirectory,Config_getString(HTML_OUTPUT),"/html"); + htmlOutput = createOutputDirectory(outputDirectory,Config_getString(HTML_OUTPUT), + "/html",Config_setterFunc(HTML_OUTPUT)); QCString docbookOutput; - bool &generateDocbook = Config_getBool(GENERATE_DOCBOOK); + bool generateDocbook = Config_getBool(GENERATE_DOCBOOK); if (generateDocbook) - docbookOutput = createOutputDirectory(outputDirectory,Config_getString(DOCBOOK_OUTPUT),"/docbook"); + docbookOutput = createOutputDirectory(outputDirectory,Config_getString(DOCBOOK_OUTPUT), + "/docbook",Config_setterFunc(DOCBOOK_OUTPUT)); QCString xmlOutput; - bool &generateXml = Config_getBool(GENERATE_XML); + bool generateXml = Config_getBool(GENERATE_XML); if (generateXml) - xmlOutput = createOutputDirectory(outputDirectory,Config_getString(XML_OUTPUT),"/xml"); + xmlOutput = createOutputDirectory(outputDirectory,Config_getString(XML_OUTPUT), + "/xml",Config_setterFunc(XML_OUTPUT)); QCString latexOutput; - bool &generateLatex = Config_getBool(GENERATE_LATEX); + bool generateLatex = Config_getBool(GENERATE_LATEX); if (generateLatex) - latexOutput = createOutputDirectory(outputDirectory,Config_getString(LATEX_OUTPUT),"/latex"); + latexOutput = createOutputDirectory(outputDirectory,Config_getString(LATEX_OUTPUT), + "/latex",Config_setterFunc(LATEX_OUTPUT)); QCString rtfOutput; - bool &generateRtf = Config_getBool(GENERATE_RTF); + bool generateRtf = Config_getBool(GENERATE_RTF); if (generateRtf) - rtfOutput = createOutputDirectory(outputDirectory,Config_getString(RTF_OUTPUT),"/rtf"); + rtfOutput = createOutputDirectory(outputDirectory,Config_getString(RTF_OUTPUT), + "/rtf",Config_setterFunc(RTF_OUTPUT)); QCString manOutput; - bool &generateMan = Config_getBool(GENERATE_MAN); + bool generateMan = Config_getBool(GENERATE_MAN); if (generateMan) - manOutput = createOutputDirectory(outputDirectory,Config_getString(MAN_OUTPUT),"/man"); + manOutput = createOutputDirectory(outputDirectory,Config_getString(MAN_OUTPUT), + "/man",Config_setterFunc(MAN_OUTPUT)); //QCString sqlOutput; //bool &generateSql = Config_getBool(GENERATE_SQLITE3); @@ -10856,11 +10836,11 @@ void parseInput() **************************************************************************/ LayoutDocManager::instance().init(); - QCString &layoutFileName = Config_getString(LAYOUT_FILE); + QCString layoutFileName = Config_getString(LAYOUT_FILE); bool defaultLayoutUsed = FALSE; if (layoutFileName.isEmpty()) { - layoutFileName = "DoxygenLayout.xml"; + layoutFileName = Config_updateString(LAYOUT_FILE,"DoxygenLayout.xml"); defaultLayoutUsed = TRUE; } @@ -10880,13 +10860,14 @@ void parseInput() **************************************************************************/ // prevent search in the output directories - QStrList &exclPatterns = Config_getList(EXCLUDE_PATTERNS); - if (generateHtml) exclPatterns.append(htmlOutput); - if (generateDocbook) exclPatterns.append(docbookOutput); - if (generateXml) exclPatterns.append(xmlOutput); - if (generateLatex) exclPatterns.append(latexOutput); - if (generateRtf) exclPatterns.append(rtfOutput); - if (generateMan) exclPatterns.append(manOutput); + StringVector exclPatterns = Config_getList(EXCLUDE_PATTERNS); + if (generateHtml) exclPatterns.push_back(htmlOutput.data()); + if (generateDocbook) exclPatterns.push_back(docbookOutput.data()); + if (generateXml) exclPatterns.push_back(xmlOutput.data()); + if (generateLatex) exclPatterns.push_back(latexOutput.data()); + if (generateRtf) exclPatterns.push_back(rtfOutput.data()); + if (generateMan) exclPatterns.push_back(manOutput.data()); + Config_updateList(EXCLUDE_PATTERNS,exclPatterns); searchInputFiles(); @@ -10919,12 +10900,10 @@ void parseInput() std::shared_ptr root = std::make_shared(); msg("Reading and parsing tag files\n"); - QStrList &tagFileList = Config_getList(TAGFILES); - char *s=tagFileList.first(); - while (s) + const StringVector &tagFileList = Config_getList(TAGFILES); + for (const auto &s : tagFileList) { - readTagFile(root,s); - s=tagFileList.next(); + readTagFile(root,s.c_str()); } /************************************************************************** diff --git a/src/doxygen.h b/src/doxygen.h index 99b5d6f..557c871 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -165,8 +165,8 @@ void cleanUpDoxygen(); int readFileOrDirectory(const char *s, FileNameLinkedMap *fnDict, StringUnorderedSet *exclSet, - QStrList *patList, - QStrList *exclPatList, + const StringVector *patList, + const StringVector *exclPatList, StringVector *resultList, StringUnorderedSet *resultSet, bool recursive, diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index cb50af1..d5a5703 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -669,7 +669,7 @@ static void generateJSNavTree(const QList &nodeList) t << "var NAVTREE =" << endl; t << "[" << endl; t << " [ "; - QCString &projName = Config_getString(PROJECT_NAME); + QCString projName = Config_getString(PROJECT_NAME); if (projName.isEmpty()) { if (mainPageHasTitle()) // Use title of main page as root diff --git a/src/htags.cpp b/src/htags.cpp index 1a240b1..0c3a9af 100644 --- a/src/htags.cpp +++ b/src/htags.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -36,25 +36,25 @@ static QDict g_symbolDict(10007); */ bool Htags::execute(const QCString &htmldir) { - static QStrList &inputSource = Config_getList(INPUT); - static bool quiet = Config_getBool(QUIET); - static bool warnings = Config_getBool(WARNINGS); - static QCString htagsOptions = ""; //Config_getString(HTAGS_OPTIONS); - static QCString projectName = Config_getString(PROJECT_NAME); - static QCString projectNumber = Config_getString(PROJECT_NUMBER); + const StringVector &inputSource = Config_getList(INPUT); + bool quiet = Config_getBool(QUIET); + bool warnings = Config_getBool(WARNINGS); + QCString htagsOptions = ""; //Config_getString(HTAGS_OPTIONS); + QCString projectName = Config_getString(PROJECT_NAME); + QCString projectNumber = Config_getString(PROJECT_NUMBER); QCString cwd = QDir::currentDirPath().utf8(); - if (inputSource.isEmpty()) + if (inputSource.empty()) { g_inputDir.setPath(cwd); } - else if (inputSource.count()==1) + else if (inputSource.size()==1) { - g_inputDir.setPath(inputSource.first()); + g_inputDir.setPath(inputSource.back().c_str()); if (!g_inputDir.exists()) err("Cannot find directory %s. " "Check the value of the INPUT tag in the configuration file.\n", - inputSource.first() + inputSource.back().c_str() ); } else @@ -69,16 +69,16 @@ bool Htags::execute(const QCString &htmldir) QCString commandLine = " -g -s -a -n "; if (!quiet) commandLine += "-v "; if (warnings) commandLine += "-w "; - if (!htagsOptions.isEmpty()) + if (!htagsOptions.isEmpty()) { commandLine += ' '; commandLine += htagsOptions; } - if (!projectName.isEmpty()) + if (!projectName.isEmpty()) { commandLine += "-t \""; commandLine += projectName; - if (!projectNumber.isEmpty()) + if (!projectNumber.isEmpty()) { commandLine += '-'; commandLine += projectNumber; @@ -150,7 +150,7 @@ bool Htags::loadFilemap(const QCString &htmlDir) } else { - err("file %s cannot be opened\n",fileMapName.data()); + err("file %s cannot be opened\n",fileMapName.data()); } } return FALSE; diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 7458b23..900ea48 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -415,7 +415,6 @@ static QCString substituteHtmlKeywords(const QCString &str, { // Build CSS/JavaScript tags depending on treeview, search engine settings QCString cssFile; - QStrList extraCssFile; QCString generatedBy; QCString treeViewCssJs; QCString searchCssJs; @@ -456,10 +455,10 @@ static QCString substituteHtmlKeywords(const QCString &str, } extraCssText = ""; - extraCssFile = Config_getList(HTML_EXTRA_STYLESHEET); - for (uint i=0; i\n" " MathJax.Hub.Config({\n" " extensions: [\"tex2jax.js\""; - QStrList &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS); - const char *s = mathJaxExtensions.first(); - while (s) + const StringVector &mathJaxExtensions = Config_getList(MATHJAX_EXTENSIONS); + for (const auto &s : mathJaxExtensions) { - mathJaxJs+= ", \""+QCString(s)+".js\""; - s = mathJaxExtensions.next(); + mathJaxJs+= ", \""+QCString(s.c_str())+".js\""; } if (mathJaxFormat.isEmpty()) { @@ -1261,10 +1258,10 @@ void HtmlGenerator::writeStyleInfo(int part) } Doxygen::indexList->addStyleSheetFile(cssfi.fileName().utf8()); } - static QStrList extraCssFile = Config_getList(HTML_EXTRA_STYLESHEET); - for (uint i=0; itrLegendTitle().data()); startTitle(ol,0); @@ -3936,8 +3936,8 @@ void writeGraphInfo(OutputList &ol) delete fd; // restore config settings - stripCommentsStateRef = oldStripCommentsState; - createSubdirs = oldCreateSubdirs; + Config_updateBool(STRIP_CODE_COMMENTS,oldStripCommentsState); + Config_updateBool(CREATE_SUBDIRS,oldCreateSubdirs); endFile(ol); ol.popGeneratorState(); diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 52a8acf..f3cce3e 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -511,10 +511,10 @@ static void writeDefaultHeaderPart1(FTextStream &t) "\\usepackage{fixltx2e}\n" // for \textsubscript "\\usepackage{calc}\n" "\\usepackage{doxygen}\n"; - QStrList extraLatexStyle = Config_getList(LATEX_EXTRA_STYLESHEET); - for (uint i=0; itype==ConfigValues::Info::Bool) { - return ConfigValues::instance().*((ConfigValues::InfoBool*)opt)->item; + return ConfigValues::instance().*(opt->value.b); } else if (!opt) { @@ -84,7 +84,7 @@ LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind, LayoutNavEntry *entry; for (li.toFirst();(entry=li.current());++li) { - // depth first search, needed to find the entry furthest from the + // depth first search, needed to find the entry furthest from the // root in case an entry is in the tree twice result = entry->find(kind,file); if (result) return result; @@ -99,7 +99,7 @@ LayoutNavEntry *LayoutNavEntry::find(LayoutNavEntry::Kind kind, QCString LayoutNavEntry::url() const { QCString url = baseFile().stripWhiteSpace(); - if ((kind()!=LayoutNavEntry::User && kind()!=LayoutNavEntry::UserGroup) || + if ((kind()!=LayoutNavEntry::User && kind()!=LayoutNavEntry::UserGroup) || (kind()==LayoutNavEntry::UserGroup && url.left(9)=="usergroup")) { url+=Doxygen::htmlFileExtension; @@ -111,7 +111,7 @@ QCString LayoutNavEntry::url() const bool found=FALSE; if (resolveLink(0,url.mid(5).stripWhiteSpace(),TRUE,&d,anchor)) { - if (d && d->isLinkable()) + if (d && d->isLinkable()) { url=d->getOutputFileBase()+Doxygen::htmlFileExtension; if (!anchor.isEmpty()) @@ -137,14 +137,14 @@ class LayoutParser : public QXmlDefaultHandler private: class StartElementHandler { - typedef void (LayoutParser::*Handler)(const QXmlAttributes &attrib); + typedef void (LayoutParser::*Handler)(const QXmlAttributes &attrib); public: - StartElementHandler(LayoutParser *parent, Handler h) + StartElementHandler(LayoutParser *parent, Handler h) : m_parent(parent), m_handler(h) {} virtual ~StartElementHandler() {} - virtual void operator()(const QXmlAttributes &attrib) - { - (m_parent->*m_handler)(attrib); + virtual void operator()(const QXmlAttributes &attrib) + { + (m_parent->*m_handler)(attrib); } protected: StartElementHandler() : m_parent(0), m_handler(0) {} @@ -156,13 +156,13 @@ class LayoutParser : public QXmlDefaultHandler class StartElementHandlerKind : public StartElementHandler { typedef void (LayoutParser::*Handler)(LayoutDocEntry::Kind kind, - const QXmlAttributes &attrib); + const QXmlAttributes &attrib); public: - StartElementHandlerKind(LayoutParser *parent, LayoutDocEntry::Kind k,Handler h) + StartElementHandlerKind(LayoutParser *parent, LayoutDocEntry::Kind k,Handler h) : m_parent(parent), m_kind(k), m_handler(h) {} - void operator()(const QXmlAttributes &attrib) - { - (m_parent->*m_handler)(m_kind,attrib); + void operator()(const QXmlAttributes &attrib) + { + (m_parent->*m_handler)(m_kind,attrib); } private: LayoutParser *m_parent; @@ -174,14 +174,14 @@ class LayoutParser : public QXmlDefaultHandler { typedef void (LayoutParser::*Handler)(LayoutDocEntry::Kind kind, const QXmlAttributes &attrib, - const QCString &title); + const QCString &title); public: StartElementHandlerSection(LayoutParser *parent, LayoutDocEntry::Kind k,Handler h, - const QCString &title) + const QCString &title) : m_parent(parent), m_kind(k), m_handler(h), m_title(title) {} - void operator()(const QXmlAttributes &attrib) - { - (m_parent->*m_handler)(m_kind,attrib,m_title); + void operator()(const QXmlAttributes &attrib) + { + (m_parent->*m_handler)(m_kind,attrib,m_title); } private: LayoutParser *m_parent; @@ -195,19 +195,19 @@ class LayoutParser : public QXmlDefaultHandler typedef void (LayoutParser::*Handler)(const QXmlAttributes &attrib, MemberListType type, const QCString &title, - const QCString &subtitle); + const QCString &subtitle); public: - StartElementHandlerMember(LayoutParser *parent, + StartElementHandlerMember(LayoutParser *parent, Handler h, MemberListType type, const QCString &tl, const QCString &ss = QCString() - ) + ) : m_parent(parent), m_handler(h), m_type(type), m_title(tl), m_subscript(ss) {} - void operator()(const QXmlAttributes &attrib) - { - (m_parent->*m_handler)(attrib,m_type,m_title,m_subscript); + void operator()(const QXmlAttributes &attrib) + { + (m_parent->*m_handler)(attrib,m_type,m_title,m_subscript); } private: LayoutParser *m_parent; @@ -221,17 +221,17 @@ class LayoutParser : public QXmlDefaultHandler { typedef void (LayoutParser::*Handler)(LayoutNavEntry::Kind kind, const QXmlAttributes &attrib, - const QCString &title); + const QCString &title); public: StartElementHandlerNavEntry(LayoutParser *parent, - LayoutNavEntry::Kind kind, + LayoutNavEntry::Kind kind, Handler h, const QCString &tl - ) + ) : m_parent(parent), m_kind(kind), m_handler(h), m_title(tl) {} - void operator()(const QXmlAttributes &attrib) - { - (m_parent->*m_handler)(m_kind,attrib,m_title); + void operator()(const QXmlAttributes &attrib) + { + (m_parent->*m_handler)(m_kind,attrib,m_title); } private: LayoutParser *m_parent; @@ -242,7 +242,7 @@ class LayoutParser : public QXmlDefaultHandler class EndElementHandler { - typedef void (LayoutParser::*Handler)(); + typedef void (LayoutParser::*Handler)(); public: EndElementHandler(LayoutParser *parent, Handler h) : m_parent(parent), m_handler(h) {} void operator()() { (m_parent->*m_handler)(); } @@ -266,51 +266,51 @@ class LayoutParser : public QXmlDefaultHandler m_rootNav = 0; //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); - //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); + //bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); //bool javaOpt = Config_getBool(OPTIMIZE_OUTPUT_JAVA); bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); // start & end handlers - m_sHandler.insert("doxygenlayout", + m_sHandler.insert("doxygenlayout", new StartElementHandler(this,&LayoutParser::startLayout)); - m_eHandler.insert("doxygenlayout", + m_eHandler.insert("doxygenlayout", new EndElementHandler(this,&LayoutParser::endLayout)); // class layout handlers - m_sHandler.insert("navindex", + m_sHandler.insert("navindex", new StartElementHandler(this,&LayoutParser::startNavIndex)); - m_sHandler.insert("navindex/tab", + m_sHandler.insert("navindex/tab", new StartElementHandler(this,&LayoutParser::startNavEntry)); - m_eHandler.insert("navindex/tab", + m_eHandler.insert("navindex/tab", new EndElementHandler(this,&LayoutParser::endNavEntry)); - m_eHandler.insert("navindex", + m_eHandler.insert("navindex", new EndElementHandler(this,&LayoutParser::endNavIndex)); // class layout handlers - m_sHandler.insert("class", + m_sHandler.insert("class", new StartElementHandler(this,&LayoutParser::startClass)); - m_sHandler.insert("class/briefdescription", + m_sHandler.insert("class/briefdescription", new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("class/detaileddescription", + m_sHandler.insert("class/detaileddescription", new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry, theTranslator->trDetailedDescription())); - m_sHandler.insert("class/authorsection", + m_sHandler.insert("class/authorsection", new StartElementHandlerKind(this,LayoutDocEntry::AuthorSection,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("class/includes", + m_sHandler.insert("class/includes", new StartElementHandlerKind(this,LayoutDocEntry::ClassIncludes,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("class/inheritancegraph", + m_sHandler.insert("class/inheritancegraph", new StartElementHandlerKind(this,LayoutDocEntry::ClassInheritanceGraph,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("class/collaborationgraph", + m_sHandler.insert("class/collaborationgraph", new StartElementHandlerKind(this,LayoutDocEntry::ClassCollaborationGraph,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("class/allmemberslink", + m_sHandler.insert("class/allmemberslink", new StartElementHandlerKind(this,LayoutDocEntry::ClassAllMembersLink,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("class/usedfiles", + m_sHandler.insert("class/usedfiles", new StartElementHandlerKind(this,LayoutDocEntry::ClassUsedFiles,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("class/memberdecl", + m_sHandler.insert("class/memberdecl", new StartElementHandler(this,&LayoutParser::startMemberDecl)); - m_sHandler.insert("class/memberdecl/membergroups", + m_sHandler.insert("class/memberdecl/membergroups", new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("class/memberdecl/nestedclasses", + m_sHandler.insert("class/memberdecl/nestedclasses", new StartElementHandlerSection(this,LayoutDocEntry::ClassNestedClasses,&LayoutParser::startSectionEntry, COMPILE_FOR_2_OPTIONS( theTranslator->trCompounds(), @@ -323,118 +323,118 @@ class LayoutParser : public QXmlDefaultHandler m_sHandler.insert("class/memberdecl/interfaces", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_interfaces,theTranslator->trInterfaces())); - m_sHandler.insert("class/memberdecl/publictypes", + m_sHandler.insert("class/memberdecl/publictypes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_pubTypes,theTranslator->trPublicTypes())); - m_sHandler.insert("class/memberdecl/publicslots", + m_sHandler.insert("class/memberdecl/publicslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_pubSlots,theTranslator->trPublicSlots())); - m_sHandler.insert("class/memberdecl/signals", + MemberListType_pubSlots,theTranslator->trPublicSlots())); + m_sHandler.insert("class/memberdecl/signals", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_signals,theTranslator->trSignals())); - m_sHandler.insert("class/memberdecl/publicmethods", + MemberListType_signals,theTranslator->trSignals())); + m_sHandler.insert("class/memberdecl/publicmethods", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_pubMethods, COMPILE_FOR_2_OPTIONS( theTranslator->trPublicMembers(), SrcLangExt_ObjC,theTranslator->trInstanceMethods(), SrcLangExt_Slice,theTranslator->trOperations() - ))); - m_sHandler.insert("class/memberdecl/publicstaticmethods", + ))); + m_sHandler.insert("class/memberdecl/publicstaticmethods", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_pubStaticMethods, COMPILE_FOR_1_OPTION( theTranslator->trStaticPublicMembers(), SrcLangExt_ObjC,theTranslator->trClassMethods() - ))); - m_sHandler.insert("class/memberdecl/publicattributes", + ))); + m_sHandler.insert("class/memberdecl/publicattributes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_pubAttribs, COMPILE_FOR_1_OPTION( theTranslator->trPublicAttribs(), SrcLangExt_Slice,theTranslator->trDataMembers() - ))); - m_sHandler.insert("class/memberdecl/publicstaticattributes", + ))); + m_sHandler.insert("class/memberdecl/publicstaticattributes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_pubStaticAttribs,theTranslator->trStaticPublicAttribs())); - m_sHandler.insert("class/memberdecl/protectedtypes", + MemberListType_pubStaticAttribs,theTranslator->trStaticPublicAttribs())); + m_sHandler.insert("class/memberdecl/protectedtypes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_proTypes,theTranslator->trProtectedTypes())); - m_sHandler.insert("class/memberdecl/protectedslots", + MemberListType_proTypes,theTranslator->trProtectedTypes())); + m_sHandler.insert("class/memberdecl/protectedslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_proSlots,theTranslator->trProtectedSlots())); - m_sHandler.insert("class/memberdecl/protectedmethods", + MemberListType_proSlots,theTranslator->trProtectedSlots())); + m_sHandler.insert("class/memberdecl/protectedmethods", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_proMethods,theTranslator->trProtectedMembers())); - m_sHandler.insert("class/memberdecl/protectedstaticmethods", + MemberListType_proMethods,theTranslator->trProtectedMembers())); + m_sHandler.insert("class/memberdecl/protectedstaticmethods", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_proStaticMethods,theTranslator->trStaticProtectedMembers())); - m_sHandler.insert("class/memberdecl/protectedattributes", + m_sHandler.insert("class/memberdecl/protectedattributes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_proAttribs,theTranslator->trProtectedAttribs())); - m_sHandler.insert("class/memberdecl/protectedstaticattributes", + MemberListType_proAttribs,theTranslator->trProtectedAttribs())); + m_sHandler.insert("class/memberdecl/protectedstaticattributes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_proStaticAttribs,theTranslator->trStaticProtectedAttribs())); - m_sHandler.insert("class/memberdecl/packagetypes", + MemberListType_proStaticAttribs,theTranslator->trStaticProtectedAttribs())); + m_sHandler.insert("class/memberdecl/packagetypes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_pacTypes,theTranslator->trPackageTypes())); - m_sHandler.insert("class/memberdecl/packagemethods", + MemberListType_pacTypes,theTranslator->trPackageTypes())); + m_sHandler.insert("class/memberdecl/packagemethods", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_pacMethods,theTranslator->trPackageMembers())); - m_sHandler.insert("class/memberdecl/packagestaticmethods", + MemberListType_pacMethods,theTranslator->trPackageMembers())); + m_sHandler.insert("class/memberdecl/packagestaticmethods", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_pacStaticMethods,theTranslator->trStaticPackageMembers())); - m_sHandler.insert("class/memberdecl/packageattributes", + MemberListType_pacStaticMethods,theTranslator->trStaticPackageMembers())); + m_sHandler.insert("class/memberdecl/packageattributes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_pacAttribs,theTranslator->trPackageAttribs())); - m_sHandler.insert("class/memberdecl/packagestaticattributes", + MemberListType_pacAttribs,theTranslator->trPackageAttribs())); + m_sHandler.insert("class/memberdecl/packagestaticattributes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_pacStaticAttribs,theTranslator->trStaticPackageAttribs())); - m_sHandler.insert("class/memberdecl/properties", + MemberListType_pacStaticAttribs,theTranslator->trStaticPackageAttribs())); + m_sHandler.insert("class/memberdecl/properties", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_properties,theTranslator->trProperties())); - m_sHandler.insert("class/memberdecl/events", + MemberListType_properties,theTranslator->trProperties())); + m_sHandler.insert("class/memberdecl/events", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_events,theTranslator->trEvents())); - m_sHandler.insert("class/memberdecl/privatetypes", + MemberListType_events,theTranslator->trEvents())); + m_sHandler.insert("class/memberdecl/privatetypes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_priTypes,theTranslator->trPrivateTypes())); - m_sHandler.insert("class/memberdecl/privateslots", + MemberListType_priTypes,theTranslator->trPrivateTypes())); + m_sHandler.insert("class/memberdecl/privateslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_priSlots,theTranslator->trPrivateSlots())); - m_sHandler.insert("class/memberdecl/privatemethods", + MemberListType_priSlots,theTranslator->trPrivateSlots())); + m_sHandler.insert("class/memberdecl/privatemethods", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_priMethods,theTranslator->trPrivateMembers())); - m_sHandler.insert("class/memberdecl/privatestaticmethods", + MemberListType_priMethods,theTranslator->trPrivateMembers())); + m_sHandler.insert("class/memberdecl/privatestaticmethods", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_priStaticMethods,theTranslator->trStaticPrivateMembers())); - m_sHandler.insert("class/memberdecl/privateattributes", + MemberListType_priStaticMethods,theTranslator->trStaticPrivateMembers())); + m_sHandler.insert("class/memberdecl/privateattributes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_priAttribs,theTranslator->trPrivateAttribs())); - m_sHandler.insert("class/memberdecl/privatestaticattributes", + MemberListType_priAttribs,theTranslator->trPrivateAttribs())); + m_sHandler.insert("class/memberdecl/privatestaticattributes", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, - MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs())); - m_sHandler.insert("class/memberdecl/friends", + MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs())); + m_sHandler.insert("class/memberdecl/friends", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_friends,theTranslator->trFriends())); - m_sHandler.insert("class/memberdecl/related", + m_sHandler.insert("class/memberdecl/related", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_related,theTranslator->trRelatedFunctions(), - theTranslator->trRelatedSubscript())); - m_eHandler.insert("class/memberdecl", + theTranslator->trRelatedSubscript())); + m_eHandler.insert("class/memberdecl", new EndElementHandler(this,&LayoutParser::endMemberDecl)); - m_sHandler.insert("class/memberdef", + m_sHandler.insert("class/memberdef", new StartElementHandler(this,&LayoutParser::startMemberDef)); - m_sHandler.insert("class/memberdef/inlineclasses", + m_sHandler.insert("class/memberdef/inlineclasses", new StartElementHandlerSection(this,LayoutDocEntry::ClassInlineClasses,&LayoutParser::startSectionEntry, COMPILE_FOR_1_OPTION( theTranslator->trClassDocumentation(), SrcLangExt_Fortran,theTranslator->trTypeDocumentation() ))); - m_sHandler.insert("class/memberdef/typedefs", + m_sHandler.insert("class/memberdef/typedefs", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_typedefMembers,theTranslator->trMemberTypedefDocumentation())); - m_sHandler.insert("class/memberdef/enums", + m_sHandler.insert("class/memberdef/enums", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_enumMembers,theTranslator->trMemberEnumerationDocumentation())); m_sHandler.insert("class/memberdef/services", @@ -443,10 +443,10 @@ class LayoutParser : public QXmlDefaultHandler m_sHandler.insert("class/memberdef/interfaces", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_interfaceMembers,theTranslator->trInterfaces())); - m_sHandler.insert("class/memberdef/constructors", + m_sHandler.insert("class/memberdef/constructors", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_constructors,theTranslator->trConstructorDocumentation())); - m_sHandler.insert("class/memberdef/functions", + m_sHandler.insert("class/memberdef/functions", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_functionMembers, COMPILE_FOR_3_OPTIONS( @@ -455,41 +455,41 @@ class LayoutParser : public QXmlDefaultHandler SrcLangExt_Fortran,theTranslator->trMemberFunctionDocumentationFortran(), SrcLangExt_Slice,theTranslator->trOperationDocumentation() ))); - m_sHandler.insert("class/memberdef/related", + m_sHandler.insert("class/memberdef/related", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_relatedMembers,theTranslator->trRelatedFunctionDocumentation())); - m_sHandler.insert("class/memberdef/variables", + m_sHandler.insert("class/memberdef/variables", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_variableMembers, COMPILE_FOR_1_OPTION( theTranslator->trMemberDataDocumentation(), SrcLangExt_Slice,theTranslator->trDataMemberDocumentation() - ))); - m_sHandler.insert("class/memberdef/properties", + ))); + m_sHandler.insert("class/memberdef/properties", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_propertyMembers,theTranslator->trPropertyDocumentation())); - m_sHandler.insert("class/memberdef/events", + m_sHandler.insert("class/memberdef/events", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_eventMembers,theTranslator->trEventDocumentation())); - m_eHandler.insert("class/memberdef", + m_eHandler.insert("class/memberdef", new EndElementHandler(this,&LayoutParser::endMemberDef)); - m_eHandler.insert("class", + m_eHandler.insert("class", new EndElementHandler(this,&LayoutParser::endClass)); // namespace layout handlers - m_sHandler.insert("namespace", + m_sHandler.insert("namespace", new StartElementHandler(this,&LayoutParser::startNamespace)); - m_sHandler.insert("namespace/briefdescription", + m_sHandler.insert("namespace/briefdescription", new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("namespace/detaileddescription", + m_sHandler.insert("namespace/detaileddescription", new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry, theTranslator->trDetailedDescription())); - m_sHandler.insert("namespace/authorsection", + m_sHandler.insert("namespace/authorsection", new StartElementHandlerKind(this,LayoutDocEntry::AuthorSection,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("namespace/memberdecl", + m_sHandler.insert("namespace/memberdecl", new StartElementHandler(this,&LayoutParser::startMemberDecl)); - m_sHandler.insert("namespace/memberdecl/nestednamespaces", + m_sHandler.insert("namespace/memberdecl/nestednamespaces", new StartElementHandlerSection(this,LayoutDocEntry::NamespaceNestedNamespaces,&LayoutParser::startSectionEntry, COMPILE_FOR_5_OPTIONS( theTranslator->trNamespaces(), @@ -503,37 +503,37 @@ class LayoutParser : public QXmlDefaultHandler m_sHandler.insert("namespace/memberdecl/constantgroups", new StartElementHandlerSection(this,LayoutDocEntry::NamespaceNestedConstantGroups,&LayoutParser::startSectionEntry, theTranslator->trConstantGroups())); - m_sHandler.insert("namespace/memberdecl/interfaces", + m_sHandler.insert("namespace/memberdecl/interfaces", new StartElementHandlerSection(this,LayoutDocEntry::NamespaceInterfaces,&LayoutParser::startSectionEntry, theTranslator->trSliceInterfaces())); - m_sHandler.insert("namespace/memberdecl/classes", + m_sHandler.insert("namespace/memberdecl/classes", new StartElementHandlerSection(this,LayoutDocEntry::NamespaceClasses,&LayoutParser::startSectionEntry, COMPILE_FOR_2_OPTIONS( theTranslator->trCompounds(), SrcLangExt_VHDL,theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE), SrcLangExt_Fortran,theTranslator->trDataTypes() ))); - m_sHandler.insert("namespace/memberdecl/structs", + m_sHandler.insert("namespace/memberdecl/structs", new StartElementHandlerSection(this,LayoutDocEntry::NamespaceStructs,&LayoutParser::startSectionEntry, theTranslator->trStructs())); - m_sHandler.insert("namespace/memberdecl/exceptions", + m_sHandler.insert("namespace/memberdecl/exceptions", new StartElementHandlerSection(this,LayoutDocEntry::NamespaceExceptions,&LayoutParser::startSectionEntry, theTranslator->trExceptions())); - m_sHandler.insert("namespace/memberdecl/membergroups", + m_sHandler.insert("namespace/memberdecl/membergroups", new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("namespace/memberdecl/typedefs", + m_sHandler.insert("namespace/memberdecl/typedefs", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decTypedefMembers,theTranslator->trTypedefs())); - m_sHandler.insert("namespace/memberdecl/sequences", + m_sHandler.insert("namespace/memberdecl/sequences", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decSequenceMembers,theTranslator->trSequences())); - m_sHandler.insert("namespace/memberdecl/dictionaries", + m_sHandler.insert("namespace/memberdecl/dictionaries", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decDictionaryMembers,theTranslator->trDictionaries())); - m_sHandler.insert("namespace/memberdecl/enums", + m_sHandler.insert("namespace/memberdecl/enums", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decEnumMembers,theTranslator->trEnumerations())); - m_sHandler.insert("namespace/memberdecl/functions", + m_sHandler.insert("namespace/memberdecl/functions", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decFuncMembers, COMPILE_FOR_2_OPTIONS( @@ -541,89 +541,89 @@ class LayoutParser : public QXmlDefaultHandler SrcLangExt_Fortran,theTranslator->trSubprograms(), SrcLangExt_VHDL,theTranslator->trFunctionAndProc() ))); - m_sHandler.insert("namespace/memberdecl/variables", + m_sHandler.insert("namespace/memberdecl/variables", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decVarMembers, sliceOpt ? theTranslator->trConstants() : theTranslator->trVariables())); - m_eHandler.insert("namespace/memberdecl", + m_eHandler.insert("namespace/memberdecl", new EndElementHandler(this,&LayoutParser::endMemberDecl)); - m_sHandler.insert("namespace/memberdef", + m_sHandler.insert("namespace/memberdef", new StartElementHandler(this,&LayoutParser::startMemberDef)); - m_sHandler.insert("namespace/memberdef/inlineclasses", + m_sHandler.insert("namespace/memberdef/inlineclasses", new StartElementHandlerSection(this,LayoutDocEntry::NamespaceInlineClasses,&LayoutParser::startSectionEntry, COMPILE_FOR_1_OPTION( theTranslator->trClassDocumentation(), SrcLangExt_Fortran,theTranslator->trTypeDocumentation() ))); - m_sHandler.insert("namespace/memberdef/typedefs", + m_sHandler.insert("namespace/memberdef/typedefs", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation())); - m_sHandler.insert("namespace/memberdef/sequences", + m_sHandler.insert("namespace/memberdef/sequences", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docSequenceMembers,theTranslator->trSequenceDocumentation())); - m_sHandler.insert("namespace/memberdef/dictionaries", + m_sHandler.insert("namespace/memberdef/dictionaries", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docDictionaryMembers, theTranslator->trDictionaryDocumentation())); - m_sHandler.insert("namespace/memberdef/enums", + m_sHandler.insert("namespace/memberdef/enums", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation())); - m_sHandler.insert("namespace/memberdef/functions", + m_sHandler.insert("namespace/memberdef/functions", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docFuncMembers, COMPILE_FOR_1_OPTION( theTranslator->trFunctionDocumentation(), SrcLangExt_Fortran,theTranslator->trSubprogramDocumentation() ))); - m_sHandler.insert("namespace/memberdef/variables", + m_sHandler.insert("namespace/memberdef/variables", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docVarMembers, sliceOpt ? theTranslator->trConstantDocumentation() : theTranslator->trVariableDocumentation())); - m_eHandler.insert("namespace/memberdef", + m_eHandler.insert("namespace/memberdef", new EndElementHandler(this,&LayoutParser::endMemberDef)); - m_eHandler.insert("namespace", + m_eHandler.insert("namespace", new EndElementHandler(this,&LayoutParser::endNamespace)); // file layout handlers - m_sHandler.insert("file", + m_sHandler.insert("file", new StartElementHandler(this,&LayoutParser::startFile)); - m_sHandler.insert("file/briefdescription", + m_sHandler.insert("file/briefdescription", new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("file/detaileddescription", + m_sHandler.insert("file/detaileddescription", new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry, theTranslator->trDetailedDescription())); - m_sHandler.insert("file/authorsection", + m_sHandler.insert("file/authorsection", new StartElementHandlerKind(this,LayoutDocEntry::AuthorSection,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("file/includes", + m_sHandler.insert("file/includes", new StartElementHandlerKind(this,LayoutDocEntry::FileIncludes,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("file/includegraph", + m_sHandler.insert("file/includegraph", new StartElementHandlerKind(this,LayoutDocEntry::FileIncludeGraph,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("file/includedbygraph", + m_sHandler.insert("file/includedbygraph", new StartElementHandlerKind(this,LayoutDocEntry::FileIncludedByGraph,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("file/sourcelink", + m_sHandler.insert("file/sourcelink", new StartElementHandlerKind(this,LayoutDocEntry::FileSourceLink,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("file/memberdecl/membergroups", + m_sHandler.insert("file/memberdecl/membergroups", new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("file/memberdecl", + m_sHandler.insert("file/memberdecl", new StartElementHandler(this,&LayoutParser::startMemberDecl)); - m_sHandler.insert("file/memberdecl/interfaces", + m_sHandler.insert("file/memberdecl/interfaces", new StartElementHandlerSection(this,LayoutDocEntry::FileInterfaces,&LayoutParser::startSectionEntry, theTranslator->trSliceInterfaces())); - m_sHandler.insert("file/memberdecl/classes", + m_sHandler.insert("file/memberdecl/classes", new StartElementHandlerSection(this,LayoutDocEntry::FileClasses,&LayoutParser::startSectionEntry, COMPILE_FOR_2_OPTIONS( theTranslator->trCompounds(), SrcLangExt_VHDL,theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE), SrcLangExt_Fortran,theTranslator->trDataTypes() ))); - m_sHandler.insert("file/memberdecl/structs", + m_sHandler.insert("file/memberdecl/structs", new StartElementHandlerSection(this,LayoutDocEntry::FileStructs,&LayoutParser::startSectionEntry, theTranslator->trStructs())); - m_sHandler.insert("file/memberdecl/exceptions", + m_sHandler.insert("file/memberdecl/exceptions", new StartElementHandlerSection(this,LayoutDocEntry::FileExceptions,&LayoutParser::startSectionEntry, theTranslator->trExceptions())); - m_sHandler.insert("file/memberdecl/namespaces", + m_sHandler.insert("file/memberdecl/namespaces", new StartElementHandlerSection(this,LayoutDocEntry::FileNamespaces,&LayoutParser::startSectionEntry, COMPILE_FOR_4_OPTIONS( theTranslator->trNamespaces(), @@ -635,22 +635,22 @@ class LayoutParser : public QXmlDefaultHandler m_sHandler.insert("file/memberdecl/constantgroups", new StartElementHandlerSection(this,LayoutDocEntry::FileConstantGroups,&LayoutParser::startSectionEntry, theTranslator->trConstantGroups())); - m_sHandler.insert("file/memberdecl/defines", + m_sHandler.insert("file/memberdecl/defines", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decDefineMembers,theTranslator->trDefines())); - m_sHandler.insert("file/memberdecl/typedefs", + m_sHandler.insert("file/memberdecl/typedefs", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decTypedefMembers,theTranslator->trTypedefs())); - m_sHandler.insert("file/memberdecl/sequences", + m_sHandler.insert("file/memberdecl/sequences", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decSequenceMembers,theTranslator->trSequences())); - m_sHandler.insert("file/memberdecl/dictionaries", + m_sHandler.insert("file/memberdecl/dictionaries", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decDictionaryMembers,theTranslator->trDictionaries())); - m_sHandler.insert("file/memberdecl/enums", + m_sHandler.insert("file/memberdecl/enums", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decEnumMembers,theTranslator->trEnumerations())); - m_sHandler.insert("file/memberdecl/functions", + m_sHandler.insert("file/memberdecl/functions", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decFuncMembers, COMPILE_FOR_2_OPTIONS( @@ -658,115 +658,115 @@ class LayoutParser : public QXmlDefaultHandler SrcLangExt_Fortran,theTranslator->trSubprograms(), SrcLangExt_VHDL,theTranslator->trFunctionAndProc() ))); - m_sHandler.insert("file/memberdecl/variables", + m_sHandler.insert("file/memberdecl/variables", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decVarMembers, sliceOpt ? theTranslator->trConstants() : theTranslator->trVariables())); - m_eHandler.insert("file/memberdecl", + m_eHandler.insert("file/memberdecl", new EndElementHandler(this,&LayoutParser::endMemberDecl)); - m_sHandler.insert("file/memberdef", + m_sHandler.insert("file/memberdef", new StartElementHandler(this,&LayoutParser::startMemberDef)); - m_sHandler.insert("file/memberdef/inlineclasses", + m_sHandler.insert("file/memberdef/inlineclasses", new StartElementHandlerSection(this,LayoutDocEntry::FileInlineClasses,&LayoutParser::startSectionEntry, COMPILE_FOR_1_OPTION( theTranslator->trClassDocumentation(), SrcLangExt_Fortran,theTranslator->trTypeDocumentation() ))); - m_sHandler.insert("file/memberdef/defines", + m_sHandler.insert("file/memberdef/defines", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docDefineMembers,theTranslator->trDefineDocumentation())); - m_sHandler.insert("file/memberdef/typedefs", + m_sHandler.insert("file/memberdef/typedefs", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation())); - m_sHandler.insert("file/memberdef/sequences", + m_sHandler.insert("file/memberdef/sequences", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docSequenceMembers,theTranslator->trSequenceDocumentation())); - m_sHandler.insert("file/memberdef/dictionaries", + m_sHandler.insert("file/memberdef/dictionaries", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docDictionaryMembers, theTranslator->trDictionaryDocumentation())); - m_sHandler.insert("file/memberdef/enums", + m_sHandler.insert("file/memberdef/enums", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docEnumMembers, theTranslator->trEnumerationTypeDocumentation())); - m_sHandler.insert("file/memberdef/functions", + m_sHandler.insert("file/memberdef/functions", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docFuncMembers, COMPILE_FOR_1_OPTION( theTranslator->trFunctionDocumentation(), SrcLangExt_Fortran,theTranslator->trSubprogramDocumentation() ))); - m_sHandler.insert("file/memberdef/variables", + m_sHandler.insert("file/memberdef/variables", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docVarMembers,theTranslator->trVariableDocumentation())); - m_eHandler.insert("file/memberdef", + m_eHandler.insert("file/memberdef", new EndElementHandler(this,&LayoutParser::endMemberDef)); - m_eHandler.insert("file", + m_eHandler.insert("file", new EndElementHandler(this,&LayoutParser::endFile)); // group layout handlers - m_sHandler.insert("group", + m_sHandler.insert("group", new StartElementHandler(this,&LayoutParser::startGroup)); - m_sHandler.insert("group/briefdescription", + m_sHandler.insert("group/briefdescription", new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("group/detaileddescription", + m_sHandler.insert("group/detaileddescription", new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry, theTranslator->trDetailedDescription())); - m_sHandler.insert("group/authorsection", + m_sHandler.insert("group/authorsection", new StartElementHandlerKind(this,LayoutDocEntry::AuthorSection,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("group/groupgraph", + m_sHandler.insert("group/groupgraph", new StartElementHandlerKind(this,LayoutDocEntry::GroupGraph,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("group/memberdecl/membergroups", + m_sHandler.insert("group/memberdecl/membergroups", new StartElementHandlerKind(this,LayoutDocEntry::MemberGroups,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("group/memberdecl", + m_sHandler.insert("group/memberdecl", new StartElementHandler(this,&LayoutParser::startMemberDecl)); - m_sHandler.insert("group/memberdecl/classes", + m_sHandler.insert("group/memberdecl/classes", new StartElementHandlerSection(this,LayoutDocEntry::GroupClasses,&LayoutParser::startSectionEntry, COMPILE_FOR_2_OPTIONS( theTranslator->trCompounds(), SrcLangExt_VHDL,theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE), SrcLangExt_Fortran,theTranslator->trDataTypes() ))); - m_sHandler.insert("group/memberdecl/namespaces", + m_sHandler.insert("group/memberdecl/namespaces", new StartElementHandlerSection(this,LayoutDocEntry::GroupNamespaces,&LayoutParser::startSectionEntry, COMPILE_FOR_2_OPTIONS( theTranslator->trNamespaces(), SrcLangExt_Java,theTranslator->trPackages(), SrcLangExt_Fortran,theTranslator->trModules() ))); - m_sHandler.insert("group/memberdecl/dirs", + m_sHandler.insert("group/memberdecl/dirs", new StartElementHandlerSection(this,LayoutDocEntry::GroupDirs,&LayoutParser::startSectionEntry, theTranslator->trDirectories() )); - m_sHandler.insert("group/memberdecl/nestedgroups", + m_sHandler.insert("group/memberdecl/nestedgroups", new StartElementHandlerSection(this,LayoutDocEntry::GroupNestedGroups,&LayoutParser::startSectionEntry, theTranslator->trModules() )); - m_sHandler.insert("group/memberdecl/files", + m_sHandler.insert("group/memberdecl/files", new StartElementHandlerSection(this,LayoutDocEntry::GroupFiles,&LayoutParser::startSectionEntry, theTranslator->trFile(TRUE,FALSE) )); - m_sHandler.insert("group/memberdecl/defines", + m_sHandler.insert("group/memberdecl/defines", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decDefineMembers,theTranslator->trDefines())); - m_sHandler.insert("group/memberdecl/typedefs", + m_sHandler.insert("group/memberdecl/typedefs", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decTypedefMembers,theTranslator->trTypedefs())); - m_sHandler.insert("group/memberdecl/sequences", + m_sHandler.insert("group/memberdecl/sequences", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decSequenceMembers,theTranslator->trSequences())); - m_sHandler.insert("group/memberdecl/dictionaries", + m_sHandler.insert("group/memberdecl/dictionaries", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decDictionaryMembers,theTranslator->trDictionaries())); - m_sHandler.insert("group/memberdecl/enums", + m_sHandler.insert("group/memberdecl/enums", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decEnumMembers,theTranslator->trEnumerations())); - m_sHandler.insert("group/memberdecl/enumvalues", + m_sHandler.insert("group/memberdecl/enumvalues", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decEnumValMembers,theTranslator->trEnumerationValues())); - m_sHandler.insert("group/memberdecl/functions", + m_sHandler.insert("group/memberdecl/functions", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decFuncMembers, COMPILE_FOR_2_OPTIONS( @@ -774,116 +774,116 @@ class LayoutParser : public QXmlDefaultHandler SrcLangExt_Fortran,theTranslator->trSubprograms(), SrcLangExt_VHDL,theTranslator->trFunctionAndProc() ))); - m_sHandler.insert("group/memberdecl/variables", + m_sHandler.insert("group/memberdecl/variables", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decVarMembers,theTranslator->trVariables())); - m_sHandler.insert("group/memberdecl/signals", + m_sHandler.insert("group/memberdecl/signals", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decSignalMembers,theTranslator->trSignals())); - m_sHandler.insert("group/memberdecl/publicslots", + m_sHandler.insert("group/memberdecl/publicslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decPubSlotMembers,theTranslator->trPublicSlots())); - m_sHandler.insert("group/memberdecl/protectedslots", + m_sHandler.insert("group/memberdecl/protectedslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decProSlotMembers,theTranslator->trProtectedSlots())); - m_sHandler.insert("group/memberdecl/privateslots", + m_sHandler.insert("group/memberdecl/privateslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decPriSlotMembers,theTranslator->trPrivateSlots())); - m_sHandler.insert("group/memberdecl/events", + m_sHandler.insert("group/memberdecl/events", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decEventMembers,theTranslator->trEvents())); - m_sHandler.insert("group/memberdecl/properties", + m_sHandler.insert("group/memberdecl/properties", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decPropMembers,theTranslator->trProperties())); - m_sHandler.insert("group/memberdecl/friends", + m_sHandler.insert("group/memberdecl/friends", new StartElementHandlerMember(this,&LayoutParser::startMemberDeclEntry, MemberListType_decFriendMembers,theTranslator->trFriends())); - m_eHandler.insert("group/memberdecl", + m_eHandler.insert("group/memberdecl", new EndElementHandler(this,&LayoutParser::endMemberDecl)); - m_sHandler.insert("group/memberdef", + m_sHandler.insert("group/memberdef", new StartElementHandler(this,&LayoutParser::startMemberDef)); - m_sHandler.insert("group/memberdef/pagedocs", + m_sHandler.insert("group/memberdef/pagedocs", new StartElementHandlerKind(this,LayoutDocEntry::GroupPageDocs,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("group/memberdef/inlineclasses", + m_sHandler.insert("group/memberdef/inlineclasses", new StartElementHandlerSection(this,LayoutDocEntry::GroupInlineClasses,&LayoutParser::startSectionEntry, COMPILE_FOR_1_OPTION( theTranslator->trClassDocumentation(), SrcLangExt_Fortran,theTranslator->trTypeDocumentation() ))); - m_sHandler.insert("group/memberdef/defines", + m_sHandler.insert("group/memberdef/defines", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docDefineMembers,theTranslator->trDefineDocumentation())); - m_sHandler.insert("group/memberdef/typedefs", + m_sHandler.insert("group/memberdef/typedefs", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docTypedefMembers,theTranslator->trTypedefDocumentation())); - m_sHandler.insert("group/memberdef/sequences", + m_sHandler.insert("group/memberdef/sequences", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docSequenceMembers,theTranslator->trSequenceDocumentation())); - m_sHandler.insert("group/memberdef/dictionaries", + m_sHandler.insert("group/memberdef/dictionaries", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docDictionaryMembers, theTranslator->trDictionaryDocumentation())); - m_sHandler.insert("group/memberdef/enums", + m_sHandler.insert("group/memberdef/enums", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docEnumMembers,theTranslator->trEnumerationTypeDocumentation())); - m_sHandler.insert("group/memberdef/enumvalues", + m_sHandler.insert("group/memberdef/enumvalues", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docEnumValMembers,theTranslator->trEnumerationValueDocumentation())); - m_sHandler.insert("group/memberdef/functions", + m_sHandler.insert("group/memberdef/functions", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docFuncMembers, COMPILE_FOR_1_OPTION( theTranslator->trFunctionDocumentation(), SrcLangExt_Fortran,theTranslator->trSubprogramDocumentation() ))); - m_sHandler.insert("group/memberdef/variables", + m_sHandler.insert("group/memberdef/variables", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docVarMembers,theTranslator->trVariableDocumentation())); - m_sHandler.insert("group/memberdef/signals", + m_sHandler.insert("group/memberdef/signals", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, - MemberListType_docSignalMembers,theTranslator->trSignals())); - m_sHandler.insert("group/memberdef/publicslots", + MemberListType_docSignalMembers,theTranslator->trSignals())); + m_sHandler.insert("group/memberdef/publicslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docPubSlotMembers,theTranslator->trPublicSlots())); - m_sHandler.insert("group/memberdef/protectedslots", + m_sHandler.insert("group/memberdef/protectedslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docProSlotMembers,theTranslator->trProtectedSlots())); - m_sHandler.insert("group/memberdef/privateslots", + m_sHandler.insert("group/memberdef/privateslots", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docPriSlotMembers,theTranslator->trPrivateSlots())); - m_sHandler.insert("group/memberdef/events", + m_sHandler.insert("group/memberdef/events", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docEventMembers,theTranslator->trEvents())); - m_sHandler.insert("group/memberdef/properties", + m_sHandler.insert("group/memberdef/properties", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docPropMembers,theTranslator->trProperties())); - m_sHandler.insert("group/memberdef/friends", + m_sHandler.insert("group/memberdef/friends", new StartElementHandlerMember(this,&LayoutParser::startMemberDefEntry, MemberListType_docFriendMembers,theTranslator->trFriends())); - m_eHandler.insert("group/memberdef", + m_eHandler.insert("group/memberdef", new EndElementHandler(this,&LayoutParser::endMemberDef)); - m_eHandler.insert("group", + m_eHandler.insert("group", new EndElementHandler(this,&LayoutParser::endGroup)); // directory layout handlers - m_sHandler.insert("directory", + m_sHandler.insert("directory", new StartElementHandler(this,&LayoutParser::startDirectory)); - m_sHandler.insert("directory/briefdescription", + m_sHandler.insert("directory/briefdescription", new StartElementHandlerKind(this,LayoutDocEntry::BriefDesc,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("directory/detaileddescription", + m_sHandler.insert("directory/detaileddescription", new StartElementHandlerSection(this,LayoutDocEntry::DetailedDesc,&LayoutParser::startSectionEntry, theTranslator->trDetailedDescription())); - m_sHandler.insert("directory/directorygraph", + m_sHandler.insert("directory/directorygraph", new StartElementHandlerKind(this,LayoutDocEntry::DirGraph,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("directory/memberdecl", + m_sHandler.insert("directory/memberdecl", new StartElementHandler(this,&LayoutParser::startMemberDecl)); - m_sHandler.insert("directory/memberdecl/dirs", + m_sHandler.insert("directory/memberdecl/dirs", new StartElementHandlerKind(this,LayoutDocEntry::DirSubDirs,&LayoutParser::startSimpleEntry)); - m_sHandler.insert("directory/memberdecl/files", + m_sHandler.insert("directory/memberdecl/files", new StartElementHandlerKind(this,LayoutDocEntry::DirFiles,&LayoutParser::startSimpleEntry)); - m_eHandler.insert("directory/memberdecl", + m_eHandler.insert("directory/memberdecl", new EndElementHandler(this,&LayoutParser::endMemberDecl)); - m_eHandler.insert("directory", + m_eHandler.insert("directory", new EndElementHandler(this,&LayoutParser::endDirectory)); } @@ -964,7 +964,7 @@ class LayoutParser : public QXmlDefaultHandler if (m_rootNav && !m_rootNav->find(LayoutNavEntry::MainPage)) { // no MainPage node... add one as the first item of the root node... - new LayoutNavEntry(m_rootNav,LayoutNavEntry::MainPage, TRUE, + new LayoutNavEntry(m_rootNav,LayoutNavEntry::MainPage, TRUE, /*Config_getBool(GENERATE_TREEVIEW) ? "main" :*/ "index", theTranslator->trMainPage(),"",TRUE); } @@ -974,8 +974,8 @@ class LayoutParser : public QXmlDefaultHandler { static bool javaOpt = Config_getBool(OPTIMIZE_OUTPUT_JAVA); static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); - static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); - static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); + static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); + static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); static bool hasGraphicalHierarchy = Config_getBool(HAVE_DOT) && Config_getBool(GRAPHICAL_HIERARCHY); static bool extractAll = Config_getBool(EXTRACT_ALL); @@ -1213,7 +1213,7 @@ class LayoutParser : public QXmlDefaultHandler } i++; } - if (mapping[i].typeStr==0) + if (mapping[i].typeStr==0) { if (type.isEmpty()) { @@ -1230,7 +1230,7 @@ class LayoutParser : public QXmlDefaultHandler QCString title = attrib.value("title").utf8(); bool isVisible = elemIsVisible(attrib); if (title.isEmpty()) // use default title - { + { title = mapping[i].mainName; // use title for main row if (m_rootNav!=LayoutDocManager::instance().rootNavEntry() && !mapping[i].subName.isEmpty()) { @@ -1384,7 +1384,7 @@ class LayoutParser : public QXmlDefaultHandler } // reimplemented from QXmlDefaultHandler - bool startElement( const QString&, const QString&, + bool startElement( const QString&, const QString&, const QString& name, const QXmlAttributes& attrib ) { //printf("startElement [%s]::[%s]\n",m_scope.data(),name.data()); @@ -1568,7 +1568,7 @@ void writeDefaultLayoutFile(const char *fileName) //---------------------------------------------------------------------------------- // Convert input to a title. -// The format of input can be a simple title "A title" or in case there are different +// The format of input can be a simple title "A title" or in case there are different // titles for some programming languages they can take the following form: // "A title|16=Another title|8=Yet Another title" // where the number is a value of SrcLangExt in decimal notation (i.e. 16=Java, 8=IDL). diff --git a/src/mangen.cpp b/src/mangen.cpp index 6709748..1faa296 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -41,7 +41,7 @@ static QCString getExtension() QCString ext = Config_getString(MAN_EXTENSION); if (ext.isEmpty()) { - ext = "3"; + ext = "3"; } else { @@ -49,7 +49,7 @@ static QCString getExtension() { if (ext.length()==1) { - ext = "3"; + ext = "3"; } else // strip . { @@ -91,8 +91,8 @@ ManGenerator::~ManGenerator() void ManGenerator::init() { - QCString &manOutput = Config_getString(MAN_OUTPUT); - + QCString manOutput = Config_getString(MAN_OUTPUT); + QDir d(manOutput); if (!d.exists() && !d.mkdir(manOutput)) { @@ -139,7 +139,7 @@ static QCString buildFileName(const char *name) } QCString manExtension = "." + getExtension(); - if (fileName.right(manExtension.length())!=manExtension) + if (fileName.right(manExtension.length())!=manExtension) { fileName+=manExtension; } @@ -161,11 +161,11 @@ void ManGenerator::endFile() void ManGenerator::endTitleHead(const char *,const char *name) { - t << ".TH \"" << name << "\" " << getExtension() << " \"" + t << ".TH \"" << name << "\" " << getExtension() << " \"" << dateToString(FALSE) << "\" \""; if (!Config_getString(PROJECT_NUMBER).isEmpty()) t << "Version " << Config_getString(PROJECT_NUMBER) << "\" \""; - if (Config_getString(PROJECT_NAME).isEmpty()) + if (Config_getString(PROJECT_NAME).isEmpty()) t << "Doxygen"; else t << Config_getString(PROJECT_NAME); @@ -284,7 +284,7 @@ void ManGenerator::docify(const char *str) { const char *p=str; char c=0; - while ((c=*p++)) + while ((c=*p++)) { switch(c) { @@ -318,8 +318,8 @@ void ManGenerator::codify(const char *str) case '.': t << "\\&."; break; // see bug652277 case '\t': spacesToNextTabStop = Config_getInt(TAB_SIZE) - (m_col%Config_getInt(TAB_SIZE)); - t << Doxygen::spaces.left(spacesToNextTabStop); - m_col+=spacesToNextTabStop; + t << Doxygen::spaces.left(spacesToNextTabStop); + m_col+=spacesToNextTabStop; break; case '\n': t << "\n"; m_firstCol=TRUE; m_col=0; break; case '\\': t << "\\"; m_col++; break; @@ -346,21 +346,21 @@ void ManGenerator::writeChar(char c) m_paragraph=FALSE; } -void ManGenerator::startDescList(SectionTypes) +void ManGenerator::startDescList(SectionTypes) { - if (!m_firstCol) - { t << endl << ".PP" << endl; - m_firstCol=TRUE; m_paragraph=TRUE; + if (!m_firstCol) + { t << endl << ".PP" << endl; + m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } m_paragraph=FALSE; startBold(); } -void ManGenerator::startTitle() -{ - if (!m_firstCol) t << endl; - t << ".SH \""; +void ManGenerator::startTitle() +{ + if (!m_firstCol) t << endl; + t << ".SH \""; m_firstCol=FALSE; m_paragraph=FALSE; } @@ -370,40 +370,40 @@ void ManGenerator::endTitle() t << "\""; } -void ManGenerator::startItemListItem() -{ - if (!m_firstCol) t << endl; - t << ".TP" << endl; +void ManGenerator::startItemListItem() +{ + if (!m_firstCol) t << endl; + t << ".TP" << endl; m_firstCol=TRUE; m_paragraph=FALSE; m_col=0; -} +} void ManGenerator::endItemListItem() { } -void ManGenerator::startCodeFragment() -{ +void ManGenerator::startCodeFragment() +{ newParagraph(); - t << ".nf" << endl; + t << ".nf" << endl; m_firstCol=TRUE; m_paragraph=FALSE; } -void ManGenerator::endCodeFragment() -{ +void ManGenerator::endCodeFragment() +{ if (!m_firstCol) t << endl; - t << ".fi" << endl; + t << ".fi" << endl; m_firstCol=TRUE; m_paragraph=FALSE; m_col=0; } -void ManGenerator::startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool) -{ +void ManGenerator::startMemberDoc(const char *,const char *,const char *,const char *,int,int,bool) +{ if (!m_firstCol) t << endl; - t << ".SS \""; + t << ".SS \""; m_firstCol=FALSE; m_paragraph=FALSE; } @@ -413,7 +413,7 @@ void ManGenerator::startDoxyAnchor(const char *,const char *manName, const char *) { // something to be done? - if( !Config_getBool(MAN_LINKS) ) + if( !Config_getBool(MAN_LINKS) ) { return; // no } @@ -426,14 +426,14 @@ void ManGenerator::startDoxyAnchor(const char *,const char *manName, //printf("Converting man link '%s'->'%s'->'%s'\n", // name,baseName.data(),buildFileName(baseName).data()); - + // - remove dangerous characters and append suffix, then add dir prefix QCString fileName=m_dir+"/"+buildFileName( baseName ); QFile linkfile( fileName ); // - only create file if it doesn't exist already - if ( !linkfile.open( IO_ReadOnly ) ) + if ( !linkfile.open( IO_ReadOnly ) ) { - if ( linkfile.open( IO_WriteOnly ) ) + if ( linkfile.open( IO_WriteOnly ) ) { FTextStream linkstream; linkstream.setDevice(&linkfile); @@ -449,10 +449,10 @@ void ManGenerator::endMemberDoc(bool) t << "\"\n"; } -void ManGenerator::startSubsection() -{ +void ManGenerator::startSubsection() +{ if (!m_firstCol) t << endl; - t << ".SS \""; + t << ".SS \""; m_firstCol=FALSE; m_paragraph=FALSE; } @@ -463,10 +463,10 @@ void ManGenerator::endSubsection() } -void ManGenerator::startSubsubsection() -{ +void ManGenerator::startSubsubsection() +{ if (!m_firstCol) t << endl; - t << "\n.SS \""; + t << "\n.SS \""; m_firstCol=FALSE; m_paragraph=FALSE; } @@ -476,10 +476,10 @@ void ManGenerator::endSubsubsection() t << "\""; } -void ManGenerator::writeSynopsis() -{ +void ManGenerator::writeSynopsis() +{ if (!m_firstCol) t << endl; - t << ".SH SYNOPSIS\n.br\n.PP\n"; + t << ".SH SYNOPSIS\n.br\n.PP\n"; m_firstCol=TRUE; m_paragraph=FALSE; } @@ -534,31 +534,31 @@ void ManGenerator::endAnonTypeScope(int indentLevel) } -void ManGenerator::startMemberItem(const char *,int,const char *) -{ +void ManGenerator::startMemberItem(const char *,int,const char *) +{ if (m_firstCol && !m_insideTabbing) t << ".in +1c\n"; - t << "\n.ti -1c\n.RI \""; + t << "\n.ti -1c\n.RI \""; m_firstCol=FALSE; } -void ManGenerator::endMemberItem() -{ - t << "\"\n.br"; +void ManGenerator::endMemberItem() +{ + t << "\"\n.br"; } -void ManGenerator::startMemberList() -{ +void ManGenerator::startMemberList() +{ if (!m_insideTabbing) { - t << "\n.in +1c"; m_firstCol=FALSE; + t << "\n.in +1c"; m_firstCol=FALSE; } } -void ManGenerator::endMemberList() -{ +void ManGenerator::endMemberList() +{ if (!m_insideTabbing) { - t << "\n.in -1c"; m_firstCol=FALSE; + t << "\n.in -1c"; m_firstCol=FALSE; } } @@ -595,7 +595,7 @@ void ManGenerator::endMemberGroup(bool) void ManGenerator::startSection(const char *,const char *,SectionType type) { - if( !m_inHeader ) + if( !m_inHeader ) { switch(type) { @@ -634,9 +634,9 @@ void ManGenerator::endSection(const char *,SectionType type) void ManGenerator::startExamples() { - if (!m_firstCol) - { t << endl << ".PP" << endl; - m_firstCol=TRUE; m_paragraph=TRUE; + if (!m_firstCol) + { t << endl << ".PP" << endl; + m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } m_paragraph=FALSE; @@ -652,9 +652,9 @@ void ManGenerator::endExamples() void ManGenerator::startDescTable(const char *title) { - if (!m_firstCol) - { t << endl << ".PP" << endl; - m_firstCol=TRUE; m_paragraph=TRUE; + if (!m_firstCol) + { t << endl << ".PP" << endl; + m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } m_paragraph=FALSE; @@ -672,9 +672,9 @@ void ManGenerator::endDescTable() void ManGenerator::startParamList(ParamListTypes,const char *title) { - if (!m_firstCol) - { t << endl << ".PP" << endl; - m_firstCol=TRUE; m_paragraph=TRUE; + if (!m_firstCol) + { t << endl << ".PP" << endl; + m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } m_paragraph=FALSE; @@ -692,16 +692,16 @@ void ManGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *) { ManDocVisitor *visitor = new ManDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString("")); n->accept(visitor); - delete visitor; + delete visitor; m_firstCol=FALSE; m_paragraph = FALSE; } void ManGenerator::startConstraintList(const char *header) { - if (!m_firstCol) - { t << endl << ".PP" << endl; - m_firstCol=TRUE; m_paragraph=TRUE; + if (!m_firstCol) + { t << endl << ".PP" << endl; + m_firstCol=TRUE; m_paragraph=TRUE; m_col=0; } m_paragraph=FALSE; @@ -748,16 +748,16 @@ void ManGenerator::endConstraintList() } -void ManGenerator::startInlineHeader() +void ManGenerator::startInlineHeader() { - if (!m_firstCol) + if (!m_firstCol) { t << endl << ".PP" << endl << ".in -1c" << endl; } - t << ".RI \"\\fB"; + t << ".RI \"\\fB"; } -void ManGenerator::endInlineHeader() +void ManGenerator::endInlineHeader() { t << "\\fP\"" << endl << ".in +1c" << endl; m_firstCol = FALSE; @@ -765,7 +765,7 @@ void ManGenerator::endInlineHeader() void ManGenerator::startMemberDocSimple(bool isEnum) { - if (!m_firstCol) + if (!m_firstCol) { t << endl << ".PP" << endl; } diff --git a/src/plantuml.cpp b/src/plantuml.cpp index 2e172ac..d020da0 100644 --- a/src/plantuml.cpp +++ b/src/plantuml.cpp @@ -208,21 +208,23 @@ static void runPlantumlContent(const QDict< QList > &plantumlFiles, QCString pumlType = ""; QCString pumlOutDir = ""; - QStrList &pumlIncludePathList = Config_getList(PLANTUML_INCLUDE_PATH); - char *s=pumlIncludePathList.first(); - if (s) + const StringVector &pumlIncludePathList = Config_getList(PLANTUML_INCLUDE_PATH); { - pumlArgs += "-Dplantuml.include.path=\""; - pumlArgs += s; - s = pumlIncludePathList.next(); - } - while (s) - { - pumlArgs += Portable::pathListSeparator(); - pumlArgs += s; - s = pumlIncludePathList.next(); + auto it = pumlIncludePathList.begin(); + if (it!=pumlIncludePathList.end()) + { + pumlArgs += "-Dplantuml.include.path=\""; + pumlArgs += it->c_str(); + ++it; + } + while (it!=pumlIncludePathList.end()) + { + pumlArgs += Portable::pathListSeparator(); + pumlArgs += it->c_str(); + ++it; + } } - if (pumlIncludePathList.first()) pumlArgs += "\" "; + if (!pumlIncludePathList.empty()) pumlArgs += "\" "; pumlArgs += "-Djava.awt.headless=true -jar \""+plantumlJarPath+"plantuml.jar\" "; if (!plantumlConfigFile.isEmpty()) { diff --git a/src/pre.l b/src/pre.l index 5981147..b78908f 100644 --- a/src/pre.l +++ b/src/pre.l @@ -1796,8 +1796,8 @@ static FileState *checkAndOpenFile(yyscan_t yyscanner,const QCString &fileName,b QFileInfo fi(fileName); if (fi.exists() && fi.isFile()) { - const QStrList &exclPatterns = Config_getList(EXCLUDE_PATTERNS); - if (patternMatch(fi,&exclPatterns)) return 0; + const StringVector &exclPatterns = Config_getList(EXCLUDE_PATTERNS); + if (patternMatch(fi,exclPatterns)) return 0; QCString absName = fi.absFilePath().utf8(); @@ -2918,11 +2918,10 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) } else if (searchIncludes) // search in INCLUDE_PATH as well { - QStrList &includePath = Config_getList(INCLUDE_PATH); - char *incPath=includePath.first(); - while (incPath) + const StringVector &includePath = Config_getList(INCLUDE_PATH); + for (const auto &incPath : includePath) { - QFileInfo fi3(incPath); + QFileInfo fi3(incPath.c_str()); if (fi3.exists() && fi3.isDir()) { absName = QCString(fi3.absFilePath().utf8())+"/"+incFileName; @@ -2935,7 +2934,6 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) } //printf( "absIncFileName = %s\n", absIncFileName.data() ); } - incPath=includePath.next(); } } //printf( "absIncFileName = %s\n", absIncFileName.data() ); @@ -3191,12 +3189,10 @@ static void initPredefined(yyscan_t yyscanner,const char *fileName) YY_EXTRA_TYPE state = preYYget_extra(yyscanner); // add predefined macros - char *defStr; - QStrList &predefList = Config_getList(PREDEFINED); - QStrListIterator sli(predefList); - for (sli.toFirst();(defStr=sli.current());++sli) + const StringVector &predefList = Config_getList(PREDEFINED); + for (const auto &defStr : predefList) { - QCString ds = defStr; + QCString ds = defStr.c_str(); int i_equals=ds.find('='); int i_obrace=ds.find('('); int i_cbrace=ds.find(')'); diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index ecf2d32..9d0a957 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -186,14 +186,14 @@ void RTFGenerator::init() } // overwrite some (or all) definitions from file - QCString &rtfStyleSheetFile = Config_getString(RTF_STYLESHEET_FILE); + QCString rtfStyleSheetFile = Config_getString(RTF_STYLESHEET_FILE); if (!rtfStyleSheetFile.isEmpty()) { loadStylesheet(rtfStyleSheetFile, rtf_Style); } // If user has defined an extension file, load its contents. - QCString &rtfExtensionsFile = Config_getString(RTF_EXTENSIONS_FILE); + QCString rtfExtensionsFile = Config_getString(RTF_EXTENSIONS_FILE); if (!rtfExtensionsFile.isEmpty()) { loadExtensions(rtfExtensionsFile); diff --git a/src/util.cpp b/src/util.cpp index 86435fa..7006f26 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -277,22 +277,20 @@ QCString generateMarker(int id) return result; } -static QCString stripFromPath(const QCString &path,QStrList &l) +static QCString stripFromPath(const QCString &path,const StringVector &l) { // look at all the strings in the list and strip the longest match - const char *s=l.first(); QCString potential; unsigned int length = 0; - while (s) + for (const auto &s : l) { - QCString prefix = s; + QCString prefix = s.c_str(); if (prefix.length() > length && qstricmp(path.left(prefix.length()),prefix)==0) // case insensitive compare { length = prefix.length(); potential = path.right(path.length()-prefix.length()); } - s = l.next(); } if (length) return potential; return path; @@ -2377,15 +2375,13 @@ int filterCRLF(char *buf,int len) return dest; // length of the valid part of the buf } -static QCString getFilterFromList(const char *name,const QStrList &filterList,bool &found) +static QCString getFilterFromList(const char *name,const StringVector &filterList,bool &found) { found=FALSE; // compare the file name to the filter pattern list - QStrListIterator sli(filterList); - char* filterStr; - for (sli.toFirst(); (filterStr = sli.current()); ++sli) + for (const auto &filterStr : filterList) { - QCString fs = filterStr; + QCString fs = filterStr.c_str(); int i_equals=fs.find('='); if (i_equals!=-1) { @@ -2419,12 +2415,12 @@ QCString getFileFilter(const char* name,bool isSourceCode) // sanity check if (name==0) return ""; - QStrList& filterSrcList = Config_getList(FILTER_SOURCE_PATTERNS); - QStrList& filterList = Config_getList(FILTER_PATTERNS); + const StringVector& filterSrcList = Config_getList(FILTER_SOURCE_PATTERNS); + const StringVector& filterList = Config_getList(FILTER_PATTERNS); QCString filterName; bool found=FALSE; - if (isSourceCode && !filterSrcList.isEmpty()) + if (isSourceCode && !filterSrcList.empty()) { // first look for source filter pattern list filterName = getFilterFromList(name,filterSrcList,found); } @@ -4633,11 +4629,10 @@ QCString substituteKeywords(const QCString &s,const char *title, int getPrefixIndex(const QCString &name) { if (name.isEmpty()) return 0; - static QStrList &sl = Config_getList(IGNORE_PREFIX); - char *s = sl.first(); - while (s) + const StringVector &sl = Config_getList(IGNORE_PREFIX); + for (const auto &s : sl) { - const char *ps=s; + const char *ps=s.c_str(); const char *pd=name.data(); int i=0; while (*ps!=0 && *pd!=0 && *ps==*pd) ps++,pd++,i++; @@ -4645,7 +4640,6 @@ int getPrefixIndex(const QCString &name) { return i; } - s = sl.next(); } return 0; } @@ -7506,7 +7500,7 @@ QCString filterTitle(const QCString &title) // returns TRUE if the name of the file represented by 'fi' matches // one of the file patterns in the 'patList' list. -bool patternMatch(const QFileInfo &fi,const QStrList *patList) +bool patternMatch(const QFileInfo &fi,const StringVector &patList) { static bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES); bool found = FALSE; @@ -7517,17 +7511,15 @@ bool patternMatch(const QFileInfo &fi,const QStrList *patList) caseSenseNames = FALSE; } - if (patList) + if (!patList.empty()) { - QStrListIterator it(*patList); - QCString pattern; - QCString fn = fi.fileName().data(); QCString fp = fi.filePath().data(); QCString afp= fi.absFilePath().data(); - for (it.toFirst();(pattern=it.current());++it) + for (const auto &pat: patList) { + QCString pattern = pat.c_str(); if (!pattern.isEmpty()) { int i=pattern.find('='); @@ -8368,18 +8360,16 @@ bool openOutputFile(const char *outFile,QFile &f) void writeExtraLatexPackages(FTextStream &t) { // User-specified packages - QStrList &extraPackages = Config_getList(EXTRA_PACKAGES); - if (!extraPackages.isEmpty()) + const StringVector &extraPackages = Config_getList(EXTRA_PACKAGES); + if (!extraPackages.empty()) { t << "% Packages requested by user\n"; - const char *pkgName=extraPackages.first(); - while (pkgName) + for (const auto &pkgName : extraPackages) { if ((pkgName[0] == '[') || (pkgName[0] == '{')) - t << "\\usepackage" << pkgName << "\n"; + t << "\\usepackage" << pkgName.c_str() << "\n"; else - t << "\\usepackage{" << pkgName << "}\n"; - pkgName=extraPackages.next(); + t << "\\usepackage{" << pkgName.c_str() << "}\n"; } t << "\n"; } diff --git a/src/util.h b/src/util.h index e49a807..a93220c 100644 --- a/src/util.h +++ b/src/util.h @@ -31,6 +31,7 @@ #include "docparser.h" #include "classdef.h" #include "arguments.h" +#include "containers.h" //-------------------------------------------------------------------- @@ -436,7 +437,7 @@ bool readInputFile(const char *fileName,BufStr &inBuf, bool filter=TRUE,bool isSourceCode=FALSE); QCString filterTitle(const QCString &title); -bool patternMatch(const QFileInfo &fi,const QStrList *patList); +bool patternMatch(const QFileInfo &fi,const StringVector &patList); QCString externalLinkTarget(const bool parent = false); QCString externalRef(const QCString &relPath,const QCString &ref,bool href); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 9a48e14..3f63cf0 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -3524,12 +3524,11 @@ void FlowChart::printUmlTree() } qcs+="\n"; - QCString & htmlOutDir = Config_getString(HTML_OUTPUT); + QCString htmlOutDir = Config_getString(HTML_OUTPUT); QCString n=convertNameToFileName(); - QCString tmp=htmlOutDir; - n=PlantumlManager::instance()->writePlantUMLSource(tmp,n,qcs,PlantumlManager::PUML_SVG); - PlantumlManager::instance()->generatePlantUMLOutput(n.data(),tmp.data(),PlantumlManager::PUML_SVG); + n=PlantumlManager::instance()->writePlantUMLSource(htmlOutDir,n,qcs,PlantumlManager::PUML_SVG); + PlantumlManager::instance()->generatePlantUMLOutput(n,htmlOutDir,PlantumlManager::PUML_SVG); } QCString FlowChart::convertNameToFileName() -- cgit v0.12