diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-04-02 14:22:55 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-04-02 14:22:55 +0200 |
| commit | 76e73866e56c359e1c67beae678b5bd368eaf1ff (patch) | |
| tree | 8313b3dfc24aae124e9dcd8289d7c427c920a1a9 /src/parameters_parser.hh | |
| parent | 5476b603e374bb93e7477a115b001b4adde92043 (diff) | |
ParameterParser takes flags
Only implemented flag is OptionsOnlyAtStart which considers
options given after the first positional parameter as a positional one
Diffstat (limited to 'src/parameters_parser.hh')
| -rw-r--r-- | src/parameters_parser.hh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/parameters_parser.hh b/src/parameters_parser.hh index bedcfc93..98d138b8 100644 --- a/src/parameters_parser.hh +++ b/src/parameters_parser.hh @@ -37,11 +37,26 @@ struct wrong_argument_count : runtime_error // * named string options, which are defined using '-name value' syntax struct ParametersParser { + enum class Flags + { + None = 0, + OptionsOnlyAtStart = 1, + }; + friend constexpr Flags operator|(Flags lhs, Flags rhs) + { + return (Flags)((int) lhs | (int) rhs); + } + friend constexpr bool operator&(Flags lhs, Flags rhs) + { + return ((int) lhs & (int) rhs) != 0; + } + // the options defines named options, if they map to true, then // they are understood as string options, else they are understood as // boolean option. ParametersParser(const ParameterList& params, std::unordered_map<String, bool> options, + Flags flags = Flags::None, size_t min_positionals = 0, size_t max_positionals = -1); |
