<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>libwps: WPSOLEStream.h Source File documentation</title> <link href="doxygen.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="main.html"><span>Main Page</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> </ul> </div> <h1>WPSOLEStream.h</h1><a href="WPSOLEStream_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* POLE - Portable C++ library to access OLE Storage </span> <a name="l00002"></a>00002 <span class="comment"> Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org></span> <a name="l00003"></a>00003 <span class="comment"></span> <a name="l00004"></a>00004 <span class="comment"> Redistribution and use in source and binary forms, with or without </span> <a name="l00005"></a>00005 <span class="comment"> modification, are permitted provided that the following conditions </span> <a name="l00006"></a>00006 <span class="comment"> are met:</span> <a name="l00007"></a>00007 <span class="comment"> * Redistributions of source code must retain the above copyright notice, </span> <a name="l00008"></a>00008 <span class="comment"> this list of conditions and the following disclaimer.</span> <a name="l00009"></a>00009 <span class="comment"> * Redistributions in binary form must reproduce the above copyright notice, </span> <a name="l00010"></a>00010 <span class="comment"> this list of conditions and the following disclaimer in the documentation </span> <a name="l00011"></a>00011 <span class="comment"> and/or other materials provided with the distribution.</span> <a name="l00012"></a>00012 <span class="comment"> * Neither the name of the authors nor the names of its contributors may be </span> <a name="l00013"></a>00013 <span class="comment"> used to endorse or promote products derived from this software without </span> <a name="l00014"></a>00014 <span class="comment"> specific prior written permission.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment"> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" </span> <a name="l00017"></a>00017 <span class="comment"> AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE </span> <a name="l00018"></a>00018 <span class="comment"> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE </span> <a name="l00019"></a>00019 <span class="comment"> ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE </span> <a name="l00020"></a>00020 <span class="comment"> LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR </span> <a name="l00021"></a>00021 <span class="comment"> CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF </span> <a name="l00022"></a>00022 <span class="comment"> SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS </span> <a name="l00023"></a>00023 <span class="comment"> INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN </span> <a name="l00024"></a>00024 <span class="comment"> CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) </span> <a name="l00025"></a>00025 <span class="comment"> ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF </span> <a name="l00026"></a>00026 <span class="comment"> THE POSSIBILITY OF SUCH DAMAGE.</span> <a name="l00027"></a>00027 <span class="comment">*/</span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="preprocessor">#ifndef WPSOLESTREAM_H</span> <a name="l00030"></a>00030 <span class="preprocessor"></span><span class="preprocessor">#define WPSOLESTREAM_H</span> <a name="l00031"></a>00031 <span class="preprocessor"></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <string></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <fstream></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <sstream></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <list></span> <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="keyword">namespace </span>libwps <a name="l00038"></a>00038 { <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="keyword">class </span>StorageIO; <a name="l00041"></a>00041 <span class="keyword">class </span>Stream; <a name="l00042"></a>00042 <span class="keyword">class </span>StreamIO; <a name="l00043"></a>00043 <a name="l00044"></a><a class="code" href="classlibwps_1_1Storage.html">00044</a> <span class="keyword">class </span><a class="code" href="classlibwps_1_1Storage.html">Storage</a> <a name="l00045"></a>00045 { <a name="l00046"></a><a class="code" href="classlibwps_1_1Storage.html#d8c01c67eaeefab6268f2f0872b47035">00046</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classlibwps_1_1Stream.html">Stream</a>; <a name="l00047"></a>00047 <a name="l00048"></a>00048 <span class="keyword">public</span>: <a name="l00049"></a>00049 <a name="l00050"></a>00050 <span class="comment">// for Storage::result()</span> <a name="l00051"></a><a class="code" href="classlibwps_1_1Storage.html#d11653cf534ffe5a1d98c2f47f07505308be46721b2215fb13bb2290bb61d33e">00051</a> <span class="keyword">enum</span> { <a class="code" href="classlibwps_1_1Storage.html#d11653cf534ffe5a1d98c2f47f075053d861c9f20d716c6e3d3aa26c8e5fbdf3">Ok</a>, <a class="code" href="classlibwps_1_1Storage.html#d11653cf534ffe5a1d98c2f47f0750536e7859c79c34f160b7e9c959c8b47a7f">OpenFailed</a>, <a class="code" href="classlibwps_1_1Storage.html#d11653cf534ffe5a1d98c2f47f075053b7d093a9d0543c90eb7b785e25e1d3b4">NotOLE</a>, <a class="code" href="classlibwps_1_1Storage.html#d11653cf534ffe5a1d98c2f47f07505395bc3622191d3a2b42599f0003185f37">BadOLE</a>, <a class="code" href="classlibwps_1_1Storage.html#d11653cf534ffe5a1d98c2f47f07505308be46721b2215fb13bb2290bb61d33e">UnknownError</a> }; <a name="l00052"></a>00052 <a name="l00056"></a>00056 <a class="code" href="classlibwps_1_1Storage.html#12297b60c8a7b87421e98d4aadadfd28" title="Constructs a storage with data.">Storage</a>( <span class="keyword">const</span> std::stringstream &memorystream ); <a name="l00057"></a>00057 <a name="l00061"></a>00061 <a class="code" href="classlibwps_1_1Storage.html#a233122d853cd2307093f9437fc3485a" title="Destroys the storage.">~Storage</a>(); <a name="l00062"></a>00062 <a name="l00066"></a>00066 <span class="keywordtype">bool</span> <a class="code" href="classlibwps_1_1Storage.html#64c01e9f12515c4224398a704b8ac7f3" title="Checks whether the storage is OLE2 storage.">isOLEStream</a>(); <a name="l00067"></a>00067 <a name="l00071"></a>00071 <span class="keywordtype">int</span> <a class="code" href="classlibwps_1_1Storage.html#21f897b3aef56b17fe7a64c90abbf125" title="Returns the error code of last operation.">result</a>(); <a name="l00072"></a>00072 <a name="l00073"></a>00073 <span class="keyword">private</span>: <a name="l00074"></a><a class="code" href="classlibwps_1_1Storage.html#f8d2039a05ad70a95a89a4cd832af860">00074</a> <a class="code" href="classlibwps_1_1StorageIO.html">StorageIO</a>* <a class="code" href="classlibwps_1_1Storage.html#f8d2039a05ad70a95a89a4cd832af860">io</a>; <a name="l00075"></a>00075 <a name="l00076"></a>00076 <span class="comment">// no copy or assign</span> <a name="l00077"></a>00077 <a class="code" href="classlibwps_1_1Storage.html#12297b60c8a7b87421e98d4aadadfd28" title="Constructs a storage with data.">Storage</a>( <span class="keyword">const</span> <a class="code" href="classlibwps_1_1Storage.html">Storage</a>& ); <a name="l00078"></a>00078 <a class="code" href="classlibwps_1_1Storage.html">Storage</a>& <a class="code" href="classlibwps_1_1Storage.html#8111159aced0e9bdf9d53e4c5255d49f">operator=</a>( <span class="keyword">const</span> <a class="code" href="classlibwps_1_1Storage.html">Storage</a>& ); <a name="l00079"></a>00079 <a name="l00080"></a>00080 }; <a name="l00081"></a>00081 <a name="l00082"></a><a class="code" href="classlibwps_1_1Stream.html">00082</a> <span class="keyword">class </span><a class="code" href="classlibwps_1_1Stream.html">Stream</a> <a name="l00083"></a>00083 { <a name="l00084"></a><a class="code" href="classlibwps_1_1Stream.html#b647623b3295040f83d3afb2a502a223">00084</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classlibwps_1_1Storage.html">Storage</a>; <a name="l00085"></a><a class="code" href="classlibwps_1_1Stream.html#5071009534d971068634b17ca17c2c5c">00085</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classlibwps_1_1StorageIO.html">StorageIO</a>; <a name="l00086"></a>00086 <a name="l00087"></a>00087 <span class="keyword">public</span>: <a name="l00088"></a>00088 <a name="l00092"></a>00092 <span class="comment">// name must be absolute, e.g "/PerfectOffice_MAIN"</span> <a name="l00093"></a>00093 <a class="code" href="classlibwps_1_1Stream.html#4e5eb3ec973b64b371834f5bcdc156ec" title="Creates a new stream.">Stream</a>( <a class="code" href="classlibwps_1_1Storage.html">Storage</a>* storage, <span class="keyword">const</span> std::string& name ); <a name="l00094"></a>00094 <a name="l00098"></a>00098 <a class="code" href="classlibwps_1_1Stream.html#c00f8b27d25a65942d226a2750c3e625" title="Destroys the stream.">~Stream</a>(); <a name="l00099"></a>00099 <a name="l00103"></a>00103 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classlibwps_1_1Stream.html#c89a69ab3d08c9509d95a3a5baf8d57e" title="Returns the stream size.">size</a>(); <a name="l00104"></a>00104 <a name="l00108"></a>00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classlibwps_1_1Stream.html#bbbfd84a38f4eee0c466ead1bdccb9c9" title="Reads a block of data.">read</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* data, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> maxlen ); <a name="l00109"></a>00109 <a name="l00110"></a>00110 <span class="keyword">private</span>: <a name="l00111"></a><a class="code" href="classlibwps_1_1Stream.html#b24d4a5939cc605f32cc9c98fa6f48cd">00111</a> <a class="code" href="classlibwps_1_1StreamIO.html">StreamIO</a>* <a class="code" href="classlibwps_1_1Stream.html#b24d4a5939cc605f32cc9c98fa6f48cd">io</a>; <a name="l00112"></a>00112 <a name="l00113"></a>00113 <span class="comment">// no copy or assign</span> <a name="l00114"></a>00114 <a class="code" href="classlibwps_1_1Stream.html#4e5eb3ec973b64b371834f5bcdc156ec" title="Creates a new stream.">Stream</a>( <span class="keyword">const</span> <a class="code" href="classlibwps_1_1Stream.html">Stream</a>& ); <a name="l00115"></a>00115 <a class="code" href="classlibwps_1_1Stream.html">Stream</a>& <a class="code" href="classlibwps_1_1Stream.html#6e8560394b24be3d3a73cc2638a020c0">operator=</a>( <span class="keyword">const</span> <a class="code" href="classlibwps_1_1Stream.html">Stream</a>& ); <a name="l00116"></a>00116 }; <a name="l00117"></a>00117 <a name="l00118"></a>00118 } <span class="comment">// namespace libwps</span> <a name="l00119"></a>00119 <a name="l00120"></a>00120 <span class="preprocessor">#endif // WPSOLESTREAM_H</span> </pre></div></div> <hr size="1"><address style="align: right;"><small> Generated on Sat Jun 28 12:35:50 2008 for libwps by <a href="http://www.doxygen.org/index.html"> doxygen</a> 1.5.6</small></address> </body> </html>