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 DString &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 DString warnFormat = Config_getString(WARN_FORMAT);
1765 if (warnFormat.find("$file")==DString::npos)
1766 {
1767 warn_uncond("warning format does not contain a $file tag!\n");
1768 }
1769 if (warnFormat.find("$line")==DString::npos)
1770 {
1771 warn_uncond("warning format does not contain a $line tag!\n");
1772 }
1773 if (warnFormat.find("$text")==DString::npos)
1774 {
1775 warn_uncond("warning format does not contain a $text tag!\n");
1776 }
1777
1778 //------------------------
1779 // check and correct PAPER_TYPE
1780 DString paperType = Config_getEnumAsString(PAPER_TYPE);
1781 paperType=paperType.lower().stripWhiteSpace();
1782 if (paperType.empty() || 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()+"/";
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 DString headerFile = Config_getString(HTML_HEADER);
1817 if (check && !headerFile.empty())
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 DString footerFile = Config_getString(HTML_FOOTER);
1830 if (check && !footerFile.empty())
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 DString mathJaxCodefile = Config_getString(MATHJAX_CODEFILE);
1869 if (check && !mathJaxCodefile.empty())
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 DString path = Config_getString(MATHJAX_RELPATH);
1879 if (path.empty())
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 DString latexHeaderFile = Config_getString(LATEX_HEADER);
1900 if (check && !latexHeaderFile.empty())
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 DString latexFooterFile = Config_getString(LATEX_FOOTER);
1913 if (check && !latexFooterFile.empty())
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 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 StringVector predefList = Config_getList(PREDEFINED);
1940 for (const auto &s : predefList)
1941 {
1942 DString predef = s;
1943 predef=predef.stripWhiteSpace();
1944 size_t i_equals=predef.find('=');
1945 size_t 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 adjustBoolSetting( depOption, "HTML_CODE_FOLDING", false );
1999 adjustBoolSetting( depOption, "INTERACTIVE_SVG", false );
2000 adjustStringSetting(depOption, "HTML_FILE_EXTENSION", ".html");
2001 adjustStringSetting(depOption, "MERMAID_RENDER_MODE", "CLI");
2002 adjustColorStyleSetting(depOption);
2003 StringVector tagFileList = Config_getList(TAGFILES);
2004 StringVector filteredTagFileList;
2005 for (const auto &s : tagFileList)
2006 {
2007 bool validUrl = false;
2008 size_t eqPos = s.find('=');
2009 if (eqPos!=std::string::npos) // tag command contains a destination
2010 {
2011 DString url = DString(s.substr(eqPos+1)).stripWhiteSpace().lower();
2012 validUrl = url.startsWith("http:") || url.startsWith("https:") ||
2013 url.startsWith("ms-its:");
2014 }
2015 if (validUrl)
2016 {
2017 filteredTagFileList.push_back(s);
2018 }
2019 else
2020 {
2021 err("When enabling GENERATE_HTMLHELP the TAGFILES option should only contain destinations "
2022 "with https / http addresses (not: {}). I'll adjust it for you.\n",s);
2023 }
2024 }
2025 Config_updateList(TAGFILES,filteredTagFileList);
2026 }
2027
2028 // check for settings that are inconsistent with having INLINE_GROUPED_CLASSES enabled
2029 if (Config_getBool(INLINE_GROUPED_CLASSES))
2030 {
2031 const char *depOption = "INLINE_GROUPED_CLASSES";
2032 adjustBoolSetting(depOption, "SEPARATE_MEMBER_PAGES", false);
2033 }
2034
2035 //------------------------
2036 int dotNumThreads = Config_getInt(DOT_NUM_THREADS);
2037 if (dotNumThreads<=0)
2038 {
2039 dotNumThreads=std::max(2u,std::thread::hardware_concurrency()+1);
2040 Config_updateInt(DOT_NUM_THREADS,dotNumThreads);
2041 }
2042
2043 //------------------------
2044 // check plantuml path
2045 DString plantumlJarPath = Config_getString(PLANTUML_JAR_PATH);
2046 if (!plantumlJarPath.empty())
2047 {
2048 FileInfo pu(plantumlJarPath.str());
2049 if (pu.exists() && pu.isDir()) // PLANTUML_JAR_PATH is directory
2050 {
2051 DString plantumlJar = plantumlJarPath+Portable::pathSeparator()+"plantuml.jar";
2052 FileInfo jar(plantumlJar.str());
2053 if (jar.exists() && jar.isFile())
2054 {
2055 plantumlJarPath = plantumlJar;
2056 }
2057 else
2058 {
2059 err("Jar file 'plantuml.jar' not found at location specified via PLANTUML_JAR_PATH: '{}'\n",plantumlJarPath);
2060 plantumlJarPath="";
2061 }
2062 }
2063 else if (pu.exists() && pu.isFile()) // PLANTUML_JAR_PATH is file
2064 {
2065 // Nothing to be done
2066 }
2067 else
2068 {
2069 err("PLANTUML_JAR_PATH is not a directory with a 'plantuml.jar' file or is not an existing file: {}\n",plantumlJarPath);
2070 plantumlJarPath="";
2071 }
2072 Config_updateString(PLANTUML_JAR_PATH,plantumlJarPath);
2073 }
2074
2075 //------------------------
2076 // check dia path
2077 DString diaPath = Config_getString(DIA_PATH);
2078 if (!diaPath.empty())
2079 {
2080 DString diaExe = diaPath+"/dia"+Portable::commandExtension();
2081 FileInfo dp(diaExe.str());
2082 if (!dp.exists() || !dp.isFile())
2083 {
2084 warn_uncond("dia could not be found at {}\n",diaPath);
2085 diaPath="";
2086 }
2087 else
2088 {
2089 diaPath=dp.dirPath(true)+"/";
2090#if defined(_WIN32) // convert slashes
2091 size_t i=0,l=diaPath.length();
2092 for (i=0;i<l;i++) if (diaPath.at(i)=='/') diaPath.at(i)='\\';
2093#endif
2094 }
2095 Config_updateString(DIA_PATH,diaPath);
2096 }
2097
2098 //------------------------
2099 // check INPUT
2100 StringVector inputSources=Config_getList(INPUT);
2101 if (inputSources.empty())
2102 {
2103 // use current dir as the default
2104 inputSources.push_back(Dir::currentDirPath());
2105 }
2106 else
2107 {
2108 for (const auto &s : inputSources)
2109 {
2110 FileInfo fi(s);
2111 if (!fi.exists())
2112 {
2113 warn_uncond("tag INPUT: input source '{}' does not exist\n",s);
2114 }
2115 }
2116 }
2117 Config_updateList(INPUT,inputSources);
2118
2119 //------------------------
2120 // if no output format is enabled, warn the user
2121 if (!Config_getBool(GENERATE_HTML) &&
2122 !Config_getBool(GENERATE_LATEX) &&
2123 !Config_getBool(GENERATE_MAN) &&
2124 !Config_getBool(GENERATE_RTF) &&
2125 !Config_getBool(GENERATE_XML) &&
2126 !Config_getBool(GENERATE_PERLMOD) &&
2127 !Config_getBool(GENERATE_RTF) &&
2128 !Config_getBool(GENERATE_DOCBOOK) &&
2129 !Config_getBool(GENERATE_AUTOGEN_DEF) &&
2130 Config_getString(GENERATE_TAGFILE).empty()
2131 )
2132 {
2133 warn_uncond("No output formats selected! Set at least one of the main GENERATE_* options to YES.\n");
2134 }
2135
2136 //------------------------
2137 // check HTMLHELP creation requirements
2138 if (!Config_getBool(GENERATE_HTML) &&
2139 Config_getBool(GENERATE_HTMLHELP))
2140 {
2141 warn_uncond("GENERATE_HTMLHELP=YES requires GENERATE_HTML=YES.\n");
2142 }
2143
2144 //------------------------
2145 // check sitemap creation requirements
2146 if (!Config_getBool(GENERATE_HTML) &&
2147 !Config_getString(SITEMAP_URL).empty())
2148 {
2149 warn_uncond("Setting SITEMAP_URL requires GENERATE_HTML=YES.\n");
2150 }
2151
2152 //------------------------
2153 // check QHP creation requirements
2154 if (Config_getBool(GENERATE_QHP))
2155 {
2156 if (!Config_getBool(GENERATE_HTML))
2157 {
2158 warn_uncond("GENERATE_QHP=YES requires GENERATE_HTML=YES.\n");
2159 }
2160 if (Config_getString(QHP_NAMESPACE).empty())
2161 {
2162 err("GENERATE_QHP=YES requires QHP_NAMESPACE to be set. Using 'org.doxygen.doc' as default!.\n");
2163 Config_updateString(QHP_NAMESPACE,"org.doxygen.doc");
2164 }
2165
2166 if (Config_getString(QHP_VIRTUAL_FOLDER).empty())
2167 {
2168 err("GENERATE_QHP=YES requires QHP_VIRTUAL_FOLDER to be set. Using 'doc' as default!\n");
2169 Config_updateString(QHP_VIRTUAL_FOLDER,"doc");
2170 }
2171 StringVector tagFileList = Config_getList(TAGFILES);
2172 if (!tagFileList.empty())
2173 {
2174 err("When enabling GENERATE_QHP the TAGFILES option should be empty. I'll adjust it for you.\n");
2175 Config_updateList(TAGFILES,StringVector());
2176 }
2177 }
2178
2179 //------------------------
2180 if (Config_getBool(OPTIMIZE_OUTPUT_JAVA) && Config_getBool(INLINE_INFO))
2181 {
2182 // don't show inline info for Java output, since Java has no inline
2183 // concept.
2184 Config_updateBool(INLINE_INFO,false);
2185 }
2186
2187 //------------------------
2188 int depth = Config_getInt(MAX_DOT_GRAPH_DEPTH);
2189 if (depth==0)
2190 {
2191 Config_updateInt(MAX_DOT_GRAPH_DEPTH,1000);
2192 }
2193
2194 //------------------------
2195 if (Config_getBool(INTERACTIVE_SVG))
2196 {
2197 // issue 11308
2198 if ((Config_getEnum(DOT_IMAGE_FORMAT) == DOT_IMAGE_FORMAT_t::svg_cairo) ||
2199 (Config_getEnum(DOT_IMAGE_FORMAT) == DOT_IMAGE_FORMAT_t::svg_cairo_cairo))
2200 {
2201 err("When using DOT_IMAGE_FORMAT with {} the INTERACTIVE_SVG option should be disabled. I'll adjust it for you.\n",
2202 Config_getEnumAsString(DOT_IMAGE_FORMAT));
2203 Config_updateBool(INTERACTIVE_SVG,false);
2204 }
2205 }
2206
2207 //------------------------
2208 // check for settings that are inconsistent with having OPTIMIZED_OUTPUT_VHDL enabled
2209 if (Config_getBool(OPTIMIZE_OUTPUT_VHDL))
2210 {
2211 const char *depOption = "OPTIMIZE_OUTPUT_VHDL";
2212 adjustBoolSetting(depOption,"INLINE_INHERITED_MEMB",false);
2213 adjustBoolSetting(depOption,"INHERIT_DOCS", false);
2214 adjustBoolSetting(depOption,"HIDE_SCOPE_NAMES", true );
2215 adjustBoolSetting(depOption,"EXTRACT_PRIVATE", true );
2216 adjustBoolSetting(depOption,"ENABLE_PREPROCESSING", false);
2217 adjustBoolSetting(depOption,"EXTRACT_PACKAGE", true );
2218 }
2219
2220 if (!checkFileName(Config_getString(GENERATE_TAGFILE),"GENERATE_TAGFILE"))
2221 {
2222 Config_updateString(GENERATE_TAGFILE,"");
2223 }
2224
2225#if 0 // TODO: this breaks test 25; SOURCEBROWSER = NO and SOURCE_TOOLTIPS = YES.
2226 // So this and other regressions should be analyzed and fixed before this can be enabled
2227 // disable any boolean options that depend on disabled options
2228 for (const auto &option : m_options)
2229 {
2230 DString depName = option->dependsOn(); // option has a dependency
2231 if (!depName.empty())
2232 {
2233 ConfigOption * dep = Config::instance()->get(depName);
2234 if (dep->kind()==ConfigOption::O_Bool &&
2235 ConfigImpl_getBool("depName")==false) // dependent option is disabled
2236 {
2237 if (option->kind()==ConfigOption::O_Bool)
2238 {
2239 printf("disabling option %s\n",qPrint(option->name()));
2240 ConfigImpl_getBool("option->name("))=false; // also disable this option
2241 }
2242 }
2243 }
2244 }
2245#endif
2246
2247}
static void config_term(fmt::format_string< Args... > fmt, Args &&... args)
Definition configimpl.h:617
@ O_Bool
A boolean value.
Definition configimpl.h:49
OptionType kind() const
Definition configimpl.h:66
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
void push_back(char c)
Definition dstring.h:202
DString lower() const
Definition dstring.h:326
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:178
char & at(size_t i)
Returns a reference to the character at index i.
Definition dstring.h:686
size_t find(char c, size_t pos=0) const
Definition dstring.h:239
DString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition dstring.h:337
const std::string & str() const
Definition dstring.h:645
bool startsWith(const char *s) const
Definition dstring.h:600
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition dstring.h:151
static std::string currentDirPath()
Definition dir.cpp:348
#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:321
static void adjustStringSetting(const char *depOption, const char *optionName, const DString &expectedValue)
static void adjustColorStyleSetting(const char *depOption)
static void cleanUpPaths(StringVector &str)
static bool checkFileName(const DString &s, const char *optionName)
static void checkList(StringVector list, const char *name, bool equalRequired, bool valueRequired)
static void adjustBoolSetting(const char *depOption, const char *optionName, bool expectedValue)
std::vector< std::string > StringVector
Definition containers.h:33
const char * qPrint(const char *s)
Definition dstring.h:783
#define warn_uncond(fmt,...)
Definition message.h:122
#define err(fmt,...)
Definition message.h:127
DString pathSeparator()
Definition portable.cpp:390
const char * commandExtension()
Definition portable.cpp:477
DString stripFromPath(const DString &path)
Definition util.cpp:219

References adjustBoolSetting(), adjustColorStyleSetting(), adjustStringSetting(), DString::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(), DString::empty(), err, FileInfo::exists(), DString::find(), FileInfo::isDir(), FileInfo::isFile(), ConfigOption::kind(), DString::length(), DString::lower(), ConfigOption::name(), DString::npos, ConfigOption::O_Bool, Portable::pathSeparator(), DString::push_back(), qPrint(), DString::startsWith(), DString::str(), stripFromPath(), DString::stripWhiteSpace(), 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 2359 of file configimpl.l.

2360{
2361 postProcess(false, compareMode);
2362 ConfigImpl::instance()->compareDoxyfile(t, compareMode);
2363}
void compareDoxyfile(TextStream &t, Config::CompareMode compareMode)
static ConfigImpl * instance()
Definition configimpl.h:347
void postProcess(bool clearHeaderAndFooter, CompareMode compareMode=CompareMode::Full)

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

Referenced by compareDoxyfile().

◆ deinit()

void Config::deinit ( )

Clean up any data

Definition at line 2407 of file configimpl.l.

2408{
2410}
static void deleteInstance()
Definition configimpl.h:353

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 DString & 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 2375 of file configimpl.l.

2376{
2377 g_compareMode = compareMode;
2378 bool parseRes = ConfigImpl::instance()->parse(fileName,update);
2379 if (!parseRes) return parseRes;
2380
2381 // Internally we use the default format UTF-8 and
2382 // when updating etc. the output is in this format as well and not in the read format
2383 ConfigString *option = dynamic_cast<ConfigString*>(g_config->get("DOXYFILE_ENCODING"));
2384 if (option) option->init();
2385
2386 return parseRes;
2387}
bool parse(const DString &fn, bool upd=false)
ConfigOption * get(const DString &name) const
Definition configimpl.h:396
Class representing a string type option.
Definition configimpl.h:184
void init() override
Definition configimpl.h:203
static Config::CompareMode g_compareMode
Definition configimpl.l:650
static ConfigImpl * g_config
Definition configimpl.l:649

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

Referenced by readConfiguration().

◆ postProcess()

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

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

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

Definition at line 2389 of file configimpl.l.

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

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

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

References convertStringToBool(), DString::empty(), ConfigImpl::get(), ConfigImpl::instance(), ConfigObsolete::isPresent(), ConfigOption::kind(), DString::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 2354 of file configimpl.l.

2355{
2356 ConfigImpl::instance()->writeTemplate(t,shortList,update);
2357}
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 2365 of file configimpl.l.

2366{
2368}
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 2370 of file configimpl.l.

2371{
2373}
void writeXSDDoxyfile(TextStream &t)

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

Referenced by generateXML().