diff options
author | Max Kellermann <max@duempel.org> | 2014-03-02 00:17:32 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-03-02 00:17:32 +0100 |
commit | 2bf2f34b1211bfde95ef4ada77147a8b65830084 (patch) | |
tree | a6e639ccd3d07d445968f888e59bab580981ce89 /src/input/InputPlugin.hxx | |
parent | 7453c26ec4838760dec767b2f99afff9eb537d53 (diff) | |
download | mpd-2bf2f34b1211bfde95ef4ada77147a8b65830084.tar.gz mpd-2bf2f34b1211bfde95ef4ada77147a8b65830084.tar.xz mpd-2bf2f34b1211bfde95ef4ada77147a8b65830084.zip |
InputPlugin: allow init() to soft-fail
Add enum InputResult which is a tri-state. Input plugins may now fail
and just become unavailable.
Diffstat (limited to '')
-rw-r--r-- | src/input/InputPlugin.hxx | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/input/InputPlugin.hxx b/src/input/InputPlugin.hxx index 83e0ab26e..090c73df8 100644 --- a/src/input/InputPlugin.hxx +++ b/src/input/InputPlugin.hxx @@ -26,12 +26,41 @@ #include <stddef.h> #include <stdint.h> +#ifdef WIN32 +#include <windows.h> +/* damn you, windows.h! */ +#ifdef ERROR +#undef ERROR +#endif +#endif + struct config_param; struct InputStream; class Error; struct Tag; struct InputPlugin { + enum class InitResult { + /** + * A fatal error has occurred (e.g. misconfiguration). + * The #Error has been set. + */ + ERROR, + + /** + * The plugin was initialized successfully and is + * ready to be used. + */ + SUCCESS, + + /** + * The plugin is not available and shall be disabled. + * The #Error may be set describing the situation (to + * be logged). + */ + UNAVAILABLE, + }; + typedef int64_t offset_type; const char *name; @@ -42,7 +71,7 @@ struct InputPlugin { * @return true on success, false if the plugin should be * disabled */ - bool (*init)(const config_param ¶m, Error &error); + InitResult (*init)(const config_param ¶m, Error &error); /** * Global deinitialization. Called once before MPD shuts |