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 <vector>
14 
15 #include "libetonyek_utils.h"
16 
17 namespace libetonyek
18 {
19 
20 class IWORKMemoryStream : public librevenge::RVNGInputStream
21 {
22  // -Weffc++
25 
26 public:
27  explicit IWORKMemoryStream(const RVNGInputStreamPtr_t &input);
28  IWORKMemoryStream(const RVNGInputStreamPtr_t &input, unsigned length);
29  explicit IWORKMemoryStream(const std::vector<unsigned char> &data);
30  IWORKMemoryStream(const unsigned char *data, unsigned length);
32 
33  bool isStructured();
34  unsigned subStreamCount();
35  const char *subStreamName(unsigned id);
36  bool existsSubStream(const char *)
37  {
38  return false;
39  }
40  librevenge::RVNGInputStream *getSubStreamByName(const char *name);
41  librevenge::RVNGInputStream *getSubStreamById(unsigned id);
42 
43  const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
44  int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType);
45  long tell();
46  bool isEnd();
47 
48 private:
49  void assign(const unsigned char *data, unsigned length);
50  void read(const RVNGInputStreamPtr_t &input, unsigned length);
51 
52 private:
53  const unsigned char *m_data;
54  long m_length;
55  long m_pos;
56 };
57 
58 }
59 
60 #endif // IWORKMEMORYSTREAM_H_INCLUDED
61 
62 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: IWORKBezierElement.cpp:18
long tell()
Definition: IWORKMemoryStream.cpp:147
long m_length
Definition: IWORKMemoryStream.h:54
librevenge::RVNGInputStream * getSubStreamByName(const char *name)
Definition: IWORKMemoryStream.cpp:87
const unsigned char * m_data
Definition: IWORKMemoryStream.h:53
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType)
Definition: IWORKMemoryStream.cpp:118
bool existsSubStream(const char *)
Definition: IWORKMemoryStream.h:36
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead)
Definition: IWORKMemoryStream.cpp:97
bool isStructured()
Definition: IWORKMemoryStream.cpp:72
bool isEnd()
Definition: IWORKMemoryStream.cpp:152
librevenge::RVNGInputStream * getSubStreamById(unsigned id)
Definition: IWORKMemoryStream.cpp:92
const char * name
Definition: IWORKToken.cpp:43
~IWORKMemoryStream()
Definition: IWORKMemoryStream.cpp:67
long m_pos
Definition: IWORKMemoryStream.h:55
Definition: IWORKMemoryStream.h:20
const char * subStreamName(unsigned id)
Definition: IWORKMemoryStream.cpp:82
void assign(const unsigned char *data, unsigned length)
Definition: IWORKMemoryStream.cpp:157
unsigned subStreamCount()
Definition: IWORKMemoryStream.cpp:77
Definition: IWORKToken.h:95
boost::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:111
Definition: IWORKToken.h:331
IWORKMemoryStream & operator=(const IWORKMemoryStream &other)
IWORKMemoryStream(const IWORKMemoryStream &other)

Generated for libetonyek by doxygen 1.8.11