aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol/ArgParser.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/ArgParser.hxx')
-rw-r--r--src/protocol/ArgParser.hxx44
1 files changed, 33 insertions, 11 deletions
diff --git a/src/protocol/ArgParser.hxx b/src/protocol/ArgParser.hxx
index 0f79e7ab2..f60dbdf50 100644
--- a/src/protocol/ArgParser.hxx
+++ b/src/protocol/ArgParser.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,35 +22,57 @@
#include "check.h"
+#include <limits>
+
#include <stdint.h>
-class Client;
+class Response;
class SongTime;
class SignedSongTime;
bool
-check_uint32(Client &client, uint32_t *dst, const char *s);
+ParseCommandArg32(Response &r, uint32_t &value_r, const char *s);
+
+bool
+ParseCommandArg(Response &r, int &value_r, const char *s,
+ int min_value, int max_value);
+
+bool
+ParseCommandArg(Response &r, int &value_r, const char *s);
+
+struct RangeArg {
+ unsigned start, end;
+
+ void SetAll() {
+ start = 0;
+ end = std::numeric_limits<unsigned>::max();
+ }
+
+ static constexpr RangeArg All() {
+ return { 0, std::numeric_limits<unsigned>::max() };
+ }
+};
bool
-check_int(Client &client, int *value_r, const char *s);
+ParseCommandArg(Response &r, RangeArg &value_r, const char *s);
bool
-check_range(Client &client, unsigned *value_r1, unsigned *value_r2,
- const char *s);
+ParseCommandArg(Response &r, unsigned &value_r, const char *s,
+ unsigned max_value);
bool
-check_unsigned(Client &client, unsigned *value_r, const char *s);
+ParseCommandArg(Response &r, unsigned &value_r, const char *s);
bool
-check_bool(Client &client, bool *value_r, const char *s);
+ParseCommandArg(Response &r, bool &value_r, const char *s);
bool
-check_float(Client &client, float *value_r, const char *s);
+ParseCommandArg(Response &r, float &value_r, const char *s);
bool
-ParseCommandArg(Client &client, SongTime &value_r, const char *s);
+ParseCommandArg(Response &r, SongTime &value_r, const char *s);
bool
-ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s);
+ParseCommandArg(Response &r, SignedSongTime &value_r, const char *s);
#endif