From b1480167be487d09ff46bb86ad02041fb28acff1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 11 Aug 2015 22:18:40 +0200 Subject: command/Request: add parser methods Wrapper for protocol/ArgParser.cxx. --- src/command/PlaylistCommands.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/command/PlaylistCommands.cxx') diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx index f6f610d7a..0122cecbd 100644 --- a/src/command/PlaylistCommands.cxx +++ b/src/command/PlaylistCommands.cxx @@ -33,7 +33,6 @@ #include "queue/Playlist.hxx" #include "TimePrint.hxx" #include "client/Client.hxx" -#include "protocol/ArgParser.hxx" #include "protocol/Result.hxx" #include "ls.hxx" #include "Mapper.hxx" @@ -71,10 +70,8 @@ handle_save(Client &client, Request args) CommandResult handle_load(Client &client, Request args) { - RangeArg range; - if (args.size < 2) - range.SetAll(); - else if (!ParseCommandArg(client, range, args[1])) + RangeArg range = RangeArg::All(); + if (!args.ParseOptional(1, range, client)) return CommandResult::ERROR; const ScopeBulkEdit bulk_edit(client.partition); @@ -146,7 +143,7 @@ handle_playlistdelete(Client &client, Request args) { const char *const name = args[0]; unsigned from; - if (!ParseCommandArg(client, from, args[1])) + if (!args.Parse(1, from, client)) return CommandResult::ERROR; Error error; @@ -160,9 +157,8 @@ handle_playlistmove(Client &client, Request args) { const char *const name = args.front(); unsigned from, to; - if (!ParseCommandArg(client, from, args[1])) - return CommandResult::ERROR; - if (!ParseCommandArg(client, to, args[2])) + if (!args.Parse(1, from, client) || + !args.Parse(2, to, client)) return CommandResult::ERROR; Error error; -- cgit v1.2.3