Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

WPXOLEStream.h

Go to the documentation of this file.
00001 /* POLE - Portable C++ library to access OLE Storage 
00002    Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org>
00003 
00004    Redistribution and use in source and binary forms, with or without 
00005    modification, are permitted provided that the following conditions 
00006    are met:
00007    * Redistributions of source code must retain the above copyright notice, 
00008      this list of conditions and the following disclaimer.
00009    * Redistributions in binary form must reproduce the above copyright notice, 
00010      this list of conditions and the following disclaimer in the documentation 
00011      and/or other materials provided with the distribution.
00012    * Neither the name of the authors nor the names of its contributors may be 
00013      used to endorse or promote products derived from this software without 
00014      specific prior written permission.
00015 
00016    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00017    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00018    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00019    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
00020    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00021    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00022    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00023    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00024    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00025    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
00026    THE POSSIBILITY OF SUCH DAMAGE.
00027 */
00028 
00029 #ifndef WPXOLESTREAM_H
00030 #define WPXOLESTREAM_H
00031 
00032 #include <string>
00033 #include <fstream>
00034 #include <sstream>
00035 #include <list>
00036 
00037 namespace libwpd
00038 {
00039 
00040 class StorageIO;
00041 class Stream;
00042 class StreamIO;
00043 
00044 class Storage
00045 {
00046   friend class Stream;
00047 
00048 public:
00049 
00050   // for Storage::result()
00051   enum { Ok, OpenFailed, NotOLE, BadOLE, UnknownError };
00052   
00056   Storage( const std::stringstream &memorystream );
00057 
00061   ~Storage();
00062   
00066   bool isOLEStream();
00067 
00071   int result();
00072   
00073 private:
00074   StorageIO* io;
00075   
00076   // no copy or assign
00077   Storage( const Storage& );
00078   Storage& operator=( const Storage& );
00079 
00080 };
00081 
00082 class Stream
00083 {
00084   friend class Storage;
00085   friend class StorageIO;
00086   
00087 public:
00088 
00092   // name must be absolute, e.g "/PerfectOffice_MAIN"
00093   Stream( Storage* storage, const std::string& name );
00094 
00098   ~Stream();
00099 
00103   unsigned long size();
00104 
00108   unsigned long read( unsigned char* data, unsigned long maxlen );
00109   
00110 private:
00111   StreamIO* io;
00112 
00113   // no copy or assign
00114   Stream( const Stream& );
00115   Stream& operator=( const Stream& );    
00116 };
00117 
00118 }  // namespace libwpd
00119 
00120 #endif // WPXOLESTREAM_H

Generated on Sat Aug 20 05:20:57 2022 for libwpd by doxygen 1.3.5