Main Page | Class List | File List | Class Members | File Members

ipod_cpp.h

Go to the documentation of this file.
00001 /*
00002  * ipod_cpp.h
00003  *
00004  * Duane Maxwell
00005  * (c) 2005 by Linspire Inc
00006  *
00007  * This library is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU Lesser General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020  */
00021 
00022 #ifndef __IPOD_CPP_H__
00023 #define __IPOD_CPP_H__
00024 
00025 #include <ipod/ipod.h>
00026 #include <ipod/ipod_file_utils.h>
00027 #include <string>
00028 
00142 class IPod;
00143 class IPodTrack;
00144 class IPodPlaylist;
00145 class IPodTrackItem;
00146 class IPodEQPreset;
00147 
00148  
00151 class IPod {
00152     friend class IPodTrack;
00153     friend class IPodPlaylist;
00154     friend class IPodEQPreset;
00155 public:
00158     enum Encoding {
00159         IPOD_ENCODING_UTF_8,        
00160         IPOD_ENCODING_ISO_8859_1    
00161     };
00162     
00171     IPod(std::string path);
00172     
00175     ~IPod();
00176     
00182     void Flush(void);
00183     
00188     unsigned long Version(void);
00189     
00201     void DiskUsage(uint64_t *total, uint64_t *free);
00202     
00207     unsigned long TrackCount(void);
00208     
00214     IPodTrack TrackByIndex(unsigned long index);
00215     
00221     IPodTrack TrackByTrackID(uint32_t trackID);
00222     
00227     unsigned long PlaylistCount(void);
00228     
00234     IPodPlaylist PlaylistByIndex(unsigned long index);
00235     
00240     unsigned long EQPresetCount(void);
00241     
00247     IPodEQPreset EQPresetByIndex(unsigned long index);
00248 
00256     static int Discover(std::string **paths);
00257     
00262     static Encoding StringEncoding(void);
00263     
00268     static void SetStringEncoding(Encoding encoding);
00269     
00270 private:
00271     ipod_t ipod;
00272     static IPod::Encoding g_encoding;
00273 };
00274 
00277 class IPodTrack {
00278     friend class IPod;
00279 public:
00284     IPodTrack(IPod &ipod);
00285     
00296     IPodTrack(IPod &ipod,std::string filePath);
00297     
00300     ~IPodTrack();
00301     
00307     void Remove(void);
00308     
00317     std::string GetText(int tag);
00318     
00329     void SetText(int tag,std::string s);
00330     
00336     bool HasText(int tag);
00337     
00346     uint32_t GetAttribute(int tag);
00347     
00357     void SetAttribute(int tag, uint32_t value);
00358     
00365     void Upload(char *filePath, ipod_file_transfer_func callback = 0, void *userData = 0);
00366     
00373 void Download(char *filePath, ipod_file_transfer_func callback = 0, void *userData = 0);
00374 
00375 private:
00376     IPodTrack(ipod_track_t t);
00377     ipod_track_t track;
00378 };
00379 
00382 class IPodPlaylist {
00383     friend class IPod;
00384     friend class IPodTrackItem;
00385 public:
00390     IPodPlaylist(IPod &ipod);
00391     
00394     ~IPodPlaylist();
00395     
00398     void Remove(void);
00399     
00408     std::string GetText(int tag);
00409     
00420     void SetText(int tag,std::string s);
00421     
00427     bool HasText(int tag);
00428     
00437     uint32_t GetAttribute(int tag);
00438     
00448     void SetAttribute(int tag, uint32_t value);
00449     
00454     unsigned long TrackItemCount(void);
00455     
00461     IPodTrackItem TrackItemByIndex(unsigned long index);
00462 private:
00463     IPodPlaylist(ipod_playlist_t p);
00464     ipod_playlist_t playlist;
00465 };
00466 
00469 class IPodTrackItem {
00470     friend class IPodPlaylist;
00471 public:
00475     IPodTrackItem(IPodPlaylist &playlist);
00478     ~IPodTrackItem();
00479     
00482     void Remove(void);
00483 
00492     uint32_t GetAttribute(int tag);
00493     
00503     void SetAttribute(int tag, uint32_t value);
00504 private:
00505     IPodTrackItem(ipod_track_item_t ti);
00506     ipod_track_item_t track_item;   
00507 };
00508 
00511 class IPodEQPreset {
00512     friend class IPod;
00513 public:
00516     IPodEQPreset(IPod &ipod);
00517     
00520     ~IPodEQPreset();
00521     
00524     void Remove(void);
00525     
00534     std::string GetText(int tag);
00535     
00546     void SetText(int tag,std::string s);
00547     
00553     bool HasText(int tag);
00554     
00563     int32_t GetAttribute(int tag);
00564     
00574     void SetAttribute(int tag, int32_t value);
00575     
00576 private:
00577     IPodEQPreset(ipod_eq_preset_t p);
00578     ipod_eq_preset_t preset;
00579 };
00580 
00581 #endif

Generated on Tue Dec 13 14:55:22 2005 for libipod by  doxygen 1.3.9.1