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

1758{
1759 ConfigValues::instance().init();
1760
1761 Config_updateBool(QUIET,quiet || Config_getBool(QUIET));
1762 //------------------------
1763 // check WARN_FORMAT
1764 QCString warnFormat = Config_getString(WARN_FORMAT);
1765 if (warnFormat.find("$file")==-1)
1766 {
1767 warn_uncond("warning format does not contain a $file tag!\n");
1768 }
1769 if (warnFormat.find("$line")==-1)
1770 {
1771 warn_uncond("warning format does not contain a $line tag!\n");
1772 }
1773 if (warnFormat.find("$text")==-1)
1774 {
1775 warn_uncond("warning format does not contain a $text tag!\n");
1776 }
1777
1778 //------------------------
1779 // check and correct PAPER_TYPE
1780 QCString paperType = Config_getEnumAsString(PAPER_TYPE);
1781 paperType=paperType.lower().stripWhiteSpace();
1782 if (paperType.isEmpty() || paperType=="a4wide")
1783 {
1784 // use a4
1785 Config_updateEnum(PAPER_TYPE,PAPER_TYPE_t::a4);
1786 }
1787 else if (paperType!="a4" && paperType!="letter" &&
1788 paperType!="legal" && paperType!="executive")
1789 {
1790 err("Unknown page type '{}' specified\n",paperType);
1791 Config_updateEnum(PAPER_TYPE,PAPER_TYPE_t::a4);
1792 }
1793
1794 //------------------------
1795 // check & correct STRIP_FROM_PATH
1796 StringVector stripFromPath = Config_getList(STRIP_FROM_PATH);
1797 if (stripFromPath.empty()) // by default use the current path
1798 {
1799 std::string p = Dir::currentDirPath()+"/";
1800 stripFromPath.push_back(p);
1801 }
1802 else
1803 {
1805 }
1806 Config_updateList(STRIP_FROM_PATH,stripFromPath);
1807
1808 //------------------------
1809 // check & correct STRIP_FROM_INC_PATH
1810 StringVector stripFromIncPath = Config_getList(STRIP_FROM_INC_PATH);
1811 cleanUpPaths(stripFromIncPath);
1812 Config_updateList(STRIP_FROM_INC_PATH,stripFromIncPath);
1813
1814 //------------------------
1815 // Test to see if HTML header is valid
1816 QCString headerFile = Config_getString(HTML_HEADER);
1817 if (check && !headerFile.isEmpty())
1818 {
1819 FileInfo fi(headerFile.str());
1820 if (!fi.exists())
1821 {
1822 ConfigImpl::config_term("tag HTML_HEADER: header file '{}' "
1823 "does not exist\n",headerFile);
1824 }
1825 }
1826
1827 //------------------------
1828 // Test to see if HTML footer is valid
1829 QCString footerFile = Config_getString(HTML_FOOTER);
1830 if (check && !footerFile.isEmpty())
1831 {
1832 FileInfo fi(footerFile.str());
1833 if (!fi.exists())
1834 {
1835 ConfigImpl::config_term("tag HTML_FOOTER: footer file '{}' "
1836 "does not exist\n",footerFile);
1837 }
1838 }
1839
1840 //------------------------
1841 // Test to see if MathJax code file is valid
1842 if (Config_getBool(USE_MATHJAX))
1843 {
1844 auto mathJaxFormat = Config_getEnum(MATHJAX_FORMAT);
1845 auto mathjaxVersion = Config_getEnum(MATHJAX_VERSION);
1846 switch (mathjaxVersion)
1847 {
1848 case MATHJAX_VERSION_t::MathJax_2:
1849 if (mathJaxFormat==MATHJAX_FORMAT_t::chtml)
1850 {
1851 Config_updateEnum(MATHJAX_FORMAT,MATHJAX_FORMAT_t::HTML_CSS);
1852 }
1853 break;
1854 case MATHJAX_VERSION_t::MathJax_3:
1855 if (mathJaxFormat==MATHJAX_FORMAT_t::HTML_CSS || mathJaxFormat==MATHJAX_FORMAT_t::NativeMML)
1856 {
1857 Config_updateEnum(MATHJAX_FORMAT,MATHJAX_FORMAT_t::chtml);
1858 }
1859 break;
1860 case MATHJAX_VERSION_t::MathJax_4:
1861 if (mathJaxFormat==MATHJAX_FORMAT_t::HTML_CSS || mathJaxFormat==MATHJAX_FORMAT_t::NativeMML)
1862 {
1863 Config_updateEnum(MATHJAX_FORMAT,MATHJAX_FORMAT_t::chtml);
1864 }
1865 break;
1866 }
1867
1868 QCString mathJaxCodefile = Config_getString(MATHJAX_CODEFILE);
1869 if (check && !mathJaxCodefile.isEmpty())
1870 {
1871 FileInfo fi(mathJaxCodefile.str());
1872 if (!fi.exists())
1873 {
1874 ConfigImpl::config_term("tag MATHJAX_CODEFILE file '{}' "
1875 "does not exist\n",mathJaxCodefile);
1876 }
1877 }
1878 QCString path = Config_getString(MATHJAX_RELPATH);
1879 if (path.isEmpty())
1880 {
1881 path = "https://cdn.jsdelivr.net/npm/mathjax@";
1882 switch (mathjaxVersion)
1883 {
1884 case MATHJAX_VERSION_t::MathJax_2: path += "2"; break;
1885 case MATHJAX_VERSION_t::MathJax_3: path += "3"; break;
1886 case MATHJAX_VERSION_t::MathJax_4: path += "4"; break;
1887 }
1888 }
1889
1890 if (path.at(path.length()-1)!='/')
1891 {
1892 path+="/";
1893 }
1894 Config_updateString(MATHJAX_RELPATH,path);
1895 }
1896
1897 //------------------------
1898 // Test to see if LaTeX header is valid
1899 QCString latexHeaderFile = Config_getString(LATEX_HEADER);
1900 if (check && !latexHeaderFile.isEmpty())
1901 {
1902 FileInfo fi(latexHeaderFile.str());
1903 if (!fi.exists())
1904 {
1905 ConfigImpl::config_term("tag LATEX_HEADER: header file '{}' "
1906 "does not exist\n",latexHeaderFile);
1907 }
1908 }
1909
1910 //------------------------
1911 // Test to see if LaTeX footer is valid
1912 QCString latexFooterFile = Config_getString(LATEX_FOOTER);
1913 if (check && !latexFooterFile.isEmpty())
1914 {
1915 FileInfo fi(latexFooterFile.str());
1916 if (!fi.exists())
1917 {
1918 ConfigImpl::config_term("tag LATEX_FOOTER: footer file '{}' "
1919 "does not exist\n",latexFooterFile);
1920 }
1921 }
1922
1923 //------------------------
1924 // check include path
1925 const StringVector &includePath = Config_getList(INCLUDE_PATH);
1926 for (const auto &s : includePath)
1927 {
1928 FileInfo fi(s);
1929 if (!fi.exists())
1930 {
1931 warn_uncond("tag INCLUDE_PATH: include path '{}' does not exist\n",s);
1932 }
1933 }
1934
1935 //------------------------
1936 // check PREDEFINED
1937 if (Config_getBool(ENABLE_PREPROCESSING))
1938 {
1939 const StringVector &predefList = Config_getList(PREDEFINED);
1940 for (const auto &s : predefList)
1941 {
1942 QCString predef = s;
1943 predef=predef.stripWhiteSpace();
1944 int i_equals=predef.find('=');
1945 int i_obrace=predef.find('(');
1946 if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && predef.at(i_equals-1)==':'))
1947 {
1948 err("Illegal PREDEFINED format '{}', no define name specified\n",predef);
1949 }
1950 }
1951 }
1952
1953 //------------------------
1954 // check EXTENSION_MAPPING
1955 checkList(Config_getList(EXTENSION_MAPPING),"EXTENSION_MAPPING",TRUE,TRUE);
1956
1957 //------------------------
1958 // check FILTER_PATTERNS
1959 checkList(Config_getList(FILTER_PATTERNS),"FILTER_PATTERNS",TRUE,TRUE);
1960
1961 //------------------------
1962 // check FILTER_SOURCE_PATTERNS
1963 checkList(Config_getList(FILTER_SOURCE_PATTERNS),"FILTER_SOURCE_PATTERNS",FALSE,FALSE);
1964
1965 //------------------------
1966 // check INPUT_FILE_ENCODING
1967 checkList(Config_getList(INPUT_FILE_ENCODING),"INPUT_FILE_ENCODING",TRUE,TRUE);
1968
1969 //------------------------
1970 // check TAGFILES
1971 checkList(Config_getList(TAGFILES),"TAGFILES",FALSE,TRUE);
1972
1973 //------------------------
1974 // check EXTRA_SEARCH_MAPPINGS
1975 if (Config_getBool(SEARCHENGINE) && Config_getBool(GENERATE_HTML))
1976 {
1977 checkList(Config_getList(EXTRA_SEARCH_MAPPINGS),"EXTRA_SEARCH_MAPPING",TRUE,TRUE);
1978 }
1979
1980 int numThreads = Config_getInt(NUM_PROC_THREADS);
1981 if (numThreads==0)
1982 {
1983 numThreads = static_cast<int>(std::thread::hardware_concurrency());
1984 Config_updateInt(NUM_PROC_THREADS,numThreads);
1985 }
1986
1987 //------------------------
1988
1989 // check for settings that are inconsistent with having GENERATE_HTMLHELP enabled
1990 if (Config_getBool(GENERATE_HTMLHELP))
1991 {
1992 const char *depOption = "GENERATE_HTMLHELP";
1993 adjustBoolSetting( depOption, "GENERATE_TREEVIEW", false );
1994 adjustBoolSetting( depOption, "SEARCHENGINE", false );
1995 adjustBoolSetting( depOption, "HTML_DYNAMIC_MENUS", false );
1996 adjustBoolSetting( depOption, "HTML_DYNAMIC_SECTIONS",false );
1997 adjustBoolSetting( depOption, "HTML_COPY_CLIPBOARD", false );
1998 adjustStringSetting(depOption, "HTML_FILE_EXTENSION", ".html");
1999 adjustColorStyleSetting(depOption);
2000 const StringVector &tagFileList = Config_getList(TAGFILES);
2001 StringVector filteredTagFileList;
2002 for (const auto &s : tagFileList)
2003 {
2004 bool validUrl = false;
2005 size_t eqPos = s.find('=');
2006 if (eqPos!=std::string::npos) // tag command contains a destination
2007 {
2008 QCString url = QCString(s.substr(eqPos+1)).stripWhiteSpace().lower();
2009 validUrl = url.startsWith("http:") || url.startsWith("https:") ||
2010 url.startsWith("ms-its:");
2011 }
2012 if (validUrl)
2013 {
2014 filteredTagFileList.push_back(s);
2015 }
2016 else
2017 {
2018 err("When enabling GENERATE_HTMLHELP the TAGFILES option should only contain destinations "
2019 "with https / http addresses (not: {}). I'll adjust it for you.\n",s);
2020 }
2021 }
2022 Config_updateList(TAGFILES,filteredTagFileList);
2023 }
2024
2025 // check for settings that are inconsistent with having INLINE_GROUPED_CLASSES enabled
2026 if (Config_getBool(INLINE_GROUPED_CLASSES))
2027 {
2028 const char *depOption = "INLINE_GROUPED_CLASSES";
2029 adjustBoolSetting(depOption, "SEPARATE_MEMBER_PAGES", false);
2030 }
2031
2032 //------------------------
2033 int dotNumThreads = Config_getInt(DOT_NUM_THREADS);
2034 if (dotNumThreads<=0)
2035 {
2036 dotNumThreads=std::max(2u,std::thread::hardware_concurrency()+1);
2037 Config_updateInt(DOT_NUM_THREADS,dotNumThreads);
2038 }
2039
2040 //------------------------
2041 // check plantuml path
2042 QCString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH);
2043 if (!plantumlJarPath.isEmpty())
2044 {
2045 FileInfo pu(plantumlJarPath.str());
2046 if (pu.exists() && pu.isDir()) // PLANTUML_JAR_PATH is directory
2047 {
2048 QCString plantumlJar = plantumlJarPath+Portable::pathSeparator()+"plantuml.jar";
2049 FileInfo jar(plantumlJar.str());
2050 if (jar.exists() && jar.isFile())
2051 {
2052 plantumlJarPath = plantumlJar;
2053 }
2054 else
2055 {
2056 err("Jar file 'plantuml.jar' not found at location specified via PLANTUML_JAR_PATH: '{}'\n",plantumlJarPath);
2057 plantumlJarPath="";
2058 }
2059 }
2060 else if (pu.exists() && pu.isFile()) // PLANTUML_JAR_PATH is file
2061 {
2062 // Nothing to be done
2063 }
2064 else
2065 {
2066 err("PLANTUML_JAR_PATH is not a directory with a 'plantuml.jar' file or is not an existing file: {}\n",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 {}\n",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);
2108 if (!fi.exists())
2109 {
2110 warn_uncond("tag INPUT: input source '{}' does not exist\n",s);
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 if (Config_getBool(INTERACTIVE_SVG))
2193 {
2194 // issue 11308
2195 if ((Config_getEnum(DOT_IMAGE_FORMAT) == DOT_IMAGE_FORMAT_t::svg_cairo) ||
2196 (Config_getEnum(DOT_IMAGE_FORMAT) == DOT_IMAGE_FORMAT_t::svg_cairo_cairo))
2197 {
2198 err("When using DOT_IMAGE_FORMAT with {} the INTERACTIVE_SVG option should be disabled. I'll adjust it for you.\n",
2199 Config_getEnumAsString(DOT_IMAGE_FORMAT));
2200 Config_updateBool(INTERACTIVE_SVG,FALSE);
2201 }
2202 }
2203
2204 //------------------------
2205 // check for settings that are inconsistent with having OPTIMIZED_OUTPUT_VHDL enabled
2206 if (Config_getBool(OPTIMIZE_OUTPUT_VHDL))
2207 {
2208 const char *depOption = "OPTIMIZE_OUTPUT_VHDL";
2209 adjustBoolSetting(depOption,"INLINE_INHERITED_MEMB",false);
2210 adjustBoolSetting(depOption,"INHERIT_DOCS", false);
2211 adjustBoolSetting(depOption,"HIDE_SCOPE_NAMES", true );
2212 adjustBoolSetting(depOption,"EXTRACT_PRIVATE", true );
2213 adjustBoolSetting(depOption,"ENABLE_PREPROCESSING", false);
2214 adjustBoolSetting(depOption,"EXTRACT_PACKAGE", true );
2215 }
2216
2217 if (!checkFileName(Config_getString(GENERATE_TAGFILE),"GENERATE_TAGFILE"))
2218 {
2219 Config_updateString(GENERATE_TAGFILE,"");
2220 }
2221
2222#if 0 // TODO: this breaks test 25; SOURCEBROWSER = NO and SOURCE_TOOLTIPS = YES.
2223 // So this and other regressions should be analyzed and fixed before this can be enabled
2224 // disable any boolean options that depend on disabled options
2225 for (const auto &option : m_options)
2226 {
2227 QCString depName = option->dependsOn(); // option has a dependency
2228 if (!depName.isEmpty())
2229 {
2230 ConfigOption * dep = Config::instance()->get(depName);
2231 if (dep->kind()==ConfigOption::O_Bool &&
2232 ConfigImpl_getBool("depName")==FALSE) // dependent option is disabled
2233 {
2234 if (option->kind()==ConfigOption::O_Bool)
2235 {
2236 printf("disabling option %s\n",qPrint(option->name()));
2237 ConfigImpl_getBool("option->name("))=FALSE; // also disable this option
2238 }
2239 }
2240 }
2241 }
2242#endif
2243
2244}
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:310

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

2357{
2358 postProcess(FALSE, compareMode);
2359 ConfigImpl::instance()->compareDoxyfile(t, compareMode);
2360}
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 2404 of file configimpl.l.

2405{
2407}
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 1666 of file configimpl.l.

1667{
1669}
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 2372 of file configimpl.l.

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

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

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

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

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

2363{
2365}
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 2367 of file configimpl.l.

2368{
2370}
void writeXSDDoxyfile(TextStream &t)

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

Referenced by generateXML().