diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-10-07 08:17:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-10-08 15:05:21 +0200 |
commit | 8384a087afc7e29e900a3ce96d55ab2f5c2a74c2 (patch) | |
tree | deff3d99e33bfc7abecb3ef0422ccb2dd6c3d43b /libbuild2/config/utility.cxx | |
parent | 734bf117f0eb596fc40579810613a6e13c43d3c4 (diff) |
Expose custom save function in config module
It can generally be useful, for example, to complete relative paths before
saving them to config.build (if abs_dir_path does not fit).
Diffstat (limited to 'libbuild2/config/utility.cxx')
-rw-r--r-- | libbuild2/config/utility.cxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libbuild2/config/utility.cxx b/libbuild2/config/utility.cxx index 6574367..aa0d5af 100644 --- a/libbuild2/config/utility.cxx +++ b/libbuild2/config/utility.cxx @@ -7,7 +7,14 @@ using namespace std; namespace build2 { - void (*config_save_variable) (scope&, const variable&, optional<uint64_t>); + void + (*config_save_variable) (scope&, + const variable&, + optional<uint64_t>, + pair<names_view, const char*> (*)(const scope&, + const value&, + const value*, + names&)); void (*config_save_environment) (scope&, const char*); void (*config_save_module) (scope&, const char*, int); const string& (*config_preprocess_create) (context&, @@ -21,7 +28,10 @@ namespace build2 namespace config { pair<lookup, bool> - lookup_config_impl (scope& rs, const variable& var, uint64_t sflags) + lookup_config_impl (scope& rs, + const variable& var, + uint64_t sflags, + save_variable_function* sfunc) { // This is a stripped-down version of the default value case. @@ -71,7 +81,7 @@ namespace build2 } if (l.defined ()) - save_variable (rs, var, sflags); + save_variable (rs, var, sflags, sfunc); return pair<lookup, bool> (l, n); } |