aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target-state.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-06-24 12:01:19 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2019-07-01 18:13:55 +0300
commit977d07a3ae47ef204665d1eda2d642e5064724f3 (patch)
tree525a3d6421f61ce789b690191d3c30fc09be3517 /libbuild2/target-state.hxx
parent7161b24963dd9da4d218f92c736b77c35c328a2d (diff)
Split build system into library and driver
Diffstat (limited to 'libbuild2/target-state.hxx')
-rw-r--r--libbuild2/target-state.hxx46
1 files changed, 46 insertions, 0 deletions
diff --git a/libbuild2/target-state.hxx b/libbuild2/target-state.hxx
new file mode 100644
index 0000000..5bc6895
--- /dev/null
+++ b/libbuild2/target-state.hxx
@@ -0,0 +1,46 @@
+// file : libbuild2/target-state.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef LIBBUILD2_TARGET_STATE_HXX
+#define LIBBUILD2_TARGET_STATE_HXX
+
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
+
+namespace build2
+{
+ // The order of the enumerators is arranged so that their integral values
+ // indicate whether one "overrides" the other in the "merge" operator|
+ // (see below).
+ //
+ // Note that postponed is "greater" than unchanged since it may result in
+ // the changed state.
+ //
+ enum class target_state: uint8_t
+ {
+ unknown,
+ unchanged,
+ postponed,
+ busy,
+ changed,
+ failed,
+ group // Target's state is the group's state.
+ };
+
+ inline target_state&
+ operator |= (target_state& l, target_state r)
+ {
+ if (static_cast<uint8_t> (r) > static_cast<uint8_t> (l))
+ l = r;
+
+ return l;
+ }
+
+ LIBBUILD2_SYMEXPORT ostream&
+ operator<< (ostream&, target_state); // target.cxx
+}
+
+#endif // LIBBUILD2_TARGET_STATE_HXX