diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-10-15 14:20:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-10-15 14:20:44 +0200 |
commit | 921c2d503a63f4769fdf1c7e6eb31be2706f9bea (patch) | |
tree | 487698c7e2877dec1eed4945cd2d1e9e09b7eb66 /libbuild2/in/rule.hxx | |
parent | 291a737de8f92a7f620853133aa404b98e552a21 (diff) |
Add ability to specify fallback value for NULL substitutions with in.null
Diffstat (limited to 'libbuild2/in/rule.hxx')
-rw-r--r-- | libbuild2/in/rule.hxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libbuild2/in/rule.hxx b/libbuild2/in/rule.hxx index cf67060..2fa1305 100644 --- a/libbuild2/in/rule.hxx +++ b/libbuild2/in/rule.hxx @@ -33,11 +33,13 @@ namespace build2 rule (string rule_id, string program, char symbol = '$', - bool strict = true) + bool strict = true, + optional<string> null = nullopt) : rule_id_ (move (rule_id)), program_ (move (program)), symbol_ (symbol), - strict_ (strict) {} + strict_ (strict), + null_ (move (null)) {} virtual bool match (action, target&, const string&) const override; @@ -65,7 +67,8 @@ namespace build2 lookup (const location&, action, const target&, - const string& name) const; + const string& name, + const optional<string>& null) const; // Perform variable substitution. Return nullopt if it should be // ignored. @@ -75,13 +78,15 @@ namespace build2 action, const target&, const string& name, - bool strict) const; + bool strict, + const optional<string>& null) const; protected: const string rule_id_; const string program_; char symbol_; bool strict_; + optional<string> null_; }; } } |