diff options
Diffstat (limited to 'src/protocol')
-rw-r--r-- | src/protocol/Ack.cxx | 2 | ||||
-rw-r--r-- | src/protocol/Ack.hxx | 2 | ||||
-rw-r--r-- | src/protocol/ArgParser.cxx | 25 | ||||
-rw-r--r-- | src/protocol/ArgParser.hxx | 10 | ||||
-rw-r--r-- | src/protocol/Result.cxx | 4 | ||||
-rw-r--r-- | src/protocol/Result.hxx | 2 |
6 files changed, 38 insertions, 7 deletions
diff --git a/src/protocol/Ack.cxx b/src/protocol/Ack.cxx index 3b66764bf..56f0f0b5d 100644 --- a/src/protocol/Ack.cxx +++ b/src/protocol/Ack.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify diff --git a/src/protocol/Ack.hxx b/src/protocol/Ack.hxx index 7d3be2626..e2c4dd9d1 100644 --- a/src/protocol/Ack.hxx +++ b/src/protocol/Ack.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index 86527c751..e373827b4 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -20,6 +20,7 @@ #include "config.h" #include "ArgParser.hxx" #include "Result.hxx" +#include "Chrono.hxx" #include <limits> @@ -186,3 +187,25 @@ check_float(Client &client, float *value_r, const char *s) *value_r = value; return true; } + +bool +ParseCommandArg(Client &client, SongTime &value_r, const char *s) +{ + float value; + bool success = check_float(client, &value, s) && value >= 0; + if (success) + value_r = SongTime::FromS(value); + + return success; +} + +bool +ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s) +{ + float value; + bool success = check_float(client, &value, s); + if (success) + value_r = SignedSongTime::FromS(value); + + return success; +} diff --git a/src/protocol/ArgParser.hxx b/src/protocol/ArgParser.hxx index ea28de79e..0f79e7ab2 100644 --- a/src/protocol/ArgParser.hxx +++ b/src/protocol/ArgParser.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -25,6 +25,8 @@ #include <stdint.h> class Client; +class SongTime; +class SignedSongTime; bool check_uint32(Client &client, uint32_t *dst, const char *s); @@ -45,4 +47,10 @@ check_bool(Client &client, bool *value_r, const char *s); bool check_float(Client &client, float *value_r, const char *s); +bool +ParseCommandArg(Client &client, SongTime &value_r, const char *s); + +bool +ParseCommandArg(Client &client, SignedSongTime &value_r, const char *s); + #endif diff --git a/src/protocol/Result.cxx b/src/protocol/Result.cxx index 17b553c34..3cc5fc33e 100644 --- a/src/protocol/Result.cxx +++ b/src/protocol/Result.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ #include "config.h" #include "Result.hxx" -#include "Client.hxx" +#include "client/Client.hxx" #include <assert.h> diff --git a/src/protocol/Result.hxx b/src/protocol/Result.hxx index 0f7339c1c..0ac9d1e6b 100644 --- a/src/protocol/Result.hxx +++ b/src/protocol/Result.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify |