IWORKMemoryStream.h Source File documentation

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++
23 IWORKMemoryStream(const IWORKMemoryStream &other);
24 IWORKMemoryStream &operator=(const IWORKMemoryStream &other);
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);
31 ~IWORKMemoryStream();
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: */
libetonyek
Definition: IWORKBezierElement.cpp:18
libetonyek::IWORKMemoryStream::tell
long tell()
Definition: IWORKMemoryStream.cpp:147
libetonyek::IWORKMemoryStream::m_length
long m_length
Definition: IWORKMemoryStream.h:54
libetonyek::IWORKMemoryStream::getSubStreamByName
librevenge::RVNGInputStream * getSubStreamByName(const char *name)
Definition: IWORKMemoryStream.cpp:87
libetonyek::IWORKMemoryStream::m_data
const unsigned char * m_data
Definition: IWORKMemoryStream.h:53
libetonyek::IWORKMemoryStream::seek
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType)
Definition: IWORKMemoryStream.cpp:118
libetonyek::IWORKMemoryStream::existsSubStream
bool existsSubStream(const char *)
Definition: IWORKMemoryStream.h:36
libetonyek::IWORKMemoryStream::read
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead)
Definition: IWORKMemoryStream.cpp:97
libetonyek::IWORKMemoryStream::isStructured
bool isStructured()
Definition: IWORKMemoryStream.cpp:72
libetonyek::IWORKMemoryStream::isEnd
bool isEnd()
Definition: IWORKMemoryStream.cpp:152
libetonyek::IWORKMemoryStream::getSubStreamById
librevenge::RVNGInputStream * getSubStreamById(unsigned id)
Definition: IWORKMemoryStream.cpp:92
name
const char * name
Definition: IWORKToken.cpp:43
libetonyek::IWORKMemoryStream::~IWORKMemoryStream
~IWORKMemoryStream()
Definition: IWORKMemoryStream.cpp:67
libetonyek::IWORKMemoryStream::m_pos
long m_pos
Definition: IWORKMemoryStream.h:55
libetonyek::IWORKMemoryStream
Definition: IWORKMemoryStream.h:20
libetonyek::IWORKMemoryStream::subStreamName
const char * subStreamName(unsigned id)
Definition: IWORKMemoryStream.cpp:82
libetonyek::IWORKMemoryStream::assign
void assign(const unsigned char *data, unsigned length)
Definition: IWORKMemoryStream.cpp:157
libetonyek::IWORKMemoryStream::subStreamCount
unsigned subStreamCount()
Definition: IWORKMemoryStream.cpp:77
libetonyek::IWORKToken::data
Definition: IWORKToken.h:95
libetonyek::RVNGInputStreamPtr_t
boost::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libetonyek_utils.h:111
libetonyek::IWORKToken::offset
Definition: IWORKToken.h:331
libetonyek_utils.h
libetonyek::IWORKMemoryStream::operator=
IWORKMemoryStream & operator=(const IWORKMemoryStream &other)
libetonyek::IWORKMemoryStream::IWORKMemoryStream
IWORKMemoryStream(const IWORKMemoryStream &other)