aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/functions-bool.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/functions-bool.cxx')
-rw-r--r--libbuild2/functions-bool.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/libbuild2/functions-bool.cxx b/libbuild2/functions-bool.cxx
new file mode 100644
index 0000000..bb2fd3f
--- /dev/null
+++ b/libbuild2/functions-bool.cxx
@@ -0,0 +1,26 @@
+// file : libbuild2/functions-bool.cxx -*- C++ -*-
+// license : MIT; see accompanying LICENSE file
+
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
+
+using namespace std;
+
+namespace build2
+{
+ void
+ bool_functions (function_map& m)
+ {
+ function_family f (m, "bool");
+
+ // $string(<bool>)
+ //
+ // Convert a boolean value to a string literal `true` or `false`.
+ //
+
+ // Note that we don't handle NULL values for this type since it has no
+ // empty representation.
+ //
+ f["string"] += [](bool b) {return b ? "true" : "false";};
+ }
+}