2023-03-06 14:42:04 +01:00
|
|
|
// 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"
|
|
|
|
|
2020-03-12 23:20:59 +01:00
|
|
|
#include <cassert>
|
2016-03-05 20:48:37 +01:00
|
|
|
|
2020-09-27 06:24:41 +02: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",
|
2020-09-27 06:24:41 +02:00
|
|
|
nullptr,
|
2016-03-05 20:48:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const char*const*
|
2017-05-08 14:44:49 +02:00
|
|
|
idle_get_names() noexcept
|
2016-03-05 20:48:37 +01:00
|
|
|
{
|
|
|
|
return idle_names;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned
|
2017-05-08 14:44:49 +02:00
|
|
|
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;
|
|
|
|
}
|