00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ 00002 /* librevenge 00003 * Version: MPL 2.0 / LGPLv2.1+ 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 * Major Contributor(s): 00010 * Copyright (C) 2004-2005 William Lachance (wrlach@gmail.com) 00011 * 00012 * For minor contributions see the git repository. 00013 * 00014 * Alternatively, the contents of this file may be used under the terms 00015 * of the GNU Lesser General Public License Version 2.1 or later 00016 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are 00017 * applicable instead of those above. 00018 */ 00019 00020 #ifndef RVNGMEMORYSTREAM_H 00021 #define RVNGMEMORYSTREAM_H 00022 00023 #include <librevenge-stream/librevenge-stream.h> 00024 00025 namespace librevenge 00026 { 00027 00028 class RVNGMemoryInputStream : public RVNGInputStream 00029 { 00030 public: 00031 RVNGMemoryInputStream(unsigned char *data, unsigned long size); 00032 ~RVNGMemoryInputStream(); 00033 bool isStructured() 00034 { 00035 return false; 00036 } 00037 unsigned subStreamCount() 00038 { 00039 return 0; 00040 } 00041 const char *subStreamName(unsigned) 00042 { 00043 return 0; 00044 } 00045 bool existsSubStream(const char *) 00046 { 00047 return false; 00048 } 00049 RVNGInputStream *getSubStreamByName(const char *) 00050 { 00051 return 0; 00052 } 00053 RVNGInputStream *getSubStreamById(unsigned) 00054 { 00055 return 0; 00056 } 00057 const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead); 00058 int seek(long offset, RVNG_SEEK_TYPE seekType); 00059 long tell(); 00060 bool isEnd(); 00061 unsigned long getSize() const 00062 { 00063 return m_size; 00064 } 00065 00066 private: 00067 long m_offset; 00068 unsigned long m_size; 00069 unsigned char *m_data; 00070 RVNGMemoryInputStream(const RVNGMemoryInputStream &); 00071 RVNGMemoryInputStream &operator=(const RVNGMemoryInputStream &); 00072 }; 00073 00074 } 00075 00076 #endif 00077 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */