diff options
author | Max Kellermann <max@musicpd.org> | 2016-10-29 10:21:57 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-10-29 10:42:56 +0200 |
commit | fac8edd47aa8f86688e8b7d7d0c6945509954d28 (patch) | |
tree | ff10541b17fac1275efd5ec822b24a270d84df48 /src/db/plugins/upnp | |
parent | 9a9da7b0773b5c4863919b84b2269cfeb605ebaa (diff) |
db/Interface: migrate visitor methods from class Error to C++ exceptions
Diffstat (limited to 'src/db/plugins/upnp')
-rw-r--r-- | src/db/plugins/upnp/ContentDirectoryService.cxx | 1 | ||||
-rw-r--r-- | src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 48 |
2 files changed, 19 insertions, 30 deletions
diff --git a/src/db/plugins/upnp/ContentDirectoryService.cxx b/src/db/plugins/upnp/ContentDirectoryService.cxx index 6754b48b7..6df0b6850 100644 --- a/src/db/plugins/upnp/ContentDirectoryService.cxx +++ b/src/db/plugins/upnp/ContentDirectoryService.cxx @@ -26,7 +26,6 @@ #include "util/NumberParser.hxx" #include "util/UriUtil.hxx" #include "util/RuntimeError.hxx" -#include "util/Error.hxx" #include "util/ScopeExit.hxx" #include <stdio.h> diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 702a37602..3be615d3a 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -35,8 +35,6 @@ #include "config/Block.hxx" #include "tag/TagBuilder.hxx" #include "tag/TagTable.hxx" -#include "util/Error.hxx" -#include "util/Domain.hxx" #include "fs/Traits.hxx" #include "Log.hxx" #include "SongFilter.hxx" @@ -84,20 +82,17 @@ public: virtual const LightSong *GetSong(const char *uri_utf8) const override; void ReturnSong(const LightSong *song) const override; - virtual bool Visit(const DatabaseSelection &selection, - VisitDirectory visit_directory, - VisitSong visit_song, - VisitPlaylist visit_playlist, - Error &error) const override; + void Visit(const DatabaseSelection &selection, + VisitDirectory visit_directory, + VisitSong visit_song, + VisitPlaylist visit_playlist) const override; - virtual bool VisitUniqueTags(const DatabaseSelection &selection, - TagType tag_type, tag_mask_t group_mask, - VisitTag visit_tag, - Error &error) const override; + void VisitUniqueTags(const DatabaseSelection &selection, + TagType tag_type, tag_mask_t group_mask, + VisitTag visit_tag) const override; + + DatabaseStats GetStats(const DatabaseSelection &selection) const override; - virtual bool GetStats(const DatabaseSelection &selection, - DatabaseStats &stats, - Error &error) const override; time_t GetUpdateStamp() const override { return 0; } @@ -576,12 +571,11 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server, } // Deal with the possibly multiple servers, call VisitServer if needed. -bool +void UpnpDatabase::Visit(const DatabaseSelection &selection, VisitDirectory visit_directory, VisitSong visit_song, - VisitPlaylist visit_playlist, - Error &) const + VisitPlaylist visit_playlist) const { auto vpath = stringToTokens(selection.uri, "/", true); if (vpath.empty()) { @@ -597,7 +591,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection, visit_playlist); } - return true; + return; } // We do have a path: the first element selects the server @@ -607,19 +601,17 @@ UpnpDatabase::Visit(const DatabaseSelection &selection, auto server = discovery->GetServer(servername.c_str()); VisitServer(server, vpath, selection, visit_directory, visit_song, visit_playlist); - return true; } -bool +void UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection, TagType tag, gcc_unused tag_mask_t group_mask, - VisitTag visit_tag, - Error &) const + VisitTag visit_tag) const { // TODO: use group_mask if (!visit_tag) - return true; + return; std::set<std::string> values; for (auto& server : discovery->GetDirectories()) { @@ -646,18 +638,16 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection, builder.AddItem(tag, value.c_str()); visit_tag(builder.Commit()); } - - return true; } -bool -UpnpDatabase::GetStats(const DatabaseSelection &, - DatabaseStats &stats, Error &) const +DatabaseStats +UpnpDatabase::GetStats(const DatabaseSelection &) const { /* Note: this gets called before the daemonizing so we can't reallyopen this would be a problem if we had real stats */ + DatabaseStats stats; stats.Clear(); - return true; + return stats; } const DatabasePlugin upnp_db_plugin = { |