<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>src/field_integer.cpp Source File</title> <link href="id3lib.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.12 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>src/field_integer.cpp</h1><a href="field__integer_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// $Id: field_integer.cpp,v 1.19 2000/10/29 01:37:28 eldamitri Exp $</font> 00002 00003 <font class="comment">// id3lib: a C++ library for creating and manipulating id3v1/v2 tags</font> 00004 <font class="comment">// Copyright 1999, 2000 Scott Thomas Haug</font> 00005 00006 <font class="comment">// This library is free software; you can redistribute it and/or modify it</font> 00007 <font class="comment">// under the terms of the GNU Library General Public License as published by</font> 00008 <font class="comment">// the Free Software Foundation; either version 2 of the License, or (at your</font> 00009 <font class="comment">// option) any later version.</font> 00010 <font class="comment">//</font> 00011 <font class="comment">// This library is distributed in the hope that it will be useful, but WITHOUT</font> 00012 <font class="comment">// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</font> 00013 <font class="comment">// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public</font> 00014 <font class="comment">// License for more details.</font> 00015 <font class="comment">//</font> 00016 <font class="comment">// You should have received a copy of the GNU Library General Public License</font> 00017 <font class="comment">// along with this library; if not, write to the Free Software Foundation,</font> 00018 <font class="comment">// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font> 00019 00020 <font class="comment">// The id3lib authors encourage improvements and optimisations to be sent to</font> 00021 <font class="comment">// the id3lib coordinator. Please see the README file for details on where to</font> 00022 <font class="comment">// send such submissions. See the AUTHORS file for a list of people who have</font> 00023 <font class="comment">// contributed to id3lib. See the ChangeLog file for a list of changes to</font> 00024 <font class="comment">// id3lib. These files are distributed with id3lib at</font> 00025 <font class="comment">// http://download.sourceforge.net/id3lib/</font> 00026 00027 <font class="preprocessor">#if defined HAVE_CONFIG_H</font> 00028 <font class="preprocessor"></font><font class="preprocessor">#include <config.h></font> 00029 <font class="preprocessor">#endif</font> 00030 <font class="preprocessor"></font> 00031 00032 <font class="preprocessor">#include "<a class="code" href="field__impl_8h.html">field_impl.h</a>"</font> 00033 <font class="preprocessor">#include "utils.h"</font> 00034 <font class="preprocessor">#include "io_helpers.h"</font> 00035 00036 <font class="keyword">using</font> <font class="keyword">namespace </font>dami; 00037 <a name="l00052"></a><a class="code" href="class_i_d3___field_impl.html#a6">00052</a> <font class="keywordtype">void</font> <a class="code" href="class_i_d3___field_impl.html#a6">ID3_FieldImpl::Set</a>(<a class="code" href="sized__types_8h.html#a4">uint32</a> val) 00053 { 00054 this-><a class="code" href="class_i_d3___field_impl.html#a8">SetInteger</a>(val); 00055 } 00056 <a name="l00057"></a><a class="code" href="class_i_d3___field_impl.html#a8">00057</a> <font class="keywordtype">void</font> <a class="code" href="class_i_d3___field_impl.html#a8">ID3_FieldImpl::SetInteger</a>(<a class="code" href="sized__types_8h.html#a4">uint32</a> val) 00058 { 00059 <font class="keywordflow">if</font> (this-><a class="code" href="class_i_d3___field_impl.html#a39">GetType</a>() == <a class="code" href="globals_8h.html#a222a187">ID3FTY_INTEGER</a>) 00060 { 00061 this-><a class="code" href="class_i_d3___field_impl.html#a1">Clear</a>(); 00062 00063 _integer = val; 00064 _changed = <font class="keyword">true</font>; 00065 } 00066 } 00067 <a name="l00077"></a><a class="code" href="class_i_d3___field_impl.html#a7">00077</a> <a class="code" href="sized__types_8h.html#a4">uint32</a> <a class="code" href="class_i_d3___field_impl.html#a7">ID3_FieldImpl::Get</a>()<font class="keyword"> const</font> 00078 <font class="keyword"></font>{ 00079 <font class="keywordflow">return</font> this-><a class="code" href="class_i_d3___field_impl.html#a9">GetInteger</a>(); 00080 } 00081 <a name="l00082"></a><a class="code" href="class_i_d3___field_impl.html#a9">00082</a> <a class="code" href="sized__types_8h.html#a4">uint32</a> <a class="code" href="class_i_d3___field_impl.html#a9">ID3_FieldImpl::GetInteger</a>()<font class="keyword"> const</font> 00083 <font class="keyword"></font>{ 00084 <a class="code" href="sized__types_8h.html#a4">uint32</a> val = 0; 00085 <font class="keywordflow">if</font> (this-><a class="code" href="class_i_d3___field_impl.html#a39">GetType</a>() == <a class="code" href="globals_8h.html#a222a187">ID3FTY_INTEGER</a>) 00086 { 00087 val = _integer; 00088 } 00089 <font class="keywordflow">return</font> val; 00090 } 00091 <a name="l00092"></a><a class="code" href="class_i_d3___field_impl.html#b3">00092</a> <font class="keywordtype">bool</font> <a class="code" href="class_i_d3___field_impl.html#b3">ID3_FieldImpl::ParseInteger</a>(<a class="code" href="class_i_d3___reader.html">ID3_Reader</a>& reader) 00093 { 00094 ID3D_NOTICE( <font class="stringliteral">"ID3_FieldImpl::ParseInteger(): beg = "</font> << reader.<a class="code" href="class_i_d3___reader.html#a1">getBeg</a>() ); 00095 ID3D_NOTICE( <font class="stringliteral">"ID3_FieldImpl::ParseInteger(): cur = "</font> << reader.<a class="code" href="class_i_d3___reader.html#a3">getCur</a>() ); 00096 ID3D_NOTICE( <font class="stringliteral">"ID3_FieldImpl::ParseInteger(): end = "</font> << reader.<a class="code" href="class_i_d3___reader.html#a2">getEnd</a>() ); 00097 <font class="keywordtype">bool</font> success = <font class="keyword">false</font>; 00098 <font class="keywordflow">if</font> (!reader.<a class="code" href="class_i_d3___reader.html#a11">atEnd</a>()) 00099 { 00100 this-><a class="code" href="class_i_d3___field_impl.html#a1">Clear</a>(); 00101 size_t fixed = this-><a class="code" href="class_i_d3___field_impl.html#a2">Size</a>(); 00102 size_t nBytes = (fixed > 0) ? fixed : <font class="keyword">sizeof</font>(uint32); 00103 this-><a class="code" href="class_i_d3___field_impl.html#a6">Set</a>(io::readBENumber(reader, nBytes)); 00104 _changed = <font class="keyword">false</font>; 00105 success = <font class="keyword">true</font>; 00106 } 00107 <font class="keywordflow">return</font> success; 00108 } 00109 <a name="l00110"></a><a class="code" href="class_i_d3___field_impl.html#b0">00110</a> <font class="keywordtype">void</font> <a class="code" href="class_i_d3___field_impl.html#b0">ID3_FieldImpl::RenderInteger</a>(<a class="code" href="class_i_d3___writer.html">ID3_Writer</a>& writer)<font class="keyword"> const</font> 00111 <font class="keyword"></font>{ 00112 io::writeBENumber(writer, _integer, this->Size()); 00113 } </pre></div><hr><address><small>Generated on Thu Jan 3 07:35:55 2002 for id3lib by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.12 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>