00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _ID3LIB_HEADER_FRAME_H_
00029 #define _ID3LIB_HEADER_FRAME_H_
00030
00031 #include "header.h"
00032 #include "field.h"
00033
00034 struct ID3_FrameDef;
00035
00036 class ID3_FrameHeader : public ID3_Header
00037 {
00038 public:
00039
00040 enum
00041 {
00042 TAGALTER = 1 << 15,
00043 FILEALTER = 1 << 14,
00044 READONLY = 1 << 13,
00045 COMPRESSION = 1 << 7,
00046 ENCRYPTION = 1 << 6,
00047 GROUPING = 1 << 5
00048 };
00049
00050 ID3_FrameHeader() : _frame_def(NULL), _dyn_frame_def(false) { ; }
00051 virtual ~ID3_FrameHeader() { this->Clear(); }
00052
00053 size_t Size() const;
00054 bool Parse(ID3_Reader&);
00055 void Render(ID3_Writer&) const;
00056 bool SetFrameID(ID3_FrameID id);
00057 ID3_FrameID GetFrameID() const;
00058 const char* GetTextID() const;
00059 const ID3_FrameDef* GetFrameDef() const;
00060 bool Clear();
00061 ID3_FrameHeader& operator=(const ID3_FrameHeader&);
00062
00063 bool SetCompression(bool b) { return this->SetFlags(COMPRESSION, b); }
00064 bool SetEncryption(bool b) { return this->SetFlags(ENCRYPTION, b); }
00065 bool SetGrouping(bool b) { return this->SetFlags(GROUPING, b); }
00066
00067 bool GetCompression() const { return _flags.test(COMPRESSION); }
00068 bool GetEncryption() const { return _flags.test(ENCRYPTION); }
00069 bool GetGrouping() const { return _flags.test(GROUPING); }
00070 bool GetReadOnly() const { return _flags.test(READONLY); }
00071 void SetUnknownFrame(const char*);
00072
00073 protected:
00074 bool SetFlags(uint16 f, bool b)
00075 {
00076 bool changed = _flags.set(f, b);
00077 _changed = _changed || changed;
00078 return changed;
00079 }
00080
00081
00082
00083 private:
00084 ID3_FrameDef* _frame_def;
00085 bool _dyn_frame_def;
00086 }
00087 ;
00088
00089 #endif