aboutsummaryrefslogtreecommitdiff
path: root/build2/variable
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-20 14:14:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-20 14:14:52 +0200
commitdf43058115b389f1375690812ad92301288f976f (patch)
treebb4196fef2bfddd8fe778b92e7d2d3ce58e68c73 /build2/variable
parent5c5a60a02ba1ddcb6782a938f3c892cda979d8fe (diff)
Implement support for <, >, <=, >= in eval context
Now can write: if ($build.version > 30000)
Diffstat (limited to 'build2/variable')
-rw-r--r--build2/variable9
1 files changed, 7 insertions, 2 deletions
diff --git a/build2/variable b/build2/variable
index cc99dc6..9473674 100644
--- a/build2/variable
+++ b/build2/variable
@@ -119,7 +119,7 @@ namespace build2
// value
//
- enum class value_state: uint8_t {null, empty, filled};
+ enum class value_state: uint8_t {null, empty, filled}; // Order is important.
class value
{
@@ -231,10 +231,15 @@ namespace build2
};
// The values should be of the same type (or both be untyped) except NULL
- // values can also be untyped. NULL values compare equal.
+ // values can also be untyped. NULL values compare equal and a NULL value
+ // is always less than a non-NULL.
//
bool operator== (const value&, const value&);
bool operator!= (const value&, const value&);
+ bool operator< (const value&, const value&);
+ bool operator<= (const value&, const value&);
+ bool operator> (const value&, const value&);
+ bool operator>= (const value&, const value&);
// Value cast. The first three expect the value to be not NULL. The cast
// from lookup expects the value to aslo be defined.