summaryrefslogtreecommitdiffstats
path: root/src/config.h
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2001-04-01 17:28:27 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2001-04-01 17:28:27 (GMT)
commitc47269c4f1fb1387d6876075f3b2e935354d5b76 (patch)
tree9ab56725fa008f006370f074ed17023811bbc55f /src/config.h
parentb11bb229001fbb79399e3c21860ae6fb4608e77a (diff)
downloadDoxygen-c47269c4f1fb1387d6876075f3b2e935354d5b76.zip
Doxygen-c47269c4f1fb1387d6876075f3b2e935354d5b76.tar.gz
Doxygen-c47269c4f1fb1387d6876075f3b2e935354d5b76.tar.bz2
Release-1.2.6-20010401
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h571
1 files changed, 426 insertions, 145 deletions
diff --git a/src/config.h b/src/config.h
index 0bdaffa..b67b97c 100644
--- a/src/config.h
+++ b/src/config.h
@@ -1,164 +1,445 @@
-/* This file was generated by configgen on Mon Mar 19 20:34:58 2001
- * from config_templ.h
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include "qtbc.h"
+#include <qstrlist.h>
+#include <qfile.h>
+#include <qdict.h>
+#include <qlist.h>
+#include <qtextstream.h>
+
+
+/*! \brief Abstract base class for any configuration option.
*
- * DO NOT EDIT!
*/
+class ConfigOption
+{
+ public:
-/******************************************************************************
- *
- *
+ enum OptionType { O_Info, O_List, O_Enum, O_String, O_Int, O_Bool };
+ enum { MAX_OPTION_LENGTH = 23 };
+ ConfigOption(OptionType t) : m_kind(t)
+ {
+ m_spaces.fill(' ',40);
+ }
+ virtual ~ConfigOption()
+ {
+ }
+ void addDependency(const char *dep)
+ {
+ m_dependency = dep;
+ }
+ OptionType kind() const { return m_kind; }
+ virtual void writeTemplate(QTextStream &t,bool sl) = 0;
+ virtual void convertStrToVal() {}
+ virtual void substEnvVars() {}
+ virtual void init() {}
+ QCString name() const { return m_name; }
+ QCString docs() const { return m_doc; }
+ QCString dependsOn() const { return m_dependency; }
+
+ protected:
+
+ QCString convertToComment(const QCString &s)
+ {
+ QCString result;
+ if (s.isEmpty()) return result;
+ else
+ {
+ result+="# ";
+ QCString tmp=s.stripWhiteSpace();
+ char *p=tmp.data();
+ char c;
+ while ((c=*p++))
+ {
+ if (c=='\n') result+="\n# ";
+ else result+=c;
+ }
+ result+='\n';
+ }
+ return result;
+ }
+
+ void writeBoolValue(QTextStream &t,bool v)
+ {
+ if (v) t << "YES"; else t << "NO";
+ }
+
+ void writeIntValue(QTextStream &t,int i)
+ {
+ t << i;
+ }
+
+ void writeStringValue(QTextStream &t,QCString &s)
+ {
+ const char *p=s.data();
+ char c;
+ bool hasBlanks=FALSE;
+ if (p)
+ {
+ while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t');
+ if (hasBlanks)
+ t << "\"" << s << "\"";
+ else
+ t << s;
+ }
+ }
+
+ void writeStringList(QTextStream &t,QStrList &l)
+ {
+ const char *p = l.first();
+ bool first=TRUE;
+ while (p)
+ {
+ char c;
+ const char *s=p;
+ bool hasBlanks=FALSE;
+ while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t');
+ if (!first) t << " ";
+ first=FALSE;
+ if (hasBlanks) t << "\"" << s << "\""; else t << s;
+ p = l.next();
+ if (p) t << " \\" << endl;
+ }
+ }
+
+ QCString m_spaces;
+ QCString m_name;
+ QCString m_doc;
+ QCString m_dependency;
+ OptionType m_kind;
+};
+
+/*! \brief Section marker for grouping the configuration options
*
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ */
+class ConfigInfo : public ConfigOption
+{
+ public:
+ ConfigInfo(const char *name,const char *doc)
+ : ConfigOption(O_Info)
+ {
+ m_name = name;
+ m_doc = doc;
+ }
+ void writeTemplate(QTextStream &t, bool sl)
+ {
+ if (!sl)
+ {
+ t << "\n";
+ }
+ t << "#---------------------------------------------------------------------------\n";
+ t << "# " << m_doc << endl;
+ t << "#---------------------------------------------------------------------------\n";
+ }
+};
+
+/*! \brief Option of the list type.
*
- * Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
- * for any purpose. It is provided "as is" without express or implied warranty.
- * See the GNU General Public License for more details.
+ */
+class ConfigList : public ConfigOption
+{
+ public:
+ enum WidgetType { String, File, Dir, FileAndDir };
+ ConfigList(const char *name,const char *doc)
+ : ConfigOption(O_List)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_widgetType = String;
+ }
+ void addValue(const char *v) { m_value.append(v); }
+ void setWidgetType(WidgetType w) { m_widgetType = w; }
+ WidgetType widgetType() const { return m_widgetType; }
+ QStrList *valueRef() { return &m_value; }
+ void writeTemplate(QTextStream &t,bool sl)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ writeStringList(t,m_value);
+ t << "\n";
+ }
+ void substEnvVars();
+ private:
+ QStrList m_value;
+ WidgetType m_widgetType;
+};
+
+/*! \brief Option of the enum type.
*
*/
+class ConfigEnum : public ConfigOption
+{
+ public:
+ ConfigEnum(const char *name,const char *doc,const char *defVal)
+ : ConfigOption(O_Enum)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_value = defVal;
+ m_defValue = defVal;
+ }
+ void addValue(const char *v) { m_valueRange.append(v); }
+ QStrListIterator iterator()
+ {
+ return QStrListIterator(m_valueRange);
+ }
+ QCString *valueRef() { return &m_value; }
+ void writeTemplate(QTextStream &t,bool sl)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ writeStringValue(t,m_value);
+ t << "\n";
+ }
+ void init() { m_value = m_defValue.copy(); }
-#ifndef CONFIG_H
-#define CONFIG_H
+ private:
+ QStrList m_valueRange;
+ QCString m_value;
+ QCString m_defValue;
+};
-#ifndef DOXYWIZARD
-#include "qtbc.h"
-#endif
-#include <qstrlist.h>
-#include <qfile.h>
+/*! \brief Option of the string type.
+ *
+ */
+class ConfigString : public ConfigOption
+{
+ public:
+ enum WidgetType { String, File, Dir };
+ ConfigString(const char *name,const char *doc)
+ : ConfigOption(O_String)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_widgetType = String;
+ }
+ ~ConfigString()
+ {
+ }
+ void setWidgetType(WidgetType w) { m_widgetType = w; }
+ WidgetType widgetType() const { return m_widgetType; }
+ void setDefaultValue(const char *v) { m_defValue = v; }
+ QCString *valueRef() { return &m_value; }
+ void writeTemplate(QTextStream &t,bool sl)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ writeStringValue(t,m_value);
+ t << "\n";
+ }
+ void substEnvVars();
+ void init() { m_value = m_defValue.copy(); }
+
+ private:
+ QCString m_value;
+ QCString m_defValue;
+ WidgetType m_widgetType;
+};
-extern void parseConfig(const QCString &config,const char *fn);
-extern void writeTemplateConfig(QFile *f,bool shortList);
-extern void checkConfig();
-extern void configStrToVal();
-extern void substituteEnvironmentVars();
+/*! \brief Option of the integer type.
+ *
+ */
+class ConfigInt : public ConfigOption
+{
+ public:
+ ConfigInt(const char *name,const char *doc,int minVal,int maxVal,int defVal)
+ : ConfigOption(O_Int)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_value = defVal;
+ m_defValue = defVal;
+ m_minVal = minVal;
+ m_maxVal = maxVal;
+ }
+ QCString *valueStringRef() { return &m_valueString; }
+ int *valueRef() { return &m_value; }
+ int minVal() const { return m_minVal; }
+ int maxVal() const { return m_maxVal; }
+ void convertStrToVal();
+ void writeTemplate(QTextStream &t,bool sl)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ writeIntValue(t,m_value);
+ t << "\n";
+ }
+ void init() { m_value = m_defValue; }
+ private:
+ int m_value;
+ int m_defValue;
+ int m_minVal;
+ int m_maxVal;
+ QCString m_valueString;
+};
+
+/*! \brief Option of the boolean type.
+ *
+ */
+class ConfigBool : public ConfigOption
+{
+ public:
+ ConfigBool(const char *name,const char *doc,bool defVal)
+ : ConfigOption(O_Bool)
+ {
+ m_name = name;
+ m_doc = doc;
+ m_value = defVal;
+ m_defValue = defVal;
+ }
+ bool *valueRef() { return &m_value; }
+ void writeTemplate(QTextStream &t,bool sl)
+ {
+ if (!sl)
+ {
+ t << endl;
+ t << convertToComment(m_doc);
+ t << endl;
+ }
+ t << m_name << m_spaces.left(MAX_OPTION_LENGTH-m_name.length()) << "= ";
+ writeBoolValue(t,m_value);
+ t << "\n";
+ }
+ void init() { m_value = m_defValue; }
+ private:
+ bool m_value;
+ bool m_defValue;
+};
-/*! \brief Namespace for configuration variables
+/*! \brief Singleton for configuration variables.
*
- * This struct acts as a namespace that holds the global static variables
+ * This object holds the global static variables
* read from a user-supplied configuration file.
+ * The static member instance() can be used to get
+ * a pointer to the one and only instance.
*/
struct Config
{
- static void init();
-
- static QCString projectName; /*!< the name of the project */
- static QCString projectNumber; /*!< the number of the project */
- static QCString outputDir; /*!< the global output directory */
- static QCString outputLanguage; /*!< the output language */
- static bool extractAllFlag; /*!< generate docs for all classes flag */
- static bool extractPrivateFlag; /*!< generate docs for private members flag */
- static bool extractStaticFlag; /*!< generate docs for static members flag */
- static bool hideMemberFlag; /*!< hide undocumented members. */
- static bool hideClassFlag; /*!< hide undocumented members. */
- static bool briefMemDescFlag; /*!< enable `inline' brief member descr. */
- static bool repeatBriefFlag; /*!< repeat brief descriptions. */
- static bool alwaysDetailsFlag; /*!< show details description even if there is only a brief description? */
- static bool fullPathNameFlag; /*!< using full path name in output */
- static QStrList stripFromPath; /*!< list of candidates to strip from the file path */
- static bool internalDocsFlag; /*!< determines what happens to internal docs. */
- static bool classDiagramFlag; /*!< enable the generation of class diagrams. */
- static bool sourceBrowseFlag; /*!< include source code in documentation. */
- static bool inlineSourceFlag; /*!< inline the definition bodies in the docs? */
- static bool stripCommentsFlag; /*!< strip special comments from code fragments? */
- static bool caseSensitiveNames; /*!< determines if output can be mixed case. */
- static bool hideScopeNames; /*!< hide the name of the scope. */
- static bool verbatimHeaderFlag; /*!< enable/disable generation of verb headers. */
- static bool showIncFileFlag; /*!< show include file in file documentation? */
- static bool autoBriefFlag; /*!< should javadoc comments behaves as Qt comments. */
- static bool inheritDocsFlag; /*!< inheritance of documentation enabled? */
- static bool inlineInfoFlag; /*!< show info about inline members? */
- static bool sortMembersFlag; /*!< sort members alphabetically? */
- static bool distributeDocFlag; /*!< distribute docs over member group? */
- static int tabSize; /*!< number of spaces in a tab */
- static QStrList sectionFilterList; /*!< list of section filters that are enabled */
- static bool generateTodoList; /*!< do we want a todo list? */
- static bool generateTestList; /*!< do we want a test list? */
- static bool generateBugList; /*!< do we want a bug list? */
- static QStrList aliasList; /*!< list of aliases */
- static int maxInitLines; /*!< when do we hide values of variable and defines? */
- static bool optimizeForCFlag; /*!< do we parse C code? */
- static bool showUsedFilesFlag; /*!< do we show the list of used files for classes and structs? */
- static bool quietFlag; /*!< generate progress messages flag */
- static bool warningFlag; /*!< generate warnings flag */
- static bool warningUndocFlag; /*!< generate undocumented warnings */
- static QCString warnFormat; /*!< format of the warning messages */
- static QCString warnLogFile; /*!< log file to write warning to */
- static QStrList inputSources; /*!< list of input files */
- static QStrList filePatternList; /*!< list of file patterns */
- static bool recursiveFlag; /*!< scan directories recursively */
- static QStrList excludeSources; /*!< list of files to exclude from the input */
- static QStrList excludePatternList; /*!< list of patterns to exclude from input */
- static QStrList examplePath; /*!< list of example paths */
- static QStrList examplePatternList; /*!< list of example patterns */
- static QStrList imagePath; /*!< list of image paths */
- static QCString inputFilter; /*!< a filter command that is applied to input files */
- static bool filterForSourceFlag; /*!< do we filter source files? */
- static bool alphaIndexFlag; /*!< should an alphabetical index be generated? */
- static int colsInAlphaIndex; /*!< number of columns in the alphabetical index */
- static QStrList ignorePrefixList; /*!< list of prefixes to ignore for the alphabetical index */
- static bool generateHtml; /*!< generate HTML output */
- static QCString htmlOutputDir; /*!< the directory to put the HTML files */
- static QCString headerFile; /*!< the name of the personal HTML header */
- static QCString footerFile; /*!< the name of the personal HTML footer */
- static QCString htmlStyleSheet; /*!< user defined cascading style sheet */
- static bool htmlAlignMemberFlag; /*!< align members in HTML using tables. */
- static bool htmlHelpFlag; /*!< should html help files be generated? */
- static bool htmlHelpChiFlag; /*!< should chi file be generated? */
- static bool htmlHelpTocFlag; /*!< should a binary table of contents be generated? */
- static bool htmlHelpTocExpandFlag; /*!< should module elements be displayed in the table of contents? */
- static bool noIndexFlag; /*!< generate condensed index flag */
- static int enumValuesPerLine; /*!< number of enum values that are put on one line */
- static bool ftvHelpFlag; /*!< should a folder tree view be generated? */
- static int treeViewWidth; /*!< What is the width of the treeview panel? */
- static bool generateLatex; /*!< generate Latex output */
- static QCString latexOutputDir; /*!< the directory to put the Latex files */
- static bool compactLatexFlag; /*!< generate compact LaTeX documentation. */
- static QCString paperType; /*!< the page type to generate docs for */
- static QStrList extraPackageList; /*!< list of extra LaTeX packages. */
- static QCString latexHeaderFile; /*!< the name of the personal LaTeX header */
- static bool pdfHyperFlag; /*!< generate latex prepared creating hyperlinked pdfs. */
- static bool usePDFLatexFlag; /*!< use pdflatex instead of plain latex */
- static bool latexBatchModeFlag; /*!< continue after latex errors? */
- static bool generateRTF; /*!< generate RTF flag */
- static QCString rtfOutputDir; /*!< the directory to put the RTF files */
- static bool compactRTFFlag; /*!< generate more compact RTF */
- static bool rtfHyperFlag; /*!< generate hyper links in RTF */
- static QCString rtfStylesheetFile; /*!< file to load stylesheet definitions from */
- static QCString rtfExtensionsFile; /*!< file to load rtf extensions from */
- static bool generateMan; /*!< generate Man pages */
- static QCString manOutputDir; /*!< the directory to put the man pages */
- static QCString manExtension; /*!< extension the man page files */
- static bool preprocessingFlag; /*!< enable preprocessing */
- static bool macroExpansionFlag; /*!< expand macros in the source. */
- static bool onlyPredefinedFlag; /*!< expand only predefined macros */
- static bool searchIncludeFlag; /*!< search for included files */
- static QStrList includePath; /*!< list of include paths */
- static QStrList includeFilePatternList; /*!< list of include file patterns */
- static QStrList predefined; /*!< list of predefined macro names. */
- static QStrList expandAsDefinedList; /*!< list of defines to expand */
- static QStrList tagFileList; /*!< list of tag files */
- static QCString genTagFile; /*!< the tag file to generate */
- static bool allExtFlag; /*!< include all external classes flag */
- static QCString perlPath; /*!< the absolute path to perl */
- static bool haveDotFlag; /*!< indicates wether or not dot is present */
- static bool classGraphFlag; /*!< class graph */
- static bool collGraphFlag; /*!< collaboration graph */
- static bool includeGraphFlag; /*!< include graph */
- static bool includedByGraphFlag; /*!< depends on include graph */
- static bool gfxHierarchyFlag; /*!< flag to enable graphical hierarchy */
- static QCString dotPath; /*!< path to the dot tool */
- static int maxDotGraphWidth; /*!< max dot graph width */
- static int maxDotGraphHeight; /*!< max dot graph height */
- static bool generateLegend; /*!< generate legend page */
- static bool dotCleanUp; /*!< remove intermedia dot files? */
- static bool searchEngineFlag; /*!< generate search engine flag */
- static QCString cgiName; /*!< the name of the CGI binary */
- static QCString cgiURL; /*!< the absolute URL to the CGI binary */
- static QCString docURL; /*!< the absolute URL to the documentation */
- static QCString docAbsPath; /*!< the absolute path to the documentation */
- static QCString binAbsPath; /*!< the absolute path to the doxysearch */
- static QStrList extDocPathList; /*!< list of external doc. directories. */
+ public:
+ static Config *instance()
+ {
+ if (m_instance==0) m_instance = new Config;
+ return m_instance;
+ }
+
+ void writeTemplate(QFile *f,bool shortIndex);
+ void convertStrToVal();
+ void substituteEnvironmentVars();
+ void check();
+ void init();
+ void parse(const QCString &config,const char *fn);
+ QListIterator<ConfigOption> iterator()
+ {
+ return QListIterator<ConfigOption>(*m_options);
+ }
+
+ ////////////////////////
+ // get functions
+ ////////////////////////
+ QCString &getString(const char *name) const;
+ QStrList &getList(const char *name) const;
+ QCString &getEnum(const char *name) const;
+ int &getInt(const char *name) const;
+ bool &getBool(const char *name) const;
+ ConfigOption *get(const char *name) const
+ {
+ return m_dict->find(name);
+ }
+
+ ////////////////////////
+ // add functions
+ ////////////////////////
+ ConfigInfo *addInfo(const char *name,const char *doc)
+ {
+ ConfigInfo *result = new ConfigInfo(name,doc);
+ m_options->append(result);
+ return result;
+ }
+ ConfigString *addString(const char *name,
+ const char *doc)
+ {
+ ConfigString *result = new ConfigString(name,doc);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+ ConfigEnum *addEnum(const char *name,
+ const char *doc,
+ const char *defVal)
+ {
+ ConfigEnum *result = new ConfigEnum(name,doc,defVal);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+ ConfigList *addList(const char *name,
+ const char *doc)
+ {
+ ConfigList *result = new ConfigList(name,doc);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+ ConfigInt *addInt(const char *name,
+ const char *doc,
+ int minVal,int maxVal,int defVal)
+ {
+ ConfigInt *result = new ConfigInt(name,doc,minVal,maxVal,defVal);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+ ConfigBool *addBool(const char *name,
+ const char *doc,
+ bool defVal)
+ {
+ ConfigBool *result = new ConfigBool(name,doc,defVal);
+ m_options->append(result);
+ m_dict->insert(name,result);
+ return result;
+ }
+ protected:
+ Config()
+ {
+ m_options = new QList<ConfigOption>;
+ m_dict = new QDict<ConfigOption>(257);
+ m_options->setAutoDelete(TRUE);
+ m_initialized = FALSE;
+ create();
+ }
+ ~Config()
+ {
+ delete m_options;
+ delete m_dict;
+ }
+ void create();
+
+ private:
+ QList<ConfigOption> *m_options;
+ QDict<ConfigOption> *m_dict;
+ static Config *m_instance;
+ bool m_initialized;
};
#endif