<!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/frame_impl.h 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 <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 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 List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <h1>src/frame_impl.h</h1> </div> </div> <div class="contents"> <a href="frame__impl_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- C++ -*-</span> <a name="l00002"></a>00002 <span class="comment">// $Id: frame_impl.h,v 1.6 2002/08/10 10:50:31 t1mpy Exp $</span> <a name="l00003"></a>00003 <a name="l00004"></a>00004 <span class="comment">// id3lib: a C++ library for creating and manipulating id3v1/v2 tags</span> <a name="l00005"></a>00005 <span class="comment">// Copyright 1999, 2000 Scott Thomas Haug</span> <a name="l00006"></a>00006 <span class="comment">// Copyright 2002 Thijmen Klok (thijmen@id3lib.org)</span> <a name="l00007"></a>00007 <a name="l00008"></a>00008 <span class="comment">// This library is free software; you can redistribute it and/or modify it</span> <a name="l00009"></a>00009 <span class="comment">// under the terms of the GNU Library General Public License as published by</span> <a name="l00010"></a>00010 <span class="comment">// the Free Software Foundation; either version 2 of the License, or (at your</span> <a name="l00011"></a>00011 <span class="comment">// option) any later version.</span> <a name="l00012"></a>00012 <span class="comment">//</span> <a name="l00013"></a>00013 <span class="comment">// This library is distributed in the hope that it will be useful, but WITHOUT</span> <a name="l00014"></a>00014 <span class="comment">// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or</span> <a name="l00015"></a>00015 <span class="comment">// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public</span> <a name="l00016"></a>00016 <span class="comment">// License for more details.</span> <a name="l00017"></a>00017 <span class="comment">//</span> <a name="l00018"></a>00018 <span class="comment">// You should have received a copy of the GNU Library General Public License</span> <a name="l00019"></a>00019 <span class="comment">// along with this library; if not, write to the Free Software Foundation,</span> <a name="l00020"></a>00020 <span class="comment">// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="comment">// The id3lib authors encourage improvements and optimisations to be sent to</span> <a name="l00023"></a>00023 <span class="comment">// the id3lib coordinator. Please see the README file for details on where to</span> <a name="l00024"></a>00024 <span class="comment">// send such submissions. See the AUTHORS file for a list of people who have</span> <a name="l00025"></a>00025 <span class="comment">// contributed to id3lib. See the ChangeLog file for a list of changes to</span> <a name="l00026"></a>00026 <span class="comment">// id3lib. These files are distributed with id3lib at</span> <a name="l00027"></a>00027 <span class="comment">// http://download.sourceforge.net/id3lib/</span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="preprocessor">#ifndef _ID3LIB_FRAME_IMPL_H_</span> <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define _ID3LIB_FRAME_IMPL_H_</span> <a name="l00031"></a>00031 <span class="preprocessor"></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <vector></span> <a name="l00033"></a>00033 <span class="preprocessor">#ifndef HAVE_BITSET</span> <a name="l00034"></a>00034 <span class="preprocessor"></span><span class="preprocessor">#include "id3/id3lib_bitset"</span> <a name="l00035"></a>00035 <span class="preprocessor">#else</span> <a name="l00036"></a>00036 <span class="preprocessor"></span><span class="preprocessor">#include <bitset></span> <a name="l00037"></a>00037 <span class="preprocessor">#endif</span> <a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#include "id3/id3lib_frame.h"</span> <a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="header__frame_8h.html">header_frame.h</a>"</span> <a name="l00040"></a>00040 <a name="l00041"></a><a class="code" href="class_i_d3___frame_impl.html">00041</a> <span class="keyword">class </span><a class="code" href="class_i_d3___frame_impl.html">ID3_FrameImpl</a> <a name="l00042"></a>00042 { <a name="l00043"></a>00043 <span class="keyword">typedef</span> std::bitset<ID3FN_LASTFIELDID> Bitset; <a name="l00044"></a>00044 <span class="keyword">typedef</span> std::vector<ID3_Field *> Fields; <a name="l00045"></a>00045 <span class="keyword">public</span>: <a name="l00046"></a><a class="code" href="class_i_d3___frame_impl.html#a80495c05f7130edef63f8d8744c7b52e">00046</a> <span class="keyword">typedef</span> Fields::iterator <a class="code" href="class_i_d3___frame_impl.html#a80495c05f7130edef63f8d8744c7b52e">iterator</a>; <a name="l00047"></a><a class="code" href="class_i_d3___frame_impl.html#adc61cf92dc24bb5cda53f141d28349a9">00047</a> <span class="keyword">typedef</span> Fields::const_iterator <a class="code" href="class_i_d3___frame_impl.html#adc61cf92dc24bb5cda53f141d28349a9">const_iterator</a>; <a name="l00048"></a>00048 <span class="keyword">public</span>: <a name="l00049"></a>00049 <a class="code" href="class_i_d3___frame_impl.html#a42e47849c1428d0dcadcb2007d23dec5">ID3_FrameImpl</a>(<a class="code" href="globals_8h.html#a78f454bf66f16b1e1c9f8e37bda9ab8a" title="Enumeration of the different types of frames recognized by id3lib.">ID3_FrameID</a> <span class="keywordtype">id</span> = <a class="code" href="globals_8h.html#a78f454bf66f16b1e1c9f8e37bda9ab8aac969f7fe3c50b9d87efdf0ad15c3802c" title="No known frame.">ID3FID_NOFRAME</a>); <a name="l00050"></a>00050 <a class="code" href="class_i_d3___frame_impl.html#a42e47849c1428d0dcadcb2007d23dec5">ID3_FrameImpl</a>(<span class="keyword">const</span> <a class="code" href="class_i_d3___frame_header.html">ID3_FrameHeader</a>&); <a name="l00051"></a>00051 <a class="code" href="class_i_d3___frame_impl.html#a42e47849c1428d0dcadcb2007d23dec5">ID3_FrameImpl</a>(<span class="keyword">const</span> <a class="code" href="class_i_d3___frame.html" title="The representative class of an id3v2 frame.">ID3_Frame</a>&); <a name="l00052"></a>00052 <a name="l00054"></a>00054 <span class="keyword">virtual</span> <a class="code" href="class_i_d3___frame_impl.html#acbd2b33663ca30d01160b35f242bb565" title="Destructor.">~ID3_FrameImpl</a>(); <a name="l00055"></a>00055 <a name="l00056"></a>00056 <span class="keywordtype">void</span> <a class="code" href="class_i_d3___frame_impl.html#a7ba8fcc06571c8e985438be9da08c2cf">Clear</a>(); <a name="l00057"></a>00057 <a name="l00058"></a>00058 <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#af6ef5475711f6c07785d191e8df16296">SetID</a>(<a class="code" href="globals_8h.html#a78f454bf66f16b1e1c9f8e37bda9ab8a" title="Enumeration of the different types of frames recognized by id3lib.">ID3_FrameID</a> <span class="keywordtype">id</span>); <a name="l00059"></a><a class="code" href="class_i_d3___frame_impl.html#ad31a62ad3c8e53b4f9ba497e72e83666">00059</a> <a class="code" href="globals_8h.html#a78f454bf66f16b1e1c9f8e37bda9ab8a" title="Enumeration of the different types of frames recognized by id3lib.">ID3_FrameID</a> <a class="code" href="class_i_d3___frame_impl.html#ad31a62ad3c8e53b4f9ba497e72e83666">GetID</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _hdr.<a class="code" href="class_i_d3___frame_header.html#aa5067d517830abcf1ca6bfe27eca8bee">GetFrameID</a>(); } <a name="l00060"></a>00060 <a name="l00061"></a>00061 <a class="code" href="class_i_d3___field.html" title="The representative class of an ID3v2 field.">ID3_Field</a>* <a class="code" href="class_i_d3___frame_impl.html#a315f2eabeba76bb366f45dd41a48b23f">GetField</a>(<a class="code" href="globals_8h.html#a23cab982426a968437cd731900cfeb2c" title="Enumeration of the different types of fields in a frame.">ID3_FieldID</a> name) <span class="keyword">const</span>; <a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="keywordtype">size_t</span> <a class="code" href="class_i_d3___frame_impl.html#af5c9dfa8a685010b1b45e3a4688b2e32">NumFields</a>() <span class="keyword">const</span>; <a name="l00064"></a>00064 <a name="l00065"></a>00065 <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="class_i_d3___frame_impl.html#a67eb21dda8f934b2698e58216cc8077e">GetDescription</a>() <span class="keyword">const</span>; <a name="l00066"></a>00066 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="class_i_d3___frame_impl.html#a67eb21dda8f934b2698e58216cc8077e">GetDescription</a>(<a class="code" href="globals_8h.html#a78f454bf66f16b1e1c9f8e37bda9ab8a" title="Enumeration of the different types of frames recognized by id3lib.">ID3_FrameID</a>); <a name="l00067"></a>00067 <a name="l00068"></a><a class="code" href="class_i_d3___frame_impl.html#adf959f2f5489cbef2dfcbdad0b427b0e">00068</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="class_i_d3___frame_impl.html#adf959f2f5489cbef2dfcbdad0b427b0e">GetTextID</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _hdr.<a class="code" href="class_i_d3___frame_header.html#af536921b0d4f7d7b0f709d6a7f3c7f9e">GetTextID</a>(); } <a name="l00069"></a>00069 <a name="l00070"></a>00070 <a class="code" href="class_i_d3___frame_impl.html">ID3_FrameImpl</a>& <a class="code" href="class_i_d3___frame_impl.html#ae360925281c1809253417a2c447ae70a">operator=</a>(<span class="keyword">const</span> <a class="code" href="class_i_d3___frame.html" title="The representative class of an id3v2 frame.">ID3_Frame</a> &); <a name="l00071"></a>00071 <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#a57f26c0eeb420a0e583d7faf88e2ae27">HasChanged</a>() <span class="keyword">const</span>; <a name="l00072"></a>00072 <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#a050d985eec9e212ff6d7012688441e1b">Parse</a>(<a class="code" href="class_i_d3___reader.html">ID3_Reader</a>&); <a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="class_i_d3___frame_impl.html#a9046ef19126c73c1b767aed994b3d2ed">Render</a>(<a class="code" href="class_i_d3___writer.html">ID3_Writer</a>&) <span class="keyword">const</span>; <a name="l00074"></a>00074 <span class="keywordtype">size_t</span> <a class="code" href="class_i_d3___frame_impl.html#a2372f07a4f1b05b144ea4a797e679e88">Size</a>(); <a name="l00075"></a><a class="code" href="class_i_d3___frame_impl.html#aec53f6a3380fc45bdcef9e3a48cec5af">00075</a> <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#aec53f6a3380fc45bdcef9e3a48cec5af">Contains</a>(<a class="code" href="globals_8h.html#a23cab982426a968437cd731900cfeb2c" title="Enumeration of the different types of fields in a frame.">ID3_FieldID</a> fld)<span class="keyword"> const</span> <a name="l00076"></a>00076 <span class="keyword"> </span>{ <span class="keywordflow">return</span> _bitset.test(fld); } <a name="l00077"></a>00077 <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#a465cf8d849f3697ee78e2bac7e86bf6a">SetSpec</a>(<a class="code" href="globals_8h.html#a48b13eb6cb3c520195901516dee1e612">ID3_V2Spec</a>); <a name="l00078"></a>00078 <a class="code" href="globals_8h.html#a48b13eb6cb3c520195901516dee1e612">ID3_V2Spec</a> <a class="code" href="class_i_d3___frame_impl.html#a8fa372b0543cf3c5ed1dd1130c35d6a0">GetSpec</a>() <span class="keyword">const</span>; <a name="l00079"></a>00079 <a name="l00085"></a><a class="code" href="class_i_d3___frame_impl.html#a78ec2bd42de41db063ba9c9e8f87d512">00085</a> <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#a78ec2bd42de41db063ba9c9e8f87d512" title="Sets the compression flag within the frame.">SetCompression</a>(<span class="keywordtype">bool</span> b) { <span class="keywordflow">return</span> _hdr.<a class="code" href="class_i_d3___frame_header.html#ab4231b74a46663d7ae992aa1b10bb405">SetCompression</a>(b); } <a name="l00094"></a><a class="code" href="class_i_d3___frame_impl.html#a1050ac21222198c58c1689d56452a747">00094</a> <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#a1050ac21222198c58c1689d56452a747" title="Returns whether or not the compression flag is set.">GetCompression</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _hdr.<a class="code" href="class_i_d3___frame_header.html#aef256ecfd63ac9aed0a4c85a0b6fd003">GetCompression</a>(); } <a name="l00095"></a><a class="code" href="class_i_d3___frame_impl.html#ac092eabba72a014b0810a865b4bcb7c1">00095</a> <span class="keywordtype">size_t</span> <a class="code" href="class_i_d3___frame_impl.html#ac092eabba72a014b0810a865b4bcb7c1">GetDataSize</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _hdr.<a class="code" href="class_i_d3___header.html#a79f72d5e938eeafe389a33649939aab3">GetDataSize</a>(); } <a name="l00096"></a>00096 <a name="l00097"></a><a class="code" href="class_i_d3___frame_impl.html#aa8766995d69f7a2bbc3f43c93d0e90e3">00097</a> <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#aa8766995d69f7a2bbc3f43c93d0e90e3">SetEncryptionID</a>(<a class="code" href="globals_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a> <span class="keywordtype">id</span>) <a name="l00098"></a>00098 { <a name="l00099"></a>00099 <span class="keywordtype">bool</span> changed = <span class="keywordtype">id</span> != _encryption_id; <a name="l00100"></a>00100 _encryption_id = id; <a name="l00101"></a>00101 _changed = _changed || changed; <a name="l00102"></a>00102 _hdr.<a class="code" href="class_i_d3___frame_header.html#a70c2a2939dac7a9897b45d6407f91ca3">SetEncryption</a>(<span class="keyword">true</span>); <a name="l00103"></a>00103 <span class="keywordflow">return</span> changed; <a name="l00104"></a>00104 } <a name="l00105"></a><a class="code" href="class_i_d3___frame_impl.html#af192377485d4b3004a5c3824c376a47c">00105</a> <a class="code" href="globals_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a> <a class="code" href="class_i_d3___frame_impl.html#af192377485d4b3004a5c3824c376a47c">GetEncryptionID</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _encryption_id; } <a name="l00106"></a><a class="code" href="class_i_d3___frame_impl.html#a186222862cf52b3e0cddd91b66a3d9af">00106</a> <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#a186222862cf52b3e0cddd91b66a3d9af">SetGroupingID</a>(<a class="code" href="globals_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a> <span class="keywordtype">id</span>) <a name="l00107"></a>00107 { <a name="l00108"></a>00108 <span class="keywordtype">bool</span> changed = <span class="keywordtype">id</span> != _grouping_id; <a name="l00109"></a>00109 _grouping_id = id; <a name="l00110"></a>00110 _changed = _changed || changed; <a name="l00111"></a>00111 _hdr.<a class="code" href="class_i_d3___frame_header.html#ae4a1868fbefaaaf8456315c5c7a34cc2">SetGrouping</a>(<span class="keyword">true</span>); <a name="l00112"></a>00112 <span class="keywordflow">return</span> changed; <a name="l00113"></a>00113 } <a name="l00114"></a><a class="code" href="class_i_d3___frame_impl.html#ac33a9fb36ecca2d83ee9cfe9dac30541">00114</a> <a class="code" href="globals_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a> <a class="code" href="class_i_d3___frame_impl.html#ac33a9fb36ecca2d83ee9cfe9dac30541">GetGroupingID</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _grouping_id; } <a name="l00115"></a>00115 <a name="l00116"></a><a class="code" href="class_i_d3___frame_impl.html#af3de0f8f806fb9815a52c3aeba742213">00116</a> <a class="code" href="class_i_d3___frame_impl.html#a80495c05f7130edef63f8d8744c7b52e">iterator</a> <a class="code" href="class_i_d3___frame_impl.html#af3de0f8f806fb9815a52c3aeba742213">begin</a>() { <span class="keywordflow">return</span> _fields.begin(); } <a name="l00117"></a><a class="code" href="class_i_d3___frame_impl.html#a741d78d7332d576cfdd65ffbc8827a07">00117</a> <a class="code" href="class_i_d3___frame_impl.html#a80495c05f7130edef63f8d8744c7b52e">iterator</a> <a class="code" href="class_i_d3___frame_impl.html#a741d78d7332d576cfdd65ffbc8827a07">end</a>() { <span class="keywordflow">return</span> _fields.end(); } <a name="l00118"></a><a class="code" href="class_i_d3___frame_impl.html#aee8c8919f7a788cfbe9264b1ae083baa">00118</a> <a class="code" href="class_i_d3___frame_impl.html#adc61cf92dc24bb5cda53f141d28349a9">const_iterator</a> <a class="code" href="class_i_d3___frame_impl.html#aee8c8919f7a788cfbe9264b1ae083baa">begin</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _fields.begin(); } <a name="l00119"></a><a class="code" href="class_i_d3___frame_impl.html#a00039816126e5e2bf49dbdf5e8553d0b">00119</a> <a class="code" href="class_i_d3___frame_impl.html#adc61cf92dc24bb5cda53f141d28349a9">const_iterator</a> <a class="code" href="class_i_d3___frame_impl.html#a00039816126e5e2bf49dbdf5e8553d0b">end</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _fields.end(); } <a name="l00120"></a>00120 <a name="l00121"></a>00121 <span class="keyword">protected</span>: <a name="l00122"></a>00122 <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#aae1409c1ddd3ca5e99c4e7c66210cec4">_SetID</a>(<a class="code" href="globals_8h.html#a78f454bf66f16b1e1c9f8e37bda9ab8a" title="Enumeration of the different types of frames recognized by id3lib.">ID3_FrameID</a>); <a name="l00123"></a>00123 <span class="keywordtype">bool</span> <a class="code" href="class_i_d3___frame_impl.html#ac8d9eff55188a698cf96b84f29690e10">_ClearFields</a>(); <a name="l00124"></a>00124 <span class="keywordtype">void</span> <a class="code" href="class_i_d3___frame_impl.html#a1e558ca98dde34bffd4b4c87e4ba4c35">_InitFields</a>(); <a name="l00125"></a>00125 <span class="keywordtype">void</span> <a class="code" href="class_i_d3___frame_impl.html#aa1ccef1ccc76ff44b2982afdf5159bf3">_InitFieldBits</a>(); <a name="l00126"></a>00126 <span class="keywordtype">void</span> <a class="code" href="class_i_d3___frame_impl.html#a81c23f0c676ae7305ea33bbcda8b120f">_UpdateFieldDeps</a>(); <a name="l00127"></a>00127 <a name="l00128"></a>00128 <span class="keyword">private</span>: <a name="l00129"></a>00129 <span class="keyword">mutable</span> <span class="keywordtype">bool</span> _changed; <span class="comment">// frame changed since last parse/render?</span> <a name="l00130"></a>00130 Bitset _bitset; <span class="comment">// which fields are present?</span> <a name="l00131"></a>00131 Fields _fields; <a name="l00132"></a>00132 <a class="code" href="class_i_d3___frame_header.html">ID3_FrameHeader</a> _hdr; <span class="comment">// </span> <a name="l00133"></a>00133 <a class="code" href="globals_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a> _encryption_id; <span class="comment">// encryption id</span> <a name="l00134"></a>00134 <a class="code" href="globals_8h.html#a65f85814a8290f9797005d3b28e7e5fc">uchar</a> _grouping_id; <span class="comment">// grouping id</span> <a name="l00135"></a>00135 } <a name="l00136"></a>00136 ; <a name="l00137"></a>00137 <a name="l00138"></a>00138 <span class="preprocessor">#endif </span><span class="comment">/* _ID3LIB_FRAME_IMPL_H_ */</span> </pre></div></div> </div> <hr size="1"><address style="text-align: right;"><small> Generated for id3lib by <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>