00001 #pragma once
00002
00027 #ifndef __ID3_H__
00028 #define __ID3_H__
00029
00030
00031 #include "id3/tag.h"
00032
00033
00034 using std::string;
00035 using std::exception;
00036
00038 class id3
00039 {
00040
00041 private:
00042 static const int ID3_GENRES=148;
00043 static const string GENRE_DESC[ID3_GENRES];
00044
00045
00046 public:
00047 id3(void);
00048 virtual ~id3(void);
00049 void link(const string& FileName);
00050 string GetSong(void) const;
00051 string GetArtist(void) const;
00052 string GetAlbum(void) const;
00053 string GetYear(void) const;
00054 string GetTrack(void) const;
00055 string GetGenre(void) const;
00056 string GetComment(void) const;
00057 private:
00058 string GetFrameDesc(ID3_FrameID FrameID) const;
00059 string GetGenreDesc(int Genre) const;
00060
00061
00062 protected:
00063 ID3_Tag* m_pTag;
00064 };
00065
00067 class id3v1: public id3
00068 {
00069
00070 public:
00071 id3v1(const string& FileName);
00072 };
00073
00075 class id3v2: public id3
00076 {
00077
00078 public:
00079 id3v2(const string& FileName);
00080 size_t GetSize(void) const;
00081
00082
00083 private:
00084 size_t m_Size;
00085 };
00086
00087
00088 namespace except
00089 {
00091 class id3_except: public exception
00092 {
00093
00094 public:
00096 id3_except(void) throw(): exception() {};
00098 virtual ~id3_except(void) throw() {};
00100 virtual const char *what(void) const throw()=0;
00101 };
00102
00104 class no_id3v1: public id3_except
00105 {
00106
00107 public:
00108 no_id3v1(const string& FileName) throw();
00109 virtual ~no_id3v1(void) throw();
00110 virtual const char *what(void) const throw();
00111
00112
00113 private:
00114 string m_FileName;
00115 };
00116
00118 class no_id3v2: public id3_except
00119 {
00120
00121 public:
00122 no_id3v2(const string& FileName) throw();
00123 virtual ~no_id3v2(void) throw();
00124 virtual const char *what(void) const throw();
00125
00126
00127 private:
00128 string m_FileName;
00129 };
00130 };
00131
00132 #endif // __ID3_H__