KEYMemoryStream.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 KEYMEMORYSTREAM_H_INCLUDED
11 #define KEYMEMORYSTREAM_H_INCLUDED
12 
13 #include <vector>
14 
15 #include "libetonyek_utils.h"
16 
17 namespace libetonyek
18 {
19 
20 class KEYMemoryStream : public librevenge::RVNGInputStream
21 {
22  // -Weffc++
23  KEYMemoryStream(const KEYMemoryStream &other);
25 
26 public:
28  KEYMemoryStream(const RVNGInputStreamPtr_t &input, unsigned length);
29  explicit KEYMemoryStream(std::vector<unsigned char> &data);
30  KEYMemoryStream(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 // KEYMEMORYSTREAM_H_INCLUDED
61 
62 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
Definition: KEY1Token.h:139
Definition: EtonyekDocument.cpp:40
const char * name
Definition: KEY1Token.cpp:43
KEYMemoryStream & operator=(const KEYMemoryStream &other)
~KEYMemoryStream()
Definition: KEYMemoryStream.cpp:66
long m_length
Definition: KEYMemoryStream.h:54
Definition: KEYMemoryStream.h:20
Definition: KEY2Token.h:1015
const char * subStreamName(unsigned id)
Definition: KEYMemoryStream.cpp:81
long m_pos
Definition: KEYMemoryStream.h:55
Definition: KEY1Token.h:41
KEYMemoryStream(const KEYMemoryStream &other)
const unsigned char * m_data
Definition: KEYMemoryStream.h:53
librevenge::RVNGInputStream * getSubStreamByName(const char *name)
Definition: KEYMemoryStream.cpp:86
librevenge::RVNGInputStream * getSubStreamById(unsigned id)
Definition: KEYMemoryStream.cpp:91
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead)
Definition: KEYMemoryStream.cpp:96
boost::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:88
bool existsSubStream(const char *)
Definition: KEYMemoryStream.h:36
bool isEnd()
Definition: KEYMemoryStream.cpp:151
bool isStructured()
Definition: KEYMemoryStream.cpp:71
RVNGInputStreamPtr_t input
Definition: EtonyekDocument.cpp:59
void assign(const unsigned char *data, unsigned length)
Definition: KEYMemoryStream.cpp:156
long tell()
Definition: KEYMemoryStream.cpp:146
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType)
Definition: KEYMemoryStream.cpp:117
unsigned subStreamCount()
Definition: KEYMemoryStream.cpp:76

Generated for libetonyek by doxygen 1.8.9.1