config/Data: add getter methods
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 * | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann