mpd/src/IdleFlags.cxx

52 lines
849 B
C++
Raw Normal View History

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
2016-03-05 20:48:37 +01:00
/*
* Support library for the "idle" command.
*
*/
#include "IdleFlags.hxx"
#include "util/ASCII.hxx"
#include <cassert>
2016-03-05 20:48:37 +01:00
static constexpr const char * idle_names[] = {
2016-03-05 20:48:37 +01:00
"database",
"stored_playlist",
"playlist",
"player",
"mixer",
"output",
"options",
"sticker",
"update",
"subscription",
"message",
"neighbor",
"mount",
2017-02-17 23:59:06 +01:00
"partition",
nullptr,
2016-03-05 20:48:37 +01:00
};
const char*const*
idle_get_names() noexcept
2016-03-05 20:48:37 +01:00
{
return idle_names;
}
unsigned
idle_parse_name(const char *name) noexcept
2016-03-05 20:48:37 +01:00
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(name != nullptr);
#endif
for (unsigned i = 0; idle_names[i] != nullptr; ++i)
if (StringEqualsCaseASCII(name, idle_names[i]))
return 1 << i;
return 0;
}