protocol/ArgParser: move struct RangeArg to separate header

This commit is contained in:
Max Kellermann 2018-09-02 07:45:45 +02:00
parent b9cca49e14
commit 68f824a186
8 changed files with 47 additions and 15 deletions

View File

@ -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 \

View File

@ -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"

View File

@ -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"

View File

@ -22,6 +22,7 @@
#include "check.h"
#include "protocol/ArgParser.hxx"
#include "protocol/RangeArg.hxx"
#include "Chrono.hxx"
#include "util/ConstBuffer.hxx"

View File

@ -19,6 +19,7 @@
#include "config.h"
#include "ArgParser.hxx"
#include "RangeArg.hxx"
#include "Ack.hxx"
#include "Chrono.hxx"
#include "util/NumberParser.hxx"

View File

@ -22,10 +22,9 @@
#include "check.h"
#include <limits>
#include <stdint.h>
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<unsigned>::max();
}
static constexpr RangeArg All() {
return { 0, std::numeric_limits<unsigned>::max() };
}
};
RangeArg
ParseCommandArgRange(const char *s);

40
src/protocol/RangeArg.hxx Normal file
View File

@ -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 <limits>
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() };
}
};
#endif

View File

@ -1,6 +1,7 @@
#include "config.h"
#include "protocol/ArgParser.hxx"
#include "protocol/Ack.hxx"
#include "protocol/RangeArg.hxx"
#include "util/Compiler.h"
#include <cppunit/TestFixture.h>