'Pluginize' Ampache
[amarok.git] / src / collection / support / MemoryMatcher.h
blob86b89265d2eeee94003b64348bf036fb0b89115a
1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
3 * (C) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com> *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef MEMORYMATCHER_H
22 #define MEMORYMATCHER_H
24 #include "amarok_export.h"
25 #include "MemoryCollection.h"
26 #include "Meta.h"
28 /**
29 A helper class for finding items in a MemoryCollection
31 @author
33 class AMAROK_EXPORT MemoryMatcher{
34 public:
35 MemoryMatcher();
36 virtual ~MemoryMatcher();
37 virtual Meta::TrackList match( MemoryCollection *memColl) = 0;
38 virtual Meta::TrackList match( const Meta::TrackList &tracks ) = 0;
40 bool isLast() const;
41 void setNext( MemoryMatcher *next );
42 MemoryMatcher* next() const;
44 private:
45 MemoryMatcher *m_next;
49 class AMAROK_EXPORT TrackMatcher : public MemoryMatcher
51 public:
52 TrackMatcher( Meta::TrackPtr track );
53 virtual Meta::TrackList match( MemoryCollection *memColl );
54 virtual Meta::TrackList match( const Meta::TrackList &tracks );
56 private:
57 Meta::TrackPtr m_track;
61 class AMAROK_EXPORT ArtistMatcher : public MemoryMatcher
63 public:
64 ArtistMatcher( Meta::ArtistPtr artist );
65 virtual Meta::TrackList match( MemoryCollection *memColl );
66 virtual Meta::TrackList match( const Meta::TrackList &tracks );
68 virtual Meta::AlbumList matchAlbums( MemoryCollection *memColl );
70 private:
71 Meta::ArtistPtr m_artist;
74 class AMAROK_EXPORT AlbumMatcher : public MemoryMatcher
76 public:
77 AlbumMatcher( Meta::AlbumPtr album );
78 virtual Meta::TrackList match( MemoryCollection *memColl );
79 virtual Meta::TrackList match( const Meta::TrackList &tracks );
81 private:
82 Meta::AlbumPtr m_album;
85 class AMAROK_EXPORT GenreMatcher : public MemoryMatcher
87 public:
88 GenreMatcher( Meta::GenrePtr genre );
89 virtual Meta::TrackList match( MemoryCollection *memColl );
90 virtual Meta::TrackList match( const Meta::TrackList &tracks );
92 private:
93 Meta::GenrePtr m_genre;
96 class AMAROK_EXPORT ComposerMatcher : public MemoryMatcher
98 public:
99 ComposerMatcher( Meta::ComposerPtr composer );
100 virtual Meta::TrackList match( MemoryCollection *memColl );
101 virtual Meta::TrackList match( const Meta::TrackList &tracks );
103 private:
104 Meta::ComposerPtr m_composer;
107 class AMAROK_EXPORT YearMatcher : public MemoryMatcher
109 public:
110 YearMatcher( Meta::YearPtr year );
111 virtual Meta::TrackList match( MemoryCollection *memColl );
112 virtual Meta::TrackList match( const Meta::TrackList &tracks );
114 private:
115 Meta::YearPtr m_year;
119 #endif