IWORKMemoryStream.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 libetonyek 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 IWORKMEMORYSTREAM_H_INCLUDED
11#define IWORKMEMORYSTREAM_H_INCLUDED
12
13#include <memory>
14#include <vector>
15
16#include "libetonyek_utils.h"
17
18namespace libetonyek
19{
20
21class IWORKMemoryStream : public librevenge::RVNGInputStream
22{
23 // -Weffc++
26
27public:
28 explicit IWORKMemoryStream(const RVNGInputStreamPtr_t &input);
29 IWORKMemoryStream(const RVNGInputStreamPtr_t &input, unsigned length);
30 explicit IWORKMemoryStream(const std::vector<unsigned char> &data);
31 IWORKMemoryStream(const unsigned char *data, unsigned length);
32 ~IWORKMemoryStream() override;
33
34 bool isStructured() override;
35 unsigned subStreamCount() override;
36 const char *subStreamName(unsigned id) override;
37 bool existsSubStream(const char *) override
38 {
39 return false;
40 }
41 librevenge::RVNGInputStream *getSubStreamByName(const char *name) override;
42 librevenge::RVNGInputStream *getSubStreamById(unsigned id) override;
43
44 const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) override;
45 int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override;
46 long tell() override;
47 bool isEnd() override;
48
49private:
50 void assign(const unsigned char *data, unsigned length);
51 void read(const RVNGInputStreamPtr_t &input, unsigned length);
52
53private:
54 std::unique_ptr<unsigned char[]> m_data;
56 long m_pos;
57};
58
59}
60
61#endif // IWORKMEMORYSTREAM_H_INCLUDED
62
63/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition IWORKMemoryStream.h:22
long tell() override
Definition IWORKMemoryStream.cpp:146
librevenge::RVNGInputStream * getSubStreamByName(const char *name) override
Definition IWORKMemoryStream.cpp:86
long m_length
Definition IWORKMemoryStream.h:55
bool isEnd() override
Definition IWORKMemoryStream.cpp:151
long m_pos
Definition IWORKMemoryStream.h:56
void assign(const unsigned char *data, unsigned length)
Definition IWORKMemoryStream.cpp:156
std::unique_ptr< unsigned char[]> m_data
Definition IWORKMemoryStream.h:54
IWORKMemoryStream & operator=(const IWORKMemoryStream &other)
librevenge::RVNGInputStream * getSubStreamById(unsigned id) override
Definition IWORKMemoryStream.cpp:91
bool existsSubStream(const char *) override
Definition IWORKMemoryStream.h:37
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead) override
Definition IWORKMemoryStream.cpp:96
IWORKMemoryStream(const IWORKMemoryStream &other)
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override
Definition IWORKMemoryStream.cpp:117
const char * subStreamName(unsigned id) override
Definition IWORKMemoryStream.cpp:81
unsigned subStreamCount() override
Definition IWORKMemoryStream.cpp:76
bool isStructured() override
Definition IWORKMemoryStream.cpp:71
~IWORKMemoryStream() override
Definition IWORKMemoryStream.cpp:67
@ offset
Definition IWORKToken.h:594
@ data
Definition IWORKToken.h:178
@ name
Definition IWORKToken.h:585
Definition IWORKBezierElement.cpp:21
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition libetonyek_utils.h:82

Generated for libetonyek by doxygen 1.12.0