aboutsummaryrefslogtreecommitdiff
path: root/build2/target-state.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-11-30 14:48:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-11-30 14:48:19 +0200
commit879b5f52cb86f24352f4ed245fcce5f1ab885f97 (patch)
treeff483ce4aa64dda7d17b82f956333f0705257568 /build2/target-state.hxx
parent074a8c04a384a9752466bd2af69b695333b2955c (diff)
Implement support for scope operation callbacks
An entity (module, core) can register a function that will be called when an action is executed on the dir{} target that corresponds to the scope. The pre callback is called just before the recipe and the post -- immediately after.
Diffstat (limited to 'build2/target-state.hxx')
-rw-r--r--build2/target-state.hxx44
1 files changed, 44 insertions, 0 deletions
diff --git a/build2/target-state.hxx b/build2/target-state.hxx
new file mode 100644
index 0000000..2913abb
--- /dev/null
+++ b/build2/target-state.hxx
@@ -0,0 +1,44 @@
+// file : build2/target-state.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BUILD2_TARGET_STATE_HXX
+#define BUILD2_TARGET_STATE_HXX
+
+#include <build2/types.hxx>
+#include <build2/utility.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;
+ }
+
+ ostream&
+ operator<< (ostream&, target_state); // target.cxx
+}
+
+#endif // BUILD2_TARGET_STATE_HXX