aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/config/utility.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/config/utility.ixx')
-rw-r--r--libbuild2/config/utility.ixx62
1 files changed, 62 insertions, 0 deletions
diff --git a/libbuild2/config/utility.ixx b/libbuild2/config/utility.ixx
new file mode 100644
index 0000000..79d5470
--- /dev/null
+++ b/libbuild2/config/utility.ixx
@@ -0,0 +1,62 @@
+// file : libbuild2/config/utility.ixx -*- C++ -*-
+// license : MIT; see accompanying LICENSE file
+
+namespace build2
+{
+ namespace config
+ {
+ LIBBUILD2_SYMEXPORT pair<lookup, bool>
+ lookup_config_impl (scope&, const variable&);
+
+ template <typename T>
+ pair<lookup, bool>
+ lookup_config_impl (scope&, const variable&, T&&, uint64_t, bool);
+
+ inline lookup
+ lookup_config (scope& rs, const variable& var)
+ {
+ return lookup_config_impl (rs, var).first;
+ }
+
+ inline lookup
+ lookup_config (bool& new_value, scope& rs, const variable& var)
+ {
+ auto r (lookup_config_impl (rs, var));
+ new_value = new_value || r.second;
+ return r.first;
+ }
+
+ template <typename T>
+ inline lookup
+ lookup_config (scope& rs,
+ const variable& var,
+ T&& def_val,
+ uint64_t sflags,
+ bool def_ovr)
+ {
+ return lookup_config_impl (rs,
+ var,
+ std::forward<T> (def_val), // VC14
+ sflags,
+ def_ovr).first;
+ }
+
+ template <typename T>
+ inline lookup
+ lookup_config (bool& new_value,
+ scope& rs,
+ const variable& var,
+ T&& def_val,
+ uint64_t sflags,
+ bool def_ovr)
+ {
+ auto r (lookup_config_impl (rs,
+ var,
+ std::forward<T> (def_val), // VC14
+ sflags,
+ def_ovr));
+ new_value = new_value || r.second;
+ return r.first;
+ }
+ }
+}