Merge branch 'runtime_enumeration' of git://github.com/eugene2k/MPD
This commit is contained in:
@@ -23,6 +23,9 @@
|
||||
#include "Ptr.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include <assert.h>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
struct ConfigBlock;
|
||||
class EventLoop;
|
||||
@@ -62,6 +65,11 @@ struct InputPlugin {
|
||||
*/
|
||||
InputStreamPtr (*open)(const char *uri, Mutex &mutex);
|
||||
|
||||
/**
|
||||
* return a set of supported protocols
|
||||
*/
|
||||
std::set<std::string> (*protocols)();
|
||||
|
||||
/**
|
||||
* Prepare a #RemoteTagScanner. The operation must be started
|
||||
* using RemoteTagScanner::Start(). Returns nullptr if the
|
||||
@@ -76,6 +84,25 @@ struct InputPlugin {
|
||||
|
||||
gcc_pure
|
||||
bool SupportsUri(const char *uri) const noexcept;
|
||||
|
||||
template<typename F>
|
||||
void ForeachSupportedUri(F lambda) const noexcept {
|
||||
assert(prefixes || protocols);
|
||||
|
||||
if (prefixes != nullptr) {
|
||||
for (auto schema = prefixes; *schema != nullptr; ++schema) {
|
||||
lambda(*schema);
|
||||
}
|
||||
}
|
||||
if (protocols != nullptr) {
|
||||
for (auto schema : protocols()) {
|
||||
lambda(schema.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool
|
||||
protocol_is_whitelisted(const char *proto);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user