From 5925c11a1fe8b2e02b790dd40b031ae005d5b68f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 10 Mar 2015 15:42:04 +0200 Subject: Further operation implementation --- build/rule | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'build/rule') diff --git a/build/rule b/build/rule index 4336c8f..2e11191 100644 --- a/build/rule +++ b/build/rule @@ -11,6 +11,7 @@ #include #include +#include #include namespace build @@ -19,17 +20,20 @@ namespace build { public: virtual void* - match (target&, const std::string& hint) const = 0; + match (action, target&, const std::string& hint) const = 0; virtual recipe - apply (target&, void*) const = 0; + apply (action, target&, void*) const = 0; }; - typedef std::unordered_map< + using target_rule_map = std::unordered_map< std::type_index, - prefix_multimap, '.'>> rule_map; + prefix_multimap, '.'>>; - extern rule_map rules; + using operation_rule_map = std::unordered_map; + + extern operation_rule_map rules; + extern const target_rule_map* current_rules; // Rules for current operation. // Fallback rule that check that the path exists. // @@ -37,39 +41,39 @@ namespace build { public: virtual void* - match (target&, const std::string& hint) const; + match (action, target&, const std::string& hint) const; virtual recipe - apply (target&, void*) const; + apply (action, target&, void*) const; static target_state - update (target&); + update (action, target&); }; class dir_rule: public rule { public: virtual void* - match (target&, const std::string& hint) const; + match (action, target&, const std::string& hint) const; virtual recipe - apply (target&, void*) const; + apply (action, target&, void*) const; static target_state - update (target&); + update (action, target&); }; class fsdir_rule: public rule { public: virtual void* - match (target&, const std::string& hint) const; + match (action, target&, const std::string& hint) const; virtual recipe - apply (target&, void*) const; + apply (action, target&, void*) const; static target_state - update (target&); + update (action, target&); }; } -- cgit v1.1