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
#include "field_impl.h"
00028
#include "id3/utils.h"
00029
#include "io_helpers.h"
00030
00031
using namespace dami;
00032
00047 void ID3_FieldImpl::Set(uint32 val)
00048 {
00049 this->
SetInteger(val);
00050 }
00051
00052 void ID3_FieldImpl::SetInteger(uint32 val)
00053 {
00054
if (this->
GetType() ==
ID3FTY_INTEGER)
00055 {
00056 this->
Clear();
00057
00058 _integer = val;
00059 _changed =
true;
00060 }
00061 }
00062
00072 uint32
ID3_FieldImpl::Get()
const
00073
{
00074
return this->
GetInteger();
00075 }
00076
00077 uint32
ID3_FieldImpl::GetInteger()
const
00078
{
00079 uint32 val = 0;
00080
if (this->
GetType() ==
ID3FTY_INTEGER)
00081 {
00082 val = _integer;
00083 }
00084
return val;
00085 }
00086
00087 bool ID3_FieldImpl::ParseInteger(
ID3_Reader& reader)
00088 {
00089 ID3D_NOTICE(
"ID3_FieldImpl::ParseInteger(): beg = " << reader.
getBeg() );
00090 ID3D_NOTICE(
"ID3_FieldImpl::ParseInteger(): cur = " << reader.
getCur() );
00091 ID3D_NOTICE(
"ID3_FieldImpl::ParseInteger(): end = " << reader.
getEnd() );
00092
bool success =
false;
00093
if (!reader.
atEnd())
00094 {
00095 this->
Clear();
00096 size_t fixed = this->
Size();
00097 size_t nBytes = (fixed > 0) ? fixed :
sizeof(uint32);
00098 this->
Set(io::readBENumber(reader, nBytes));
00099 _changed =
false;
00100 success =
true;
00101 }
00102
return success;
00103 }
00104
00105 void ID3_FieldImpl::RenderInteger(
ID3_Writer& writer)
const
00106
{
00107 io::writeBENumber(writer, _integer, this->Size());
00108 }
00109