From 5f768f4f3e6e9e1b7310a0e8b09a97bf6d0115ea Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 25 Mar 2021 10:24:54 +0200 Subject: Implement config.config.environment storage --- libbuild2/config/module.hxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libbuild2/config/module.hxx') diff --git a/libbuild2/config/module.hxx b/libbuild2/config/module.hxx index 3afe721..b8b5d07 100644 --- a/libbuild2/config/module.hxx +++ b/libbuild2/config/module.hxx @@ -26,10 +26,19 @@ namespace build2 // saved in the order populated. If flags are absent, then this variable // was marked as "unsaved" (always transient). // + // The optional save function can be used to implement custom variable + // saving, for example, as a difference appended to the base value. The + // second half of the result is the assignment operator to use. + // + using save_variable_function = + pair (const value&, + const value* base, + names& storage); struct saved_variable { reference_wrapper var; optional flags; + save_variable_function* save; }; struct saved_variables: vector @@ -74,7 +83,9 @@ namespace build2 // Return true if variable/module were newly inserted. // bool - save_variable (const variable&, optional flags); + save_variable (const variable&, + optional flags, + save_variable_function* = nullptr); static void save_variable (scope&, const variable&, optional); -- cgit v1.1