diff --git a/Makefile.am b/Makefile.am index ebc306e77..bacc257b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,6 +82,7 @@ libmpd_a_SOURCES = \ src/open.h \ src/protocol/Ack.cxx src/protocol/Ack.hxx \ src/protocol/ArgParser.cxx src/protocol/ArgParser.hxx \ + src/protocol/RangeArg.hxx \ src/protocol/Result.cxx src/protocol/Result.hxx \ src/command/Request.hxx \ src/command/CommandResult.hxx \ diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx index 0d0b8448d..59aebf6d4 100644 --- a/src/command/DatabaseCommands.cxx +++ b/src/command/DatabaseCommands.cxx @@ -26,6 +26,7 @@ #include "db/Count.hxx" #include "db/Selection.hxx" #include "CommandError.hxx" +#include "protocol/RangeArg.hxx" #include "client/Client.hxx" #include "client/Response.hxx" #include "tag/ParseName.hxx" diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx index c040033a2..61e783fa1 100644 --- a/src/command/QueueCommands.cxx +++ b/src/command/QueueCommands.cxx @@ -21,6 +21,7 @@ #include "QueueCommands.hxx" #include "Request.hxx" #include "CommandError.hxx" +#include "protocol/RangeArg.hxx" #include "db/DatabaseQueue.hxx" #include "db/Selection.hxx" #include "song/Filter.hxx" diff --git a/src/command/Request.hxx b/src/command/Request.hxx index 02f7804e5..f8ea53fd8 100644 --- a/src/command/Request.hxx +++ b/src/command/Request.hxx @@ -22,6 +22,7 @@ #include "check.h" #include "protocol/ArgParser.hxx" +#include "protocol/RangeArg.hxx" #include "Chrono.hxx" #include "util/ConstBuffer.hxx" diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index bdc28bcbf..23d203931 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -19,6 +19,7 @@ #include "config.h" #include "ArgParser.hxx" +#include "RangeArg.hxx" #include "Ack.hxx" #include "Chrono.hxx" #include "util/NumberParser.hxx" diff --git a/src/protocol/ArgParser.hxx b/src/protocol/ArgParser.hxx index 8a23f25a8..d2844e016 100644 --- a/src/protocol/ArgParser.hxx +++ b/src/protocol/ArgParser.hxx @@ -22,10 +22,9 @@ #include "check.h" -#include - #include +struct RangeArg; class SongTime; class SignedSongTime; @@ -38,19 +37,6 @@ ParseCommandArgInt(const char *s, int min_value, int max_value); int ParseCommandArgInt(const char *s); -struct RangeArg { - unsigned start, end; - - void SetAll() { - start = 0; - end = std::numeric_limits::max(); - } - - static constexpr RangeArg All() { - return { 0, std::numeric_limits::max() }; - } -}; - RangeArg ParseCommandArgRange(const char *s); diff --git a/src/protocol/RangeArg.hxx b/src/protocol/RangeArg.hxx new file mode 100644 index 000000000..3eca8a75e --- /dev/null +++ b/src/protocol/RangeArg.hxx @@ -0,0 +1,40 @@ +/* + * Copyright 2003-2018 The Music Player Daemon Project + * http://www.musicpd.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPD_PROTOCOL_RANGE_ARG_HXX +#define MPD_PROTOCOL_RANGE_ARG_HXX + +#include "check.h" + +#include + +struct RangeArg { + unsigned start, end; + + void SetAll() { + start = 0; + end = std::numeric_limits::max(); + } + + static constexpr RangeArg All() { + return { 0, std::numeric_limits::max() }; + } +}; + +#endif diff --git a/test/test_protocol.cxx b/test/test_protocol.cxx index 596e4afc3..b587561a6 100644 --- a/test/test_protocol.cxx +++ b/test/test_protocol.cxx @@ -1,6 +1,7 @@ #include "config.h" #include "protocol/ArgParser.hxx" #include "protocol/Ack.hxx" +#include "protocol/RangeArg.hxx" #include "util/Compiler.h" #include