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

2344{
2345 postProcess(false, compareMode);
2346 ConfigImpl::instance()->compareDoxyfile(t, compareMode);
2347}
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 2391 of file configimpl.l.

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

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

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

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

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

2339{
2340 ConfigImpl::instance()->writeTemplate(t,shortList,update);
2341}
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 2349 of file configimpl.l.

2350{
2352}
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 2354 of file configimpl.l.

2355{
2357}
void writeXSDDoxyfile(TextStream &t)

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

Referenced by generateXML().