diff options
author | Max Kellermann <max@duempel.org> | 2015-08-11 22:18:40 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-08-11 23:02:34 +0200 |
commit | b1480167be487d09ff46bb86ad02041fb28acff1 (patch) | |
tree | d819a825fb82c4258cc17d5f40793409f61600a1 /src/command/PlaylistCommands.cxx | |
parent | e118e958f7f9b87054679ebf6102d6923abbba81 (diff) | |
download | mpd-b1480167be487d09ff46bb86ad02041fb28acff1.tar.gz mpd-b1480167be487d09ff46bb86ad02041fb28acff1.tar.xz mpd-b1480167be487d09ff46bb86ad02041fb28acff1.zip |
command/Request: add parser methods
Wrapper for protocol/ArgParser.cxx.
Diffstat (limited to 'src/command/PlaylistCommands.cxx')
-rw-r--r-- | src/command/PlaylistCommands.cxx | 14 |
1 files changed, 5 insertions, 9 deletions
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; |