|
1 | 1 | // SPDX-License-Identifier: GPL-2.0-or-later
|
2 | 2 | // Copyright The Music Player Daemon Project
|
3 | 3 |
|
4 |
| -#ifndef MPD_PLAYLIST_PLUGIN_HXX |
5 |
| -#define MPD_PLAYLIST_PLUGIN_HXX |
| 4 | +#pragma once |
6 | 5 |
|
7 | 6 | #include "input/Ptr.hxx"
|
8 | 7 | #include "thread/Mutex.hxx"
|
@@ -117,33 +116,26 @@ struct PlaylistPlugin {
|
117 | 116 | */
|
118 | 117 | [[gnu::pure]]
|
119 | 118 | bool SupportsMimeType(std::string_view mime_type) const noexcept;
|
120 |
| -}; |
121 | 119 |
|
122 |
| -/** |
123 |
| - * Initialize a plugin. |
124 |
| - * |
125 |
| - * @param block a configuration block for this plugin, or nullptr if none |
126 |
| - * is configured |
127 |
| - * @return true if the plugin was initialized successfully, false if |
128 |
| - * the plugin is not available |
129 |
| - */ |
130 |
| -static inline bool |
131 |
| -playlist_plugin_init(const PlaylistPlugin *plugin, |
132 |
| - const ConfigBlock &block) |
133 |
| -{ |
134 |
| - return plugin->init != nullptr |
135 |
| - ? plugin->init(block) |
136 |
| - : true; |
137 |
| -} |
138 |
| - |
139 |
| -/** |
140 |
| - * Deinitialize a plugin which was initialized successfully. |
141 |
| - */ |
142 |
| -static inline void |
143 |
| -playlist_plugin_finish(const PlaylistPlugin *plugin) noexcept |
144 |
| -{ |
145 |
| - if (plugin->finish != nullptr) |
146 |
| - plugin->finish(); |
147 |
| -} |
148 |
| - |
149 |
| -#endif |
| 120 | + /** |
| 121 | + * Initialize the plugin. |
| 122 | + * |
| 123 | + * @param block a configuration block for this plugin, or nullptr if none |
| 124 | + * is configured |
| 125 | + * @return true if the plugin was initialized successfully, false if |
| 126 | + * the plugin is not available |
| 127 | + */ |
| 128 | + bool Init(const ConfigBlock &block) const { |
| 129 | + return init != nullptr |
| 130 | + ? init(block) |
| 131 | + : true; |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * Deinitialize the plugin which was initialized successfully. |
| 136 | + */ |
| 137 | + void Finish() const noexcept { |
| 138 | + if (finish != nullptr) |
| 139 | + finish(); |
| 140 | + } |
| 141 | +}; |
0 commit comments