summaryrefslogtreecommitdiff
path: root/src/lib/FHInternalStream.h
blob: bdf20ab9fa5724c77bdad613c2824171f21b5064 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
 * This file is part of the libfreehand project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */


#ifndef __FHINTERNALSTREAM_H__
#define __FHINTERNALSTREAM_H__

#include <vector>

#include <librevenge-stream/librevenge-stream.h>

namespace libfreehand
{

class FHInternalStream : public librevenge::RVNGInputStream
{
public:
  FHInternalStream(librevenge::RVNGInputStream *input, unsigned long size, bool compressed=false);
  ~FHInternalStream() {}
  virtual bool isStructured()
  {
    return false;
  }
  virtual unsigned subStreamCount()
  {
    return 0;
  }
  virtual const char *subStreamName(unsigned)
  {
    return 0;
  }
  virtual bool existsSubStream(const char *)
  {
    return false;
  }
  virtual librevenge::RVNGInputStream *getSubStreamByName(const char *)
  {
    return 0;
  }
  virtual librevenge::RVNGInputStream *getSubStreamById(unsigned)
  {
    return 0;
  }
  const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
  int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
  long tell();
  bool isEnd();
  unsigned long getSize() const
  {
    return m_buffer.size();
  }

private:
  volatile long m_offset;
  std::vector<unsigned char> m_buffer;
  FHInternalStream(const FHInternalStream &);
  FHInternalStream &operator=(const FHInternalStream &);
};

} // namespace libfreehand

#endif
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */