diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2018-09-15 15:12:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-15 15:12:08 (GMT) |
commit | 6c1c88f41aa68e6999bfa4b72e37c5a8034588a5 (patch) | |
tree | c7e362d4241f6f4e30b0f85afa08b31506bd12a5 /src | |
parent | 7a24844b214005b4a12005c4d3e3c2c998dd8ae5 (diff) | |
parent | ed1fb80b55bab16443b211ebeb1cd45bb630b08b (diff) | |
download | Doxygen-6c1c88f41aa68e6999bfa4b72e37c5a8034588a5.zip Doxygen-6c1c88f41aa68e6999bfa4b72e37c5a8034588a5.tar.gz Doxygen-6c1c88f41aa68e6999bfa4b72e37c5a8034588a5.tar.bz2 |
Merge pull request #6510 from albert-github/feature/doxyfile_differnces
Difference between standard and used Doxyfile
Diffstat (limited to 'src')
-rw-r--r-- | src/config.h | 5 | ||||
-rw-r--r-- | src/configimpl.h | 14 | ||||
-rw-r--r-- | src/configimpl.l | 60 | ||||
-rw-r--r-- | src/doxygen.cpp | 33 |
4 files changed, 111 insertions, 1 deletions
diff --git a/src/config.h b/src/config.h index e86e950..98f5a92 100644 --- a/src/config.h +++ b/src/config.h @@ -51,6 +51,11 @@ namespace Config */ void writeTemplate(FTextStream &t,bool shortList,bool updateOnly=FALSE); + /*! Writes a the differences between the current configuration and the + * template configuration to stream \a t. + */ + void compareDoxyfile(FTextStream &t); + /*! Parses a configuration file with name \a fn. * \returns TRUE if successful, FALSE if the file could not be * opened or read. diff --git a/src/configimpl.h b/src/configimpl.h index c901198..ef8bb21 100644 --- a/src/configimpl.h +++ b/src/configimpl.h @@ -73,6 +73,7 @@ class ConfigOption protected: virtual void writeTemplate(FTextStream &t,bool sl,bool upd) = 0; + virtual void compareDoxyfile(FTextStream &t) = 0; virtual void convertStrToVal() {} virtual void substEnvVars() = 0; virtual void init() {} @@ -103,6 +104,7 @@ class ConfigInfo : public ConfigOption m_doc = doc; } void writeTemplate(FTextStream &t, bool sl,bool); + void compareDoxyfile(FTextStream &){}; void substEnvVars() {} }; @@ -124,6 +126,7 @@ class ConfigList : public ConfigOption WidgetType widgetType() const { return m_widgetType; } QStrList *valueRef() { return &m_value; } void writeTemplate(FTextStream &t,bool sl,bool); + void compareDoxyfile(FTextStream &t); void substEnvVars(); void init() { m_value = m_defaultValue; } private: @@ -153,6 +156,7 @@ class ConfigEnum : public ConfigOption QCString *valueRef() { return &m_value; } void substEnvVars(); void writeTemplate(FTextStream &t,bool sl,bool); + void compareDoxyfile(FTextStream &t); void init() { m_value = m_defValue.copy(); } private: @@ -182,6 +186,7 @@ class ConfigString : public ConfigOption void setDefaultValue(const char *v) { m_defValue = v; } QCString *valueRef() { return &m_value; } void writeTemplate(FTextStream &t,bool sl,bool); + void compareDoxyfile(FTextStream &t); void substEnvVars(); void init() { m_value = m_defValue.copy(); } @@ -213,6 +218,7 @@ class ConfigInt : public ConfigOption void convertStrToVal(); void substEnvVars(); void writeTemplate(FTextStream &t,bool sl,bool upd); + void compareDoxyfile(FTextStream &t); void init() { m_value = m_defValue; } private: int m_value; @@ -241,6 +247,7 @@ class ConfigBool : public ConfigOption void substEnvVars(); void setValueString(const QCString &v) { m_valueString = v; } void writeTemplate(FTextStream &t,bool sl,bool upd); + void compareDoxyfile(FTextStream &t); void init() { m_value = m_defValue; } private: bool m_value; @@ -256,6 +263,7 @@ class ConfigObsolete : public ConfigOption ConfigObsolete(const char *name) : ConfigOption(O_Obsolete) { m_name = name; } void writeTemplate(FTextStream &,bool,bool); + void compareDoxyfile(FTextStream &) {} void substEnvVars() {} }; @@ -267,6 +275,7 @@ class ConfigDisabled : public ConfigOption ConfigDisabled(const char *name) : ConfigOption(O_Disabled) { m_name = name; } void writeTemplate(FTextStream &,bool,bool); + void compareDoxyfile(FTextStream &) {} void substEnvVars() {} }; @@ -466,6 +475,11 @@ class ConfigImpl */ void writeTemplate(FTextStream &t,bool shortIndex,bool updateOnly); + /*! Writes a the differences between the current configuration and the + * template configuration to stream \a t. + */ + void compareDoxyfile(FTextStream &t); + void setHeader(const char *header) { m_header = header; } ///////////////////////////// diff --git a/src/configimpl.l b/src/configimpl.l index df032a6..72584d7 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -315,6 +315,28 @@ void ConfigList::writeTemplate(FTextStream &t,bool sl,bool) t << "\n"; } +void ConfigList::compareDoxyfile(FTextStream &t) +{ + if ( m_value.count() != m_defaultValue.count()) + { + writeTemplate(t,TRUE,TRUE); + return; + } + + const char *p = m_value.first(); + const char *q = m_defaultValue.first(); + while (p) + { + p = m_value.next(); + q = m_defaultValue.next(); + if (QCString(p).stripWhiteSpace() != QCString(q).stripWhiteSpace()) + { + writeTemplate(t,TRUE,TRUE); + return; + } + } +} + void ConfigEnum::writeTemplate(FTextStream &t,bool sl,bool) { if (!sl) @@ -332,6 +354,11 @@ void ConfigEnum::writeTemplate(FTextStream &t,bool sl,bool) t << "\n"; } +void ConfigEnum::compareDoxyfile(FTextStream &t) +{ + if (m_value != m_defValue) writeTemplate(t,TRUE,TRUE); +} + void ConfigString::writeTemplate(FTextStream &t,bool sl,bool) { if (!sl) @@ -349,6 +376,11 @@ void ConfigString::writeTemplate(FTextStream &t,bool sl,bool) t << "\n"; } +void ConfigString::compareDoxyfile(FTextStream &t) +{ + if (m_value.stripWhiteSpace() != m_defValue.stripWhiteSpace()) writeTemplate(t,TRUE,TRUE); +} + void ConfigInt::writeTemplate(FTextStream &t,bool sl,bool upd) { if (!sl) @@ -373,6 +405,11 @@ void ConfigInt::writeTemplate(FTextStream &t,bool sl,bool upd) t << "\n"; } +void ConfigInt::compareDoxyfile(FTextStream &t) +{ + if (m_value != m_defValue) writeTemplate(t,TRUE,TRUE); +} + void ConfigBool::writeTemplate(FTextStream &t,bool sl,bool upd) { if (!sl) @@ -397,6 +434,11 @@ void ConfigBool::writeTemplate(FTextStream &t,bool sl,bool upd) t << "\n"; } +void ConfigBool::compareDoxyfile(FTextStream &t) +{ + if (m_value != m_defValue) writeTemplate(t,TRUE,TRUE); +} + void ConfigObsolete::writeTemplate(FTextStream &,bool,bool) {} void ConfigDisabled::writeTemplate(FTextStream &,bool,bool) {} @@ -871,6 +913,18 @@ void ConfigImpl::writeTemplate(FTextStream &t,bool sl,bool upd) } } +void ConfigImpl::compareDoxyfile(FTextStream &t) +{ + t << "# Difference with default Doxyfile " << versionString << endl; + QListIterator<ConfigOption> it = iterator(); + ConfigOption *option; + for (;(option=it.current());++it) + { + option->m_userComment = ""; + option->compareDoxyfile(t); + } +} + void ConfigImpl::convertStrToVal() { QListIterator<ConfigOption> it = iterator(); @@ -1749,6 +1803,12 @@ void Config::writeTemplate(FTextStream &t,bool shortList,bool update) ConfigImpl::instance()->writeTemplate(t,shortList,update); } +void Config::compareDoxyfile(FTextStream &t) +{ + postProcess(FALSE); + ConfigImpl::instance()->compareDoxyfile(t); +} + bool Config::parse(const char *fileName,bool update) { return ConfigImpl::instance()->parse(fileName,update); diff --git a/src/doxygen.cpp b/src/doxygen.cpp index bf93a9b..f0fc650 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -9151,7 +9151,24 @@ static void generateConfigFile(const char *configFile,bool shortList, exit(1); } } - +static void compareDoxyfile() +{ + QFile f; + char configFile[2]; + configFile[0] = '-'; + configFile[1] = '\0'; + bool fileOpened=openOutputFile(configFile,f); + if (fileOpened) + { + FTextStream t(&f); + Config::compareDoxyfile(t); + } + else + { + err("Cannot open file %s for writing\n",configFile); + exit(1); + } +} //---------------------------------------------------------------------------- // read and parse a tag file @@ -10009,6 +10026,8 @@ static void usage(const char *name) msg(" LaTeX: %s -w latex headerFile footerFile styleSheetFile [configFile]\n\n",name); msg("6) Use doxygen to generate a rtf extensions file\n"); msg(" RTF: %s -e rtf extensionsFile\n\n",name); + msg("7) Use doxygen to compare the used configuration file with the template configuration file\n"); + msg(" %s -x [configFile]\n\n",name); msg("If -s is specified the comments of the configuration items in the config file will be omitted.\n"); msg("If configName is omitted `Doxyfile' will be used as a default.\n\n"); msg("-v print version string\n"); @@ -10211,6 +10230,7 @@ void readConfiguration(int argc, char **argv) const char *formatName; bool genConfig=FALSE; bool shortList=FALSE; + bool diffList=FALSE; bool updateConfig=FALSE; int retVal; while (optind<argc && argv[optind][0]=='-' && @@ -10248,6 +10268,9 @@ void readConfiguration(int argc, char **argv) exit(1); } break; + case 'x': + diffList=TRUE; + break; case 's': shortList=TRUE; break; @@ -10498,6 +10521,7 @@ void readConfiguration(int argc, char **argv) exit(1); } } + if (genConfig && g_useOutputTemplate) { generateTemplateFiles("templates"); @@ -10519,6 +10543,13 @@ void readConfiguration(int argc, char **argv) exit(1); } + if (diffList) + { + compareDoxyfile(); + cleanUpDoxygen(); + exit(0); + } + if (updateConfig) { generateConfigFile(configName,shortList,TRUE); |