1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
3 * (C) 2007 Maximilian Kossick <maximilian.kossick@googlemail.com> *
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. *
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. *
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"
29 A helper class for finding items in a MemoryCollection
33 class AMAROK_EXPORT MemoryMatcher
{
36 virtual ~MemoryMatcher();
37 virtual Meta::TrackList
match( MemoryCollection
*memColl
) = 0;
38 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
) = 0;
41 void setNext( MemoryMatcher
*next
);
42 MemoryMatcher
* next() const;
45 MemoryMatcher
*m_next
;
49 class AMAROK_EXPORT TrackMatcher
: public MemoryMatcher
52 TrackMatcher( Meta::TrackPtr track
);
53 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
54 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
57 Meta::TrackPtr m_track
;
61 class AMAROK_EXPORT ArtistMatcher
: public MemoryMatcher
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
);
71 Meta::ArtistPtr m_artist
;
74 class AMAROK_EXPORT AlbumMatcher
: public MemoryMatcher
77 AlbumMatcher( Meta::AlbumPtr album
);
78 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
79 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
82 Meta::AlbumPtr m_album
;
85 class AMAROK_EXPORT GenreMatcher
: public MemoryMatcher
88 GenreMatcher( Meta::GenrePtr genre
);
89 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
90 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
93 Meta::GenrePtr m_genre
;
96 class AMAROK_EXPORT ComposerMatcher
: public MemoryMatcher
99 ComposerMatcher( Meta::ComposerPtr composer
);
100 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
101 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
104 Meta::ComposerPtr m_composer
;
107 class AMAROK_EXPORT YearMatcher
: public MemoryMatcher
110 YearMatcher( Meta::YearPtr year
);
111 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
112 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
115 Meta::YearPtr m_year
;