~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to projectmanagers/cmake/parser/cmakecondition.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* KDevelop CMake Support
 
2
 *
 
3
 * Copyright 2007 Aleix Pol <aleixpol@gmail.com>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License
 
7
 * as published by the Free Software Foundation; either version 2
 
8
 * of the License, or (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
18
 * 02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef CMAKECONDITION_H
 
22
#define CMAKECONDITION_H
 
23
 
 
24
#include "cmakeprojectvisitor.h"
 
25
 
 
26
class KDEVCMAKECOMMON_EXPORT CMakeCondition
 
27
{
 
28
    public:
 
29
        CMakeCondition(const CMakeProjectVisitor* v);
 
30
        bool condition(const QStringList &expression);
 
31
        QList<int> variableArguments() const { return m_argUses; }
 
32
        
 
33
        enum conditionToken { None=0, variable, NOT, AND, OR, COMMAND, EXISTS, IS_NEWER_THAN, IS_DIRECTORY, IS_ABSOLUTE, MATCHES,
 
34
            LESS, GREATER, EQUAL, STRLESS, STRGREATER, STREQUAL, DEFINED, LPR, RPR, Last };
 
35
    private:
 
36
        static conditionToken typeName(const QString& name);
 
37
        QStringList::const_iterator prevOperator(QStringList::const_iterator it, QStringList::const_iterator itStop) const;
 
38
        bool evaluateCondition(QStringList::const_iterator it, QStringList::const_iterator itEnd);
 
39
        bool isTrue(const QStringList::const_iterator& var);
 
40
        const VariableMap *m_vars;
 
41
        const CMakeProjectVisitor *m_visitor;
 
42
        
 
43
        static QVector<int> m_priorities;
 
44
        static QMap<QString, conditionToken> nameToToken;
 
45
        static QSet<QString> s_falseDefinitions;
 
46
        
 
47
        QList<QStringList::const_iterator> m_varUses;
 
48
        QList<int> m_argUses;
 
49
//         int m_parameters[Last];
 
50
 
 
51
        QStringList::const_iterator conditionBegin;
 
52
};
 
53
 
 
54
#endif