CDRInternalStream.h Source File documentation

CDRInternalStream.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 part of the libcdr 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 __CDRINTERNALSTREAM_H__
11#define __CDRINTERNALSTREAM_H__
12
13#include <vector>
14
15#include <librevenge-stream/librevenge-stream.h>
16
17namespace libcdr
18{
19
20 class CDRInternalStream : public librevenge::RVNGInputStream
21{
22public:
23 CDRInternalStream(librevenge::RVNGInputStream *input, unsigned long size, bool compressed=false);
24 CDRInternalStream(const std::vector<unsigned char> &buffer);
25 ~CDRInternalStream() override {}
26
27 bool isStructured() override
28 {
29 return false;
30 }
31 unsigned subStreamCount() override
32 {
33 return 0;
34 }
35 const char *subStreamName(unsigned) override
36 {
37 return nullptr;
38 }
39 bool existsSubStream(const char *) override
40 {
41 return false;
42 }
43 librevenge::RVNGInputStream *getSubStreamByName(const char *) override
44 {
45 return nullptr;
46 }
47 librevenge::RVNGInputStream *getSubStreamById(unsigned) override
48 {
49 return nullptr;
50 }
51 const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) override;
52 int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override;
53 long tell() override;
54 bool isEnd() override;
55 unsigned long getSize() const
56 {
57 return m_buffer.size();
58 }
59
60private:
61 volatile long m_offset;
62 std::vector<unsigned char> m_buffer;
63 CDRInternalStream(const CDRInternalStream &);
64 CDRInternalStream &operator=(const CDRInternalStream &);
65};
66
67} // namespace libcdr
68
69#endif
70/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libcdr::CDRInternalStream
Definition CDRInternalStream.h:21
libcdr::CDRInternalStream::operator=
CDRInternalStream & operator=(const CDRInternalStream &)
libcdr::CDRInternalStream::existsSubStream
bool existsSubStream(const char *) override
Definition CDRInternalStream.h:39
libcdr::CDRInternalStream::getSize
unsigned long getSize() const
Definition CDRInternalStream.h:55
libcdr::CDRInternalStream::CDRInternalStream
CDRInternalStream(librevenge::RVNGInputStream *input, unsigned long size, bool compressed=false)
Definition CDRInternalStream.cpp:25
libcdr::CDRInternalStream::tell
long tell() override
Definition CDRInternalStream.cpp:148
libcdr::CDRInternalStream::read
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead) override
Definition CDRInternalStream.cpp:100
libcdr::CDRInternalStream::subStreamCount
unsigned subStreamCount() override
Definition CDRInternalStream.h:31
libcdr::CDRInternalStream::~CDRInternalStream
~CDRInternalStream() override
Definition CDRInternalStream.h:25
libcdr::CDRInternalStream::getSubStreamById
librevenge::RVNGInputStream * getSubStreamById(unsigned) override
Definition CDRInternalStream.h:47
libcdr::CDRInternalStream::isStructured
bool isStructured() override
Definition CDRInternalStream.h:27
libcdr::CDRInternalStream::isEnd
bool isEnd() override
Definition CDRInternalStream.cpp:153
libcdr::CDRInternalStream::subStreamName
const char * subStreamName(unsigned) override
Definition CDRInternalStream.h:35
libcdr::CDRInternalStream::CDRInternalStream
CDRInternalStream(const CDRInternalStream &)
libcdr::CDRInternalStream::seek
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override
Definition CDRInternalStream.cpp:125
libcdr::CDRInternalStream::m_buffer
std::vector< unsigned char > m_buffer
Definition CDRInternalStream.h:62
libcdr::CDRInternalStream::m_offset
volatile long m_offset
Definition CDRInternalStream.h:61
libcdr::CDRInternalStream::getSubStreamByName
librevenge::RVNGInputStream * getSubStreamByName(const char *) override
Definition CDRInternalStream.h:43
libcdr
Definition CDRCollector.h:25