summaryrefslogtreecommitdiff
path: root/src/parameters_parser.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-03-14 19:16:46 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-03-14 19:16:46 +0000
commitb5854ece4383687e41ea69ac6896acd0a894510d (patch)
treec7fea52bba5ad073636f3e0e091079131e727f5c /src/parameters_parser.hh
parent65fd0df0410760ff2a3c3d965b136ffa776c464d (diff)
Change ParameterParser switch interface, use an Optional<StringView>
Merge has_option and option_value into a single method get_switch.
Diffstat (limited to 'src/parameters_parser.hh')
-rw-r--r--src/parameters_parser.hh10
1 files changed, 4 insertions, 6 deletions
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<StringView> get_switch(StringView name) const;
struct iterator : std::iterator<std::forward_iterator_tag, String>
{