diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2013-07-21 10:40:14 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2013-07-28 11:47:23 (GMT) |
commit | 38e67b40b1c50e1ccbda4ffd867b6aa82a6c2212 (patch) | |
tree | c162a1ab1c375aa21c4f137ec30ae765b67527a4 /src/config.l | |
parent | 10ab1d5dddd63b5e7b3a65da8eb8a6416be7c914 (diff) | |
download | Doxygen-38e67b40b1c50e1ccbda4ffd867b6aa82a6c2212.zip Doxygen-38e67b40b1c50e1ccbda4ffd867b6aa82a6c2212.tar.gz Doxygen-38e67b40b1c50e1ccbda4ffd867b6aa82a6c2212.tar.bz2 |
config.xml is now used to generate configoptions.cpp and config.doc
Diffstat (limited to 'src/config.l')
-rw-r--r-- | src/config.l | 208 |
1 files changed, 91 insertions, 117 deletions
diff --git a/src/config.l b/src/config.l index dcc7da8..eb7c1c2 100644 --- a/src/config.l +++ b/src/config.l @@ -77,7 +77,7 @@ static QCString configStringRecode( /* ----------------------------------------------------------------- */ -QCString ConfigOption::convertToComment(const QCString &s, const QCString &u) +static QCString convertToComment(const QCString &s, const QCString &u) { //printf("convertToComment(%s)=%s\n",s.data(),u.data()); QCString result; @@ -291,106 +291,120 @@ bool &Config::getBool(const char *fileName,int num,const char *name) const return *((ConfigBool *)opt)->valueRef(); } -/* ----------------------------------------------------------------- - */ - -void ConfigInt::writeXML(FTextStream& t) -{ - t << " <option type='int' " - "id='" << convertToXML(name()) << "' " - "docs='\n" << convertToXML(docs()) << "' " - "minval='" << m_minVal << "' " - "maxval='" << m_maxVal << "' " - "defval='" << m_defValue << "'"; - if (!m_dependency.isEmpty()) t << " depends='" << m_dependency << "'"; - t << "/>" << endl; -} +/* ------------------------------------------ */ -void ConfigBool::writeXML(FTextStream& t) +void ConfigInfo::writeTemplate(FTextStream &t, bool sl,bool) { - t << " <option type='bool' " - "id='" << convertToXML(name()) << "' " - "docs='\n" << convertToXML(docs()) << "' " - "defval='" << m_defValue << "'"; - if (!m_dependency.isEmpty()) t << " depends='" << m_dependency << "'"; - t << "/>" << endl; + if (!sl) + { + t << "\n"; + } + t << "#---------------------------------------------------------------------------\n"; + t << "# " << m_doc << endl; + t << "#---------------------------------------------------------------------------\n"; } -void ConfigString::writeXML(FTextStream& t) +void ConfigList::writeTemplate(FTextStream &t,bool sl,bool) { - QString format; - switch (m_widgetType) - { - case String: format="string"; break; - case File: format="file"; break; - case Dir: format="dir"; break; - } - t << " <option type='string' " - "id='" << convertToXML(name()) << "' " - "format='" << format << "' " - "docs='\n" << convertToXML(docs()) << "' " - "defval='" << convertToXML(m_defValue) << "'"; - if (!m_dependency.isEmpty()) t << " depends='" << m_dependency << "'"; - t << "/>" << endl; + if (!sl) + { + t << endl; + t << convertToComment(m_doc, m_userComment); + t << endl; + } + else if (!m_userComment.isEmpty()) + { + t << convertToComment("", m_userComment); + } + t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "="; + writeStringList(t,m_value); + t << "\n"; } -void ConfigEnum::writeXML(FTextStream &t) +void ConfigEnum::writeTemplate(FTextStream &t,bool sl,bool) { - t << " <option type='enum' " - "id='" << convertToXML(name()) << "' " - "defval='" << convertToXML(m_defValue) << "' " - "docs='\n" << convertToXML(docs()) << "'"; - if (!m_dependency.isEmpty()) t << " depends='" << m_dependency << "'"; - t << ">" << endl; - - char *enumVal = m_valueRange.first(); - while (enumVal) + if (!sl) { - t << " <value name='" << convertToXML(enumVal) << "'/>" << endl; - enumVal = m_valueRange.next(); + t << endl; + t << convertToComment(m_doc, m_userComment); + t << endl; } - - t << " </option>" << endl; + else if (!m_userComment.isEmpty()) + { + t << convertToComment("", m_userComment); + } + t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "="; + writeStringValue(t,m_value); + t << "\n"; } -void ConfigList::writeXML(FTextStream &t) +void ConfigString::writeTemplate(FTextStream &t,bool sl,bool) { - QString format; - switch (m_widgetType) + if (!sl) { - case String: format="string"; break; - case File: format="file"; break; - case Dir: format="dir"; break; - case FileAndDir: format="filedir"; break; + t << endl; + t << convertToComment(m_doc, m_userComment); + t << endl; } - t << " <option type='list' " - "id='" << convertToXML(name()) << "' " - "format='" << format << "' " - "docs='\n" << convertToXML(docs()) << "'"; - if (!m_dependency.isEmpty()) t << " depends='" << m_dependency << "'"; - t << ">" << endl; - char *enumVal = m_value.first(); - while (enumVal) + else if (!m_userComment.isEmpty()) { - t << " <value name='" << convertToXML(enumVal) << "'/>" << endl; - enumVal = m_value.next(); + t << convertToComment("", m_userComment); } - - t << " </option>" << endl; + t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "="; + writeStringValue(t,m_value); + t << "\n"; } -void ConfigObsolete::writeXML(FTextStream &t) +void ConfigInt::writeTemplate(FTextStream &t,bool sl,bool upd) { - t << " <option type='obsolete' " - "id='" << convertToXML(name()) << "'/>" << endl; + if (!sl) + { + t << endl; + t << convertToComment(m_doc, m_userComment); + t << endl; + } + else if (!m_userComment.isEmpty()) + { + t << convertToComment("", m_userComment); + } + t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "="; + if (upd && !m_valueString.isEmpty()) + { + writeStringValue(t,m_valueString); + } + else + { + writeIntValue(t,m_value); + } + t << "\n"; } -void ConfigDisabled::writeXML(FTextStream &t) +void ConfigBool::writeTemplate(FTextStream &t,bool sl,bool upd) { - t << " <option type='disabled' " - "id='" << convertToXML(name()) << "'/>" << endl; + if (!sl) + { + t << endl; + t << convertToComment(m_doc, m_userComment); + t << endl; + } + else if (!m_userComment.isEmpty()) + { + t << convertToComment("", m_userComment); + } + t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "="; + if (upd && !m_valueString.isEmpty()) + { + writeStringValue(t,m_valueString); + } + else + { + writeBoolValue(t,m_value); + } + t << "\n"; } +void ConfigObsolete::writeTemplate(FTextStream &,bool,bool) {} +void ConfigDisabled::writeTemplate(FTextStream &,bool,bool) {} /* ----------------------------------------------------------------- * @@ -830,17 +844,7 @@ void Config::writeTemplate(FTextStream &t,bool sl,bool upd) t << "# Doxyfile " << versionString << endl << endl; if (!sl) { - t << "# This file describes the settings to be used by the documentation system\n"; - t << "# doxygen (www.doxygen.org) for a project.\n"; - t << "#\n"; - t << "# All text after a double hash (##) is considered a comment and is placed\n"; - t << "# in front of the TAG it is preceding .\n"; - t << "# All text after a hash (#) is considered a comment and will be ignored.\n"; - t << "# The format is:\n"; - t << "# TAG = value [value, ...]\n"; - t << "# For lists items can also be appended using:\n"; - t << "# TAG += value [value, ...]\n"; - t << "# Values that contain spaces should be placed between quotes (\" \").\n"; + t << convertToComment(m_header,""); } ConfigOption *option = m_options->first(); while (option) @@ -856,36 +860,6 @@ void Config::writeTemplate(FTextStream &t,bool sl,bool upd) } } -void Config::writeXML(FTextStream &t) -{ - t << "<doxygenconfig>" << endl; - bool first=TRUE; - ConfigOption *option = m_options->first(); - while (option) - { - if (option->kind()==ConfigOption::O_Info) - { - if (!first) t << " </group>" << endl; - t << " <group name='" << option->name() << "' " - "docs='" << option->docs() << "'>" << endl; - first=FALSE; - } - else - { - option->writeXML(t); - } - option = m_options->next(); - } - option = m_obsolete->first(); - while (option) - { - option->writeXML(t); - option = m_obsolete->next(); - } - if (!first) t << " </group>" << endl; - t << "</doxygenconfig>" << endl; -} - void Config::convertStrToVal() { ConfigOption *option = m_options->first(); |