1 /***************************************************************************
3 copyright : (C) 2002 - 2004 by Scott Wheeler
4 email : wheeler@kde.org
5 ***************************************************************************/
7 /***************************************************************************
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 ***************************************************************************/
19 #include <QDataStream>
21 #include "stringhash.h"
25 class PlaylistCollection
;
30 typedef QList
<Playlist
*> PlaylistList
;
32 class Cache
: public FileHandleHash
35 static Cache
*instance();
38 static void loadPlaylists(PlaylistCollection
*collection
);
39 static void savePlaylists(const PlaylistList
&playlists
);
41 static bool cacheFileExists();
48 static const int m_currentVersion
= 1;
52 * A simple QDataStream subclass that has an extra field to indicate the cache
56 class CacheDataStream
: public QDataStream
59 CacheDataStream(QIODevice
*d
) : QDataStream(d
), m_cacheVersion(0) {}
60 CacheDataStream(QByteArray
&a
, int mode
) : QDataStream(&a
, mode
), m_cacheVersion(0) {}
62 virtual ~CacheDataStream() {}
64 int cacheVersion() const { return m_cacheVersion
; }
65 void setCacheVersion(int v
) { m_cacheVersion
= v
; }
73 // vim: set et sw=4 tw=0 sta: