itunesdb::TrackPredicate Class Reference

#include <track.h>

Inheritance diagram for itunesdb::TrackPredicate:

itunesdb::TrackPredicates::ByAlbum itunesdb::TrackPredicates::ByArtist itunesdb::TrackPredicates::ByFullInfo itunesdb::TrackPredicates::Contains ITunesDBSPLRuleSet List of all members.

Public Member Functions

virtual bool operator() (const Track &)=0

Detailed Description

This interface will be used by ITunesDB::findFirstTrackBy and ITunesDB::getTracksBy. Callers to these functions provide a reference to an implementation of this interface and thus provide code to decide if a given track is a valid result.

Example: you need to get all the tracks performed at a given year (e.g. 2004) from the database

First create an implementor for TrackPredicate like this:


 class TracksByYearPredicate : public TrackPredicate {
     Q_UINT32 m_givenYear;
 public:
     TracksByYearPredicate( Q_UINT32 givenYear ) : m_givenYear( givenYear ) {}
     ~TracksByYearPredicate() {}
     bool operator() ( const itunesdb::Track& track ) {
         return track.getYear() == m_givenYear;
     }
 };
 
then you call the getTracksBy() method of your ITunesDB instance (here itunesdb) with a reference to your predicate

 TracksByYearPredicate yearPredicate( 2004 );
 TrackPtrList result;
 itunesdb.getTracksBy( yearPredicate, result );
 
Now you have all tracks performed at 2004 in your result list.
See also:
ITunesDB::findFirstTrackBy()

ITunesDB::getTracksBy() }


Member Function Documentation

virtual bool itunesdb::TrackPredicate::operator() ( const Track  )  [pure virtual]

Implement this method accordingly to the documentation above and (!) the documentation of the function this predicate will be given to.

Implemented in ITunesDBSPLRuleSet, itunesdb::TrackPredicates::ByArtist, itunesdb::TrackPredicates::ByAlbum, itunesdb::TrackPredicates::ByFullInfo, and itunesdb::TrackPredicates::Contains.


The documentation for this class was generated from the following file:
Generated on Tue Dec 12 16:39:28 2006 for libqtpod.kdevelop by  doxygen 1.5.1