1
/* KDevelop CMake Support
3
* Copyright 2007 Aleix Pol <aleixpol@gmail.com>
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.
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.
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
21
#ifndef CMAKECONDITION_H
22
#define CMAKECONDITION_H
24
#include "cmakeprojectvisitor.h"
26
class KDEVCMAKECOMMON_EXPORT CMakeCondition
29
CMakeCondition(const CMakeProjectVisitor* v);
30
bool condition(const QStringList &expression);
31
QList<int> variableArguments() const { return m_argUses; }
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 };
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;
43
static QVector<int> m_priorities;
44
static QMap<QString, conditionToken> nameToToken;
45
static QSet<QString> s_falseDefinitions;
47
QList<QStringList::const_iterator> m_varUses;
49
// int m_parameters[Last];
51
QStringList::const_iterator conditionBegin;