aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/DatabaseCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-08-11 22:18:40 +0200
committerMax Kellermann <max@duempel.org>2015-08-11 23:02:34 +0200
commitb1480167be487d09ff46bb86ad02041fb28acff1 (patch)
treed819a825fb82c4258cc17d5f40793409f61600a1 /src/command/DatabaseCommands.cxx
parente118e958f7f9b87054679ebf6102d6923abbba81 (diff)
downloadmpd-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/DatabaseCommands.cxx')
-rw-r--r--src/command/DatabaseCommands.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx
index 99a200848..6e6f3399b 100644
--- a/src/command/DatabaseCommands.cxx
+++ b/src/command/DatabaseCommands.cxx
@@ -33,7 +33,6 @@
#include "util/Error.hxx"
#include "SongFilter.hxx"
#include "protocol/Result.hxx"
-#include "protocol/ArgParser.hxx"
#include "BulkEdit.hxx"
#include <string.h>
@@ -54,7 +53,7 @@ CommandResult
handle_lsinfo2(Client &client, Request args)
{
/* default is root directory */
- const char *const uri = args.IsEmpty() ? "" : args.front();
+ const auto uri = args.GetOptional(0, "");
const DatabaseSelection selection(uri, false);
@@ -70,7 +69,7 @@ handle_match(Client &client, Request args, bool fold_case)
{
RangeArg window;
if (args.size >= 2 && strcmp(args[args.size - 2], "window") == 0) {
- if (!ParseCommandArg(client, window, args.back()))
+ if (!args.Parse(args.size - 1, window, client))
return CommandResult::ERROR;
args.pop_back();
@@ -190,7 +189,7 @@ CommandResult
handle_listall(Client &client, Request args)
{
/* default is root directory */
- const char *const uri = args.IsEmpty() ? "" : args.front();
+ const auto uri = args.GetOptional(0, "");
Error error;
return db_selection_print(client, DatabaseSelection(uri, true),
@@ -275,7 +274,7 @@ CommandResult
handle_listallinfo(Client &client, Request args)
{
/* default is root directory */
- const char *const uri = args.IsEmpty() ? "" : args.front();
+ const auto uri = args.GetOptional(0, "");
Error error;
return db_selection_print(client, DatabaseSelection(uri, true),