| 1 |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 |
/* |
| 3 |
* This file is part of the libabw 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 __ABWZLIBSTREAM_H__ |
| 11 |
#define __ABWZLIBSTREAM_H__ |
| 12 |
|
| 13 |
#include <vector> |
| 14 |
#include <librevenge-stream/librevenge-stream.h> |
| 15 |
|
| 16 |
namespace libabw |
| 17 |
{ |
| 18 |
|
| 19 |
class ABWZlibStream : public librevenge::RVNGInputStream |
| 20 |
{ |
| 21 |
public: |
| 22 |
ABWZlibStream(librevenge::RVNGInputStream *input); |
| 23 |
~ABWZlibStream() override {} |
| 24 |
|
| 25 |
bool isStructured() override |
| 26 |
{ |
| 27 |
return false; |
| 28 |
} |
| 29 |
unsigned subStreamCount() override |
| 30 |
{ |
| 31 |
return 0; |
| 32 |
} |
| 33 |
const char *subStreamName(unsigned) override |
| 34 |
{ |
| 35 |
return nullptr; |
| 36 |
} |
| 37 |
bool existsSubStream(const char *) override |
| 38 |
{ |
| 39 |
return false; |
| 40 |
} |
| 41 |
librevenge::RVNGInputStream *getSubStreamByName(const char *) override |
| 42 |
{ |
| 43 |
return nullptr; |
| 44 |
} |
| 45 |
librevenge::RVNGInputStream *getSubStreamById(unsigned) override |
| 46 |
{ |
| 47 |
return nullptr; |
| 48 |
} |
| 49 |
const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) override; |
| 50 |
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override; |
| 51 |
long tell() override; |
| 52 |
bool isEnd() override; |
| 53 |
unsigned long getSize() const |
| 54 |
{ |
| 55 |
return m_buffer.size(); |
| 56 |
} |
| 57 |
private: |
| 58 |
librevenge::RVNGInputStream *m_input; |
| 59 |
volatile long m_offset; |
| 60 |
std::vector<unsigned char> m_buffer; |
| 61 |
ABWZlibStream(const ABWZlibStream &); |
| 62 |
ABWZlibStream &operator=(const ABWZlibStream &); |
| 63 |
}; |
| 64 |
|
| 65 |
} // namespace libabw |
| 66 |
|
| 67 |
#endif // __ABWZLIBSTREAM_H__ |
| 68 |
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |