Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 8ae7ec6813c5bf60cf058a6da524a0db > files > 104

id3lib-devel-3.8.3-25.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>id3lib: src/field_integer.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="id3lib.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">id3lib&#160;<span id="projectnumber">3.8.3</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>src/field_integer.cpp</h1>  </div>
</div>
<div class="contents">
<a href="field__integer_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// $Id: field_integer.cpp,v 1.21 2002/07/02 22:12:13 t1mpy Exp $</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="comment">// id3lib: a C++ library for creating and manipulating id3v1/v2 tags</span>
<a name="l00004"></a>00004 <span class="comment">// Copyright 1999, 2000  Scott Thomas Haug</span>
<a name="l00005"></a>00005 
<a name="l00006"></a>00006 <span class="comment">// This library is free software; you can redistribute it and/or modify it</span>
<a name="l00007"></a>00007 <span class="comment">// under the terms of the GNU Library General Public License as published by</span>
<a name="l00008"></a>00008 <span class="comment">// the Free Software Foundation; either version 2 of the License, or (at your</span>
<a name="l00009"></a>00009 <span class="comment">// option) any later version.</span>
<a name="l00010"></a>00010 <span class="comment">//</span>
<a name="l00011"></a>00011 <span class="comment">// This library is distributed in the hope that it will be useful, but WITHOUT</span>
<a name="l00012"></a>00012 <span class="comment">// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</span>
<a name="l00013"></a>00013 <span class="comment">// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public</span>
<a name="l00014"></a>00014 <span class="comment">// License for more details.</span>
<a name="l00015"></a>00015 <span class="comment">//</span>
<a name="l00016"></a>00016 <span class="comment">// You should have received a copy of the GNU Library General Public License</span>
<a name="l00017"></a>00017 <span class="comment">// along with this library; if not, write to the Free Software Foundation,</span>
<a name="l00018"></a>00018 <span class="comment">// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="comment">// The id3lib authors encourage improvements and optimisations to be sent to</span>
<a name="l00021"></a>00021 <span class="comment">// the id3lib coordinator.  Please see the README file for details on where to</span>
<a name="l00022"></a>00022 <span class="comment">// send such submissions.  See the AUTHORS file for a list of people who have</span>
<a name="l00023"></a>00023 <span class="comment">// contributed to id3lib.  See the ChangeLog file for a list of changes to</span>
<a name="l00024"></a>00024 <span class="comment">// id3lib.  These files are distributed with id3lib at</span>
<a name="l00025"></a>00025 <span class="comment">// http://download.sourceforge.net/id3lib/</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="field__impl_8h.html">field_impl.h</a>&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;id3/utils.h&quot;</span> <span class="comment">// has &lt;config.h&gt; &quot;id3/id3lib_streams.h&quot; &quot;id3/globals.h&quot; &quot;id3/id3lib_strings.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;io_helpers.h&quot;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="keyword">using namespace </span>dami;
<a name="l00032"></a>00032 
<a name="l00047"></a><a class="code" href="class_i_d3___field_impl.html#a6daa86b940122734d9bee75d7b57d6cf">00047</a> <span class="keywordtype">void</span> <a class="code" href="class_i_d3___field_impl.html#a6daa86b940122734d9bee75d7b57d6cf" title="Sets the value of the field to the specified integer.">ID3_FieldImpl::Set</a>(uint32 val)
<a name="l00048"></a>00048 {
<a name="l00049"></a>00049   this-&gt;SetInteger(val);
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00052"></a><a class="code" href="class_i_d3___field_impl.html#a421dbd80fb2c4f4feceb0c08eee6a94c">00052</a> <span class="keywordtype">void</span> <a class="code" href="class_i_d3___field_impl.html#a421dbd80fb2c4f4feceb0c08eee6a94c">ID3_FieldImpl::SetInteger</a>(uint32 val)
<a name="l00053"></a>00053 {
<a name="l00054"></a>00054   <span class="keywordflow">if</span> (this-&gt;GetType() == <a class="code" href="globals_8h.html#adc0ffe8cf70623e6d4d17092b20bdd6ba0ca8942d094abdf66373a765aba09caa">ID3FTY_INTEGER</a>)
<a name="l00055"></a>00055   {
<a name="l00056"></a>00056     this-&gt;<a class="code" href="class_i_d3___frame_impl.html#a7ba8fcc06571c8e985438be9da08c2cf">Clear</a>();
<a name="l00057"></a>00057     
<a name="l00058"></a>00058     _integer = val;
<a name="l00059"></a>00059     _changed = <span class="keyword">true</span>;
<a name="l00060"></a>00060   }
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 
<a name="l00072"></a><a class="code" href="class_i_d3___field_impl.html#ab0e321c609325a38f29bc279bfb7b2be">00072</a> uint32 <a class="code" href="class_i_d3___field_impl.html#ab0e321c609325a38f29bc279bfb7b2be" title="Returns the value of the integer field.">ID3_FieldImpl::Get</a>()<span class="keyword"> const</span>
<a name="l00073"></a>00073 <span class="keyword"></span>{
<a name="l00074"></a>00074   <span class="keywordflow">return</span> this-&gt;GetInteger();
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 
<a name="l00077"></a><a class="code" href="class_i_d3___field_impl.html#a7b1aeb5f8fcc8266b52c55f2d6258dde">00077</a> uint32 <a class="code" href="class_i_d3___field_impl.html#a7b1aeb5f8fcc8266b52c55f2d6258dde">ID3_FieldImpl::GetInteger</a>()<span class="keyword"> const</span>
<a name="l00078"></a>00078 <span class="keyword"></span>{
<a name="l00079"></a>00079   uint32 val = 0;
<a name="l00080"></a>00080   <span class="keywordflow">if</span> (this-&gt;GetType() == <a class="code" href="globals_8h.html#adc0ffe8cf70623e6d4d17092b20bdd6ba0ca8942d094abdf66373a765aba09caa">ID3FTY_INTEGER</a>)
<a name="l00081"></a>00081   {
<a name="l00082"></a>00082     val = _integer;
<a name="l00083"></a>00083   }
<a name="l00084"></a>00084   <span class="keywordflow">return</span> val;
<a name="l00085"></a>00085 }
<a name="l00086"></a>00086 
<a name="l00087"></a><a class="code" href="class_i_d3___field_impl.html#a150705fc1b3891b6abd06d00dc7f41bc">00087</a> <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___field_impl.html#a150705fc1b3891b6abd06d00dc7f41bc">ID3_FieldImpl::ParseInteger</a>(<a class="code" href="class_i_d3___reader.html">ID3_Reader</a>&amp; reader)
<a name="l00088"></a>00088 {
<a name="l00089"></a>00089   ID3D_NOTICE( <span class="stringliteral">&quot;ID3_FieldImpl::ParseInteger(): beg = &quot;</span> &lt;&lt; reader.<a class="code" href="class_i_d3___reader.html#aeaf468ffe03c08731dcaf268fff3391b" title="Return the beginning position in the reader.">getBeg</a>() );
<a name="l00090"></a>00090   ID3D_NOTICE( <span class="stringliteral">&quot;ID3_FieldImpl::ParseInteger(): cur = &quot;</span> &lt;&lt; reader.<a class="code" href="class_i_d3___reader.html#a232935e138e44ea49e5a289fb8d7ac94" title="Return the current position in the reader.">getCur</a>() );
<a name="l00091"></a>00091   ID3D_NOTICE( <span class="stringliteral">&quot;ID3_FieldImpl::ParseInteger(): end = &quot;</span> &lt;&lt; reader.<a class="code" href="class_i_d3___reader.html#a5872b6813a652d831b770bfb7d65aec8" title="Return the ending position in the reader.">getEnd</a>() );
<a name="l00092"></a>00092   <span class="keywordtype">bool</span> success = <span class="keyword">false</span>;
<a name="l00093"></a>00093   <span class="keywordflow">if</span> (!reader.<a class="code" href="class_i_d3___reader.html#a2d7e9a6e4c4c5f751035ea507c6cadb5">atEnd</a>())
<a name="l00094"></a>00094   {
<a name="l00095"></a>00095     this-&gt;<a class="code" href="class_i_d3___frame_impl.html#a7ba8fcc06571c8e985438be9da08c2cf">Clear</a>();
<a name="l00096"></a>00096     <span class="keywordtype">size_t</span> fixed = this-&gt;<a class="code" href="class_i_d3___frame_impl.html#a2372f07a4f1b05b144ea4a797e679e88">Size</a>();
<a name="l00097"></a>00097     <span class="keywordtype">size_t</span> nBytes = (fixed &gt; 0) ? fixed : <span class="keyword">sizeof</span>(uint32);
<a name="l00098"></a>00098     this-&gt;Set(io::readBENumber(reader, nBytes));
<a name="l00099"></a>00099     _changed = <span class="keyword">false</span>;
<a name="l00100"></a>00100     success = <span class="keyword">true</span>;
<a name="l00101"></a>00101   }
<a name="l00102"></a>00102   <span class="keywordflow">return</span> success;
<a name="l00103"></a>00103 }
<a name="l00104"></a>00104 
<a name="l00105"></a><a class="code" href="class_i_d3___field_impl.html#a6bc25f2a946d1fceaf99b4c5099615d2">00105</a> <span class="keywordtype">void</span> <a class="code" href="class_i_d3___field_impl.html#a6bc25f2a946d1fceaf99b4c5099615d2">ID3_FieldImpl::RenderInteger</a>(<a class="code" href="class_i_d3___writer.html">ID3_Writer</a>&amp; writer)<span class="keyword"> const</span>
<a name="l00106"></a>00106 <span class="keyword"></span>{
<a name="l00107"></a>00107   io::writeBENumber(writer, _integer, this-&gt;<a class="code" href="class_i_d3___frame_impl.html#a2372f07a4f1b05b144ea4a797e679e88">Size</a>());
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109 
</pre></div></div>
</div>
<hr size="1"><address style="text-align: right;"><small>
Generated for id3lib by&nbsp;<a href="http://www.doxygen.org/
index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a>
1.7.3</small></address></body></html>