id3lib 3.8.3

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

header_frame.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: header_frame.h,v 1.2 2002/07/05 12:31:15 t1mpy Exp $
3
4 // id3lib: a C++ library for creating and manipulating id3v1/v2 tags
5 // Copyright 1999, 2000 Scott Thomas Haug
6
7 // This library is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU Library General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or (at your
10 // option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public License
18 // along with this library; if not, write to the Free Software Foundation,
19 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 // The id3lib authors encourage improvements and optimisations to be sent to
22 // the id3lib coordinator. Please see the README file for details on where to
23 // send such submissions. See the AUTHORS file for a list of people who have
24 // contributed to id3lib. See the ChangeLog file for a list of changes to
25 // id3lib. These files are distributed with id3lib at
26 // http://download.sourceforge.net/id3lib/
27
28 #ifndef _ID3LIB_HEADER_FRAME_H_
29 #define _ID3LIB_HEADER_FRAME_H_
30
31 #include "header.h"
32 #include "field.h"
33
34 struct ID3_FrameDef;
35
36 class ID3_FrameHeader : public ID3_Header
37 {
38 public:
39
40 enum
41 {
42 TAGALTER = 1 << 15,
43 FILEALTER = 1 << 14,
44 READONLY = 1 << 13,
45 COMPRESSION = 1 << 7,
46 ENCRYPTION = 1 << 6,
47 GROUPING = 1 << 5
48 };
49
50 ID3_FrameHeader() : _frame_def(NULL), _dyn_frame_def(false) { ; }
51 virtual ~ID3_FrameHeader() { this->Clear(); }
52
53 /* */ size_t Size() const;
54 /* */ bool Parse(ID3_Reader&);
55 /* */ void Render(ID3_Writer&) const;
56 /* */ bool SetFrameID(ID3_FrameID id);
57 /* */ ID3_FrameID GetFrameID() const;
58 const char* GetTextID() const;
59 const ID3_FrameDef* GetFrameDef() const;
60 /* */ bool Clear();
61 ID3_FrameHeader& operator=(const ID3_FrameHeader&);
62
63 bool SetCompression(bool b) { return this->SetFlags(COMPRESSION, b); }
64 bool SetEncryption(bool b) { return this->SetFlags(ENCRYPTION, b); }
65 bool SetGrouping(bool b) { return this->SetFlags(GROUPING, b); }
66
67 bool GetCompression() const { return _flags.test(COMPRESSION); }
68 bool GetEncryption() const { return _flags.test(ENCRYPTION); }
69 bool GetGrouping() const { return _flags.test(GROUPING); }
70 bool GetReadOnly() const { return _flags.test(READONLY); }
71 void SetUnknownFrame(const char*);
72
73 protected:
74 bool SetFlags(uint16 f, bool b)
75 {
76 bool changed = _flags.set(f, b);
77 _changed = _changed || changed;
78 return changed;
79 }
80 // following is moved to public due to bug unknownframes corrupting a tag
81 // void SetUnknownFrame(const char*);
82
83 private:
84 ID3_FrameDef* _frame_def;
85 bool _dyn_frame_def;
86 }
87 ;
88
89 #endif /* _ID3LIB_HEADER_FRAME_ */
ID3_FrameHeader::SetFrameID
bool SetFrameID(ID3_FrameID id)
Definition: header_frame.cpp:65
ID3_FrameHeader::ENCRYPTION
Definition: header_frame.h:46
ID3_Flags::test
bool test(TYPE f) const
Definition: flags.h:42
ID3_FrameHeader::GetCompression
bool GetCompression() const
Definition: header_frame.h:67
header.h
ID3_FrameDef
Definition: frame_def.h:36
ID3_FrameHeader::SetGrouping
bool SetGrouping(bool b)
Definition: header_frame.h:65
ID3_FrameHeader::operator=
ID3_FrameHeader & operator=(const ID3_FrameHeader &)
Definition: header_frame.cpp:180
ID3_FrameHeader::ID3_FrameHeader
ID3_FrameHeader()
Definition: header_frame.h:50
ID3_FrameHeader::SetFlags
bool SetFlags(uint16 f, bool b)
Definition: header_frame.h:74
ID3_FrameHeader::FILEALTER
Definition: header_frame.h:43
ID3_FrameHeader::GetReadOnly
bool GetReadOnly() const
Definition: header_frame.h:70
ID3_FrameHeader::COMPRESSION
Definition: header_frame.h:45
ID3_FrameHeader::GetFrameID
ID3_FrameID GetFrameID() const
Definition: header_frame.cpp:209
ID3_FrameHeader::GetGrouping
bool GetGrouping() const
Definition: header_frame.h:69
ID3_FrameHeader::Size
size_t Size() const
Definition: header_frame.cpp:79
ID3_FrameHeader::Clear
bool Clear()
Definition: header_frame.cpp:225
ID3_FrameHeader::Parse
bool Parse(ID3_Reader &)
Definition: header_frame.cpp:91
ID3_Flags::set
bool set(TYPE f)
Definition: flags.h:43
ID3_FrameID
ID3_FrameID
Enumeration of the different types of frames recognized by id3lib.
Definition: globals.h:229
ID3_FrameHeader::SetCompression
bool SetCompression(bool b)
Definition: header_frame.h:63
ID3_FrameHeader::~ID3_FrameHeader
virtual ~ID3_FrameHeader()
Definition: header_frame.h:51
ID3_FrameHeader::TAGALTER
Definition: header_frame.h:42
ID3_FrameHeader::GetEncryption
bool GetEncryption() const
Definition: header_frame.h:68
ID3_Reader
Definition: reader.h:33
ID3_FrameHeader::SetEncryption
bool SetEncryption(bool b)
Definition: header_frame.h:64
ID3_FrameHeader
Definition: header_frame.h:36
ID3_FrameHeader::Render
void Render(ID3_Writer &) const
Definition: header_frame.cpp:135
ID3_FrameHeader::GetFrameDef
const ID3_FrameDef * GetFrameDef() const
Definition: header_frame.cpp:220
field.h
NULL
#define NULL
Definition: globals.h:743
ID3_FrameHeader::SetUnknownFrame
void SetUnknownFrame(const char *)
Definition: header_frame.cpp:38
ID3_Header::_changed
bool _changed
Definition: header.h:106
ID3_Writer
Definition: writer.h:33
ID3_FrameHeader::GROUPING
Definition: header_frame.h:47
ID3_FrameHeader::GetTextID
const char * GetTextID() const
Definition: header_frame.cpp:163
ID3_Header::_flags
ID3_Flags _flags
Definition: header.h:104
ID3_Header
Definition: header.h:38
ID3_FrameHeader::READONLY
Definition: header_frame.h:44