qdoc: Added support for modularized example doc
[profile/ivi/qtbase.git] / src / tools / qdoc / config.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the tools applications of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 /*
43   config.h
44 */
45
46 #ifndef CONFIG_H
47 #define CONFIG_H
48
49 #include <QMap>
50 #include <QSet>
51 #include <QStringList>
52
53 #include "location.h"
54
55 QT_BEGIN_NAMESPACE
56
57 typedef QMultiMap<QString, QString> QStringMultiMap;
58
59 class Config
60 {
61 public:
62     Config(const QString& programName);
63     ~Config();
64
65     void load(const QString& fileName);
66     void unload(const QString& fileName);
67     void setStringList(const QString& var, const QStringList& values);
68
69     const QString& programName() const { return prog; }
70     const Location& location() const { return loc; }
71     const Location& lastLocation() const { return lastLoc; }
72     bool getBool(const QString& var) const;
73     int getInt(const QString& var) const;
74     QString getOutputDir() const;
75     QSet<QString> getOutputFormats() const;
76     QString getString(const QString& var) const;
77     QSet<QString> getStringSet(const QString& var) const;
78     QStringList getStringList(const QString& var) const;
79     QStringList getCleanPathList(const QString& var) const;
80     QRegExp getRegExp(const QString& var) const;
81     QList<QRegExp> getRegExpList(const QString& var) const;
82     QSet<QString> subVars(const QString& var) const;
83     void subVarsAndValues(const QString& var, QStringMultiMap& t) const;
84     QStringList getAllFiles(const QString& filesVar,
85                             const QString& dirsVar,
86                             const QSet<QString> &excludedDirs = QSet<QString>(),
87                             const QSet<QString> &excludedFiles = QSet<QString>());
88     QStringList getExampleQdocFiles();
89     static QStringList getFilesHere(const QString& dir,
90                                     const QString& nameFilter,
91                                     const QSet<QString> &excludedDirs = QSet<QString>(),
92                                     const QSet<QString> &excludedFiles = QSet<QString>());
93     static QString findFile(const Location& location,
94                             const QStringList &files,
95                             const QStringList& dirs,
96                             const QString& fileName,
97                             QString& userFriendlyFilePath);
98     static QString findFile(const Location &location,
99                             const QStringList &files,
100                             const QStringList &dirs,
101                             const QString &fileBase,
102                             const QStringList &fileExtensions,
103                             QString &userFriendlyFilePath);
104     static QString copyFile(const Location& location,
105                             const QString& sourceFilePath,
106                             const QString& userFriendlySourceFilePath,
107                             const QString& targetDirPath);
108     static int numParams(const QString& value);
109     static bool removeDirContents(const QString& dir);
110
111     QT_STATIC_CONST QString dot;
112
113     static bool generateExamples;
114     static QString installDir;
115     static QString overrideOutputDir;
116     static QSet<QString> overrideOutputFormats;
117
118 private:
119     static bool isMetaKeyChar(QChar ch);
120     void load(Location location, const QString& fileName);
121
122     QString prog;
123     Location loc;
124     Location lastLoc;
125     QMap<QString, Location> locMap;
126     QMap<QString, QStringList> stringListValueMap;
127     QMap<QString, QString> stringValueMap;
128
129     static QMap<QString, QString> uncompressedFiles;
130     static QMap<QString, QString> extractedDirs;
131     static int numInstances;
132 };
133
134 #define CONFIG_ALIAS                    "alias"
135 #define CONFIG_BASE                     "base"
136 #define CONFIG_BASEDIR                  "basedir"
137 #define CONFIG_CODEINDENT               "codeindent"
138 #define CONFIG_DEFINES                  "defines"
139 #define CONFIG_DEPENDS                  "depends"
140 #define CONFIG_DESCRIPTION              "description"
141 #define CONFIG_EDITION                  "edition"
142 #define CONFIG_ENDHEADER                "endheader"
143 #define CONFIG_EXAMPLEDIRS              "exampledirs"
144 #define CONFIG_EXAMPLES                 "examples"
145 #define CONFIG_EXCLUDEDIRS              "excludedirs"
146 #define CONFIG_EXCLUDEFILES             "excludefiles"
147 #define CONFIG_EXTRAIMAGES              "extraimages"
148 #define CONFIG_FALSEHOODS               "falsehoods"
149 #define CONFIG_FORMATTING               "formatting"
150 #define CONFIG_GENERATEINDEX            "generateindex"
151 #define CONFIG_HEADERDIRS               "headerdirs"
152 #define CONFIG_HEADERS                  "headers"
153 #define CONFIG_HEADERSCRIPTS            "headerscripts"
154 #define CONFIG_HEADERSTYLES             "headerstyles"
155 #define CONFIG_IGNOREDIRECTIVES         "ignoredirectives"
156 #define CONFIG_IGNORETOKENS             "ignoretokens"
157 #define CONFIG_IMAGEDIRS                "imagedirs"
158 #define CONFIG_IMAGES                   "images"
159 #define CONFIG_INDEXES                  "indexes"
160 #define CONFIG_LANGUAGE                 "language"
161 #define CONFIG_MACRO                    "macro"
162 #define CONFIG_NATURALLANGUAGE          "naturallanguage"
163 #define CONFIG_OBSOLETELINKS            "obsoletelinks"
164 #define CONFIG_OUTPUTDIR                "outputdir"
165 #define CONFIG_OUTPUTENCODING           "outputencoding"
166 #define CONFIG_OUTPUTLANGUAGE           "outputlanguage"
167 #define CONFIG_OUTPUTFORMATS            "outputformats"
168 #define CONFIG_OUTPUTPREFIXES           "outputprefixes"
169 #define CONFIG_PROJECT                  "project"
170 #define CONFIG_QHP                      "qhp"
171 #define CONFIG_QUOTINGINFORMATION       "quotinginformation"
172 #define CONFIG_SCRIPTDIRS               "scriptdirs"
173 #define CONFIG_SCRIPTS                  "scripts"
174 #define CONFIG_SHOWINTERNAL             "showinternal"
175 #define CONFIG_SOURCEDIRS               "sourcedirs"
176 #define CONFIG_SOURCEENCODING           "sourceencoding"
177 #define CONFIG_SOURCES                  "sources"
178 #define CONFIG_SPURIOUS                 "spurious"
179 #define CONFIG_STYLEDIRS                "styledirs"
180 #define CONFIG_STYLE                    "style"
181 #define CONFIG_STYLES                   "styles"
182 #define CONFIG_STYLESHEETS              "stylesheets"
183 #define CONFIG_SYNTAXHIGHLIGHTING       "syntaxhighlighting"
184 #define CONFIG_TEMPLATEDIR              "templatedir"
185 #define CONFIG_TABSIZE                  "tabsize"
186 #define CONFIG_TAGFILE                  "tagfile"
187 #define CONFIG_TRANSLATORS              "translators"
188 #define CONFIG_URL                      "url"
189 #define CONFIG_VERSION                  "version"
190 #define CONFIG_VERSIONSYM               "versionsym"
191 #define CONFIG_FILEEXTENSIONS           "fileextensions"
192 #define CONFIG_IMAGEEXTENSIONS          "imageextensions"
193 #define CONFIG_QMLONLY                  "qmlonly"
194
195 QT_END_NAMESPACE
196
197 #endif