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 1762 of file configimpl.l.

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

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 2363 of file configimpl.l.

2364{
2365 postProcess(FALSE, compareMode);
2366 ConfigImpl::instance()->compareDoxyfile(t, compareMode);
2367}
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode)
static ConfigImpl * instance()
Definition configimpl.h:351
void postProcess(bool clearHeaderAndFooter, CompareMode compareMode=CompareMode::Full)

References FALSE, and postProcess().

Referenced by compareDoxyfile().

◆ deinit()

void Config::deinit ( )

Clean up any data

Definition at line 2411 of file configimpl.l.

2412{
2414}
static void deleteInstance()
Definition configimpl.h:357

Referenced by generateOutput().

◆ init()

void Config::init ( )

Initialize configuration variables to their default value

Definition at line 1671 of file configimpl.l.

1672{
1674}
void init()

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 2379 of file configimpl.l.

2380{
2381 g_compareMode = compareMode;
2382 bool parseRes = ConfigImpl::instance()->parse(fileName,update);
2383 if (!parseRes) return parseRes;
2384
2385 // Internally we use the default format UTF-8 and
2386 // when updating etc. the output is in this format as well and not in the read format
2387 ConfigString *option = dynamic_cast<ConfigString*>(g_config->get("DOXYFILE_ENCODING"));
2388 option->init();
2389
2390 return parseRes;
2391}
bool parse(const QCString &fn, bool upd=FALSE)
Class representing a string type option.
Definition configimpl.h:188
void init() override
Definition configimpl.h:207
static Config::CompareMode g_compareMode
Definition configimpl.l:654
static ConfigImpl * g_config
Definition configimpl.l:653

References g_compareMode, and g_config.

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 2393 of file configimpl.l.

2394{
2395 auto configInst = ConfigImpl::instance();
2396 if (compareMode != CompareMode::CompressedNoEnv) configInst->substituteEnvironmentVars();
2397 if (compareMode == CompareMode::Full) configInst->emptyValueToDefault();
2398 configInst->convertStrToVal(compareMode);
2399
2400 // avoid bootstrapping issues when the g_config file already
2401 // refers to the files that we are supposed to parse.
2402 if (clearHeaderAndFooter)
2403 {
2404 Config_updateString(HTML_HEADER ,"");
2405 Config_updateString(HTML_FOOTER ,"");
2406 Config_updateString(LATEX_HEADER,"");
2407 Config_updateString(LATEX_FOOTER,"");
2408 }
2409}

References CompressedNoEnv, and Full.

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

◆ updateObsolete()

void Config::updateObsolete ( )

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

Definition at line 2258 of file configimpl.l.

2259{
2260 //------------------------
2261 // check for presence of obsolete CLASS_DIAGRAM option and correct CLASS_GRAPH if needed
2262 ConfigOption *classDiagramsOpt = ConfigImpl::instance()->get("CLASS_DIAGRAMS");
2263 ConfigOption *haveDotOpt = ConfigImpl::instance()->get("HAVE_DOT");
2264 ConfigOption *classGraphOpt = ConfigImpl::instance()->get("CLASS_GRAPH");
2265 if (classDiagramsOpt && classDiagramsOpt->kind()==ConfigOption::O_Obsolete &&
2266 haveDotOpt && classGraphOpt)
2267 {
2268 ConfigObsolete *classDiagramsOpt_ = dynamic_cast<ConfigObsolete*>(classDiagramsOpt);
2269 ConfigBool *haveDotOpt_ = dynamic_cast<ConfigBool*>(haveDotOpt);
2270 ConfigEnum *classGraphOpt_ = dynamic_cast<ConfigEnum*>(classGraphOpt);
2271 if (classDiagramsOpt_ && haveDotOpt_ && classGraphOpt_ &&
2272 classDiagramsOpt_->isPresent() && classDiagramsOpt_->orgType()==ConfigOption::O_Bool)
2273 {
2274 QCString classDiagramValue = *classDiagramsOpt_->valueStringRef();
2275 QCString haveDotValue = *haveDotOpt_->valueStringRef();
2276 QCString &classGraphValue = *classGraphOpt_->valueRef();
2277 bool isValid1=true, isValid2=true;
2278 bool bClassDiagrams = convertStringToBool(classDiagramValue,isValid1);
2279 bool bHaveDot = haveDotValue.isEmpty() ? false : convertStringToBool(haveDotValue, isValid2);
2280 if (isValid1 && isValid2 && !bClassDiagrams && !bHaveDot && classGraphValue.lower()=="yes")
2281 {
2282 warn_uncond("Changing CLASS_GRAPH option to TEXT because obsolete option CLASS_DIAGRAM was found and set to NO.\n");
2283 classGraphValue="TEXT";
2284 }
2285 }
2286 }
2287
2288 // update TIMESTAMP based on HTML_TIMESTAMP and LATEX_TIMESTAMP
2289 ConfigOption *HtmlTimestamp = ConfigImpl::instance()->get("HTML_TIMESTAMP");
2290 ConfigOption *timestampOpt = ConfigImpl::instance()->get("TIMESTAMP");
2291 bool reset = false;
2292 if (HtmlTimestamp && HtmlTimestamp->kind()==ConfigOption::O_Obsolete && timestampOpt)
2293 {
2294 ConfigObsolete *htmlTimestamp_ = dynamic_cast<ConfigObsolete*>(HtmlTimestamp);
2295 ConfigEnum *timestampOpt_ = dynamic_cast<ConfigEnum*>(timestampOpt);
2296 if (htmlTimestamp_ && timestampOpt_ &&
2297 htmlTimestamp_->isPresent() && htmlTimestamp_->orgType()==ConfigOption::O_Bool)
2298 {
2299 QCString &timestampValue = *timestampOpt_->valueRef();
2300 QCString htmlTimestampValue = *htmlTimestamp_->valueStringRef();
2301 bool isValid=true;
2302 bool bTimestamp = convertStringToBool(htmlTimestampValue,isValid);
2303 if (isValid && bTimestamp)
2304 {
2305 reset = true;
2306 timestampValue = "YES";
2307 }
2308 }
2309 }
2310 ConfigOption *LatexTimestamp = ConfigImpl::instance()->get("LATEX_TIMESTAMP");
2311 if (!reset && LatexTimestamp && LatexTimestamp->kind()==ConfigOption::O_Obsolete && timestampOpt)
2312 {
2313 ConfigObsolete *latexTimestamp_ = dynamic_cast<ConfigObsolete*>(LatexTimestamp);
2314 ConfigEnum *timestampOpt_ = dynamic_cast<ConfigEnum*>(timestampOpt);
2315 if (latexTimestamp_ && timestampOpt_ &&
2316 latexTimestamp_->isPresent() && latexTimestamp_->orgType()==ConfigOption::O_Bool)
2317 {
2318 QCString &timestampValue = *timestampOpt_->valueRef();
2319 QCString latexTimestampValue = *latexTimestamp_->valueStringRef();
2320 bool isValid=true;
2321 bool bTimestamp = convertStringToBool(latexTimestampValue,isValid);
2322 if (isValid && bTimestamp) timestampValue = "YES";
2323 }
2324 }
2325
2326 auto fontname = dynamic_cast<ConfigObsolete*>(ConfigImpl::instance()->get("DOT_FONTNAME"));
2327 auto fontsize = dynamic_cast<ConfigObsolete*>(ConfigImpl::instance()->get("DOT_FONTSIZE"));
2328
2329 // correct DOT_FONTNAME if needed
2330 if (fontname &&
2331 (*fontname->valueStringRef() == "FreeSans"
2332 || *fontname->valueStringRef() == "FreeSans.ttf"))
2333 warn_uncond("doxygen no longer ships with the FreeSans font.\n"
2334 " You may want to clear or change DOT_FONTNAME.\n"
2335 " Otherwise you run the risk that the wrong font is being used for dot generated graphs.\n");
2336
2337 auto commonAttrOpt = dynamic_cast<ConfigString*>(ConfigImpl::instance()->get("DOT_COMMON_ATTR"));
2338 if (commonAttrOpt)
2339 {
2340 QCString& commonAttrStr = *commonAttrOpt->valueRef();
2341 DotAttributes commonAttr(commonAttrStr);
2342 updateAttribute(commonAttr, "fontname", fontname);
2343 updateAttribute(commonAttr, "fontsize", fontsize);
2344 commonAttrStr = commonAttr.str();
2345 }
2346
2347 auto edgeAttrOpt = dynamic_cast<ConfigString*>(ConfigImpl::instance()->get("DOT_EDGE_ATTR"));
2348 if (edgeAttrOpt)
2349 {
2350 QCString& edgeAttrStr = *edgeAttrOpt->valueRef();
2351 DotAttributes edgeAttr(edgeAttrStr);
2352 updateAttribute(edgeAttr, "labelfontname", fontname);
2353 updateAttribute(edgeAttr, "labelfontsize", fontsize);
2354 edgeAttrStr = edgeAttr.str();
2355 }
2356}
Class representing a Boolean type option.
Definition configimpl.h:255
QCString * valueStringRef()
Definition configimpl.h:265
Class representing an enum type option.
Definition configimpl.h:157
QCString * valueRef()
Definition configimpl.h:169
ConfigOption * get(const QCString &name) const
Definition configimpl.h:400
Section marker for obsolete options.
Definition configimpl.h:285
bool isPresent() const
Definition configimpl.h:298
QCString * valueStringRef()
Definition configimpl.h:296
OptionType orgType() const
Definition configimpl.h:294
Abstract base class for any configuration option.
Definition configimpl.h:39
@ O_Obsolete
An obsolete option.
Definition configimpl.h:54
static void updateAttribute(DotAttributes &attr, QCString name, ConfigObsolete *value)
static bool convertStringToBool(const QCString &str, bool &isValid)
Definition configimpl.l:217

References convertStringToBool(), QCString::isEmpty(), ConfigObsolete::isPresent(), QCString::lower(), ConfigOption::O_Bool, ConfigOption::O_Obsolete, ConfigObsolete::orgType(), 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 2358 of file configimpl.l.

2359{
2360 ConfigImpl::instance()->writeTemplate(t,shortList,update);
2361}
void writeTemplate(TextStream &t, bool shortIndex, bool updateOnly)

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 2369 of file configimpl.l.

2370{
2372}
void writeXMLDoxyfile(TextStream &t)

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 2374 of file configimpl.l.

2375{
2377}
void writeXSDDoxyfile(TextStream &t)

Referenced by generateXML().