diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-02-06 05:05:56 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-02-06 05:05:56 +0200 |
commit | a5acaba537dab8e06be1197916acff86699aa5a3 (patch) | |
tree | 3f34f1d3889f17937b170a032ebd60338cd71ae1 /libbuild2/variable.hxx | |
parent | 5b21820a4ad0f69290c6a20643640ff5fbf5021a (diff) |
Add support for value type-specific subscript and iteration
Diffstat (limited to 'libbuild2/variable.hxx')
-rw-r--r-- | libbuild2/variable.hxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx index a91a7e0..9d7b001 100644 --- a/libbuild2/variable.hxx +++ b/libbuild2/variable.hxx @@ -99,6 +99,28 @@ namespace build2 // If NULL, then the value is never empty. // bool (*const empty) (const value&); + + // Custom subscript function. If NULL, then the generic implementation is + // used. + // + // Note that val can be NULL. If val_data points to val, then it can be + // moved from. The sloc and bloc arguments are the subscript and brace + // locations, respectively. + // + // Note: should normally be consistent with iterate. + // + value (*const subscript) (const value& val, + value* val_data, + value&& subscript, + const location& sloc, + const location& bloc); + + // Custom iteration function. It should invoked the specified function for + // each element in order. If NULL, then the generic implementation is + // used. The passed value is never NULL. + // + void (*const iterate) (const value&, + const function<void (value&&, bool first)>&); }; // The order of the enumerators is arranged so that their integral values |