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 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef MEMORYMATCHER_H
22 #define MEMORYMATCHER_H
24 #include "MemoryCollection.h"
28 A helper class for finding items in a MemoryCollection
35 virtual ~MemoryMatcher();
36 virtual Meta::TrackList
match( MemoryCollection
*memColl
) = 0;
37 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
) = 0;
40 void setNext( MemoryMatcher
*next
);
41 MemoryMatcher
* next() const;
44 MemoryMatcher
*m_next
;
48 class TrackMatcher
: public MemoryMatcher
51 TrackMatcher( Meta::TrackPtr track
);
52 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
53 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
56 Meta::TrackPtr m_track
;
60 class ArtistMatcher
: public MemoryMatcher
63 ArtistMatcher( Meta::ArtistPtr artist
);
64 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
65 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
68 Meta::ArtistPtr m_artist
;
71 class AlbumMatcher
: public MemoryMatcher
74 AlbumMatcher( Meta::AlbumPtr album
);
75 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
76 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
79 Meta::AlbumPtr m_album
;
82 class GenreMatcher
: public MemoryMatcher
85 GenreMatcher( Meta::GenrePtr genre
);
86 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
87 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
90 Meta::GenrePtr m_genre
;
93 class ComposerMatcher
: public MemoryMatcher
96 ComposerMatcher( Meta::ComposerPtr composer
);
97 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
98 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
101 Meta::ComposerPtr m_composer
;
104 class YearMatcher
: public MemoryMatcher
107 YearMatcher( Meta::YearPtr year
);
108 virtual Meta::TrackList
match( MemoryCollection
*memColl
);
109 virtual Meta::TrackList
match( const Meta::TrackList
&tracks
);
112 Meta::YearPtr m_year
;