diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-08-05 19:36:34 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-08-06 11:39:14 +0300 |
commit | 7ebd5f9f540e907de06d8fdc76d95ccacabbbe1f (patch) | |
tree | 2069a221f6f8a7bc2ec8619f8a9d9ec25064dd74 /libbutl/default-options.mxx | |
parent | 1cdb233cedd12069a4aa5d761e20b42e842ec58f (diff) |
Add support for option positions to load_default_options()
Diffstat (limited to 'libbutl/default-options.mxx')
-rw-r--r-- | libbutl/default-options.mxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libbutl/default-options.mxx b/libbutl/default-options.mxx index 2d44333..1694d48 100644 --- a/libbutl/default-options.mxx +++ b/libbutl/default-options.mxx @@ -11,6 +11,7 @@ #include <utility> // move(), forward(), make_pair() #include <algorithm> // reverse() +#include <stdexcept> // invalid_argument #include <system_error> #endif @@ -107,6 +108,15 @@ LIBBUTL_MODEXPORT namespace butl // // Note that the extra directory options files are never considered remote. // + // For the convenience of implementation, the function parses the option + // files in the reverse order. Thus, to make sure that positions in the + // options list monotonically increase, it needs the maximum number of + // arguments, globally and per file, to be specified. This way the starting + // options position for each file will be less than for the previously + // parsed file by arg_max_file and equal to arg_max - arg_max_file for the + // first file. If the actual number of arguments exceeds the specified, then + // invalid_argument is thrown. + // template <typename O, typename S, typename U, typename F> default_options<O> load_default_options (const optional<dir_path>& sys_dir, @@ -115,6 +125,8 @@ LIBBUTL_MODEXPORT namespace butl const default_options_files&, F&&, const std::string& option, + std::size_t arg_max, + std::size_t arg_max_file, bool args = false); // Merge the default options/arguments and the command line |