config/Data: add getter methods

This commit is contained in:
Max Kellermann 2018-07-17 20:39:33 +02:00
parent 5b192beaa5
commit b211d31a64
3 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2017 The Music Player Daemon Project
* Copyright 2003-2018 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2017 The Music Player Daemon Project
* Copyright 2003-2018 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@ -32,6 +32,16 @@ struct ConfigData {
std::array<ConfigBlock *, std::size_t(ConfigBlockOption::MAX)> blocks;
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

View File

@ -77,13 +77,13 @@ void config_global_check(void)
const ConfigParam *
config_get_param(ConfigOption option) noexcept
{
return config_data.params[unsigned(option)];
return config_data.GetParam(option);
}
const ConfigBlock *
config_get_block(ConfigBlockOption option) noexcept
{
return config_data.blocks[unsigned(option)];
return config_data.GetBlock(option);
}
const ConfigBlock *