summaryrefslogtreecommitdiff
path: root/src/SongFilter.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-19 10:51:34 +0100
committerMax Kellermann <max@duempel.org>2014-01-19 17:04:51 +0100
commitf5ae1ce00b85699291a7cdf9782574e70a8c28f5 (patch)
tree9cb95dd1d98b1b0cd522ee27d7e8a374a3c8eb4a /src/SongFilter.cxx
parent738d6f10409037fbf8aa30cec5aceb121e21e230 (diff)
LightSong: new class to be used by DatabasePlugin callbacks
Detach the Song class completely from the public API, only to be used by SimpleDatabase and the update thread.
Diffstat (limited to 'src/SongFilter.cxx')
-rw-r--r--src/SongFilter.cxx33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/SongFilter.cxx b/src/SongFilter.cxx
index dccbab925..594ac3abc 100644
--- a/src/SongFilter.cxx
+++ b/src/SongFilter.cxx
@@ -20,6 +20,7 @@
#include "config.h"
#include "SongFilter.hxx"
#include "Song.hxx"
+#include "LightSong.hxx"
#include "DetachedSong.hxx"
#include "tag/Tag.hxx"
#include "util/ASCII.hxx"
@@ -137,7 +138,19 @@ SongFilter::Item::Match(const Tag &_tag) const
}
bool
-SongFilter::Item::Match(const Song &song) const
+SongFilter::Item::Match(const DetachedSong &song) const
+{
+ if (tag == LOCATE_TAG_BASE_TYPE)
+ return uri_is_child_or_same(value.c_str(), song.GetURI());
+
+ if (tag == LOCATE_TAG_FILE_TYPE)
+ return StringMatch(song.GetURI());
+
+ return Match(song.GetTag());
+}
+
+bool
+SongFilter::Item::Match(const LightSong &song) const
{
if (tag == LOCATE_TAG_BASE_TYPE) {
const auto uri = song.GetURI();
@@ -149,19 +162,7 @@ SongFilter::Item::Match(const Song &song) const
return StringMatch(uri.c_str());
}
- return Match(song.tag);
-}
-
-bool
-SongFilter::Item::Match(const DetachedSong &song) const
-{
- if (tag == LOCATE_TAG_BASE_TYPE)
- return uri_is_child_or_same(value.c_str(), song.GetURI());
-
- if (tag == LOCATE_TAG_FILE_TYPE)
- return StringMatch(song.GetURI());
-
- return Match(song.GetTag());
+ return Match(*song.tag);
}
SongFilter::SongFilter(unsigned tag, const char *value, bool fold_case)
@@ -207,7 +208,7 @@ SongFilter::Parse(unsigned argc, char *argv[], bool fold_case)
}
bool
-SongFilter::Match(const Song &song) const
+SongFilter::Match(const DetachedSong &song) const
{
for (const auto &i : items)
if (!i.Match(song))
@@ -217,7 +218,7 @@ SongFilter::Match(const Song &song) const
}
bool
-SongFilter::Match(const DetachedSong &song) const
+SongFilter::Match(const LightSong &song) const
{
for (const auto &i : items)
if (!i.Match(song))