diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-03-25 10:24:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-03-26 12:14:30 +0200 |
commit | 5f768f4f3e6e9e1b7310a0e8b09a97bf6d0115ea (patch) | |
tree | dcc37234fa0fbd2340015b9a29ce7a5bfa403462 /libbuild2/config/module.hxx | |
parent | a85d3e26b4915f60869a69e71e16800087cf2e8a (diff) |
Implement config.config.environment storage
Diffstat (limited to 'libbuild2/config/module.hxx')
-rw-r--r-- | libbuild2/config/module.hxx | 13 |
1 files changed, 12 insertions, 1 deletions
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<names_view, const char*> (const value&, + const value* base, + names& storage); struct saved_variable { reference_wrapper<const variable> var; optional<uint64_t> flags; + save_variable_function* save; }; struct saved_variables: vector<saved_variable> @@ -74,7 +83,9 @@ namespace build2 // Return true if variable/module were newly inserted. // bool - save_variable (const variable&, optional<uint64_t> flags); + save_variable (const variable&, + optional<uint64_t> flags, + save_variable_function* = nullptr); static void save_variable (scope&, const variable&, optional<uint64_t>); |