Commit b211d31a authored by Max Kellermann's avatar Max Kellermann

config/Data: add getter methods

parent 5b192bea
/* /*
* Copyright 2003-2017 The Music Player Daemon Project * Copyright 2003-2018 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
......
/* /*
* Copyright 2003-2017 The Music Player Daemon Project * Copyright 2003-2018 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -32,6 +32,16 @@ struct ConfigData { ...@@ -32,6 +32,16 @@ struct ConfigData {
std::array<ConfigBlock *, std::size_t(ConfigBlockOption::MAX)> blocks; std::array<ConfigBlock *, std::size_t(ConfigBlockOption::MAX)> blocks;
void Clear(); void Clear();
gcc_pure
const ConfigParam *GetParam(ConfigOption option) noexcept {
return params[size_t(option)];
}
gcc_pure
const ConfigBlock *GetBlock(ConfigBlockOption option) noexcept {
return blocks[size_t(option)];
}
}; };
#endif #endif
...@@ -77,13 +77,13 @@ void config_global_check(void) ...@@ -77,13 +77,13 @@ void config_global_check(void)
const ConfigParam * const ConfigParam *
config_get_param(ConfigOption option) noexcept config_get_param(ConfigOption option) noexcept
{ {
return config_data.params[unsigned(option)]; return config_data.GetParam(option);
} }
const ConfigBlock * const ConfigBlock *
config_get_block(ConfigBlockOption option) noexcept config_get_block(ConfigBlockOption option) noexcept
{ {
return config_data.blocks[unsigned(option)]; return config_data.GetBlock(option);
} }
const ConfigBlock * const ConfigBlock *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment