id3lib
3.8.3
src
header_tag.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
// $Id: header_tag.h,v 1.2 2002/07/31 13:20:49 t1mpy Exp $
3
4
// id3lib: a C++ library for creating and manipulating id3v1/v2 tags
5
// Copyright 1999, 2000 Scott Thomas Haug
6
// Copyright 2002 Thijmen Klok (thijmen@id3lib.org)
7
8
// This library is free software; you can redistribute it and/or modify it
9
// under the terms of the GNU Library General Public License as published by
10
// the Free Software Foundation; either version 2 of the License, or (at your
11
// option) any later version.
12
//
13
// This library is distributed in the hope that it will be useful, but WITHOUT
14
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16
// License for more details.
17
//
18
// You should have received a copy of the GNU Library General Public License
19
// along with this library; if not, write to the Free Software Foundation,
20
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22
// The id3lib authors encourage improvements and optimisations to be sent to
23
// the id3lib coordinator. Please see the README file for details on where to
24
// send such submissions. See the AUTHORS file for a list of people who have
25
// contributed to id3lib. See the ChangeLog file for a list of changes to
26
// id3lib. These files are distributed with id3lib at
27
// http://download.sourceforge.net/id3lib/
28
29
#ifndef _ID3LIB_HEADER_TAG_H_
30
#define _ID3LIB_HEADER_TAG_H_
31
32
#include "
header.h
"
33
34
class
ID3_TagHeader
:
public
ID3_Header
35
{
36
public
:
37
38
enum
39
{
40
HEADER_FLAG_UNSYNC
= 1 << 7,
41
HEADER_FLAG_EXTENDED
= 1 << 6,
42
HEADER_FLAG_EXPERIMENTAL
= 1 << 5,
43
HEADER_FLAG_FOOTER
= 1 << 4
44
};
45
46
enum
47
{
48
EXT_HEADER_FLAG_BIT1
= 1 << 7,
49
EXT_HEADER_FLAG_BIT2
= 1 << 6,
50
EXT_HEADER_FLAG_BIT3
= 1 << 5,
51
EXT_HEADER_FLAG_BIT4
= 1 << 4
52
};
53
54
ID3_TagHeader
() :
ID3_Header
() { ; }
55
virtual
~ID3_TagHeader
() { ; }
56
ID3_TagHeader
(
const
ID3_TagHeader
& rhs) :
ID3_Header
() { *
this
= rhs; }
57
58
bool
SetSpec
(
ID3_V2Spec
);
59
size_t
Size
()
const
;
60
void
Render
(
ID3_Writer
&)
const
;
61
bool
Parse
(
ID3_Reader
&);
62
void
ParseExtended
(
ID3_Reader
&);
63
ID3_TagHeader
&
operator=
(
const
ID3_TagHeader
&hdr)
64
{ this->
ID3_Header::operator=
(hdr);
return
*
this
; }
65
66
bool
SetUnsync
(
bool
b)
67
{
68
bool
changed =
_flags
.
set
(
HEADER_FLAG_UNSYNC
, b);
69
_changed
=
_changed
|| changed;
70
return
changed;
71
}
72
bool
GetUnsync
()
const
{
return
_flags
.
test
(
HEADER_FLAG_UNSYNC
); }
73
bool
SetExtended
(
bool
b)
74
{
75
bool
changed =
_flags
.
set
(
HEADER_FLAG_EXTENDED
, b);
76
_changed
=
_changed
|| changed;
77
return
changed;
78
}
79
bool
GetExtended
()
const
{
return
_flags
.
test
(
HEADER_FLAG_EXTENDED
); }
80
bool
SetExperimental
(
bool
b)
81
{
82
bool
changed =
_flags
.
set
(
HEADER_FLAG_EXPERIMENTAL
, b);
83
_changed
=
_changed
|| changed;
84
return
changed;
85
}
86
bool
GetExperimental
()
const
{
return
_flags
.
test
(
HEADER_FLAG_EXPERIMENTAL
); }
87
bool
SetFooter
(
bool
b)
88
{
89
bool
changed =
_flags
.
set
(
HEADER_FLAG_FOOTER
, b);
90
_changed
=
_changed
|| changed;
91
return
changed;
92
}
93
bool
GetFooter
()
const
{
return
_flags
.
test
(
HEADER_FLAG_FOOTER
); }
94
95
// id3v2 tag header signature: $49 44 33 MM mm GG ss ss ss ss
96
// MM = major version (will never be 0xFF)
97
// mm = minor version (will never be 0xFF)
98
// ff = flags byte
99
// ss = size bytes (less than $80)
100
static
const
char
*
const
ID
;
101
enum
102
{
103
ID_SIZE
= 3,
104
MAJOR_OFFSET
= 3,
105
MINOR_OFFSET
= 4,
106
FLAGS_OFFSET
= 5,
107
SIZE_OFFSET
= 6,
108
SIZE
= 10
// does not include extented headers
109
};
110
111
};
112
113
#endif
/* _ID3LIB_HEADER_TAG_H_ */
ID3_Flags::test
bool test(TYPE f) const
Definition
flags.h:42
ID3_Flags::set
bool set(TYPE f)
Definition
flags.h:43
ID3_Header
Definition
header.h:39
ID3_Header::_changed
bool _changed
Definition
header.h:106
ID3_Header::operator=
ID3_Header & operator=(const ID3_Header &rhs)
Definition
header.h:90
ID3_Header::_flags
ID3_Flags _flags
Definition
header.h:104
ID3_Reader
Definition
reader.h:34
ID3_TagHeader
Definition
header_tag.h:35
ID3_TagHeader::ID3_TagHeader
ID3_TagHeader(const ID3_TagHeader &rhs)
Definition
header_tag.h:56
ID3_TagHeader::SetExperimental
bool SetExperimental(bool b)
Definition
header_tag.h:80
ID3_TagHeader::Render
void Render(ID3_Writer &) const
Definition
header_tag.cpp:66
ID3_TagHeader::GetUnsync
bool GetUnsync() const
Definition
header_tag.h:72
ID3_TagHeader::ID3_TagHeader
ID3_TagHeader()
Definition
header_tag.h:54
ID3_TagHeader::Parse
bool Parse(ID3_Reader &)
Definition
header_tag.cpp:101
ID3_TagHeader::operator=
ID3_TagHeader & operator=(const ID3_TagHeader &hdr)
Definition
header_tag.h:63
ID3_TagHeader::ParseExtended
void ParseExtended(ID3_Reader &)
Definition
header_tag.cpp:134
ID3_TagHeader::FLAGS_OFFSET
@ FLAGS_OFFSET
Definition
header_tag.h:106
ID3_TagHeader::MAJOR_OFFSET
@ MAJOR_OFFSET
Definition
header_tag.h:104
ID3_TagHeader::SIZE
@ SIZE
Definition
header_tag.h:108
ID3_TagHeader::ID_SIZE
@ ID_SIZE
Definition
header_tag.h:103
ID3_TagHeader::MINOR_OFFSET
@ MINOR_OFFSET
Definition
header_tag.h:105
ID3_TagHeader::SIZE_OFFSET
@ SIZE_OFFSET
Definition
header_tag.h:107
ID3_TagHeader::ID
static const char *const ID
Definition
header_tag.h:100
ID3_TagHeader::~ID3_TagHeader
virtual ~ID3_TagHeader()
Definition
header_tag.h:55
ID3_TagHeader::SetFooter
bool SetFooter(bool b)
Definition
header_tag.h:87
ID3_TagHeader::Size
size_t Size() const
Definition
header_tag.cpp:53
ID3_TagHeader::GetExtended
bool GetExtended() const
Definition
header_tag.h:79
ID3_TagHeader::GetExperimental
bool GetExperimental() const
Definition
header_tag.h:86
ID3_TagHeader::SetSpec
bool SetSpec(ID3_V2Spec)
Definition
header_tag.cpp:39
ID3_TagHeader::EXT_HEADER_FLAG_BIT4
@ EXT_HEADER_FLAG_BIT4
Definition
header_tag.h:51
ID3_TagHeader::EXT_HEADER_FLAG_BIT2
@ EXT_HEADER_FLAG_BIT2
Definition
header_tag.h:49
ID3_TagHeader::EXT_HEADER_FLAG_BIT1
@ EXT_HEADER_FLAG_BIT1
Definition
header_tag.h:48
ID3_TagHeader::EXT_HEADER_FLAG_BIT3
@ EXT_HEADER_FLAG_BIT3
Definition
header_tag.h:50
ID3_TagHeader::SetExtended
bool SetExtended(bool b)
Definition
header_tag.h:73
ID3_TagHeader::SetUnsync
bool SetUnsync(bool b)
Definition
header_tag.h:66
ID3_TagHeader::HEADER_FLAG_FOOTER
@ HEADER_FLAG_FOOTER
Definition
header_tag.h:43
ID3_TagHeader::HEADER_FLAG_EXPERIMENTAL
@ HEADER_FLAG_EXPERIMENTAL
Definition
header_tag.h:42
ID3_TagHeader::HEADER_FLAG_UNSYNC
@ HEADER_FLAG_UNSYNC
Definition
header_tag.h:40
ID3_TagHeader::HEADER_FLAG_EXTENDED
@ HEADER_FLAG_EXTENDED
Definition
header_tag.h:41
ID3_TagHeader::GetFooter
bool GetFooter() const
Definition
header_tag.h:93
ID3_Writer
Definition
writer.h:34
ID3_V2Spec
ID3_V2Spec
Definition
globals.h:162
header.h
Generated for id3lib by
1.10.0