Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > abb2634846290d27f545cecded067e1f > files > 282

barry-devel-docs-0.17.1-4.fc14.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Barry: builder.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="classes.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_3e14c0bb4416cf979afc3165665fc916.html">src</a>
  </div>
</div>
<div class="contents">
<h1>builder.h</h1><a href="builder_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">///</span>
<a name="l00002"></a>00002 <span class="comment"></span><span class="comment">/// \file       builder.h</span>
<a name="l00003"></a>00003 <span class="comment"></span><span class="comment">///             Virtual protocol packet builder wrapper</span>
<a name="l00004"></a>00004 <span class="comment"></span><span class="comment">///</span>
<a name="l00005"></a>00005 <span class="comment"></span>
<a name="l00006"></a>00006 <span class="comment">/*</span>
<a name="l00007"></a>00007 <span class="comment">    Copyright (C) 2005-2011, Net Direct Inc. (http://www.netdirect.ca/)</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">    This program is free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment">    it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment">    the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment">    (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">    This program is distributed in the hope that it will be useful,</span>
<a name="l00015"></a>00015 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00016"></a>00016 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span>
<a name="l00017"></a>00017 <span class="comment"></span>
<a name="l00018"></a>00018 <span class="comment">    See the GNU General Public License in the COPYING file at the</span>
<a name="l00019"></a>00019 <span class="comment">    root directory of this project for more details.</span>
<a name="l00020"></a>00020 <span class="comment">*/</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef __BARRY_BUILDER_H__</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define __BARRY_BUILDER_H__</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="dll_8h.html" title="Macros for handling DLL/library API visibility.">dll.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="data_8h.html" title="Class to deal with pre-saved data files.">data.h</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;stdint.h&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="comment">//</span>
<a name="l00031"></a>00031 <span class="comment">// This macro can be used to automatically generate code for all known</span>
<a name="l00032"></a>00032 <span class="comment">// record types.  Just #undef HANDLE_BUILDER, then #define it to whatever</span>
<a name="l00033"></a>00033 <span class="comment">// you need, then use ALL_KNOWN_BUILDER_TYPES.  See parser.cc for</span>
<a name="l00034"></a>00034 <span class="comment">// various examples.</span>
<a name="l00035"></a>00035 <span class="comment">//</span>
<a name="l00036"></a>00036 <span class="comment">// These are sorted so their GetDBName()'s will display in alphabetical order.</span>
<a name="l00037"></a>00037 <span class="comment">//</span>
<a name="l00038"></a>00038 <span class="preprocessor">#define ALL_KNOWN_BUILDER_TYPES \</span>
<a name="l00039"></a>00039 <span class="preprocessor">        HANDLE_BUILDER(Contact) \</span>
<a name="l00040"></a>00040 <span class="preprocessor">        HANDLE_BUILDER(Calendar) \</span>
<a name="l00041"></a>00041 <span class="preprocessor">        HANDLE_BUILDER(CalendarAll) \</span>
<a name="l00042"></a>00042 <span class="preprocessor">        HANDLE_BUILDER(ContentStore) \</span>
<a name="l00043"></a>00043 <span class="preprocessor">        HANDLE_BUILDER(Memo) \</span>
<a name="l00044"></a>00044 <span class="preprocessor">        HANDLE_BUILDER(Task) \</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a>00046 <span class="preprocessor"></span><span class="keyword">namespace </span>Barry {
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="comment">// forward declarations</span>
<a name="l00049"></a>00049 <span class="keyword">class </span>IConverter;
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="comment">//</span>
<a name="l00052"></a>00052 <span class="comment">// Builder class</span>
<a name="l00053"></a>00053 <span class="comment">//</span><span class="comment"></span>
<a name="l00054"></a>00054 <span class="comment">/// Base class for the builder functor hierarchy.</span>
<a name="l00055"></a>00055 <span class="comment">///</span>
<a name="l00056"></a>00056 <span class="comment">/// This defines the API used by the Controller and Packet classes</span>
<a name="l00057"></a>00057 <span class="comment">/// for building a raw device record to write to the device.</span>
<a name="l00058"></a>00058 <span class="comment">///</span>
<a name="l00059"></a><a class="code" href="classBarry_1_1Builder.html">00059</a> <span class="comment"></span><span class="keyword">class </span>BXEXPORT <a class="code" href="classBarry_1_1Builder.html" title="Base class for the builder functor hierarchy.">Builder</a>
<a name="l00060"></a>00060 {
<a name="l00061"></a>00061 <span class="keyword">public</span>:
<a name="l00062"></a>00062         <a class="code" href="classBarry_1_1Builder.html" title="Base class for the builder functor hierarchy.">Builder</a>() {}
<a name="l00063"></a>00063         <span class="keyword">virtual</span> ~<a class="code" href="classBarry_1_1Builder.html" title="Base class for the builder functor hierarchy.">Builder</a>() {}
<a name="l00064"></a>00064 <span class="comment"></span>
<a name="l00065"></a>00065 <span class="comment">        /// Called to build the record field data.  Store the raw data</span>
<a name="l00066"></a>00066 <span class="comment">        /// in data, using offset to know where to write.  Be sure to</span>
<a name="l00067"></a>00067 <span class="comment">        /// update offset, and be sure to adjust the size of the data</span>
<a name="l00068"></a>00068 <span class="comment">        /// packet (possibly with Data::ReleaseBuffer()).</span>
<a name="l00069"></a>00069 <span class="comment">        ///</span>
<a name="l00070"></a>00070 <span class="comment">        /// Returns true if successful, and false if at the end of</span>
<a name="l00071"></a>00071 <span class="comment">        /// the series.  Note that if EndOfFile() is false after</span>
<a name="l00072"></a>00072 <span class="comment">        /// this function returns false, then there may be another</span>
<a name="l00073"></a>00073 <span class="comment">        /// series available, which the next call to BuildRecord()</span>
<a name="l00074"></a>00074 <span class="comment">        /// will determine.</span>
<a name="l00075"></a>00075 <span class="comment">        ///</span>
<a name="l00076"></a>00076 <span class="comment"></span>        <span class="keyword">virtual</span> <span class="keywordtype">bool</span> BuildRecord(<a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;data, <span class="keywordtype">size_t</span> &amp;offset,
<a name="l00077"></a>00077                 <span class="keyword">const</span> <a class="code" href="classBarry_1_1IConverter.html" title="Main charset conversion class, primarily focused on converting between the Blackberry...">IConverter</a> *ic) = 0;
<a name="l00078"></a>00078 <span class="comment"></span>
<a name="l00079"></a>00079 <span class="comment">        /// Same as BuildRecord, but does not care about any offsets.</span>
<a name="l00080"></a>00080 <span class="comment">        /// The caller should call DBData::GetOffset() afterward</span>
<a name="l00081"></a>00081 <span class="comment">        /// to discover if there is an offset to the result.</span>
<a name="l00082"></a>00082 <span class="comment">        ///</span>
<a name="l00083"></a>00083 <span class="comment">        /// This is usually the fastest of the two functions, since</span>
<a name="l00084"></a>00084 <span class="comment">        /// extra copying may be required if a specific offset is</span>
<a name="l00085"></a>00085 <span class="comment">        /// given.  When building records from Record classes, both</span>
<a name="l00086"></a>00086 <span class="comment">        /// functions are the same speed.  But when building records</span>
<a name="l00087"></a>00087 <span class="comment">        /// from the device, the device decides the offset, so FetchRecord()</span>
<a name="l00088"></a>00088 <span class="comment">        /// is faster, since BuildRecord requires a copy to adjust</span>
<a name="l00089"></a>00089 <span class="comment">        /// to the right offset.</span>
<a name="l00090"></a>00090 <span class="comment">        ///</span>
<a name="l00091"></a>00091 <span class="comment">        /// The caller should use the function that results in the least</span>
<a name="l00092"></a>00092 <span class="comment">        /// amount of copying for the caller.  If the caller doesn't</span>
<a name="l00093"></a>00093 <span class="comment">        /// care about where the resulting record is in data, use</span>
<a name="l00094"></a>00094 <span class="comment">        /// FetchRecord().</span>
<a name="l00095"></a>00095 <span class="comment">        ///</span>
<a name="l00096"></a>00096 <span class="comment"></span>        <span class="keyword">virtual</span> <span class="keywordtype">bool</span> FetchRecord(<a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;data, <span class="keyword">const</span> <a class="code" href="classBarry_1_1IConverter.html" title="Main charset conversion class, primarily focused on converting between the Blackberry...">IConverter</a> *ic) = 0;
<a name="l00097"></a>00097 <span class="comment"></span>
<a name="l00098"></a>00098 <span class="comment">        /// Sometimes a builder can have multiple databases stored</span>
<a name="l00099"></a>00099 <span class="comment">        /// in it, so when Build/Fetch returns false, check if there</span>
<a name="l00100"></a>00100 <span class="comment">        /// is more data with this function.  This function is</span>
<a name="l00101"></a>00101 <span class="comment">        /// not used by database-oriented functions, but by pipe-</span>
<a name="l00102"></a>00102 <span class="comment">        /// oriented functions.</span>
<a name="l00103"></a>00103 <span class="comment"></span>        <span class="keyword">virtual</span> <span class="keywordtype">bool</span> EndOfFile() <span class="keyword">const</span> = 0;
<a name="l00104"></a>00104 };
<a name="l00105"></a>00105 
<a name="l00106"></a>00106 
<a name="l00107"></a>00107 <span class="comment">//</span>
<a name="l00108"></a>00108 <span class="comment">// DBDataBuilder</span>
<a name="l00109"></a>00109 <span class="comment">//</span><span class="comment"></span>
<a name="l00110"></a>00110 <span class="comment">/// Wrapper class around a DBData object, to make it easy to pass a DBData</span>
<a name="l00111"></a>00111 <span class="comment">/// object into a function or API that requires a builder.  The main</span>
<a name="l00112"></a>00112 <span class="comment">/// advantage to this is that the Builder API allows for movement of</span>
<a name="l00113"></a>00113 <span class="comment">/// data, depending on the required offsets.</span>
<a name="l00114"></a>00114 <span class="comment">///</span>
<a name="l00115"></a><a class="code" href="classBarry_1_1DBDataBuilder.html">00115</a> <span class="comment"></span><span class="keyword">class </span>BXEXPORT <a class="code" href="classBarry_1_1DBDataBuilder.html" title="Wrapper class around a DBData object, to make it easy to pass a DBData object into...">DBDataBuilder</a> : <span class="keyword">public</span> <a class="code" href="classBarry_1_1Builder.html" title="Base class for the builder functor hierarchy.">Builder</a>
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117         <span class="keyword">const</span> <a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;m_orig;
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 <span class="keyword">public</span>:
<a name="l00120"></a>00120         <span class="keyword">explicit</span> <a class="code" href="classBarry_1_1DBDataBuilder.html" title="Wrapper class around a DBData object, to make it easy to pass a DBData object into...">DBDataBuilder</a>(<span class="keyword">const</span> <a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;orig);
<a name="l00121"></a>00121         <span class="keyword">virtual</span> ~<a class="code" href="classBarry_1_1DBDataBuilder.html" title="Wrapper class around a DBData object, to make it easy to pass a DBData object into...">DBDataBuilder</a>();
<a name="l00122"></a>00122 
<a name="l00123"></a>00123         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> BuildRecord(<a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;data, <span class="keywordtype">size_t</span> &amp;offset,
<a name="l00124"></a>00124                 <span class="keyword">const</span> <a class="code" href="classBarry_1_1IConverter.html" title="Main charset conversion class, primarily focused on converting between the Blackberry...">IConverter</a> *ic);
<a name="l00125"></a>00125         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> FetchRecord(<a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;data, <span class="keyword">const</span> <a class="code" href="classBarry_1_1IConverter.html" title="Main charset conversion class, primarily focused on converting between the Blackberry...">IConverter</a> *ic);
<a name="l00126"></a>00126         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> EndOfFile() <span class="keyword">const</span>;
<a name="l00127"></a>00127 };
<a name="l00128"></a>00128 
<a name="l00129"></a>00129 <span class="comment">//</span>
<a name="l00130"></a>00130 <span class="comment">// SetDBData</span>
<a name="l00131"></a>00131 <span class="comment">//</span><span class="comment"></span>
<a name="l00132"></a>00132 <span class="comment">/// Contains the proper way to convert a record object into a DBData object.</span>
<a name="l00133"></a>00133 <span class="comment">///</span>
<a name="l00134"></a>00134 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> RecordT&gt;
<a name="l00135"></a><a class="code" href="namespaceBarry.html#1694e381d8f7c0a41714992c831e716b">00135</a> <span class="keywordtype">void</span> <a class="code" href="namespaceBarry.html#1694e381d8f7c0a41714992c831e716b" title="Contains the proper way to convert a record object into a DBData object.">SetDBData</a>(<span class="keyword">const</span> RecordT &amp;rec, <a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;data, <span class="keywordtype">size_t</span> &amp;offset,
<a name="l00136"></a>00136                 <span class="keyword">const</span> <a class="code" href="classBarry_1_1IConverter.html" title="Main charset conversion class, primarily focused on converting between the Blackberry...">IConverter</a> *ic)
<a name="l00137"></a>00137 {
<a name="l00138"></a>00138         data.<a class="code" href="classBarry_1_1DBData.html#d1a3e69cabea68e0a309459cd7c58e78">SetVersion</a>(DBData::REC_VERSION_1);
<a name="l00139"></a>00139         data.<a class="code" href="classBarry_1_1DBData.html#cb569139ee2d44442d4709ccf2a4ab3c">SetOffset</a>(offset);
<a name="l00140"></a>00140         data.<a class="code" href="classBarry_1_1DBData.html#55d6bde680fe0b48d07882ade96ef9c3">SetDBName</a>(RecordT::GetDBName());
<a name="l00141"></a>00141         data.<a class="code" href="classBarry_1_1DBData.html#a46147fced1b122cb6a0e6d1cee3cb07">SetIds</a>(rec.GetRecType(), rec.GetUniqueId());
<a name="l00142"></a>00142         rec.BuildHeader(data.<a class="code" href="classBarry_1_1DBData.html#3c1c4ad5ce85cef0ea85002a0fe07881">UseData</a>(), offset);
<a name="l00143"></a>00143         rec.BuildFields(data.<a class="code" href="classBarry_1_1DBData.html#3c1c4ad5ce85cef0ea85002a0fe07881">UseData</a>(), offset, ic);
<a name="l00144"></a>00144 }
<a name="l00145"></a>00145 
<a name="l00146"></a>00146 <span class="comment">//</span>
<a name="l00147"></a>00147 <span class="comment">// RecordBuilder template class</span>
<a name="l00148"></a>00148 <span class="comment">//</span><span class="comment"></span>
<a name="l00149"></a>00149 <span class="comment">/// Template class for easy creation of specific protocol packet builder</span>
<a name="l00150"></a>00150 <span class="comment">/// objects.  This template takes the following template arguments:</span>
<a name="l00151"></a>00151 <span class="comment">///</span>
<a name="l00152"></a>00152 <span class="comment">///     - RecordT: One of the record classes in record.h</span>
<a name="l00153"></a>00153 <span class="comment">///     - StorageT: A custom storage functor class.  An object of this type</span>
<a name="l00154"></a>00154 <span class="comment">///             will be called as a function with empty Record as an</span>
<a name="l00155"></a>00155 <span class="comment">///             argument.  The storage class is expected to fill the</span>
<a name="l00156"></a>00156 <span class="comment">///             record object in preparation for building the packet</span>
<a name="l00157"></a>00157 <span class="comment">///             out of that data.  These calls happen on the fly as the data</span>
<a name="l00158"></a>00158 <span class="comment">///             is sent to the device over USB, so it should not block forever.</span>
<a name="l00159"></a>00159 <span class="comment">///</span>
<a name="l00160"></a>00160 <span class="comment">/// Example SaveDatabase() call:</span>
<a name="l00161"></a>00161 <span class="comment">///</span>
<a name="l00162"></a>00162 <span class="comment">/// &lt;pre&gt;</span>
<a name="l00163"></a>00163 <span class="comment">/// FIXME</span>
<a name="l00164"></a>00164 <span class="comment">/// &lt;/pre&gt;</span>
<a name="l00165"></a>00165 <span class="comment">///</span>
<a name="l00166"></a>00166 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> RecordT, <span class="keyword">class</span> StorageT&gt;
<a name="l00167"></a><a class="code" href="classBarry_1_1RecordBuilder.html">00167</a> <span class="keyword">class </span><a class="code" href="classBarry_1_1RecordBuilder.html" title="Template class for easy creation of specific protocol packet builder objects.">RecordBuilder</a> : <span class="keyword">public</span> <a class="code" href="classBarry_1_1Builder.html" title="Base class for the builder functor hierarchy.">Builder</a>
<a name="l00168"></a>00168 {
<a name="l00169"></a>00169         StorageT *m_storage;
<a name="l00170"></a>00170         <span class="keywordtype">bool</span> m_owned;
<a name="l00171"></a>00171         <span class="keywordtype">bool</span> m_record_loaded;
<a name="l00172"></a>00172         <span class="keywordtype">bool</span> m_end_of_file;
<a name="l00173"></a>00173         RecordT m_rec;
<a name="l00174"></a>00174 
<a name="l00175"></a>00175 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l00176"></a>00176 <span class="comment">        /// Constructor that references an externally managed storage object.</span>
<a name="l00177"></a><a class="code" href="classBarry_1_1RecordBuilder.html#c8cda12de94498b715d6171fb51930af">00177</a> <span class="comment"></span>        <a class="code" href="classBarry_1_1RecordBuilder.html#c8cda12de94498b715d6171fb51930af" title="Constructor that references an externally managed storage object.">RecordBuilder</a>(StorageT &amp;storage)
<a name="l00178"></a>00178                 : m_storage(&amp;storage)
<a name="l00179"></a>00179                 , m_owned(false)
<a name="l00180"></a>00180                 , m_record_loaded(false)
<a name="l00181"></a>00181                 , m_end_of_file(false)
<a name="l00182"></a>00182         {
<a name="l00183"></a>00183         }
<a name="l00184"></a>00184 <span class="comment"></span>
<a name="l00185"></a>00185 <span class="comment">        /// Constructor that references a locally managed storage object.</span>
<a name="l00186"></a>00186 <span class="comment">        /// The pointer passed in will be stored, and freed when this class</span>
<a name="l00187"></a>00187 <span class="comment">        /// is destroyed.  It is safe to call this constructor with</span>
<a name="l00188"></a>00188 <span class="comment">        /// a 'new'ly created storage object.</span>
<a name="l00189"></a><a class="code" href="classBarry_1_1RecordBuilder.html#ab6421e54af5c0886d2d9979fe4d2d35">00189</a> <span class="comment"></span>        <a class="code" href="classBarry_1_1RecordBuilder.html#c8cda12de94498b715d6171fb51930af" title="Constructor that references an externally managed storage object.">RecordBuilder</a>(StorageT *storage)
<a name="l00190"></a>00190                 : m_storage(storage)
<a name="l00191"></a>00191                 , m_owned(true)
<a name="l00192"></a>00192                 , m_record_loaded(false)
<a name="l00193"></a>00193                 , m_end_of_file(false)
<a name="l00194"></a>00194         {
<a name="l00195"></a>00195         }
<a name="l00196"></a>00196 
<a name="l00197"></a>00197         ~<a class="code" href="classBarry_1_1RecordBuilder.html" title="Template class for easy creation of specific protocol packet builder objects.">RecordBuilder</a>()
<a name="l00198"></a>00198         {
<a name="l00199"></a>00199                 <span class="keywordflow">if</span>( this-&gt;m_owned )
<a name="l00200"></a>00200                         <span class="keyword">delete</span> m_storage;
<a name="l00201"></a>00201         }
<a name="l00202"></a>00202 
<a name="l00203"></a><a class="code" href="classBarry_1_1RecordBuilder.html#cc484ee4a8e30cf634e86c282498e9a0">00203</a>         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBarry_1_1RecordBuilder.html#cc484ee4a8e30cf634e86c282498e9a0" title="Called to build the record field data.">BuildRecord</a>(<a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;data, <span class="keywordtype">size_t</span> &amp;offset,
<a name="l00204"></a>00204                                 <span class="keyword">const</span> <a class="code" href="classBarry_1_1IConverter.html" title="Main charset conversion class, primarily focused on converting between the Blackberry...">IConverter</a> *ic)
<a name="l00205"></a>00205         {
<a name="l00206"></a>00206                 <span class="keywordflow">if</span>( m_end_of_file )
<a name="l00207"></a>00207                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00208"></a>00208 
<a name="l00209"></a>00209                 <span class="keywordflow">if</span>( !(*m_storage)(m_rec, *<span class="keyword">this</span>) ) {
<a name="l00210"></a>00210                         m_end_of_file = <span class="keyword">true</span>;
<a name="l00211"></a>00211                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00212"></a>00212                 }
<a name="l00213"></a>00213 
<a name="l00214"></a>00214                 <a class="code" href="namespaceBarry.html#1694e381d8f7c0a41714992c831e716b" title="Contains the proper way to convert a record object into a DBData object.">SetDBData</a>(m_rec, data, offset, ic);
<a name="l00215"></a>00215                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00216"></a>00216         }
<a name="l00217"></a>00217 
<a name="l00218"></a><a class="code" href="classBarry_1_1RecordBuilder.html#12bf6698689b031986008924d8c66946">00218</a>         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBarry_1_1RecordBuilder.html#12bf6698689b031986008924d8c66946" title="Same as BuildRecord, but does not care about any offsets.">FetchRecord</a>(<a class="code" href="classBarry_1_1DBData.html" title="Database record data class.">DBData</a> &amp;data, <span class="keyword">const</span> <a class="code" href="classBarry_1_1IConverter.html" title="Main charset conversion class, primarily focused on converting between the Blackberry...">IConverter</a> *ic)
<a name="l00219"></a>00219         {
<a name="l00220"></a>00220                 <span class="keywordtype">size_t</span> offset = 0;
<a name="l00221"></a>00221                 <span class="keywordflow">return</span> <a class="code" href="classBarry_1_1RecordBuilder.html#cc484ee4a8e30cf634e86c282498e9a0" title="Called to build the record field data.">BuildRecord</a>(data, offset, ic);
<a name="l00222"></a>00222         }
<a name="l00223"></a>00223 
<a name="l00224"></a><a class="code" href="classBarry_1_1RecordBuilder.html#a58d766db9692f978aa2a49736607dac">00224</a>         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classBarry_1_1RecordBuilder.html#a58d766db9692f978aa2a49736607dac" title="Sometimes a builder can have multiple databases stored in it, so when Build/Fetch...">EndOfFile</a>()<span class="keyword"> const</span>
<a name="l00225"></a>00225 <span class="keyword">        </span>{
<a name="l00226"></a>00226                 <span class="keywordflow">return</span> m_end_of_file;
<a name="l00227"></a>00227         }
<a name="l00228"></a>00228 };
<a name="l00229"></a>00229 
<a name="l00230"></a>00230 
<a name="l00231"></a>00231 <span class="comment">//</span>
<a name="l00232"></a>00232 <span class="comment">// RecordFetch template class</span>
<a name="l00233"></a>00233 <span class="comment">//</span><span class="comment"></span>
<a name="l00234"></a>00234 <span class="comment">/// Generic record fetch class, to help with using records without</span>
<a name="l00235"></a>00235 <span class="comment">/// builder classes.</span>
<a name="l00236"></a>00236 <span class="comment">///</span>
<a name="l00237"></a>00237 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> RecordT&gt;
<a name="l00238"></a><a class="code" href="classBarry_1_1RecordFetch.html">00238</a> <span class="keyword">class </span><a class="code" href="classBarry_1_1RecordFetch.html" title="Generic record fetch class, to help with using records without builder classes.">RecordFetch</a>
<a name="l00239"></a>00239 {
<a name="l00240"></a>00240         <span class="keyword">const</span> RecordT &amp;m_rec;
<a name="l00241"></a>00241         <span class="keyword">mutable</span> <span class="keywordtype">bool</span> m_done;
<a name="l00242"></a>00242 
<a name="l00243"></a>00243 <span class="keyword">public</span>:
<a name="l00244"></a>00244         <a class="code" href="classBarry_1_1RecordFetch.html" title="Generic record fetch class, to help with using records without builder classes.">RecordFetch</a>(<span class="keyword">const</span> RecordT &amp;rec) : m_rec(rec), m_done(<span class="keyword">false</span>) {}
<a name="l00245"></a>00245         <span class="keywordtype">bool</span> operator()(RecordT &amp;rec, <a class="code" href="classBarry_1_1Builder.html" title="Base class for the builder functor hierarchy.">Builder</a> &amp;)<span class="keyword"> const</span>
<a name="l00246"></a>00246 <span class="keyword">        </span>{
<a name="l00247"></a>00247                 <span class="keywordflow">if</span>( m_done )
<a name="l00248"></a>00248                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00249"></a>00249                 rec = m_rec;
<a name="l00250"></a>00250                 m_done = <span class="keyword">true</span>;
<a name="l00251"></a>00251                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00252"></a>00252         }
<a name="l00253"></a>00253 };
<a name="l00254"></a>00254 
<a name="l00255"></a>00255 
<a name="l00256"></a>00256 } <span class="comment">// namespace Barry</span>
<a name="l00257"></a>00257 
<a name="l00258"></a>00258 <span class="preprocessor">#endif</span>
<a name="l00259"></a>00259 <span class="preprocessor"></span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Mar 1 17:50:15 2011 for Barry by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>