util/{Const,Writable}Buffer, ...: rename IsEmpty() to empty(), imitating STL

This commit is contained in:
Max Kellermann
2017-11-10 19:24:33 +01:00
parent 523051132d
commit 49784513b1
51 changed files with 142 additions and 142 deletions

View File

@@ -58,7 +58,7 @@ handle_password(Client &client, Request args, Response &r)
static TagMask
ParseTagMask(Request request)
{
if (request.IsEmpty())
if (request.empty())
throw ProtocolError(ACK_ERROR_ARG, "Not enough arguments");
TagMask result = TagMask::None();
@@ -77,14 +77,14 @@ ParseTagMask(Request request)
CommandResult
handle_tagtypes(Client &client, Request request, Response &r)
{
if (request.IsEmpty()) {
if (request.empty()) {
tag_print_types(r);
return CommandResult::OK;
}
const char *cmd = request.shift();
if (StringIsEqual(cmd, "all")) {
if (!request.IsEmpty()) {
if (!request.empty()) {
r.Error(ACK_ERROR_ARG, "Too many arguments");
return CommandResult::ERROR;
}
@@ -92,7 +92,7 @@ handle_tagtypes(Client &client, Request request, Response &r)
client.tag_mask = TagMask::All();
return CommandResult::OK;
} else if (StringIsEqual(cmd, "clear")) {
if (!request.IsEmpty()) {
if (!request.empty()) {
r.Error(ACK_ERROR_ARG, "Too many arguments");
return CommandResult::ERROR;
}

View File

@@ -169,7 +169,7 @@ handle_count(Client &client, Request args, Response &r)
}
SongFilter filter;
if (!args.IsEmpty() && !filter.Parse(args, false)) {
if (!args.empty() && !filter.Parse(args, false)) {
r.Error(ACK_ERROR_ARG, "incorrect arguments");
return CommandResult::ERROR;
}
@@ -235,7 +235,7 @@ handle_list(Client &client, Request args, Response &r)
args.pop_back();
}
if (!args.IsEmpty()) {
if (!args.empty()) {
filter.reset(new SongFilter());
if (!filter->Parse(args, false)) {
r.Error(ACK_ERROR_ARG, "not able to parse args");

View File

@@ -76,7 +76,7 @@ handle_unsubscribe(Client &client, Request args, Response &r)
CommandResult
handle_channels(Client &client, gcc_unused Request args, Response &r)
{
assert(args.IsEmpty());
assert(args.empty());
std::set<std::string> channels;
for (const auto &c : *client.GetInstance().client_list)
@@ -93,7 +93,7 @@ CommandResult
handle_read_messages(Client &client,
gcc_unused Request args, Response &r)
{
assert(args.IsEmpty());
assert(args.empty());
while (!client.messages.empty()) {
const ClientMessage &msg = client.messages.front();

View File

@@ -284,7 +284,7 @@ handle_update(Client &client, Request args, Response &r, bool discard)
const char *path = "";
assert(args.size <= 1);
if (!args.IsEmpty()) {
if (!args.empty()) {
path = args.front();
if (*path == 0 || StringIsEqual(path, "/"))

View File

@@ -71,7 +71,7 @@ handle_toggleoutput(Client &client, Request args, Response &r)
CommandResult
handle_devices(Client &client, gcc_unused Request args, Response &r)
{
assert(args.IsEmpty());
assert(args.empty());
printAudioDevices(r, client.GetPartition().outputs);
return CommandResult::OK;

View File

@@ -95,7 +95,7 @@ handle_pause(Client &client, Request args, gcc_unused Response &r)
{
auto &pc = client.GetPlayerControl();
if (!args.IsEmpty()) {
if (!args.empty()) {
bool pause_flag = args.ParseBool(0);
pc.LockSetPause(pause_flag);
} else

View File

@@ -242,7 +242,7 @@ handle_playlistinfo(Client &client, Request args, Response &r)
CommandResult
handle_playlistid(Client &client, Request args, Response &r)
{
if (!args.IsEmpty()) {
if (!args.empty()) {
unsigned id = args.ParseUnsigned(0);
playlist_print_id(r, client.GetPlaylist(), id);
} else {