playlistitem.h

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 ITUNESDBPLAYLISTITEM_H
00025 #define ITUNESDBPLAYLISTITEM_H
00026 
00027 #include "listitem.h"
00028 #include "utils.h"
00029 
00030 #define PLAYLISTITEM_INVALID 0xEEEEEEEE
00031 
00032 namespace itunesdb {
00033 
00034 /**
00035 @author Michael Schulze
00036 */
00037 class PlaylistItem : public ListItem
00038 {
00039     friend class ItunesDBParser;
00040     friend class Playlist;
00041 
00042 public:
00043 
00044     virtual ~PlaylistItem();
00045 
00046     /**
00047      * Returns the ID of the track this PlaylistItem is referring to.
00048      * @return the trackID of the track.
00049      */
00050     Q_UINT32 getID() const;
00051 
00052     /**
00053      * Returns the position in the playlist.
00054      */
00055     Q_UINT32 getPosition() const;
00056 
00057     /**
00058      * Sets the position of this PlaylistItem in the playlist.
00059      */
00060     void setPosition( Q_UINT32 pos );
00061 
00062     /**
00063      * Returns true if the position has been set.
00064      */
00065     bool isPositionSet() const { return m_pos != PLAYLISTITEM_INVALID; }
00066 
00067 protected:
00068 
00069     PlaylistItem();
00070     PlaylistItem( Q_UINT32 ipod_id);
00071 
00072     /**
00073      * override from ListItem::doneAddingData()
00074      */
00075     virtual void doneAddingData();
00076 
00077     /**
00078      * Reads the playlist order MHODs
00079      */
00080     virtual void readMHOD( QDataStream& stream, Q_UINT32 type, Q_UINT32 blocklen );
00081 
00082     Q_UINT32 m_id;
00083     Q_UINT32 m_pos;
00084 };
00085 
00086 /**
00087  * This class compares two PlaylistItems and returns a negative int, zero, or
00088  * a positive int if the first item is smaller, equal or greater than the second.
00089  */
00090 class PlaylistItemComparator : public itunesdb::utils::Comparator<PlaylistItem> {
00091 public:
00092     virtual ~PlaylistItemComparator() {}
00093     virtual int compare( const PlaylistItem& item1, const PlaylistItem& item2 ) const = 0;
00094 };
00095 
00096 }
00097 
00098 #endif

Generated on Wed Dec 19 00:15:19 2007 for libqtpod by  doxygen 1.5.0