id3lib
3.8.3
Main Page
Namespaces
Classes
Files
File List
File Members
src
field_integer.cpp
Go to the documentation of this file.
1
// $Id: field_integer.cpp,v 1.21 2002/07/02 22:12:13 t1mpy Exp $
2
3
// id3lib: a C++ library for creating and manipulating id3v1/v2 tags
4
// Copyright 1999, 2000 Scott Thomas Haug
5
6
// This library is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Library General Public License as published by
8
// the Free Software Foundation; either version 2 of the License, or (at your
9
// option) any later version.
10
//
11
// This library is distributed in the hope that it will be useful, but WITHOUT
12
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14
// License for more details.
15
//
16
// You should have received a copy of the GNU Library General Public License
17
// along with this library; if not, write to the Free Software Foundation,
18
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20
// The id3lib authors encourage improvements and optimisations to be sent to
21
// the id3lib coordinator. Please see the README file for details on where to
22
// send such submissions. See the AUTHORS file for a list of people who have
23
// contributed to id3lib. See the ChangeLog file for a list of changes to
24
// id3lib. These files are distributed with id3lib at
25
// http://download.sourceforge.net/id3lib/
26
27
#include "
field_impl.h
"
28
#include "id3/utils.h"
// has <config.h> "id3/id3lib_streams.h" "id3/globals.h" "id3/id3lib_strings.h"
29
#include "io_helpers.h"
30
31
using namespace
dami;
32
47
void
ID3_FieldImpl::Set
(uint32 val)
48
{
49
this->SetInteger(val);
50
}
51
52
void
ID3_FieldImpl::SetInteger
(uint32 val)
53
{
54
if
(this->GetType() ==
ID3FTY_INTEGER
)
55
{
56
this->
Clear
();
57
58
_integer = val;
59
_changed =
true
;
60
}
61
}
62
72
uint32
ID3_FieldImpl::Get
()
const
73
{
74
return
this->GetInteger();
75
}
76
77
uint32
ID3_FieldImpl::GetInteger
()
const
78
{
79
uint32 val = 0;
80
if
(this->GetType() ==
ID3FTY_INTEGER
)
81
{
82
val = _integer;
83
}
84
return
val;
85
}
86
87
bool
ID3_FieldImpl::ParseInteger
(
ID3_Reader
& reader)
88
{
89
ID3D_NOTICE(
"ID3_FieldImpl::ParseInteger(): beg = "
<< reader.
getBeg
() );
90
ID3D_NOTICE(
"ID3_FieldImpl::ParseInteger(): cur = "
<< reader.
getCur
() );
91
ID3D_NOTICE(
"ID3_FieldImpl::ParseInteger(): end = "
<< reader.
getEnd
() );
92
bool
success =
false
;
93
if
(!reader.
atEnd
())
94
{
95
this->
Clear
();
96
size_t
fixed = this->
Size
();
97
size_t
nBytes = (fixed > 0) ? fixed :
sizeof
(uint32);
98
this->Set(io::readBENumber(reader, nBytes));
99
_changed =
false
;
100
success =
true
;
101
}
102
return
success;
103
}
104
105
void
ID3_FieldImpl::RenderInteger
(
ID3_Writer
& writer)
const
106
{
107
io::writeBENumber(writer, _integer, this->
Size
());
108
}
109
Generated for id3lib by
1.8.1.2