summaryrefslogtreecommitdiffstats
path: root/Source/cmConditionEvaluator.h
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2014-09-11 17:50:51 (GMT)
committerNils Gladitz <nilsgladitz@gmail.com>2014-09-11 19:17:09 (GMT)
commitb900c1ccaae7a500dda88240873122d0d899bf93 (patch)
tree524168715d82090de6c13a0c887ebbab2ad0322d /Source/cmConditionEvaluator.h
parent103ddca336c6ccf2fca3c2b8897c8f9319f836d5 (diff)
downloadCMake-b900c1ccaae7a500dda88240873122d0d899bf93.zip
CMake-b900c1ccaae7a500dda88240873122d0d899bf93.tar.gz
CMake-b900c1ccaae7a500dda88240873122d0d899bf93.tar.bz2
If: Extract cmConditionEvaluator from if() implementation
Diffstat (limited to 'Source/cmConditionEvaluator.h')
-rw-r--r--Source/cmConditionEvaluator.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h
new file mode 100644
index 0000000..9076988
--- /dev/null
+++ b/Source/cmConditionEvaluator.h
@@ -0,0 +1,90 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2014 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmConditionEvaluator_h
+#define cmConditionEvaluator_h
+
+#include "cmCommand.h"
+
+class cmConditionEvaluator
+{
+public:
+ typedef std::list<std::string> cmArgumentList;
+
+ cmConditionEvaluator(cmMakefile& makefile);
+
+ // this is a shared function for both If and Else to determine if the
+ // arguments were valid, and if so, was the response true. If there is
+ // an error, the errorString will be set.
+ bool IsTrue(const std::vector<std::string> &args,
+ std::string &errorString,
+ cmake::MessageType &status);
+
+private:
+ const char* GetVariableOrString(
+ const std::string& argument) const;
+
+ bool IsKeyword(std::string const& keyword,
+ std::string& argument) const;
+
+ bool GetBooleanValue(
+ std::string& arg) const;
+
+ bool GetBooleanValueOld(
+ std::string const& arg, bool one) const;
+
+ bool GetBooleanValueWithAutoDereference(
+ std::string &newArg,
+ std::string &errorString,
+ cmake::MessageType &status,
+ bool oneArg = false) const;
+
+ void IncrementArguments(
+ cmArgumentList &newArgs,
+ cmArgumentList::iterator &argP1,
+ cmArgumentList::iterator &argP2) const;
+
+ void HandlePredicate(bool value, int &reducible,
+ cmArgumentList::iterator &arg,
+ cmArgumentList &newArgs,
+ cmArgumentList::iterator &argP1,
+ cmArgumentList::iterator &argP2) const;
+
+ void HandleBinaryOp(bool value, int &reducible,
+ cmArgumentList::iterator &arg,
+ cmArgumentList &newArgs,
+ cmArgumentList::iterator &argP1,
+ cmArgumentList::iterator &argP2);
+
+ bool HandleLevel0(cmArgumentList &newArgs,
+ std::string &errorString,
+ cmake::MessageType &status);
+
+ bool HandleLevel1(cmArgumentList &newArgs,
+ std::string &, cmake::MessageType &);
+
+ bool HandleLevel2(cmArgumentList &newArgs,
+ std::string &errorString,
+ cmake::MessageType &status);
+
+ bool HandleLevel3(cmArgumentList &newArgs,
+ std::string &errorString,
+ cmake::MessageType &status);
+
+ bool HandleLevel4(cmArgumentList &newArgs,
+ std::string &errorString,
+ cmake::MessageType &status);
+
+ cmMakefile& Makefile;
+ cmPolicies::PolicyStatus Policy12Status;
+};
+
+#endif