CDRInternalStream.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libcdr 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 #ifndef __CDRINTERNALSTREAM_H__
00011 #define __CDRINTERNALSTREAM_H__
00012 
00013 #include <vector>
00014 
00015 #include <librevenge-stream/librevenge-stream.h>
00016 
00017 namespace libcdr
00018 {
00019 
00020 class CDRInternalStream : public librevenge::RVNGInputStream
00021 {
00022 public:
00023   CDRInternalStream(librevenge::RVNGInputStream *input, unsigned long size, bool compressed=false);
00024   CDRInternalStream(const std::vector<unsigned char> &buffer);
00025   ~CDRInternalStream() {}
00026 
00027   bool isStructured()
00028   {
00029     return false;
00030   }
00031   unsigned subStreamCount()
00032   {
00033     return 0;
00034   }
00035   const char *subStreamName(unsigned)
00036   {
00037     return 0;
00038   }
00039   bool existsSubStream(const char *)
00040   {
00041     return false;
00042   }
00043   librevenge::RVNGInputStream *getSubStreamByName(const char *)
00044   {
00045     return 0;
00046   }
00047   librevenge::RVNGInputStream *getSubStreamById(unsigned)
00048   {
00049     return 0;
00050   }
00051   const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
00052   int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
00053   long tell();
00054   bool isEnd();
00055   unsigned long getSize() const
00056   {
00057     return m_buffer.size();
00058   }
00059 
00060 private:
00061   volatile long m_offset;
00062   std::vector<unsigned char> m_buffer;
00063   CDRInternalStream(const CDRInternalStream &);
00064   CDRInternalStream &operator=(const CDRInternalStream &);
00065 };
00066 
00067 } // namespace libcdr
00068 
00069 #endif
00070 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */