| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the Qt Linguist of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 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 | ** 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 have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef PROFILEEVALUATOR_H
|
|---|
| 43 | #define PROFILEEVALUATOR_H
|
|---|
| 44 |
|
|---|
| 45 | #include "proitems.h"
|
|---|
| 46 | #include "abstractproitemvisitor.h"
|
|---|
| 47 |
|
|---|
| 48 | #include <QtCore/QIODevice>
|
|---|
| 49 | #include <QtCore/QHash>
|
|---|
| 50 | #include <QtCore/QStringList>
|
|---|
| 51 | #include <QtCore/QStack>
|
|---|
| 52 |
|
|---|
| 53 | #if (!defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)) && !defined(__SUNPRO_CC)
|
|---|
| 54 | # define HAVE_TEMPLATE_CLASS_FRIENDS
|
|---|
| 55 | #endif
|
|---|
| 56 |
|
|---|
| 57 | QT_BEGIN_NAMESPACE
|
|---|
| 58 |
|
|---|
| 59 | class ProFileEvaluator
|
|---|
| 60 | {
|
|---|
| 61 | #ifdef HAVE_TEMPLATE_CLASS_FRIENDS
|
|---|
| 62 | private:
|
|---|
| 63 | #else
|
|---|
| 64 | public:
|
|---|
| 65 | #endif
|
|---|
| 66 | class Private;
|
|---|
| 67 |
|
|---|
| 68 | public:
|
|---|
| 69 | enum TemplateType {
|
|---|
| 70 | TT_Unknown = 0,
|
|---|
| 71 | TT_Application,
|
|---|
| 72 | TT_Library,
|
|---|
| 73 | TT_Script,
|
|---|
| 74 | TT_Subdirs
|
|---|
| 75 | };
|
|---|
| 76 |
|
|---|
| 77 | ProFileEvaluator();
|
|---|
| 78 | virtual ~ProFileEvaluator();
|
|---|
| 79 |
|
|---|
| 80 | ProFileEvaluator::TemplateType templateType();
|
|---|
| 81 | virtual bool contains(const QString &variableName) const;
|
|---|
| 82 | void setVerbose(bool on); // Default is false
|
|---|
| 83 | void setCumulative(bool on); // Default is true!
|
|---|
| 84 | void setOutputDir(const QString &dir); // Default is empty
|
|---|
| 85 |
|
|---|
| 86 | bool queryProFile(ProFile *pro);
|
|---|
| 87 | bool accept(ProFile *pro);
|
|---|
| 88 |
|
|---|
| 89 | void addVariables(const QHash<QString, QStringList> &variables);
|
|---|
| 90 | void addProperties(const QHash<QString, QString> &properties);
|
|---|
| 91 | QStringList values(const QString &variableName) const;
|
|---|
| 92 | QStringList values(const QString &variableName, const ProFile *pro) const;
|
|---|
| 93 | QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const;
|
|---|
| 94 | QStringList absoluteFileValues(
|
|---|
| 95 | const QString &variable, const QString &baseDirectory, const QStringList &searchDirs,
|
|---|
| 96 | const ProFile *pro) const;
|
|---|
| 97 | QString propertyValue(const QString &val) const;
|
|---|
| 98 |
|
|---|
| 99 | // for our descendents
|
|---|
| 100 | virtual ProFile *parsedProFile(const QString &fileName);
|
|---|
| 101 | virtual void releaseParsedProFile(ProFile *proFile);
|
|---|
| 102 | virtual void logMessage(const QString &msg);
|
|---|
| 103 | virtual void errorMessage(const QString &msg); // .pro parse errors
|
|---|
| 104 | virtual void fileMessage(const QString &msg); // error() and message() from .pro file
|
|---|
| 105 |
|
|---|
| 106 | private:
|
|---|
| 107 | Private *d;
|
|---|
| 108 |
|
|---|
| 109 | #ifdef HAVE_TEMPLATE_CLASS_FRIENDS
|
|---|
| 110 | template<typename T> friend class QTypeInfo;
|
|---|
| 111 | #endif
|
|---|
| 112 | };
|
|---|
| 113 |
|
|---|
| 114 | QT_END_NAMESPACE
|
|---|
| 115 |
|
|---|
| 116 | #endif // PROFILEEVALUATOR_H
|
|---|