00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* 00003 * This file is part of the libfreehand project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 */ 00009 00010 00011 #ifndef __FHINTERNALSTREAM_H__ 00012 #define __FHINTERNALSTREAM_H__ 00013 00014 #include <vector> 00015 00016 #include <libwpd-stream/libwpd-stream.h> 00017 00018 namespace libfreehand 00019 { 00020 00021 class FHInternalStream : public WPXInputStream 00022 { 00023 public: 00024 FHInternalStream(WPXInputStream *input, unsigned long size, bool compressed=false); 00025 ~FHInternalStream() {} 00026 00027 bool isOLEStream() 00028 { 00029 return false; 00030 } 00031 WPXInputStream *getDocumentOLEStream(const char *) 00032 { 00033 return 0; 00034 } 00035 00036 const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead); 00037 int seek(long offset, WPX_SEEK_TYPE seekType); 00038 long tell(); 00039 bool atEOS(); 00040 unsigned long getSize() const 00041 { 00042 return m_buffer.size(); 00043 } 00044 00045 private: 00046 volatile long m_offset; 00047 std::vector<unsigned char> m_buffer; 00048 FHInternalStream(const FHInternalStream &); 00049 FHInternalStream &operator=(const FHInternalStream &); 00050 }; 00051 00052 } // namespace libfreehand 00053 00054 #endif 00055 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */