Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > 07dfcfe50d66c9a48a3c5e6c1693f12a > files > 1724

cryptopp-doc-5.6.1-0.1.svn479.fc13.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>Crypto++: files.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;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 class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>files.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_FILES_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_FILES_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;<a class="code" href="cryptlib_8h.html">cryptlib.h</a>&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;filters.h&quot;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &quot;argnames.h&quot;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;fstream&gt;</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 NAMESPACE_BEGIN(CryptoPP)
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="comment">//! file-based implementation of Store interface</span>
<a name="l00014"></a><a class="code" href="class_file_store.html">00014</a> <span class="comment"></span>class CRYPTOPP_DLL <a class="code" href="class_file_store.html" title="file-based implementation of Store interface">FileStore</a> : public <a class="code" href="class_store.html" title="A BufferedTransformation that only contains pre-existing data as &amp;quot;output&amp;quot;...">Store</a>, private <a class="code" href="struct_filter_put_space_helper.html">FilterPutSpaceHelper</a>, public <a class="code" href="class_not_copyable.html">NotCopyable</a>
<a name="l00015"></a>00015 {
<a name="l00016"></a>00016 <span class="keyword">public</span>:
<a name="l00017"></a><a class="code" href="class_file_store_1_1_err.html">00017</a>         <span class="keyword">class </span><a class="code" href="class_file_store_1_1_err.html">Err</a> : <span class="keyword">public</span> <a class="code" href="class_exception.html" title="base class for all exceptions thrown by Crypto++">Exception</a>
<a name="l00018"></a>00018         {
<a name="l00019"></a>00019         <span class="keyword">public</span>:
<a name="l00020"></a>00020                 <a class="code" href="class_file_store_1_1_err.html">Err</a>(<span class="keyword">const</span> std::string &amp;s) : <a class="code" href="class_exception.html" title="base class for all exceptions thrown by Crypto++">Exception</a>(IO_ERROR, s) {}
<a name="l00021"></a>00021         };
<a name="l00022"></a><a class="code" href="class_file_store_1_1_open_err.html">00022</a>         <span class="keyword">class </span><a class="code" href="class_file_store_1_1_open_err.html">OpenErr</a> : <span class="keyword">public</span> <a class="code" href="class_file_store_1_1_err.html">Err</a> {<span class="keyword">public</span>: <a class="code" href="class_file_store_1_1_open_err.html">OpenErr</a>(<span class="keyword">const</span> std::string &amp;filename) : <a class="code" href="class_file_store_1_1_err.html">Err</a>(<span class="stringliteral">&quot;FileStore: error opening file for reading: &quot;</span> + filename) {}};
<a name="l00023"></a><a class="code" href="class_file_store_1_1_read_err.html">00023</a>         <span class="keyword">class </span><a class="code" href="class_file_store_1_1_read_err.html">ReadErr</a> : <span class="keyword">public</span> <a class="code" href="class_file_store_1_1_err.html">Err</a> {<span class="keyword">public</span>: <a class="code" href="class_file_store_1_1_read_err.html">ReadErr</a>() : <a class="code" href="class_file_store_1_1_err.html">Err</a>(<span class="stringliteral">&quot;FileStore: error reading file&quot;</span>) {}};
<a name="l00024"></a>00024 
<a name="l00025"></a>00025         <a class="code" href="class_file_store.html" title="file-based implementation of Store interface">FileStore</a>() : m_stream(NULL) {}
<a name="l00026"></a>00026         <a class="code" href="class_file_store.html" title="file-based implementation of Store interface">FileStore</a>(std::istream &amp;in)
<a name="l00027"></a>00027                 {StoreInitialize(MakeParameters(Name::InputStreamPointer(), &amp;in));}
<a name="l00028"></a>00028         <a class="code" href="class_file_store.html" title="file-based implementation of Store interface">FileStore</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename)
<a name="l00029"></a>00029                 {StoreInitialize(MakeParameters(Name::InputFileName(), filename));}
<a name="l00030"></a>00030 <span class="preprocessor">#if defined(CRYPTOPP_UNIX_AVAILABLE) || _MSC_VER &gt;= 1400</span><span class="comment"></span>
<a name="l00031"></a>00031 <span class="comment">        //! specify file with Unicode name. On non-Windows OS, this function assumes that setlocale() has been called.</span>
<a name="l00032"></a>00032 <span class="comment"></span>        FileStore(const wchar_t *filename)
<a name="l00033"></a>00033                 {StoreInitialize(MakeParameters(Name::InputFileNameWide(), filename));}
<a name="l00034"></a>00034 <span class="preprocessor">#endif</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span>
<a name="l00036"></a>00036         std::istream* GetStream() {<span class="keywordflow">return</span> m_stream;}
<a name="l00037"></a>00037 
<a name="l00038"></a>00038         lword MaxRetrievable() <span class="keyword">const</span>;
<a name="l00039"></a>00039         <span class="keywordtype">size_t</span> TransferTo2(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;target, lword &amp;transferBytes, <span class="keyword">const</span> std::string &amp;channel=DEFAULT_CHANNEL, <span class="keywordtype">bool</span> blocking=<span class="keyword">true</span>);
<a name="l00040"></a>00040         <span class="keywordtype">size_t</span> CopyRangeTo2(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;target, lword &amp;begin, lword end=LWORD_MAX, <span class="keyword">const</span> std::string &amp;channel=DEFAULT_CHANNEL, <span class="keywordtype">bool</span> blocking=<span class="keyword">true</span>) <span class="keyword">const</span>;
<a name="l00041"></a>00041         lword Skip(lword skipMax=ULONG_MAX);
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keyword">private</span>:
<a name="l00044"></a>00044         <span class="keywordtype">void</span> StoreInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters);
<a name="l00045"></a>00045         
<a name="l00046"></a>00046         <a class="code" href="classmember__ptr.html">member_ptr&lt;std::ifstream&gt;</a> m_file;
<a name="l00047"></a>00047         std::istream *m_stream;
<a name="l00048"></a>00048         byte *m_space;
<a name="l00049"></a>00049         <span class="keywordtype">size_t</span> m_len;
<a name="l00050"></a>00050         <span class="keywordtype">bool</span> m_waiting;
<a name="l00051"></a>00051 };
<a name="l00052"></a>00052 <span class="comment"></span>
<a name="l00053"></a>00053 <span class="comment">//! file-based implementation of Source interface</span>
<a name="l00054"></a><a class="code" href="class_file_source.html">00054</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_file_source.html" title="file-based implementation of Source interface">FileSource</a> : <span class="keyword">public</span> <a class="code" href="class_source_template.html" title="Turn a Store into a Source.">SourceTemplate</a>&lt;FileStore&gt;
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056 <span class="keyword">public</span>:
<a name="l00057"></a>00057         <span class="keyword">typedef</span> <a class="code" href="class_file_store_1_1_err.html">FileStore::Err</a> <a class="code" href="class_file_store_1_1_err.html">Err</a>;
<a name="l00058"></a>00058         <span class="keyword">typedef</span> <a class="code" href="class_file_store_1_1_open_err.html">FileStore::OpenErr</a> <a class="code" href="class_file_store_1_1_open_err.html">OpenErr</a>;
<a name="l00059"></a>00059         <span class="keyword">typedef</span> <a class="code" href="class_file_store_1_1_read_err.html">FileStore::ReadErr</a> <a class="code" href="class_file_store_1_1_read_err.html">ReadErr</a>;
<a name="l00060"></a>00060 
<a name="l00061"></a>00061         <a class="code" href="class_file_source.html" title="file-based implementation of Source interface">FileSource</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment = NULL)
<a name="l00062"></a>00062                 : <a class="code" href="class_source_template.html">SourceTemplate&lt;FileStore&gt;</a>(attachment) {}
<a name="l00063"></a>00063         <a class="code" href="class_file_source.html" title="file-based implementation of Source interface">FileSource</a>(std::istream &amp;in, <span class="keywordtype">bool</span> pumpAll, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment = NULL)
<a name="l00064"></a>00064                 : <a class="code" href="class_source_template.html">SourceTemplate&lt;FileStore&gt;</a>(attachment) {SourceInitialize(pumpAll, MakeParameters(Name::InputStreamPointer(), &amp;in));}
<a name="l00065"></a>00065         <a class="code" href="class_file_source.html" title="file-based implementation of Source interface">FileSource</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, <span class="keywordtype">bool</span> pumpAll, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> *attachment = NULL, <span class="keywordtype">bool</span> binary=<span class="keyword">true</span>)
<a name="l00066"></a>00066                 : <a class="code" href="class_source_template.html">SourceTemplate&lt;FileStore&gt;</a>(attachment) {SourceInitialize(pumpAll, MakeParameters(Name::InputFileName(), filename)(Name::InputBinaryMode(), binary));}
<a name="l00067"></a>00067 <span class="preprocessor">#if defined(CRYPTOPP_UNIX_AVAILABLE) || _MSC_VER &gt;= 1400</span><span class="comment"></span>
<a name="l00068"></a>00068 <span class="comment">        //! specify file with Unicode name. On non-Windows OS, this function assumes that setlocale() has been called.</span>
<a name="l00069"></a>00069 <span class="comment"></span>        FileSource(const wchar_t *filename, bool pumpAll, BufferedTransformation *attachment = NULL, bool binary=true)
<a name="l00070"></a>00070                 : <a class="code" href="class_source_template.html">SourceTemplate&lt;FileStore&gt;</a>(attachment) {SourceInitialize(pumpAll, MakeParameters(Name::InputFileNameWide(), filename)(Name::InputBinaryMode(), binary));}
<a name="l00071"></a>00071 <span class="preprocessor">#endif</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span>
<a name="l00073"></a>00073         std::istream* GetStream() {<span class="keywordflow">return</span> m_store.GetStream();}
<a name="l00074"></a>00074 };
<a name="l00075"></a>00075 <span class="comment"></span>
<a name="l00076"></a>00076 <span class="comment">//! file-based implementation of Sink interface</span>
<a name="l00077"></a><a class="code" href="class_file_sink.html">00077</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_file_sink.html" title="file-based implementation of Sink interface">FileSink</a> : <span class="keyword">public</span> <a class="code" href="class_sink.html" title="A BufferedTransformation that doesn&amp;#39;t produce any retrievable output.">Sink</a>, <span class="keyword">public</span> NotCopyable
<a name="l00078"></a>00078 {
<a name="l00079"></a>00079 <span class="keyword">public</span>:
<a name="l00080"></a><a class="code" href="class_file_sink_1_1_err.html">00080</a>         <span class="keyword">class </span><a class="code" href="class_file_sink_1_1_err.html">Err</a> : <span class="keyword">public</span> <a class="code" href="class_exception.html" title="base class for all exceptions thrown by Crypto++">Exception</a>
<a name="l00081"></a>00081         {
<a name="l00082"></a>00082         <span class="keyword">public</span>:
<a name="l00083"></a>00083                 <a class="code" href="class_file_sink_1_1_err.html">Err</a>(<span class="keyword">const</span> std::string &amp;s) : <a class="code" href="class_exception.html" title="base class for all exceptions thrown by Crypto++">Exception</a>(IO_ERROR, s) {}
<a name="l00084"></a>00084         };
<a name="l00085"></a><a class="code" href="class_file_sink_1_1_open_err.html">00085</a>         <span class="keyword">class </span><a class="code" href="class_file_sink_1_1_open_err.html">OpenErr</a> : <span class="keyword">public</span> <a class="code" href="class_file_sink_1_1_err.html">Err</a> {<span class="keyword">public</span>: <a class="code" href="class_file_sink_1_1_open_err.html">OpenErr</a>(<span class="keyword">const</span> std::string &amp;filename) : <a class="code" href="class_file_sink_1_1_err.html">Err</a>(<span class="stringliteral">&quot;FileSink: error opening file for writing: &quot;</span> + filename) {}};
<a name="l00086"></a><a class="code" href="class_file_sink_1_1_write_err.html">00086</a>         <span class="keyword">class </span><a class="code" href="class_file_sink_1_1_write_err.html">WriteErr</a> : <span class="keyword">public</span> <a class="code" href="class_file_sink_1_1_err.html">Err</a> {<span class="keyword">public</span>: <a class="code" href="class_file_sink_1_1_write_err.html">WriteErr</a>() : <a class="code" href="class_file_sink_1_1_err.html">Err</a>(<span class="stringliteral">&quot;FileSink: error writing file&quot;</span>) {}};
<a name="l00087"></a>00087 
<a name="l00088"></a>00088         <a class="code" href="class_file_sink.html" title="file-based implementation of Sink interface">FileSink</a>() : m_stream(NULL) {}
<a name="l00089"></a>00089         <a class="code" href="class_file_sink.html" title="file-based implementation of Sink interface">FileSink</a>(std::ostream &amp;out)
<a name="l00090"></a>00090                 {IsolatedInitialize(MakeParameters(Name::OutputStreamPointer(), &amp;out));}
<a name="l00091"></a>00091         <a class="code" href="class_file_sink.html" title="file-based implementation of Sink interface">FileSink</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename, <span class="keywordtype">bool</span> binary=<span class="keyword">true</span>)
<a name="l00092"></a>00092                 {IsolatedInitialize(MakeParameters(Name::OutputFileName(), filename)(Name::OutputBinaryMode(), binary));}
<a name="l00093"></a>00093 <span class="preprocessor">#if defined(CRYPTOPP_UNIX_AVAILABLE) || _MSC_VER &gt;= 1400</span><span class="comment"></span>
<a name="l00094"></a>00094 <span class="comment">        //! specify file with Unicode name. On non-Windows OS, this function assumes that setlocale() has been called.</span>
<a name="l00095"></a>00095 <span class="comment"></span>        FileSink(const wchar_t *filename, bool binary=true)
<a name="l00096"></a>00096                 {IsolatedInitialize(MakeParameters(Name::OutputFileNameWide(), filename)(Name::OutputBinaryMode(), binary));}
<a name="l00097"></a>00097 <span class="preprocessor">#endif</span>
<a name="l00098"></a>00098 <span class="preprocessor"></span>
<a name="l00099"></a>00099         std::ostream* GetStream() {<span class="keywordflow">return</span> m_stream;}
<a name="l00100"></a>00100 
<a name="l00101"></a>00101         <span class="keywordtype">void</span> IsolatedInitialize(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters);
<a name="l00102"></a>00102         <span class="keywordtype">size_t</span> <a class="code" href="class_buffered_transformation.html#ad396dcb42260f23125a35ec0e5d17d55" title="input multiple bytes for blocking or non-blocking processing">Put2</a>(<span class="keyword">const</span> byte *inString, <span class="keywordtype">size_t</span> length, <span class="keywordtype">int</span> messageEnd, <span class="keywordtype">bool</span> blocking);
<a name="l00103"></a>00103         <span class="keywordtype">bool</span> IsolatedFlush(<span class="keywordtype">bool</span> hardFlush, <span class="keywordtype">bool</span> blocking);
<a name="l00104"></a>00104 
<a name="l00105"></a>00105 <span class="keyword">private</span>:
<a name="l00106"></a>00106         <a class="code" href="classmember__ptr.html">member_ptr&lt;std::ofstream&gt;</a> m_file;
<a name="l00107"></a>00107         std::ostream *m_stream;
<a name="l00108"></a>00108 };
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 NAMESPACE_END
<a name="l00111"></a>00111 
<a name="l00112"></a>00112 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 9 Dec 2009 for Crypto++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>