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

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

2349{
2350 postProcess(FALSE, compareMode);
2351 ConfigImpl::instance()->compareDoxyfile(t, compareMode);
2352}
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode)
static ConfigImpl * instance()
Definition configimpl.h:351
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 2396 of file configimpl.l.

2397{
2399}
static void deleteInstance()
Definition configimpl.h:357

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

Referenced by generateOutput().

◆ init()

void Config::init ( )

Initialize configuration variables to their default value

Definition at line 1662 of file configimpl.l.

1663{
1665}
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 2364 of file configimpl.l.

2365{
2366 g_compareMode = compareMode;
2367 bool parseRes = ConfigImpl::instance()->parse(fileName,update);
2368 if (!parseRes) return parseRes;
2369
2370 // Internally we use the default format UTF-8 and
2371 // when updating etc. the output is in this format as well and not in the read format
2372 ConfigString *option = dynamic_cast<ConfigString*>(g_config->get("DOXYFILE_ENCODING"));
2373 option->init();
2374
2375 return parseRes;
2376}
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, g_config, 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 2378 of file configimpl.l.

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

References CompressedNoEnv, Config_updateString, Full, 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 2243 of file configimpl.l.

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

2344{
2345 ConfigImpl::instance()->writeTemplate(t,shortList,update);
2346}
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 2354 of file configimpl.l.

2355{
2357}
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 2359 of file configimpl.l.

2360{
2362}
void writeXSDDoxyfile(TextStream &t)

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

Referenced by generateXML().