author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 33 | 3e2da88830cd |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the tools applications of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
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 |
class Config |
|
58 |
{ |
|
59 |
public: |
|
60 |
Config(const QString& programName); |
|
61 |
~Config(); |
|
62 |
||
63 |
void load(const QString& fileName); |
|
64 |
void setStringList(const QString& var, const QStringList& values); |
|
65 |
||
66 |
const QString& programName() const { return prog; } |
|
67 |
const Location& location() const { return loc; } |
|
68 |
const Location& lastLocation() const { return lastLoc; } |
|
69 |
bool getBool(const QString& var) const; |
|
70 |
int getInt(const QString& var) const; |
|
71 |
QString getString(const QString& var) const; |
|
72 |
QSet<QString> getStringSet(const QString& var) const; |
|
73 |
QStringList getStringList(const QString& var) const; |
|
74 |
QRegExp getRegExp(const QString& var) const; |
|
75 |
QList<QRegExp> getRegExpList(const QString& var) const; |
|
76 |
QSet<QString> subVars(const QString& var) const; |
|
77 |
QStringList getAllFiles(const QString& filesVar, |
|
78 |
const QString& dirsVar, |
|
79 |
const QString& defaultNameFilter, |
|
80 |
const QSet<QString> &excludedDirs = QSet<QString>()); |
|
81 |
||
82 |
static QStringList getFilesHere(const QString& dir, |
|
83 |
const QString& nameFilter, |
|
84 |
const QSet<QString> &excludedDirs = QSet<QString>()); |
|
85 |
static QString findFile(const Location& location, |
|
86 |
const QStringList &files, |
|
87 |
const QStringList& dirs, |
|
88 |
const QString& fileName, |
|
89 |
QString& userFriendlyFilePath); |
|
90 |
static QString findFile(const Location &location, |
|
91 |
const QStringList &files, |
|
92 |
const QStringList &dirs, |
|
93 |
const QString &fileBase, |
|
94 |
const QStringList &fileExtensions, |
|
95 |
QString &userFriendlyFilePath); |
|
96 |
static QString copyFile(const Location& location, |
|
97 |
const QString& sourceFilePath, |
|
98 |
const QString& userFriendlySourceFilePath, |
|
99 |
const QString& targetDirPath); |
|
100 |
static int numParams(const QString& value); |
|
101 |
static bool removeDirContents(const QString& dir); |
|
102 |
||
103 |
QT_STATIC_CONST QString dot; |
|
104 |
||
105 |
private: |
|
106 |
static bool isMetaKeyChar(QChar ch); |
|
107 |
void load(Location location, const QString& fileName); |
|
108 |
||
109 |
QString prog; |
|
110 |
Location loc; |
|
111 |
Location lastLoc; |
|
112 |
QMap<QString, Location> locMap; |
|
113 |
QMap<QString, QStringList> stringListValueMap; |
|
114 |
QMap<QString, QString> stringValueMap; |
|
115 |
||
116 |
static QMap<QString, QString> uncompressedFiles; |
|
117 |
static QMap<QString, QString> extractedDirs; |
|
118 |
static int numInstances; |
|
119 |
}; |
|
120 |
||
121 |
#define CONFIG_ALIAS "alias" |
|
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
122 |
#define CONFIG_APPLICATION "application" |
0 | 123 |
#define CONFIG_BASE "base" // ### don't document for now |
124 |
#define CONFIG_CODEINDENT "codeindent" |
|
125 |
#define CONFIG_DEFINES "defines" |
|
126 |
#define CONFIG_DESCRIPTION "description" |
|
127 |
#define CONFIG_EDITION "edition" |
|
128 |
#define CONFIG_EXAMPLEDIRS "exampledirs" |
|
129 |
#define CONFIG_EXAMPLES "examples" |
|
130 |
#define CONFIG_EXCLUDEDIRS "excludedirs" |
|
131 |
#define CONFIG_EXTRAIMAGES "extraimages" |
|
132 |
#define CONFIG_FALSEHOODS "falsehoods" |
|
133 |
#define CONFIG_FORMATTING "formatting" |
|
134 |
#define CONFIG_GENERATEINDEX "generateindex" |
|
135 |
#define CONFIG_HEADERDIRS "headerdirs" |
|
136 |
#define CONFIG_HEADERS "headers" |
|
137 |
#define CONFIG_IGNOREDIRECTIVES "ignoredirectives" |
|
138 |
#define CONFIG_IGNORETOKENS "ignoretokens" |
|
139 |
#define CONFIG_IMAGEDIRS "imagedirs" |
|
140 |
#define CONFIG_IMAGES "images" |
|
141 |
#define CONFIG_INDEXES "indexes" |
|
142 |
#define CONFIG_LANGUAGE "language" |
|
143 |
#define CONFIG_MACRO "macro" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
144 |
#define CONFIG_NATURALLANGUAGE "naturallanguage" |
0 | 145 |
#define CONFIG_OBSOLETELINKS "obsoletelinks" |
37
758a864f9613
Revision: 201037
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
146 |
#define CONFIG_APPLICATION "application" |
0 | 147 |
#define CONFIG_OUTPUTDIR "outputdir" |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
148 |
#define CONFIG_OUTPUTENCODING "outputencoding" |
0 | 149 |
#define CONFIG_OUTPUTLANGUAGE "outputlanguage" |
150 |
#define CONFIG_OUTPUTFORMATS "outputformats" |
|
151 |
#define CONFIG_PROJECT "project" |
|
152 |
#define CONFIG_QHP "qhp" |
|
153 |
#define CONFIG_QUOTINGINFORMATION "quotinginformation" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
154 |
#define CONFIG_SCRIPTDIRS "scriptdirs" |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
155 |
#define CONFIG_SCRIPTS "scripts" |
0 | 156 |
#define CONFIG_SLOW "slow" |
157 |
#define CONFIG_SHOWINTERNAL "showinternal" |
|
158 |
#define CONFIG_SOURCEDIRS "sourcedirs" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
159 |
#define CONFIG_SOURCEENCODING "sourceencoding" |
0 | 160 |
#define CONFIG_SOURCES "sources" |
161 |
#define CONFIG_SPURIOUS "spurious" |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
162 |
#define CONFIG_STYLEDIRS "styledirs" |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
163 |
#define CONFIG_STYLES "styles" |
0 | 164 |
#define CONFIG_STYLESHEETS "stylesheets" |
165 |
#define CONFIG_TABSIZE "tabsize" |
|
166 |
#define CONFIG_TAGFILE "tagfile" |
|
167 |
#define CONFIG_TRANSLATORS "translators" // ### don't document for now |
|
168 |
#define CONFIG_URL "url" |
|
169 |
#define CONFIG_VERSION "version" |
|
170 |
#define CONFIG_VERSIONSYM "versionsym" |
|
171 |
||
172 |
#define CONFIG_FILEEXTENSIONS "fileextensions" |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
173 |
#define CONFIG_IMAGEEXTENSIONS "imageextensions" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
174 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
175 |
#ifdef QDOC_QML |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
176 |
#define CONFIG_QMLONLY "qmlonly" |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
177 |
#endif |
0 | 178 |
|
179 |
QT_END_NAMESPACE |
|
180 |
||
181 |
#endif |