00001 /***************************************************************************** 00002 * Copyright (C) 2004 by Michael Schulze * 00003 * mike.s@genion.de * 00004 * * 00005 * The code contained in this file is free software; you can redistribute * 00006 * it and/or modify it under the terms of the GNU Lesser General Public * 00007 * License as published by the Free Software Foundation; either version * 00008 * 2.1 of the License, or (at your option) any later version. * 00009 * * 00010 * This file is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00013 * Lesser General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU Lesser General Public * 00016 * License along with this code; if not, write to the Free Software * 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00018 * * 00019 * iTunes and iPod are trademarks of Apple * 00020 * * 00021 * This product is not supported/written/published by Apple! * 00022 *****************************************************************************/ 00023 00024 #ifndef ITUNESDBITUNESDBLISTENER_H 00025 #define ITUNESDBITUNESDBLISTENER_H 00026 00027 #include <qstring.h> 00028 #include "track.h" 00029 #include "playlist.h" 00030 #include "playlistitem.h" 00031 00032 namespace itunesdb { 00033 00034 /** 00035 * The methods in this interface will be called by ITunesDBParser during the parsing process. 00036 * @author Michael Schulze 00037 */ 00038 class ItunesDBListener { 00039 00040 public: 00041 00042 virtual ~ItunesDBListener() {} 00043 00044 /** 00045 * Creates a new Track. Override this method if you need your own Track implementation. 00046 * The returned pointer will be handed over to the @c handleTrack() method during the 00047 * parse process. 00048 */ 00049 virtual Track * createNewTrack(); 00050 00051 /** 00052 * Creates a new Playlist. Override this method if you need your own Playlist implementation. 00053 * The returned pointer will be handed over to the @c handlePlaylist() and @c handleOTGPlaylist() 00054 * methods during the parse process. 00055 */ 00056 virtual Playlist * createNewPlaylist(); 00057 00058 /** 00059 * gets called if an error occured during the parse process. 00060 * The parse process ends after a call to this method. 00061 */ 00062 virtual void handleError( const QString& message) = 0; 00063 00064 /** 00065 * gets called if the parser finds a mhsd block 00066 */ 00067 virtual void handleDataSet(Q_UINT32 type) = 0; 00068 00069 /** 00070 * sets the number of tracks (information from the itunesdb file) 00071 */ 00072 virtual void setNumTracks( Q_UINT32 numtracks) = 0; 00073 00074 /** 00075 * sets the number of playlists (information from the itunesdb file) 00076 */ 00077 virtual void setNumPlaylists( Q_UINT32 numplaylists) = 0; 00078 00079 /** 00080 * Handles a given Playcount entry 00081 */ 00082 virtual void handlePlaycount( Q_UINT32 idx, Q_UINT32 lastplayed, Q_UINT32 stars, Q_UINT32 count, Q_UINT32 bookmark, Q_UINT32 skipcount, Q_UINT32 last_skipped ) = 0; 00083 00084 /** 00085 * Handles the given on the go playlist. The pointer was created with the createNewPlaylist Method. 00086 * The implementor is the owner thus responsible for managing the pointer. 00087 */ 00088 virtual void handleOTGPlaylist( Playlist * playlist ) = 0; 00089 00090 /** 00091 * handles the given playlist. The pointer was created with the @c createNewPlaylist Method. 00092 * The implementor is the owner thus responsible for managing the pointer. 00093 */ 00094 virtual void handlePlaylist( Playlist * playlist ) = 0; 00095 00096 /** 00097 * handles the given track. The pointer was created with the @c createNewTrack Method. 00098 * The implementor is the owner thus responsible for managing the pointer. 00099 */ 00100 virtual void handleTrack( Track * track) = 0; 00101 00102 /** 00103 * gets called at the beginning of the parse process. 00104 */ 00105 virtual void parseStarted() = 0; 00106 00107 /** 00108 * parsing process done. No calls to the methods above will happen from the parser. 00109 */ 00110 virtual void parseFinished() = 0; 00111 }; 00112 00113 } 00114 00115 #endif