listitem.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 ITUNESDBLISTITEM_H
00025 #define ITUNESDBLISTITEM_H
00026 
00027 #include <qobject.h>
00028 #include <qstring.h>
00029 
00030 #include <map>
00031 #include <vector>
00032 
00033 namespace itunesdb {
00034 
00038 enum ItemProperty {
00039   MHOD_TITLE = 1,
00040   MHOD_PATH = 2,
00041   MHOD_ALBUM = 3,
00042   MHOD_ARTIST = 4,
00043   MHOD_GENRE = 5,
00044   MHOD_FDESC = 6,
00045   MHOD_EQ_SETTING = 7,
00046   MHOD_COMMENT = 8,
00047   MHOD_CATEGORY = 9,
00048   MHOD_COMPOSER = 12,
00049   MHOD_GROUPING = 13,
00050   MHOD_DESCRIPTION_TEXT = 14,
00051   MHOD_PODCAST_ENCLOSURE_URL = 15,
00052   MHOD_PODCAST_RSS_URL = 16,
00053   MHOD_CHAPTER_DATA = 17,
00054   MHOD_SUBTITLE = 18,
00055   MHOD_SMART_PLAYLIST_INFO = 50,
00056   MHOD_SMART_PLAYLIST_IRULES = 51,
00057   MHOD_LIBRARY_PLAYLIST_INDEX = 52,
00058   MHOD_PLAYLIST = 100
00059 };
00060 
00064 enum {
00065   ITEMTYPE_NONE = 0,
00066   ITEMTYPE_TRACK = 1,
00067   ITEMTYPE_PLAYLISTITEM = 2,
00068   ITEMTYPE_PLAYLIST = 3
00069 };    // known implementors
00070 
00071 typedef QPair<Q_UINT32,QByteArray> MHODPair;
00072 
00078 class ListItem {
00079 
00080     friend class ItunesDBParser;
00081 
00082 public:
00083 
00084     virtual ~ListItem();
00085 
00091     int getType() const;
00092 
00098     void setItemProperty(const QString& data, ItemProperty field);
00099 
00105     const QString& getItemProperty( ItemProperty field) const;
00106 
00110     uint getNumComponents() const;
00111 
00115     uint getNumStringComponents() const;
00116 
00120     virtual void doneAddingData();
00121 
00126     virtual bool isDirty() const;
00127 
00128 protected:
00129     typedef std::map<Q_UINT32,QString> PropertyMap;
00130     PropertyMap m_properties;
00131 
00132     ListItem();
00133     ListItem( int type);
00134 
00135     const QByteArray * getDumpedMHOD( Q_UINT32 type ) const;
00136 
00137     virtual void readMHOD( QDataStream& stream, Q_UINT32 type, Q_UINT32 blocklen );
00138     Q_UINT32 writeMHODsToStream ( QDataStream & outstream ) const;
00139 
00140     virtual void readNonStringMHOD( QDataStream& stream, Q_UINT32 type, Q_UINT32 blocklen );
00141     virtual uint writeNonStringMHODs( QDataStream& outstream ) const;
00142 
00143     typedef std::vector<MHODPair> DumpedMHODs;
00144     DumpedMHODs m_dumpedMHODs;
00145 
00146     int m_itemType;
00147 
00148     virtual void setDirty( bool dirtyFlag = true );
00149 
00150 private:
00151     bool m_dirty;
00152 };
00153 
00154 }
00155 
00156 #endif

Generated on Tue Dec 12 16:39:26 2006 for libqtpod.kdevelop by  doxygen 1.5.1