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 adjustStringSetting(depOption, "MERMAID_RENDER_MODE", "CLI");
2007 adjustColorStyleSetting(depOption);
2008 const StringVector &tagFileList = Config_getList(TAGFILES);
2009 StringVector filteredTagFileList;
2010 for (const auto &s : tagFileList)
2011 {
2012 bool validUrl = false;
2013 size_t eqPos = s.find('=');
2014 if (eqPos!=std::string::npos) // tag command contains a destination
2015 {
2016 QCString url = QCString(s.substr(eqPos+1)).stripWhiteSpace().lower();
2017 validUrl = url.startsWith("http:") || url.startsWith("https:") ||
2018 url.startsWith("ms-its:");
2019 }
2020 if (validUrl)
2021 {
2022 filteredTagFileList.push_back(s);
2023 }
2024 else
2025 {
2026 err("When enabling GENERATE_HTMLHELP the TAGFILES option should only contain destinations "
2027 "with https / http addresses (not: {}). I'll adjust it for you.\n",s);
2028 }
2029 }
2030 Config_updateList(TAGFILES,filteredTagFileList);
2031 }
2032
2033 // check for settings that are inconsistent with having INLINE_GROUPED_CLASSES enabled
2034 if (Config_getBool(INLINE_GROUPED_CLASSES))
2035 {
2036 const char *depOption = "INLINE_GROUPED_CLASSES";
2037 adjustBoolSetting(depOption, "SEPARATE_MEMBER_PAGES", false);
2038 }
2039
2040 //------------------------
2041 int dotNumThreads = Config_getInt(DOT_NUM_THREADS);
2042 if (dotNumThreads<=0)
2043 {
2044 dotNumThreads=std::max(2u,std::thread::hardware_concurrency()+1);
2045 Config_updateInt(DOT_NUM_THREADS,dotNumThreads);
2046 }
2047
2048 //------------------------
2049 // check plantuml path
2050 QCString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH);
2051 if (!plantumlJarPath.isEmpty())
2052 {
2053 FileInfo pu(plantumlJarPath.str());
2054 if (pu.exists() && pu.isDir()) // PLANTUML_JAR_PATH is directory
2055 {
2056 QCString plantumlJar = plantumlJarPath+Portable::pathSeparator()+"plantuml.jar";
2057 FileInfo jar(plantumlJar.str());
2058 if (jar.exists() && jar.isFile())
2059 {
2060 plantumlJarPath = plantumlJar;
2061 }
2062 else
2063 {
2064 err("Jar file 'plantuml.jar' not found at location specified via PLANTUML_JAR_PATH: '{}'\n",plantumlJarPath);
2065 plantumlJarPath="";
2066 }
2067 }
2068 else if (pu.exists() && pu.isFile()) // PLANTUML_JAR_PATH is file
2069 {
2070 // Nothing to be done
2071 }
2072 else
2073 {
2074 err("PLANTUML_JAR_PATH is not a directory with a 'plantuml.jar' file or is not an existing file: {}\n",plantumlJarPath);
2075 plantumlJarPath="";
2076 }
2077 Config_updateString(PLANTUML_JAR_PATH,plantumlJarPath);
2078 }
2079
2080 //------------------------
2081 // check dia path
2082 QCString diaPath = Config_getString(DIA_PATH);
2083 if (!diaPath.isEmpty())
2084 {
2085 QCString diaExe = diaPath+"/dia"+Portable::commandExtension();
2086 FileInfo dp(diaExe.str());
2087 if (!dp.exists() || !dp.isFile())
2088 {
2089 warn_uncond("dia could not be found at {}\n",diaPath);
2090 diaPath="";
2091 }
2092 else
2093 {
2094 diaPath=dp.dirPath(TRUE)+"/";
2095#if defined(_WIN32) // convert slashes
2096 size_t i=0,l=diaPath.length();
2097 for (i=0;i<l;i++) if (diaPath.at(i)=='/') diaPath.at(i)='\\';
2098#endif
2099 }
2100 Config_updateString(DIA_PATH,diaPath);
2101 }
2102
2103 //------------------------
2104 // check INPUT
2105 StringVector inputSources=Config_getList(INPUT);
2106 if (inputSources.empty())
2107 {
2108 // use current dir as the default
2109 inputSources.push_back(Dir::currentDirPath());
2110 }
2111 else
2112 {
2113 for (const auto &s : inputSources)
2114 {
2115 FileInfo fi(s);
2116 if (!fi.exists())
2117 {
2118 warn_uncond("tag INPUT: input source '{}' does not exist\n",s);
2119 }
2120 }
2121 }
2122 Config_updateList(INPUT,inputSources);
2123
2124 //------------------------
2125 // if no output format is enabled, warn the user
2126 if (!Config_getBool(GENERATE_HTML) &&
2127 !Config_getBool(GENERATE_LATEX) &&
2128 !Config_getBool(GENERATE_MAN) &&
2129 !Config_getBool(GENERATE_RTF) &&
2130 !Config_getBool(GENERATE_XML) &&
2131 !Config_getBool(GENERATE_PERLMOD) &&
2132 !Config_getBool(GENERATE_RTF) &&
2133 !Config_getBool(GENERATE_DOCBOOK) &&
2134 !Config_getBool(GENERATE_AUTOGEN_DEF) &&
2135 Config_getString(GENERATE_TAGFILE).isEmpty()
2136 )
2137 {
2138 warn_uncond("No output formats selected! Set at least one of the main GENERATE_* options to YES.\n");
2139 }
2140
2141 //------------------------
2142 // check HTMLHELP creation requirements
2143 if (!Config_getBool(GENERATE_HTML) &&
2144 Config_getBool(GENERATE_HTMLHELP))
2145 {
2146 warn_uncond("GENERATE_HTMLHELP=YES requires GENERATE_HTML=YES.\n");
2147 }
2148
2149 //------------------------
2150 // check sitemap creation requirements
2151 if (!Config_getBool(GENERATE_HTML) &&
2152 !Config_getString(SITEMAP_URL).isEmpty())
2153 {
2154 warn_uncond("Setting SITEMAP_URL requires GENERATE_HTML=YES.\n");
2155 }
2156
2157 //------------------------
2158 // check QHP creation requirements
2159 if (Config_getBool(GENERATE_QHP))
2160 {
2161 if (!Config_getBool(GENERATE_HTML))
2162 {
2163 warn_uncond("GENERATE_QHP=YES requires GENERATE_HTML=YES.\n");
2164 }
2165 if (Config_getString(QHP_NAMESPACE).isEmpty())
2166 {
2167 err("GENERATE_QHP=YES requires QHP_NAMESPACE to be set. Using 'org.doxygen.doc' as default!.\n");
2168 Config_updateString(QHP_NAMESPACE,"org.doxygen.doc");
2169 }
2170
2171 if (Config_getString(QHP_VIRTUAL_FOLDER).isEmpty())
2172 {
2173 err("GENERATE_QHP=YES requires QHP_VIRTUAL_FOLDER to be set. Using 'doc' as default!\n");
2174 Config_updateString(QHP_VIRTUAL_FOLDER,"doc");
2175 }
2176 const StringVector &tagFileList = Config_getList(TAGFILES);
2177 if (!tagFileList.empty())
2178 {
2179 err("When enabling GENERATE_QHP the TAGFILES option should be empty. I'll adjust it for you.\n");
2180 Config_updateList(TAGFILES,StringVector());
2181 }
2182 }
2183
2184 //------------------------
2185 if (Config_getBool(OPTIMIZE_OUTPUT_JAVA) && Config_getBool(INLINE_INFO))
2186 {
2187 // don't show inline info for Java output, since Java has no inline
2188 // concept.
2189 Config_updateBool(INLINE_INFO,FALSE);
2190 }
2191
2192 //------------------------
2193 int depth = Config_getInt(MAX_DOT_GRAPH_DEPTH);
2194 if (depth==0)
2195 {
2196 Config_updateInt(MAX_DOT_GRAPH_DEPTH,1000);
2197 }
2198
2199 //------------------------
2200 if (Config_getBool(INTERACTIVE_SVG))
2201 {
2202 // issue 11308
2203 if ((Config_getEnum(DOT_IMAGE_FORMAT) == DOT_IMAGE_FORMAT_t::svg_cairo) ||
2204 (Config_getEnum(DOT_IMAGE_FORMAT) == DOT_IMAGE_FORMAT_t::svg_cairo_cairo))
2205 {
2206 err("When using DOT_IMAGE_FORMAT with {} the INTERACTIVE_SVG option should be disabled. I'll adjust it for you.\n",
2207 Config_getEnumAsString(DOT_IMAGE_FORMAT));
2208 Config_updateBool(INTERACTIVE_SVG,FALSE);
2209 }
2210 }
2211
2212 //------------------------
2213 // check for settings that are inconsistent with having OPTIMIZED_OUTPUT_VHDL enabled
2214 if (Config_getBool(OPTIMIZE_OUTPUT_VHDL))
2215 {
2216 const char *depOption = "OPTIMIZE_OUTPUT_VHDL";
2217 adjustBoolSetting(depOption,"INLINE_INHERITED_MEMB",false);
2218 adjustBoolSetting(depOption,"INHERIT_DOCS", false);
2219 adjustBoolSetting(depOption,"HIDE_SCOPE_NAMES", true );
2220 adjustBoolSetting(depOption,"EXTRACT_PRIVATE", true );
2221 adjustBoolSetting(depOption,"ENABLE_PREPROCESSING", false);
2222 adjustBoolSetting(depOption,"EXTRACT_PACKAGE", true );
2223 }
2224
2225 if (!checkFileName(Config_getString(GENERATE_TAGFILE),"GENERATE_TAGFILE"))
2226 {
2227 Config_updateString(GENERATE_TAGFILE,"");
2228 }
2229
2230#if 0 // TODO: this breaks test 25; SOURCEBROWSER = NO and SOURCE_TOOLTIPS = YES.
2231 // So this and other regressions should be analyzed and fixed before this can be enabled
2232 // disable any boolean options that depend on disabled options
2233 for (const auto &option : m_options)
2234 {
2235 QCString depName = option->dependsOn(); // option has a dependency
2236 if (!depName.isEmpty())
2237 {
2238 ConfigOption * dep = Config::instance()->get(depName);
2239 if (dep->kind()==ConfigOption::O_Bool &&
2240 ConfigImpl_getBool("depName")==FALSE) // dependent option is disabled
2241 {
2242 if (option->kind()==ConfigOption::O_Bool)
2243 {
2244 printf("disabling option %s\n",qPrint(option->name()));
2245 ConfigImpl_getBool("option->name("))=FALSE; // also disable this option
2246 }
2247 }
2248 }
2249 }
2250#endif
2251
2252}
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:374
const char * commandExtension()
Definition portable.cpp:461
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:298

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

2365{
2366 postProcess(FALSE, compareMode);
2367 ConfigImpl::instance()->compareDoxyfile(t, compareMode);
2368}
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 2412 of file configimpl.l.

2413{
2415}
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 1671 of file configimpl.l.

1672{
1674}
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 2380 of file configimpl.l.

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

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

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

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

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

2371{
2373}
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 2375 of file configimpl.l.

2376{
2378}
void writeXSDDoxyfile(TextStream &t)

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

Referenced by generateXML().