Doxygen
Loading...
Searching...
No Matches
Config Namespace Reference

Public function to deal with the configuration file. More...

Enumerations

enum class  CompareMode { Full , Compressed , CompressedNoEnv }
 

Functions

void init ()
 
void writeTemplate (TextStream &t, bool shortList, bool updateOnly=FALSE)
 
void compareDoxyfile (TextStream &t, CompareMode compareMode)
 
void writeXMLDoxyfile (TextStream &t)
 
void writeXSDDoxyfile (TextStream &t)
 
bool parse (const QCString &fileName, bool update=FALSE, CompareMode compareMode=CompareMode::Full)
 
void postProcess (bool clearHeaderAndFooter, CompareMode compareMode=CompareMode::Full)
 
void checkAndCorrect (bool quiet, const bool check)
 
void updateObsolete ()
 
void deinit ()
 

Detailed Description

Public function to deal with the configuration file.

Enumeration Type Documentation

◆ CompareMode

enum class Config::CompareMode
strong
Enumerator
Full 
Compressed 
CompressedNoEnv 

Definition at line 54 of file config.h.

Function Documentation

◆ checkAndCorrect()

void Config::checkAndCorrect ( bool quiet,
const bool check )

Check the validity of the parsed options and correct or warn the user where needed.

Parameters
quietsetting for the QUIET option (can have been overruled by means of a command line option)
checkcheck HTML / LaTeX header file etc. on existence (and terminate when not present)

Definition at line 1761 of file configimpl.l.

1762{
1763 ConfigValues::instance().init();
1764
1765 Config_updateBool(QUIET,quiet || Config_getBool(QUIET));
1766 //------------------------
1767 // check WARN_FORMAT
1768 QCString warnFormat = Config_getString(WARN_FORMAT);
1769 if (warnFormat.find("$file")==-1)
1770 {
1771 warn_uncond("warning format does not contain a $file tag!\n");
1772 }
1773 if (warnFormat.find("$line")==-1)
1774 {
1775 warn_uncond("warning format does not contain a $line tag!\n");
1776 }
1777 if (warnFormat.find("$text")==-1)
1778 {
1779 warn_uncond("warning format does not contain a $text tag!\n");
1780 }
1781
1782 //------------------------
1783 // check and correct PAPER_TYPE
1784 QCString paperType = Config_getEnumAsString(PAPER_TYPE);
1785 paperType=paperType.lower().stripWhiteSpace();
1786 if (paperType.isEmpty() || paperType=="a4wide")
1787 {
1788 // use a4
1789 Config_updateEnum(PAPER_TYPE,PAPER_TYPE_t::a4);
1790 }
1791 else if (paperType!="a4" && paperType!="letter" &&
1792 paperType!="legal" && paperType!="executive")
1793 {
1794 err("Unknown page type '%s' specified\n",qPrint(paperType));
1795 Config_updateEnum(PAPER_TYPE,PAPER_TYPE_t::a4);
1796 }
1797
1798 //------------------------
1799 // check & correct STRIP_FROM_PATH
1800 StringVector stripFromPath = Config_getList(STRIP_FROM_PATH);
1801 if (stripFromPath.empty()) // by default use the current path
1802 {
1803 std::string p = Dir::currentDirPath()+"/";
1804 stripFromPath.push_back(p);
1805 }
1806 else
1807 {
1809 }
1810 Config_updateList(STRIP_FROM_PATH,stripFromPath);
1811
1812 //------------------------
1813 // check & correct STRIP_FROM_INC_PATH
1814 StringVector stripFromIncPath = Config_getList(STRIP_FROM_INC_PATH);
1815 cleanUpPaths(stripFromIncPath);
1816 Config_updateList(STRIP_FROM_INC_PATH,stripFromIncPath);
1817
1818 //------------------------
1819 // Test to see if HTML header is valid
1820 QCString headerFile = Config_getString(HTML_HEADER);
1821 if (check && !headerFile.isEmpty())
1822 {
1823 FileInfo fi(headerFile.str());
1824 if (!fi.exists())
1825 {
1826 ConfigImpl::config_term("tag HTML_HEADER: header file '%s' "
1827 "does not exist\n",qPrint(headerFile));
1828 }
1829 }
1830
1831 //------------------------
1832 // Test to see if HTML footer is valid
1833 QCString footerFile = Config_getString(HTML_FOOTER);
1834 if (check && !footerFile.isEmpty())
1835 {
1836 FileInfo fi(footerFile.str());
1837 if (!fi.exists())
1838 {
1839 ConfigImpl::config_term("tag HTML_FOOTER: footer file '%s' "
1840 "does not exist\n",qPrint(footerFile));
1841 }
1842 }
1843
1844 //------------------------
1845 // Test to see if MathJax code file is valid
1846 if (Config_getBool(USE_MATHJAX))
1847 {
1848 auto mathJaxFormat = Config_getEnum(MATHJAX_FORMAT);
1849 auto mathjaxVersion = Config_getEnum(MATHJAX_VERSION);
1850 if (mathjaxVersion == MATHJAX_VERSION_t::MathJax_2)
1851 {
1852 if (mathJaxFormat==MATHJAX_FORMAT_t::chtml)
1853 {
1854 Config_updateEnum(MATHJAX_FORMAT,MATHJAX_FORMAT_t::HTML_CSS);
1855 }
1856 }
1857 else
1858 {
1859 if (mathJaxFormat==MATHJAX_FORMAT_t::HTML_CSS || mathJaxFormat==MATHJAX_FORMAT_t::NativeMML)
1860 {
1861 Config_updateEnum(MATHJAX_FORMAT,MATHJAX_FORMAT_t::chtml);
1862 }
1863 }
1864
1865 QCString mathJaxCodefile = Config_getString(MATHJAX_CODEFILE);
1866 if (check && !mathJaxCodefile.isEmpty())
1867 {
1868 FileInfo fi(mathJaxCodefile.str());
1869 if (!fi.exists())
1870 {
1871 ConfigImpl::config_term("tag MATHJAX_CODEFILE file '%s' "
1872 "does not exist\n",qPrint(mathJaxCodefile));
1873 }
1874 }
1875 QCString path = Config_getString(MATHJAX_RELPATH);
1876 if (path.isEmpty())
1877 {
1878 path = "https://cdn.jsdelivr.net/npm/mathjax@";
1879 switch (mathjaxVersion)
1880 {
1881 case MATHJAX_VERSION_t::MathJax_2: path += "2"; break;
1882 case MATHJAX_VERSION_t::MathJax_3: path += "3"; break;
1883 }
1884 }
1885
1886 if (path.at(path.length()-1)!='/')
1887 {
1888 path+="/";
1889 }
1890 Config_updateString(MATHJAX_RELPATH,path);
1891 }
1892
1893 //------------------------
1894 // Test to see if LaTeX header is valid
1895 QCString latexHeaderFile = Config_getString(LATEX_HEADER);
1896 if (check && !latexHeaderFile.isEmpty())
1897 {
1898 FileInfo fi(latexHeaderFile.str());
1899 if (!fi.exists())
1900 {
1901 ConfigImpl::config_term("tag LATEX_HEADER: header file '%s' "
1902 "does not exist\n",qPrint(latexHeaderFile));
1903 }
1904 }
1905
1906 //------------------------
1907 // Test to see if LaTeX footer is valid
1908 QCString latexFooterFile = Config_getString(LATEX_FOOTER);
1909 if (check && !latexFooterFile.isEmpty())
1910 {
1911 FileInfo fi(latexFooterFile.str());
1912 if (!fi.exists())
1913 {
1914 ConfigImpl::config_term("tag LATEX_FOOTER: footer file '%s' "
1915 "does not exist\n",qPrint(latexFooterFile));
1916 }
1917 }
1918
1919 //------------------------
1920 // check include path
1921 const StringVector &includePath = Config_getList(INCLUDE_PATH);
1922 for (const auto &s : includePath)
1923 {
1924 FileInfo fi(s);
1925 if (!fi.exists()) warn_uncond("tag INCLUDE_PATH: include path '%s' "
1926 "does not exist\n",s.c_str());
1927 }
1928
1929 //------------------------
1930 // check PREDEFINED
1931 if (Config_getBool(ENABLE_PREPROCESSING))
1932 {
1933 const StringVector &predefList = Config_getList(PREDEFINED);
1934 for (const auto &s : predefList)
1935 {
1936 QCString predef=s.c_str();
1937 predef=predef.stripWhiteSpace();
1938 int i_equals=predef.find('=');
1939 int i_obrace=predef.find('(');
1940 if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && predef.at(i_equals-1)==':'))
1941 {
1942 err("Illegal PREDEFINED format '%s', no define name specified\n",qPrint(predef));
1943 }
1944 }
1945 }
1946
1947 //------------------------
1948 // check EXTENSION_MAPPING
1949 checkList(Config_getList(EXTENSION_MAPPING),"EXTENSION_MAPPING",TRUE,TRUE);
1950
1951 //------------------------
1952 // check FILTER_PATTERNS
1953 checkList(Config_getList(FILTER_PATTERNS),"FILTER_PATTERNS",TRUE,TRUE);
1954
1955 //------------------------
1956 // check FILTER_SOURCE_PATTERNS
1957 checkList(Config_getList(FILTER_SOURCE_PATTERNS),"FILTER_SOURCE_PATTERNS",FALSE,FALSE);
1958
1959 //------------------------
1960 // check INPUT_FILE_ENCODING
1961 checkList(Config_getList(INPUT_FILE_ENCODING),"INPUT_FILE_ENCODING",TRUE,TRUE);
1962
1963 //------------------------
1964 // check TAGFILES
1965 checkList(Config_getList(TAGFILES),"TAGFILES",FALSE,TRUE);
1966
1967 //------------------------
1968 // check EXTRA_SEARCH_MAPPINGS
1969 if (Config_getBool(SEARCHENGINE) && Config_getBool(GENERATE_HTML))
1970 {
1971 checkList(Config_getList(EXTRA_SEARCH_MAPPINGS),"EXTRA_SEARCH_MAPPING",TRUE,TRUE);
1972 }
1973
1974 int numThreads = Config_getInt(NUM_PROC_THREADS);
1975 if (numThreads==0)
1976 {
1977 numThreads = static_cast<int>(std::thread::hardware_concurrency());
1978 Config_updateInt(NUM_PROC_THREADS,numThreads);
1979 }
1980
1981 //------------------------
1982
1983 // check for settings that are inconsistent with having GENERATE_HTMLHELP enabled
1984 if (Config_getBool(GENERATE_HTMLHELP))
1985 {
1986 const char *depOption = "GENERATE_HTMLHELP";
1987 adjustBoolSetting( depOption, "GENERATE_TREEVIEW", false );
1988 adjustBoolSetting( depOption, "SEARCHENGINE", false );
1989 adjustBoolSetting( depOption, "HTML_DYNAMIC_MENUS", false );
1990 adjustBoolSetting( depOption, "HTML_DYNAMIC_SECTIONS",false );
1991 adjustBoolSetting( depOption, "HTML_COPY_CLIPBOARD", false );
1992 adjustStringSetting(depOption, "HTML_FILE_EXTENSION", ".html");
1993 adjustColorStyleSetting(depOption);
1994 const StringVector &tagFileList = Config_getList(TAGFILES);
1995 StringVector filteredTagFileList;
1996 for (const auto &s : tagFileList)
1997 {
1998 bool validUrl = false;
1999 size_t eqPos = s.find('=');
2000 if (eqPos!=std::string::npos) // tag command contains a destination
2001 {
2002 QCString url = QCString(s.substr(eqPos+1)).stripWhiteSpace().lower();
2003 validUrl = url.startsWith("http:") || url.startsWith("https:");
2004 }
2005 if (validUrl)
2006 {
2007 filteredTagFileList.push_back(s);
2008 }
2009 else
2010 {
2011 err("When enabling GENERATE_HTMLHELP the TAGFILES option should only contain destinations "
2012 "with https / http addresses (not: %s). I'll adjust it for you.\n",s.c_str());
2013 }
2014 }
2015 Config_updateList(TAGFILES,filteredTagFileList);
2016 }
2017
2018 // check for settings that are inconsistent with having INLINE_GROUPED_CLASSES enabled
2019 if (Config_getBool(INLINE_GROUPED_CLASSES))
2020 {
2021 const char *depOption = "INLINE_GROUPED_CLASSES";
2022 adjustBoolSetting(depOption, "SEPARATE_MEMBER_PAGES", false);
2023 }
2024
2025 //------------------------
2026 // clip number of threads
2027 int dotNumThreads = Config_getInt(DOT_NUM_THREADS);
2028 if (dotNumThreads>32)
2029 {
2030 dotNumThreads=32;
2031 }
2032 else if (dotNumThreads<=0)
2033 {
2034 dotNumThreads=std::max(2u,std::thread::hardware_concurrency()+1);
2035 }
2036 Config_updateInt(DOT_NUM_THREADS,dotNumThreads);
2037
2038 //------------------------
2039 // check plantuml path
2040 QCString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH);
2041 if (!plantumlJarPath.isEmpty())
2042 {
2043 FileInfo pu(plantumlJarPath.str());
2044 if (pu.exists() && pu.isDir()) // PLANTUML_JAR_PATH is directory
2045 {
2046 QCString plantumlJar = plantumlJarPath+Portable::pathSeparator()+"plantuml.jar";
2047 FileInfo jar(plantumlJar.str());
2048 if (jar.exists() && jar.isFile())
2049 {
2050 plantumlJarPath = plantumlJar;
2051 }
2052 else
2053 {
2054 err("Jar file 'plantuml.jar' not found at location "
2055 "specified via PLANTUML_JAR_PATH: '%s'\n",qPrint(plantumlJarPath));
2056 plantumlJarPath="";
2057 }
2058 }
2059 else if (pu.exists() && pu.isFile()) // PLANTUML_JAR_PATH is file
2060 {
2061 // Nothing to be done
2062 }
2063 else
2064 {
2065 err("PLANTUML_JAR_PATH is not a directory with a 'plantuml.jar' file or is not an existing file: %s\n",
2066 qPrint(plantumlJarPath));
2067 plantumlJarPath="";
2068 }
2069 Config_updateString(PLANTUML_JAR_PATH,plantumlJarPath);
2070 }
2071
2072 //------------------------
2073 // check dia path
2074 QCString diaPath = Config_getString(DIA_PATH);
2075 if (!diaPath.isEmpty())
2076 {
2077 QCString diaExe = diaPath+"/dia"+Portable::commandExtension();
2078 FileInfo dp(diaExe.str());
2079 if (!dp.exists() || !dp.isFile())
2080 {
2081 warn_uncond("dia could not be found at %s\n",qPrint(diaPath));
2082 diaPath="";
2083 }
2084 else
2085 {
2086 diaPath=dp.dirPath(TRUE)+"/";
2087#if defined(_WIN32) // convert slashes
2088 size_t i=0,l=diaPath.length();
2089 for (i=0;i<l;i++) if (diaPath.at(i)=='/') diaPath.at(i)='\\';
2090#endif
2091 }
2092 Config_updateString(DIA_PATH,diaPath);
2093 }
2094
2095 //------------------------
2096 // check INPUT
2097 StringVector inputSources=Config_getList(INPUT);
2098 if (inputSources.empty())
2099 {
2100 // use current dir as the default
2101 inputSources.push_back(Dir::currentDirPath());
2102 }
2103 else
2104 {
2105 for (const auto &s : inputSources)
2106 {
2107 FileInfo fi(s.c_str());
2108 if (!fi.exists())
2109 {
2110 warn_uncond("tag INPUT: input source '%s' does not exist\n",s.c_str());
2111 }
2112 }
2113 }
2114 Config_updateList(INPUT,inputSources);
2115
2116 //------------------------
2117 // if no output format is enabled, warn the user
2118 if (!Config_getBool(GENERATE_HTML) &&
2119 !Config_getBool(GENERATE_LATEX) &&
2120 !Config_getBool(GENERATE_MAN) &&
2121 !Config_getBool(GENERATE_RTF) &&
2122 !Config_getBool(GENERATE_XML) &&
2123 !Config_getBool(GENERATE_PERLMOD) &&
2124 !Config_getBool(GENERATE_RTF) &&
2125 !Config_getBool(GENERATE_DOCBOOK) &&
2126 !Config_getBool(GENERATE_AUTOGEN_DEF) &&
2127 Config_getString(GENERATE_TAGFILE).isEmpty()
2128 )
2129 {
2130 warn_uncond("No output formats selected! Set at least one of the main GENERATE_* options to YES.\n");
2131 }
2132
2133 //------------------------
2134 // check HTMLHELP creation requirements
2135 if (!Config_getBool(GENERATE_HTML) &&
2136 Config_getBool(GENERATE_HTMLHELP))
2137 {
2138 warn_uncond("GENERATE_HTMLHELP=YES requires GENERATE_HTML=YES.\n");
2139 }
2140
2141 //------------------------
2142 // check sitemap creation requirements
2143 if (!Config_getBool(GENERATE_HTML) &&
2144 !Config_getString(SITEMAP_URL).isEmpty())
2145 {
2146 warn_uncond("Setting SITEMAP_URL requires GENERATE_HTML=YES.\n");
2147 }
2148
2149 //------------------------
2150 // check QHP creation requirements
2151 if (Config_getBool(GENERATE_QHP))
2152 {
2153 if (!Config_getBool(GENERATE_HTML))
2154 {
2155 warn_uncond("GENERATE_QHP=YES requires GENERATE_HTML=YES.\n");
2156 }
2157 if (Config_getString(QHP_NAMESPACE).isEmpty())
2158 {
2159 err("GENERATE_QHP=YES requires QHP_NAMESPACE to be set. Using 'org.doxygen.doc' as default!.\n");
2160 Config_updateString(QHP_NAMESPACE,"org.doxygen.doc");
2161 }
2162
2163 if (Config_getString(QHP_VIRTUAL_FOLDER).isEmpty())
2164 {
2165 err("GENERATE_QHP=YES requires QHP_VIRTUAL_FOLDER to be set. Using 'doc' as default!\n");
2166 Config_updateString(QHP_VIRTUAL_FOLDER,"doc");
2167 }
2168 const StringVector &tagFileList = Config_getList(TAGFILES);
2169 if (!tagFileList.empty())
2170 {
2171 err("When enabling GENERATE_QHP the TAGFILES option should be empty. I'll adjust it for you.\n");
2172 Config_updateList(TAGFILES,StringVector());
2173 }
2174 }
2175
2176 //------------------------
2177 if (Config_getBool(OPTIMIZE_OUTPUT_JAVA) && Config_getBool(INLINE_INFO))
2178 {
2179 // don't show inline info for Java output, since Java has no inline
2180 // concept.
2181 Config_updateBool(INLINE_INFO,FALSE);
2182 }
2183
2184 //------------------------
2185 int depth = Config_getInt(MAX_DOT_GRAPH_DEPTH);
2186 if (depth==0)
2187 {
2188 Config_updateInt(MAX_DOT_GRAPH_DEPTH,1000);
2189 }
2190
2191 //------------------------
2192 // check for settings that are inconsistent with having OPTIMIZED_OUTPUT_VHDL enabled
2193 if (Config_getBool(OPTIMIZE_OUTPUT_VHDL))
2194 {
2195 const char *depOption = "OPTIMIZE_OUTPUT_VHDL";
2196 adjustBoolSetting(depOption,"INLINE_INHERITED_MEMB",false);
2197 adjustBoolSetting(depOption,"INHERIT_DOCS", false);
2198 adjustBoolSetting(depOption,"HIDE_SCOPE_NAMES", true );
2199 adjustBoolSetting(depOption,"EXTRACT_PRIVATE", true );
2200 adjustBoolSetting(depOption,"ENABLE_PREPROCESSING", false);
2201 adjustBoolSetting(depOption,"EXTRACT_PACKAGE", true );
2202 }
2203
2204 if (!checkFileName(Config_getString(GENERATE_TAGFILE),"GENERATE_TAGFILE"))
2205 {
2206 Config_updateString(GENERATE_TAGFILE,"");
2207 }
2208
2209#if 0 // TODO: this breaks test 25; SOURCEBROWSER = NO and SOURCE_TOOLTIPS = YES.
2210 // So this and other regressions should be analysed and fixed before this can be enabled
2211 // disable any boolean options that depend on disabled options
2212 for (const auto &option : m_options)
2213 {
2214 QCString depName = option->dependsOn(); // option has a dependency
2215 if (!depName.isEmpty())
2216 {
2217 ConfigOption * dep = Config::instance()->get(depName);
2218 if (dep->kind()==ConfigOption::O_Bool &&
2219 ConfigImpl_getBool("depName")==FALSE) // dependent option is disabled
2220 {
2221 if (option->kind()==ConfigOption::O_Bool)
2222 {
2223 printf("disabling option %s\n",qPrint(option->name()));
2224 ConfigImpl_getBool("option->name("))=FALSE; // also disable this option
2225 }
2226 }
2227 }
2228 }
2229#endif
2230
2231}
static void config_term(const char *fmt,...)
Definition configimpl.l:68
Abstract base class for any configuration option.
Definition configimpl.h:38
@ O_Bool
A boolean value.
Definition configimpl.h:52
OptionType kind() const
Definition configimpl.h:69
static std::string currentDirPath()
Definition dir.cpp:340
Minimal replacement for QFileInfo.
Definition fileinfo.h:23
This is an alternative implementation of QCString.
Definition qcstring.h:94
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:146
bool startsWith(const char *s) const
Definition qcstring.h:483
QCString lower() const
Definition qcstring.h:227
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:558
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:143
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:238
const std::string & str() const
Definition qcstring.h:517
#define Config_getInt(name)
Definition config.h:34
#define Config_getList(name)
Definition config.h:38
#define Config_updateString(name, value)
Definition config.h:39
#define Config_updateInt(name, value)
Definition config.h:41
#define Config_getEnumAsString(name)
Definition config.h:36
#define Config_updateBool(name, value)
Definition config.h:40
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
#define Config_updateList(name,...)
Definition config.h:43
#define Config_updateEnum(name, value)
Definition config.h:42
#define Config_getEnum(name)
Definition config.h:35
#define ConfigImpl_getBool(val)
Definition configimpl.h:324
static void adjustStringSetting(const char *depOption, const char *optionName, const QCString &expectedValue)
static void adjustColorStyleSetting(const char *depOption)
static void cleanUpPaths(StringVector &str)
static void checkList(const StringVector &list, const char *name, bool equalRequired, bool valueRequired)
static bool checkFileName(const QCString &s, const char *optionName)
static void adjustBoolSetting(const char *depOption, const char *optionName, bool expectedValue)
std::vector< std::string > StringVector
Definition containers.h:33
#define warn_uncond(fmt,...)
Definition message.h:79
#define err(fmt,...)
Definition message.h:84
QCString pathSeparator()
Definition portable.cpp:382
const char * commandExtension()
Definition portable.cpp:469
const char * qPrint(const char *s)
Definition qcstring.h:652
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
static QCString stripFromPath(const QCString &p, const StringVector &l)
Definition util.cpp:309

References adjustBoolSetting(), adjustColorStyleSetting(), adjustStringSetting(), QCString::at(), checkFileName(), checkList(), cleanUpPaths(), Portable::commandExtension(), Config_getBool, Config_getEnum, Config_getEnumAsString, Config_getInt, Config_getList, Config_getString, ConfigImpl::config_term(), Config_updateBool, Config_updateEnum, Config_updateInt, Config_updateList, Config_updateString, ConfigImpl_getBool, Dir::currentDirPath(), ConfigOption::dependsOn(), FileInfo::dirPath(), err, FileInfo::exists(), FALSE, QCString::find(), FileInfo::isDir(), QCString::isEmpty(), FileInfo::isFile(), ConfigOption::kind(), QCString::length(), QCString::lower(), ConfigOption::name(), ConfigOption::O_Bool, Portable::pathSeparator(), qPrint(), QCString::startsWith(), QCString::str(), stripFromPath(), QCString::stripWhiteSpace(), TRUE, and warn_uncond.

Referenced by checkConfiguration(), and readConfiguration().

◆ compareDoxyfile()

void Config::compareDoxyfile ( TextStream & t,
Config::CompareMode compareMode )

Writes a the differences between the current configuration and the template configuration to stream t.

Definition at line 2343 of file configimpl.l.

2344{
2345 postProcess(FALSE, compareMode);
2346 ConfigImpl::instance()->compareDoxyfile(t, compareMode);
2347}
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode)
static ConfigImpl * instance()
Definition configimpl.h:350
void postProcess(bool clearHeaderAndFooter, CompareMode compareMode=CompareMode::Full)

References ConfigImpl::compareDoxyfile(), FALSE, ConfigImpl::instance(), and postProcess().

Referenced by compareDoxyfile().

◆ deinit()

void Config::deinit ( )

Clean up any data

Definition at line 2391 of file configimpl.l.

2392{
2394}
static void deleteInstance()
Definition configimpl.h:356

References ConfigImpl::deleteInstance(), and ConfigImpl::instance().

Referenced by generateOutput().

◆ init()

void Config::init ( )

Initialize configuration variables to their default value

Definition at line 1670 of file configimpl.l.

1671{
1673}
void init()

References ConfigImpl::init(), and ConfigImpl::instance().

Referenced by readConfiguration().

◆ parse()

bool Config::parse ( const QCString & fileName,
bool update = FALSE,
Config::CompareMode compareMode = CompareMode::Full )

Parses a configuration file with name fn.

Returns
TRUE if successful, FALSE if the file could not be opened or read.

Definition at line 2359 of file configimpl.l.

2360{
2361 g_compareMode = compareMode;
2362 bool parseRes = ConfigImpl::instance()->parse(fileName,update);
2363 if (!parseRes) return parseRes;
2364
2365 // Internally we use the default format UTF-8 and
2366 // when updating etc. the output is in this format as well and not in the read format
2367 ConfigString *option = dynamic_cast<ConfigString*>(g_config->get("DOXYFILE_ENCODING"));
2368 option->init();
2369
2370 return parseRes;
2371}
bool parse(const QCString &fn, bool upd=FALSE)
ConfigOption * get(const QCString &name) const
Definition configimpl.h:399
Class representing a string type option.
Definition configimpl.h:187
void init() override
Definition configimpl.h:206
static Config::CompareMode g_compareMode
Definition configimpl.l:664
static ConfigImpl * g_config
Definition configimpl.l:663

References g_compareMode, g_config, ConfigImpl::get(), ConfigString::init(), ConfigImpl::instance(), and ConfigImpl::parse().

Referenced by readConfiguration().

◆ postProcess()

void Config::postProcess ( bool clearHeaderAndFooter,
Config::CompareMode compareMode = CompareMode::Full )

Post processed the parsed data. Replaces raw string values by the actual values. and replaces environment variables.

Parameters
clearHeaderAndFooterset to TRUE when writing header and footer templates.
compareModesignals if we in Doxyfile compare (-x or -x_noenv) mode are or not. Influences setting of the default value and replacement of environment variables and CMake type replacement variables.

Definition at line 2373 of file configimpl.l.

2374{
2375 auto configInst = ConfigImpl::instance();
2376 if (compareMode != CompareMode::CompressedNoEnv) configInst->substituteEnvironmentVars();
2377 if (compareMode == CompareMode::Full) configInst->emptyValueToDefault();
2378 configInst->convertStrToVal(compareMode);
2379
2380 // avoid bootstrapping issues when the g_config file already
2381 // refers to the files that we are supposed to parse.
2382 if (clearHeaderAndFooter)
2383 {
2384 Config_updateString(HTML_HEADER ,"");
2385 Config_updateString(HTML_FOOTER ,"");
2386 Config_updateString(LATEX_HEADER,"");
2387 Config_updateString(LATEX_FOOTER,"");
2388 }
2389}

References Config_updateString, and ConfigImpl::instance().

Referenced by checkConfiguration(), compareDoxyfile(), and readConfiguration().

◆ updateObsolete()

void Config::updateObsolete ( )

Adjust any configuration values based on the value of obsolete options.

Definition at line 2238 of file configimpl.l.

2239{
2240 //------------------------
2241 // check for presence of obsolete CLASS_DIAGRAM option and correct CLASS_GRAPH if needed
2242 ConfigOption *classDiagramsOpt = ConfigImpl::instance()->get("CLASS_DIAGRAMS");
2243 ConfigOption *haveDotOpt = ConfigImpl::instance()->get("HAVE_DOT");
2244 ConfigOption *classGraphOpt = ConfigImpl::instance()->get("CLASS_GRAPH");
2245 if (classDiagramsOpt && classDiagramsOpt->kind()==ConfigOption::O_Obsolete &&
2246 haveDotOpt && classGraphOpt)
2247 {
2248 ConfigObsolete *classDiagramsOpt_ = dynamic_cast<ConfigObsolete*>(classDiagramsOpt);
2249 ConfigBool *haveDotOpt_ = dynamic_cast<ConfigBool*>(haveDotOpt);
2250 ConfigEnum *classGraphOpt_ = dynamic_cast<ConfigEnum*>(classGraphOpt);
2251 if (classDiagramsOpt_ && haveDotOpt_ && classGraphOpt_ &&
2252 classDiagramsOpt_->isPresent() && classDiagramsOpt_->orgType()==ConfigOption::O_Bool)
2253 {
2254 QCString classDiagramValue = *classDiagramsOpt_->valueStringRef();
2255 QCString haveDotValue = *haveDotOpt_->valueStringRef();
2256 QCString &classGraphValue = *classGraphOpt_->valueRef();
2257 bool isValid1=true, isValid2=true;
2258 bool bClassDiagrams = convertStringToBool(classDiagramValue,isValid1);
2259 bool bHaveDot = haveDotValue.isEmpty() ? false : convertStringToBool(haveDotValue, isValid2);
2260 if (isValid1 && isValid2 && !bClassDiagrams && !bHaveDot && classGraphValue.lower()=="yes")
2261 {
2262 warn_uncond("Changing CLASS_GRAPH option to TEXT because obsolete option CLASS_DIAGRAM was found and set to NO.\n");
2263 classGraphValue="TEXT";
2264 }
2265 }
2266 }
2267
2268 // update TIMESTAMP based on HTML_TIMESTAMP and LATEX_TIMESTAMP
2269 ConfigOption *HtmlTimestamp = ConfigImpl::instance()->get("HTML_TIMESTAMP");
2270 ConfigOption *timestampOpt = ConfigImpl::instance()->get("TIMESTAMP");
2271 bool reset = false;
2272 if (HtmlTimestamp && HtmlTimestamp->kind()==ConfigOption::O_Obsolete && timestampOpt)
2273 {
2274 ConfigObsolete *htmlTimestamp_ = dynamic_cast<ConfigObsolete*>(HtmlTimestamp);
2275 ConfigEnum *timestampOpt_ = dynamic_cast<ConfigEnum*>(timestampOpt);
2276 if (htmlTimestamp_ && timestampOpt_ &&
2277 htmlTimestamp_->isPresent() && htmlTimestamp_->orgType()==ConfigOption::O_Bool)
2278 {
2279 QCString &timestampValue = *timestampOpt_->valueRef();
2280 QCString htmlTimestampValue = *htmlTimestamp_->valueStringRef();
2281 bool isValid=true;
2282 bool bTimestamp = convertStringToBool(htmlTimestampValue,isValid);
2283 if (isValid && bTimestamp)
2284 {
2285 reset = true;
2286 timestampValue = "YES";
2287 }
2288 }
2289 }
2290 ConfigOption *LatexTimestamp = ConfigImpl::instance()->get("LATEX_TIMESTAMP");
2291 if (!reset && LatexTimestamp && LatexTimestamp->kind()==ConfigOption::O_Obsolete && timestampOpt)
2292 {
2293 ConfigObsolete *latexTimestamp_ = dynamic_cast<ConfigObsolete*>(LatexTimestamp);
2294 ConfigEnum *timestampOpt_ = dynamic_cast<ConfigEnum*>(timestampOpt);
2295 if (latexTimestamp_ && timestampOpt_ &&
2296 latexTimestamp_->isPresent() && latexTimestamp_->orgType()==ConfigOption::O_Bool)
2297 {
2298 QCString &timestampValue = *timestampOpt_->valueRef();
2299 QCString latexTimestampValue = *latexTimestamp_->valueStringRef();
2300 bool isValid=true;
2301 bool bTimestamp = convertStringToBool(latexTimestampValue,isValid);
2302 if (isValid && bTimestamp) timestampValue = "YES";
2303 }
2304 }
2305
2306 auto fontname = dynamic_cast<ConfigObsolete*>(ConfigImpl::instance()->get("DOT_FONTNAME"));
2307 auto fontsize = dynamic_cast<ConfigObsolete*>(ConfigImpl::instance()->get("DOT_FONTSIZE"));
2308
2309 // correct DOT_FONTNAME if needed
2310 if (fontname &&
2311 (*fontname->valueStringRef() == "FreeSans"
2312 || *fontname->valueStringRef() == "FreeSans.ttf"))
2313 warn_uncond("doxygen no longer ships with the FreeSans font.\n"
2314 " You may want to clear or change DOT_FONTNAME.\n"
2315 " Otherwise you run the risk that the wrong font is being used for dot generated graphs.\n");
2316
2317 auto commonAttrOpt = dynamic_cast<ConfigString*>(ConfigImpl::instance()->get("DOT_COMMON_ATTR"));
2318 if (commonAttrOpt)
2319 {
2320 QCString& commonAttrStr = *commonAttrOpt->valueRef();
2321 DotAttributes commonAttr(commonAttrStr);
2322 updateAttribute(commonAttr, "fontname", fontname);
2323 updateAttribute(commonAttr, "fontsize", fontsize);
2324 commonAttrStr = commonAttr.str();
2325 }
2326
2327 auto edgeAttrOpt = dynamic_cast<ConfigString*>(ConfigImpl::instance()->get("DOT_EDGE_ATTR"));
2328 if (edgeAttrOpt)
2329 {
2330 QCString& edgeAttrStr = *edgeAttrOpt->valueRef();
2331 DotAttributes edgeAttr(edgeAttrStr);
2332 updateAttribute(edgeAttr, "labelfontname", fontname);
2333 updateAttribute(edgeAttr, "labelfontsize", fontsize);
2334 edgeAttrStr = edgeAttr.str();
2335 }
2336}
Class representing a Boolean type option.
Definition configimpl.h:254
QCString * valueStringRef()
Definition configimpl.h:264
Class representing an enum type option.
Definition configimpl.h:156
QCString * valueRef()
Definition configimpl.h:168
Section marker for obsolete options.
Definition configimpl.h:284
bool isPresent() const
Definition configimpl.h:297
QCString * valueStringRef()
Definition configimpl.h:295
OptionType orgType() const
Definition configimpl.h:293
@ O_Obsolete
An obsolete option.
Definition configimpl.h:53
Class representing an attribute list of a dot graph object.
static void updateAttribute(DotAttributes &attr, QCString name, ConfigObsolete *value)
static bool convertStringToBool(const QCString &str, bool &isValid)
Definition configimpl.l:227

References convertStringToBool(), ConfigImpl::get(), ConfigImpl::instance(), QCString::isEmpty(), ConfigObsolete::isPresent(), ConfigOption::kind(), QCString::lower(), ConfigOption::O_Bool, ConfigOption::O_Obsolete, ConfigObsolete::orgType(), DotAttributes::str(), updateAttribute(), ConfigEnum::valueRef(), ConfigBool::valueStringRef(), ConfigObsolete::valueStringRef(), and warn_uncond.

Referenced by checkConfiguration(), and readConfiguration().

◆ writeTemplate()

void Config::writeTemplate ( TextStream & t,
bool shortList,
bool updateOnly = FALSE )

Writes a template configuration to stream t. If shortList is TRUE the description of each configuration option will be omitted.

Definition at line 2338 of file configimpl.l.

2339{
2340 ConfigImpl::instance()->writeTemplate(t,shortList,update);
2341}
void writeTemplate(TextStream &t, bool shortIndex, bool updateOnly)

References ConfigImpl::instance(), and ConfigImpl::writeTemplate().

Referenced by generateConfigFile().

◆ writeXMLDoxyfile()

void Config::writeXMLDoxyfile ( TextStream & t)

Writes a the used settings of the current configuration as XML format to stream t.

Definition at line 2349 of file configimpl.l.

2350{
2352}
void writeXMLDoxyfile(TextStream &t)

References ConfigImpl::instance(), and ConfigImpl::writeXMLDoxyfile().

Referenced by generateXML().

◆ writeXSDDoxyfile()

void Config::writeXSDDoxyfile ( TextStream & t)

Writes all possible setting ids to an XSD file for validation through the stream t.

Definition at line 2354 of file configimpl.l.

2355{
2357}
void writeXSDDoxyfile(TextStream &t)

References ConfigImpl::instance(), and ConfigImpl::writeXSDDoxyfile().

Referenced by generateXML().