00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* librevenge 00003 00004 Original source: POLE - Portable C++ library to access OLE Storage 00005 Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org> 00006 00007 Redistribution and use in source and binary forms, with or without 00008 modification, are permitted provided that the following conditions 00009 are met: 00010 * Redistributions of source code must retain the above copyright notice, 00011 this list of conditions and the following disclaimer. 00012 * Redistributions in binary form must reproduce the above copyright notice, 00013 this list of conditions and the following disclaimer in the documentation 00014 and/or other materials provided with the distribution. 00015 * Neither the name of the authors nor the names of its contributors may be 00016 used to endorse or promote products derived from this software without 00017 specific prior written permission. 00018 00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00020 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00022 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00023 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00024 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00025 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00026 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00027 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 00029 THE POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 00032 #ifndef RVNGOLESTREAM_H 00033 #define RVNGOLESTREAM_H 00034 00035 #include <string> 00036 #include <vector> 00037 00038 namespace librevenge 00039 { 00040 00041 class RVNGInputStream; 00042 00043 class IStorage; 00044 class Stream; 00045 class IStream; 00046 00047 class Storage 00048 { 00049 friend class Stream; 00050 00051 public: 00052 00053 // for Storage::result() 00054 enum Result { Ok, OpenFailed, NotOLE, BadOLE, UnknownError }; 00055 00059 Storage(RVNGInputStream *is); 00060 00064 ~Storage(); 00065 00069 bool isStructured(); 00070 00074 std::vector<std::string> getSubStreamNamesList(); 00075 00079 Result result(); 00080 00081 private: 00082 IStorage *m_io; 00083 00084 // no copy or assign 00085 Storage(const Storage &); 00086 Storage &operator=(const Storage &); 00087 00088 }; 00089 00090 class Stream 00091 { 00092 friend class Storage; 00093 friend class IStorage; 00094 00095 public: 00096 00100 Stream(Storage *storage, const std::string &name); 00101 00105 ~Stream(); 00106 00110 unsigned long size(); 00111 00115 unsigned long read(unsigned char *data, unsigned long maxlen); 00116 00117 private: 00118 IStream *m_io; 00119 00120 // no copy or assign 00121 Stream(const Stream &); 00122 Stream &operator=(const Stream &); 00123 }; 00124 00125 } // namespace librevenge 00126 00127 #endif // RVNGOLESTREAM_H 00128 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */