From 879b5f52cb86f24352f4ed245fcce5f1ab885f97 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 30 Nov 2017 14:48:19 +0200 Subject: 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. --- build2/target-state.hxx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 build2/target-state.hxx (limited to 'build2/target-state.hxx') 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 +#include + +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 (r) > static_cast (l)) + l = r; + + return l; + } + + ostream& + operator<< (ostream&, target_state); // target.cxx +} + +#endif // BUILD2_TARGET_STATE_HXX -- cgit v1.1