From b5854ece4383687e41ea69ac6896acd0a894510d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 14 Mar 2015 19:16:46 +0000 Subject: Change ParameterParser switch interface, use an Optional Merge has_option and option_value into a single method get_switch. --- src/parameters_parser.hh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/parameters_parser.hh') diff --git a/src/parameters_parser.hh b/src/parameters_parser.hh index 6104376c..827eacf9 100644 --- a/src/parameters_parser.hh +++ b/src/parameters_parser.hh @@ -5,6 +5,7 @@ #include "id_map.hh" #include "array_view.hh" #include "flags.hh" +#include "optional.hh" #include "string.hh" namespace Kakoune @@ -79,12 +80,9 @@ struct ParametersParser // boolean option. ParametersParser(ParameterList params, const ParameterDesc& desc); - // check if a named option (either string or boolean) is specified - bool has_option(const String& name) const; - - // get a string option value, returns an empty string if the option - // is not defined - const String& option_value(const String& name) const; + // Return a valid optional if the switch was given, with + // a non empty StringView value if the switch took an argument. + Optional get_switch(StringView name) const; struct iterator : std::iterator { -- cgit v1.2.3