Eneboo - Documentación para desarrolladores
src/qt/qmake/project.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/project.h   3.3.8   edited Jan 11 14:37 $
00003 **
00004 ** Definition of QMakeProject class.
00005 **
00006 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00007 **
00008 ** This file is part of qmake.
00009 **
00010 ** This file may be distributed under the terms of the Q Public License
00011 ** as defined by Trolltech ASA of Norway and appearing in the file
00012 ** LICENSE.QPL included in the packaging of this file.
00013 **
00014 ** This file may be distributed and/or modified under the terms of the
00015 ** GNU General Public License version 2 as published by the Free Software
00016 ** Foundation and appearing in the file LICENSE.GPL included in the
00017 ** packaging of this file.
00018 **
00019 ** Licensees holding valid Qt Enterprise Edition licenses may use this
00020 ** file in accordance with the Qt Commercial License Agreement provided
00021 ** with the Software.
00022 **
00023 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00024 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00025 **
00026 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00027 **   information about Qt Commercial License Agreements.
00028 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00029 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00030 **
00031 ** Contact info@trolltech.com if any conditions of this licensing are
00032 ** not clear to you.
00033 **
00034 **********************************************************************/
00035 
00036 #ifndef __PROJECT_H__
00037 #define __PROJECT_H__
00038 
00039 #include <qstringlist.h>
00040 #include <qstring.h>
00041 #include <qmap.h>
00042 
00043 class QMakeProperty;
00044 
00045 class QMakeProject
00046 {
00047     enum TestStatus { TestNone, TestFound, TestSeek } test_status;
00048     int scope_block, scope_flag;
00049 
00050     QString pfile, cfile;
00051     QMakeProperty *prop;
00052     void reset();
00053     QMap<QString, QStringList> vars, base_vars, cache;
00054     bool parse(const QString &text, QMap<QString, QStringList> &place);
00055     bool doProjectTest(const QString &func, const QString &params, QMap<QString, QStringList> &place);
00056     bool doProjectTest(const QString &func, QStringList args, QMap<QString, QStringList> &place);
00057     bool doProjectCheckReqs(const QStringList &deps, QMap<QString, QStringList> &place);
00058     QString doVariableReplace(QString &str, const QMap<QString, QStringList> &place);
00059 
00060 public:
00061     QMakeProject();
00062     QMakeProject(QMakeProperty *);
00063 
00064     enum { ReadCache=0x01, ReadConf=0x02, ReadCmdLine=0x04, ReadProFile=0x08, ReadPostFiles=0x10, ReadAll=0xFF };
00065     bool read(const QString &project, const QString &pwd, uchar cmd=ReadAll);
00066     bool read(uchar cmd=ReadAll);
00067 
00068     QString projectFile();
00069     QString configFile();
00070 
00071     bool isEmpty(const QString &v);
00072     QStringList &values(const QString &v);
00073     QString first(const QString &v);
00074     QMap<QString, QStringList> &variables();
00075     bool isActiveConfig(const QString &x, bool regex=FALSE, QMap<QString, QStringList> *place=NULL);
00076 
00077 protected:
00078     friend class MakefileGenerator;
00079     bool read(const QString &file, QMap<QString, QStringList> &place);
00080 
00081 };
00082 
00083 inline QString QMakeProject::projectFile()
00084 {
00085 #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP)
00086     // workaround for Sun WorkShop 5.0 bug fixed in Forte 6
00087     if (pfile == "-")
00088         return QString("(stdin)");
00089     else
00090         return pfile;
00091 #else
00092     return pfile == "-" ? QString("(stdin)") : pfile;
00093 #endif
00094 }
00095 
00096 inline QString QMakeProject::configFile()
00097 { return cfile; }
00098 
00099 inline bool QMakeProject::isEmpty(const QString &v)
00100 { return !vars.contains(v) || vars[v].isEmpty(); }
00101 
00102 inline QStringList &QMakeProject::values(const QString &v)
00103 { return vars[v]; }
00104 
00105 inline QString QMakeProject::first(const QString &v)
00106 {
00107 #if defined(Q_CC_SUN) && (__SUNPRO_CC == 0x500) || defined(Q_CC_HP)
00108     // workaround for Sun WorkShop 5.0 bug fixed in Forte 6
00109     if (isEmpty(v))
00110         return QString("");
00111     else
00112         return vars[v].first();
00113 #else
00114     return isEmpty(v) ? QString("") : vars[v].first();
00115 #endif
00116 }
00117 
00118 inline QMap<QString, QStringList> &QMakeProject::variables()
00119 { return vars; }
00120 
00121 #endif /* __PROJECT_H__ */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'