source: trunk/tools/qdoc3/config.h@ 497

Last change on this file since 497 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 6.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the tools applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
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
55QT_BEGIN_NAMESPACE
56
57class 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"
122#define CONFIG_BASE "base" // ### don't document for now
123#define CONFIG_CODEINDENT "codeindent"
124#define CONFIG_DEFINES "defines"
125#define CONFIG_DESCRIPTION "description"
126#define CONFIG_EDITION "edition"
127#define CONFIG_EXAMPLEDIRS "exampledirs"