tools/qdoc3/config.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     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"
       
   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"
       
   128 #define CONFIG_EXAMPLES                 "examples"
       
   129 #define CONFIG_EXCLUDEDIRS              "excludedirs"
       
   130 #define CONFIG_EXTRAIMAGES              "extraimages"
       
   131 #define CONFIG_FALSEHOODS               "falsehoods"
       
   132 #define CONFIG_FORMATTING               "formatting"
       
   133 #define CONFIG_GENERATEINDEX            "generateindex"
       
   134 #define CONFIG_HEADERDIRS               "headerdirs"
       
   135 #define CONFIG_HEADERS                  "headers"
       
   136 #define CONFIG_IGNOREDIRECTIVES         "ignoredirectives"
       
   137 #define CONFIG_IGNORETOKENS             "ignoretokens"
       
   138 #define CONFIG_IMAGEDIRS                "imagedirs"
       
   139 #define CONFIG_IMAGES                   "images"
       
   140 #define CONFIG_INDEXES                  "indexes"
       
   141 #define CONFIG_LANGUAGE                 "language"
       
   142 #define CONFIG_MACRO                    "macro"
       
   143 #define CONFIG_OBSOLETELINKS            "obsoletelinks"
       
   144 #define CONFIG_OUTPUTDIR                "outputdir"
       
   145 #define CONFIG_OUTPUTLANGUAGE           "outputlanguage"
       
   146 #define CONFIG_OUTPUTFORMATS            "outputformats"
       
   147 #define CONFIG_PROJECT                  "project"
       
   148 #define CONFIG_QHP                      "qhp"
       
   149 #define CONFIG_QUOTINGINFORMATION       "quotinginformation"
       
   150 #define CONFIG_SLOW                     "slow"
       
   151 #define CONFIG_SHOWINTERNAL             "showinternal"
       
   152 #define CONFIG_SOURCEDIRS               "sourcedirs"
       
   153 #define CONFIG_SOURCES                  "sources"
       
   154 #define CONFIG_SPURIOUS                 "spurious"
       
   155 #define CONFIG_STYLESHEETS              "stylesheets"
       
   156 #define CONFIG_TABSIZE                  "tabsize"
       
   157 #define CONFIG_TAGFILE                  "tagfile"
       
   158 #define CONFIG_TRANSLATORS              "translators" // ### don't document for now
       
   159 #define CONFIG_URL                      "url"
       
   160 #define CONFIG_VERSION                  "version"
       
   161 #define CONFIG_VERSIONSYM               "versionsym"
       
   162 
       
   163 #define CONFIG_FILEEXTENSIONS           "fileextensions"
       
   164 
       
   165 QT_END_NAMESPACE
       
   166 
       
   167 #endif