Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 2c9d30f3cf217a6cae41860ebc0d6704 > files > 165

libid3lib3.8_0-devel-3.8.0-0.pre2.1.1mdk.i586.rpm

<!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>include/id3/reader.h 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> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>include/id3/reader.h</h1><a href="reader_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// -*- C++ -*-</font>
00002 <font class="comment">// $Id: reader.h,v 1.11 2001/07/30 18:22:53 abscess Exp $</font>
00003 
00004 <font class="comment">// id3lib: a software library for creating and manipulating id3v1/v2 tags</font>
00005 <font class="comment">// Copyright 1999, 2000  Scott Thomas Haug</font>
00006 
00007 <font class="comment">// This library is free software; you can redistribute it and/or modify it</font>
00008 <font class="comment">// under the terms of the GNU Library General Public License as published by</font>
00009 <font class="comment">// the Free Software Foundation; either version 2 of the License, or (at your</font>
00010 <font class="comment">// option) any later version.</font>
00011 <font class="comment">//</font>
00012 <font class="comment">// This library is distributed in the hope that it will be useful, but WITHOUT</font>
00013 <font class="comment">// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</font>
00014 <font class="comment">// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public</font>
00015 <font class="comment">// License for more details.</font>
00016 <font class="comment">//</font>
00017 <font class="comment">// You should have received a copy of the GNU Library General Public License</font>
00018 <font class="comment">// along with this library; if not, write to the Free Software Foundation,</font>
00019 <font class="comment">// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font>
00020 
00021 <font class="comment">// The id3lib authors encourage improvements and optimisations to be sent to</font>
00022 <font class="comment">// the id3lib coordinator.  Please see the README file for details on where to</font>
00023 <font class="comment">// send such submissions.  See the AUTHORS file for a list of people who have</font>
00024 <font class="comment">// contributed to id3lib.  See the ChangeLog file for a list of changes to</font>
00025 <font class="comment">// id3lib.  These files are distributed with id3lib at</font>
00026 <font class="comment">// http://download.sourceforge.net/id3lib/</font>
00027 
00028 <font class="preprocessor">#ifndef _ID3LIB_READER_H_</font>
00029 <font class="preprocessor"></font><font class="preprocessor">#define _ID3LIB_READER_H_</font>
00030 <font class="preprocessor"></font>
00031 <font class="preprocessor">#include &lt;<a class="code" href="globals_8h.html">id3/globals.h</a>&gt;</font>
00032 
<a name="l00033"></a><a class="code" href="class_i_d3___reader.html">00033</a> <font class="keyword">class </font><a class="code" href="globals_8h.html#a1">ID3_CPP_EXPORT</a> <a class="code" href="class_i_d3___reader.html">ID3_Reader</a>
00034 {
00035  <font class="keyword">public</font>:
<a name="l00036"></a><a class="code" href="class_i_d3___reader.html#s0">00036</a>   <font class="keyword">typedef</font> <a class="code" href="sized__types_8h.html#a4">uint32</a> size_type;
<a name="l00037"></a><a class="code" href="class_i_d3___reader.html#s1">00037</a>   <font class="keyword">typedef</font> <a class="code" href="sized__types_8h.html#a0">uint8</a>  char_type;
<a name="l00038"></a><a class="code" href="class_i_d3___reader.html#s2">00038</a>   <font class="keyword">typedef</font> <a class="code" href="sized__types_8h.html#a4">uint32</a> pos_type;
<a name="l00039"></a><a class="code" href="class_i_d3___reader.html#s3">00039</a>   <font class="keyword">typedef</font>  <a class="code" href="sized__types_8h.html#a5">int32</a> off_type;
<a name="l00040"></a><a class="code" href="class_i_d3___reader.html#s4">00040</a>   <font class="keyword">typedef</font>  <a class="code" href="sized__types_8h.html#a3">int16</a> int_type;
00041   <font class="keyword">static</font> <font class="keyword">const</font> int_type END_OF_READER;
00042   
00045   <font class="keyword">virtual</font> <font class="keywordtype">void</font> close() = 0;
00046 
<a name="l00048"></a><a class="code" href="class_i_d3___reader.html#a1">00048</a>   <font class="keyword">virtual</font> pos_type getBeg() { <font class="keywordflow">return</font> static_cast&lt;pos_type&gt;(0); }
00049 
<a name="l00051"></a><a class="code" href="class_i_d3___reader.html#a2">00051</a>   <font class="keyword">virtual</font> pos_type getEnd() { <font class="keywordflow">return</font> static_cast&lt;pos_type&gt;(-1); }
00052 
00054   <font class="keyword">virtual</font> pos_type getCur() = 0;
00055 
00058   <font class="keyword">virtual</font> pos_type setCur(pos_type pos) = 0;
00059 
<a name="l00065"></a><a class="code" href="class_i_d3___reader.html#a5">00065</a>   <font class="keyword">virtual</font> int_type readChar() 
00066   {
00067     <font class="keywordflow">if</font> (this-&gt;atEnd())
00068     { 
00069       <font class="keywordflow">return</font> END_OF_READER; 
00070     }
00071     char_type ch;
00072     this-&gt;readChars(&amp;ch, 1);
00073     <font class="keywordflow">return</font> ch;
00074   }
00075 
00080   <font class="keyword">virtual</font> int_type peekChar() = 0;
00081   
00087   <font class="keyword">virtual</font> size_type readChars(char_type buf[], size_type len) = 0;
<a name="l00088"></a><a class="code" href="class_i_d3___reader.html#a8">00088</a>   <font class="keyword">virtual</font> size_type readChars(<font class="keywordtype">char</font> buf[], size_type len)
00089   {
00090     <font class="keywordflow">return</font> this-&gt;readChars(reinterpret_cast&lt;char_type *&gt;(buf), len);
00091   }
00092   
<a name="l00097"></a><a class="code" href="class_i_d3___reader.html#a9">00097</a>   <font class="keyword">virtual</font> size_type skipChars(size_type len)
00098   {
00099     <font class="keyword">const</font> size_type SIZE = 1024;
00100     char_type bytes[SIZE];
00101     size_type remaining = len;
00102     <font class="keywordflow">while</font> (!this-&gt;atEnd() &amp;&amp; remaining &gt; 0)
00103     {
00104       remaining -= this-&gt;readChars(bytes, (remaining &lt; SIZE ? remaining : SIZE));
00105     }
00106     <font class="keywordflow">return</font> len - remaining;
00107   }
00108 
<a name="l00109"></a><a class="code" href="class_i_d3___reader.html#a10">00109</a>   <font class="keyword">virtual</font> size_type remainingBytes()
00110   {
00111     pos_type end = this-&gt;getEnd(), cur = this-&gt;getCur();
00112     <font class="keywordflow">if</font> (end == pos_type(-1))
00113     {
00114       <font class="keywordflow">return</font> size_type(-1);
00115     }
00116     
00117     <font class="keywordflow">if</font> (end &gt;= cur)
00118     {
00119       <font class="keywordflow">return</font> end - cur;
00120     }
00121     
00122     <font class="keywordflow">return</font> 0;
00123   }
00124   
<a name="l00125"></a><a class="code" href="class_i_d3___reader.html#a11">00125</a>   <font class="keyword">virtual</font> <font class="keywordtype">bool</font> atEnd() { <font class="keywordflow">return</font> this-&gt;getCur() &gt;= this-&gt;getEnd(); }
00126 };
00127 
00128 <font class="preprocessor">#endif </font><font class="comment">/* _ID3LIB_READER_H_ */</font>
</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>,
 &copy;&nbsp;1997-2001</small></address>
</body>
</html>