id3lib
3.8.3
|
00001 // -*- C++ -*- 00002 // $Id: header_frame.h,v 1.2 2002/07/05 12:31:15 t1mpy Exp $ 00003 00004 // id3lib: a C++ library for creating and manipulating id3v1/v2 tags 00005 // Copyright 1999, 2000 Scott Thomas Haug 00006 00007 // This library is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU Library General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or (at your 00010 // option) any later version. 00011 // 00012 // This library is distributed in the hope that it will be useful, but WITHOUT 00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00015 // License for more details. 00016 // 00017 // You should have received a copy of the GNU Library General Public License 00018 // along with this library; if not, write to the Free Software Foundation, 00019 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 00021 // The id3lib authors encourage improvements and optimisations to be sent to 00022 // the id3lib coordinator. Please see the README file for details on where to 00023 // send such submissions. See the AUTHORS file for a list of people who have 00024 // contributed to id3lib. See the ChangeLog file for a list of changes to 00025 // id3lib. These files are distributed with id3lib at 00026 // http://download.sourceforge.net/id3lib/ 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 // following is moved to public due to bug unknownframes corrupting a tag 00081 // void SetUnknownFrame(const char*); 00082 00083 private: 00084 ID3_FrameDef* _frame_def; 00085 bool _dyn_frame_def; 00086 } 00087 ; 00088 00089 #endif /* _ID3LIB_HEADER_FRAME_ */