ZMFInternalStream.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is a part of the libzmf project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef ZMFINTERNALSTREAM_H_INCLUDED
11 #define ZMFINTERNALSTREAM_H_INCLUDED
12
13 #include <vector>
14
15 #include <librevenge-stream/librevenge-stream.h>
16
17 #include "libzmf_utils.h"
18
19 namespace libzmf
20 {
21
22 class ZMFInternalStream : public librevenge::RVNGInputStream
23 {
24 public:
25 ZMFInternalStream(const unsigned char *data, unsigned long size);
26 ZMFInternalStream(const std::vector<unsigned char> &data);
27 ZMFInternalStream(const RVNGInputStreamPtr &input, unsigned long size);
28 virtual ~ZMFInternalStream();
29
30 virtual bool isStructured();
31 virtual unsigned subStreamCount();
32 virtual const char *subStreamName(unsigned id);
33 virtual bool existsSubStream(const char *name);
34 virtual librevenge::RVNGInputStream *getSubStreamByName(const char *name);
35 virtual librevenge::RVNGInputStream *getSubStreamById(unsigned id);
36
37 const virtual unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
38 virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
39 virtual long tell();
40 virtual bool isEnd();
41
42 private:
43 long m_offset;
44 unsigned long m_size;
45 const unsigned char *m_data;
46 unsigned char *m_tmpBuf;
47 bool m_dataOwner;
48 ZMFInternalStream(const ZMFInternalStream &);
49 ZMFInternalStream &operator=(const ZMFInternalStream &);
50 };
51
52 }
53
54 #endif // ZMFINTERNALSTREAM_H_INCLUDED
55
56 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libzmf::ZMFInternalStream::read
virtual const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead)
Definition: ZMFInternalStream.cpp:91
libzmf::ZMFInternalStream::m_tmpBuf
unsigned char * m_tmpBuf
Definition: ZMFInternalStream.h:46
libzmf::ZMFInternalStream::existsSubStream
virtual bool existsSubStream(const char *name)
Definition: ZMFInternalStream.cpp:76
libzmf::ZMFInternalStream::subStreamCount
virtual unsigned subStreamCount()
Definition: ZMFInternalStream.cpp:66
libzmf::ZMFInternalStream::tell
virtual long tell()
Definition: ZMFInternalStream.cpp:147
libzmf::ZMFInternalStream::m_data
const unsigned char * m_data
Definition: ZMFInternalStream.h:45
libzmf::ZMFInternalStream::m_offset
long m_offset
Definition: ZMFInternalStream.h:43
libzmf::ZMFInternalStream::getSubStreamById
virtual librevenge::RVNGInputStream * getSubStreamById(unsigned id)
Definition: ZMFInternalStream.cpp:86
libzmf::ZMFInternalStream
Definition: ZMFInternalStream.h:22
libzmf::RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
Definition: libzmf_utils.h:72
libzmf::ZMFInternalStream::operator=
ZMFInternalStream & operator=(const ZMFInternalStream &)
libzmf_utils.h
libzmf::ZMFInternalStream::~ZMFInternalStream
virtual ~ZMFInternalStream()
Definition: ZMFInternalStream.cpp:53
libzmf::ZMFInternalStream::isEnd
virtual bool isEnd()
Definition: ZMFInternalStream.cpp:152
libzmf
Definition: BMIHeader.cpp:13
libzmf::ZMFInternalStream::ZMFInternalStream
ZMFInternalStream(const unsigned char *data, unsigned long size)
Definition: ZMFInternalStream.cpp:17
libzmf::ZMFInternalStream::seek
virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType)
Definition: ZMFInternalStream.cpp:124
libzmf::ZMFInternalStream::m_dataOwner
bool m_dataOwner
Definition: ZMFInternalStream.h:47
libzmf::ZMFInternalStream::getSubStreamByName
virtual librevenge::RVNGInputStream * getSubStreamByName(const char *name)
Definition: ZMFInternalStream.cpp:81
libzmf::ZMFInternalStream::isStructured
virtual bool isStructured()
Definition: ZMFInternalStream.cpp:61
libzmf::ZMFInternalStream::m_size
unsigned long m_size
Definition: ZMFInternalStream.h:44
libzmf::ZMFInternalStream::subStreamName
virtual const char * subStreamName(unsigned id)
Definition: ZMFInternalStream.cpp:71