RVNGStreamImplementation.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* librevenge
3  * Version: MPL 2.0 / LGPLv2.1+
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  * Major Contributor(s):
10  * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
11  *
12  * For minor contributions see the git repository.
13  *
14  * Alternatively, the contents of this file may be used under the terms
15  * of the GNU Lesser General Public License Version 2.1 or later
16  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
17  * applicable instead of those above.
18  */
19 
20 #ifndef RVNGSTREAMIMPLEMENTATION_H
21 #define RVNGSTREAMIMPLEMENTATION_H
22 
23 #include "librevenge-stream-api.h"
24 
25 #include "RVNGStream.h"
26 
27 namespace librevenge
28 {
29 
30 class RVNGFileStreamPrivate;
31 
33 {
34 public:
35  explicit RVNGFileStream(const char *filename);
36  ~RVNGFileStream();
37 
38  const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
39  long tell();
40  int seek(long offset, RVNG_SEEK_TYPE seekType);
41  bool isEnd();
42 
43  bool isStructured();
44  unsigned subStreamCount();
45  const char *subStreamName(unsigned id);
46  bool existsSubStream(const char *name);
47  RVNGInputStream *getSubStreamById(unsigned id);
48  RVNGInputStream *getSubStreamByName(const char *name);
49 
50 private:
52  RVNGFileStream(const RVNGFileStream &); // copy is not allowed
53  RVNGFileStream &operator=(const RVNGFileStream &); // assignment is not allowed
54 };
55 
57 
59 {
60 public:
61  RVNGStringStream(const unsigned char *data, const unsigned int dataSize);
63 
64  const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead);
65  long tell();
66  int seek(long offset, RVNG_SEEK_TYPE seekType);
67  bool isEnd();
68 
69  bool isStructured();
70  unsigned subStreamCount();
71  const char *subStreamName(unsigned);
72  bool existsSubStream(const char *name);
73  RVNGInputStream *getSubStreamByName(const char *name);
74  RVNGInputStream *getSubStreamById(unsigned);
75 
76 private:
78  RVNGStringStream(const RVNGStringStream &); // copy is not allowed
79  RVNGStringStream &operator=(const RVNGStringStream &); // assignment is not allowed
80 };
81 
82 }
83 
84 #endif // RVNGSTREAMIMPLEMENTATION_H
85 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
librevenge::RVNGFileStream::isStructured
bool isStructured()
Analyses the content of the input stream to see whether it is an OLE2 storage.
Definition: RVNGStreamImplementation.cpp:273
librevenge::Stream
Definition: RVNGOLEStream.h:91
librevenge::RVNGStringStreamPrivate::operator=
RVNGStringStreamPrivate & operator=(const RVNGStringStreamPrivate &)
librevenge::RVNG_SEEK_END
@ RVNG_SEEK_END
Definition: RVNGStream.h:30
librevenge::RVNGFileStream::isEnd
bool isEnd()
Determines whether the current position is at the end of the stream.
Definition: RVNGStreamImplementation.cpp:266
librevenge::RVNGStringStreamPrivate::streamType
RVNGStreamType streamType
Definition: RVNGStreamImplementation.cpp:67
librevenge::RVNGFileStreamPrivate::RVNGFileStreamPrivate
RVNGFileStreamPrivate()
Definition: RVNGStreamImplementation.cpp:74
librevenge-stream.h
librevenge::Storage::isStructured
bool isStructured()
Checks whether the storage is OLE2 storage.
Definition: RVNGOLEStream.cpp:1762
librevenge::RVNGFileStream::RVNGFileStream
RVNGFileStream(const RVNGFileStream &)
BUFFER_MAX
#define BUFFER_MAX
Definition: RVNGStreamImplementation.cpp:145
librevenge::RVNGStringStream::~RVNGStringStream
~RVNGStringStream()
Definition: RVNGStreamImplementation.cpp:387
librevenge::RVNGStringStreamPrivate::RVNGStringStreamPrivate
RVNGStringStreamPrivate(const unsigned char *data, unsigned dataSize)
Definition: RVNGStreamImplementation.cpp:93
librevenge::RVNGFileStream::subStreamCount
unsigned subStreamCount()
Definition: RVNGStreamImplementation.cpp:309
librevenge::RVNGStringStream::tell
long tell()
Returns the actual position inside the input stream.
Definition: RVNGStreamImplementation.cpp:418
librevenge::RVNGFileStream::~RVNGFileStream
~RVNGFileStream()
Definition: RVNGStreamImplementation.cpp:139
librevenge::RVNGFileStream::subStreamName
const char * subStreamName(unsigned id)
Definition: RVNGStreamImplementation.cpp:315
librevenge::RVNGStringStream::d
RVNGStringStreamPrivate * d
Definition: RVNGStreamImplementation.h:77
librevenge::RVNGFileStreamPrivate::streamType
RVNGStreamType streamType
Definition: RVNGStreamImplementation.cpp:53
librevenge::RVNGFileStreamPrivate::streamNameList
std::vector< std::string > streamNameList
Definition: RVNGStreamImplementation.cpp:54
RVNGOLEStream.h
librevenge::RVNGZipStream::getSubstream
static RVNGInputStream * getSubstream(RVNGInputStream *input, const char *name)
Definition: RVNGZipStream.cpp:426
librevenge::RVNGZipStream::getSubStreamNamesList
static std::vector< std::string > getSubStreamNamesList(RVNGInputStream *input)
Definition: RVNGZipStream.cpp:421
librevenge::Storage::Ok
@ Ok
Definition: RVNGOLEStream.h:54
librevenge::RVNGFileStreamPrivate::RVNGFileStreamPrivate
RVNGFileStreamPrivate(const RVNGFileStreamPrivate &)
S_ISREG
#define S_ISREG(x)
Definition: RVNGStreamImplementation.cpp:35
librevenge::RVNGStringStream::getSubStreamById
RVNGInputStream * getSubStreamById(unsigned)
Definition: RVNGStreamImplementation.cpp:518
librevenge::RVNGStringStreamPrivate::offset
volatile long offset
Definition: RVNGStreamImplementation.cpp:66
librevenge::ZIP
@ ZIP
Definition: RVNGStreamImplementation.cpp:41
librevenge::RVNGStringStreamPrivate::RVNGStringStreamPrivate
RVNGStringStreamPrivate(const RVNGStringStreamPrivate &)
librevenge::RVNGStringStream::RVNGStringStream
RVNGStringStream(const unsigned char *data, const unsigned int dataSize)
Definition: RVNGStreamImplementation.cpp:381
librevenge-stream-api.h
librevenge::FLAT
@ FLAT
Definition: RVNGStreamImplementation.cpp:41
librevenge::RVNGStringStream::isEnd
bool isEnd()
Determines whether the current position is at the end of the stream.
Definition: RVNGStreamImplementation.cpp:446
librevenge::RVNGFileStreamPrivate::readBufferPos
unsigned long readBufferPos
Definition: RVNGStreamImplementation.cpp:52
librevenge::RVNGStringStream::RVNGStringStream
RVNGStringStream(const RVNGStringStream &)
librevenge::RVNGFileStreamPrivate::operator=
RVNGFileStreamPrivate & operator=(const RVNGFileStreamPrivate &)
librevenge::RVNGStringStreamPrivate::streamNameList
std::vector< std::string > streamNameList
Definition: RVNGStreamImplementation.cpp:68
librevenge::RVNGFileStream::tell
long tell()
Returns the actual position inside the input stream.
Definition: RVNGStreamImplementation.cpp:220
librevenge::RVNGFileStreamPrivate::readBufferLength
unsigned long readBufferLength
Definition: RVNGStreamImplementation.cpp:51
librevenge::RVNGStringStream::read
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead)
Tries to read a given number of bytes starting from the current position inside the input stream.
Definition: RVNGStreamImplementation.cpp:392
librevenge::RVNGStreamType
RVNGStreamType
Definition: RVNGStreamImplementation.cpp:41
RVNGZipStream.h
librevenge::RVNG_SEEK_CUR
@ RVNG_SEEK_CUR
Definition: RVNGStream.h:28
filename
std::string filename
Definition: RVNGZipStream.cpp:51
librevenge::RVNG_SEEK_SET
@ RVNG_SEEK_SET
Definition: RVNGStream.h:29
librevenge::RVNGFileStream::existsSubStream
bool existsSubStream(const char *name)
Definition: RVNGStreamImplementation.cpp:322
librevenge::RVNGFileStream
Definition: RVNGStreamImplementation.h:33
librevenge::RVNGFileStream::read
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead)
Tries to read a given number of bytes starting from the current position inside the input stream.
Definition: RVNGStreamImplementation.cpp:147
librevenge::UNKNOWN
@ UNKNOWN
Definition: RVNGStreamImplementation.cpp:41
librevenge::RVNGStringStream
Definition: RVNGStreamImplementation.h:59
librevenge::Stream::size
unsigned long size()
Returns the stream size.
Definition: RVNGOLEStream.cpp:1797
librevenge::RVNGFileStreamPrivate::readBuffer
unsigned char * readBuffer
Definition: RVNGStreamImplementation.cpp:50
librevenge::RVNGStringStreamPrivate::buffer
std::vector< unsigned char > buffer
Definition: RVNGStreamImplementation.cpp:65
librevenge::RVNGFileStream::getSubStreamById
RVNGInputStream * getSubStreamById(unsigned id)
Definition: RVNGStreamImplementation.cpp:340
librevenge::Stream::read
unsigned long read(unsigned char *data, unsigned long maxlen)
Reads a block of data.
Definition: RVNGOLEStream.cpp:1802
RVNGStream.h
librevenge::Storage::result
Result result()
Returns the error code of last operation.
Definition: RVNGOLEStream.cpp:1757
librevenge::RVNGFileStreamPrivate::streamSize
unsigned long streamSize
Definition: RVNGStreamImplementation.cpp:49
librevenge::RVNGStringStreamPrivate::~RVNGStringStreamPrivate
~RVNGStringStreamPrivate()
Definition: RVNGStreamImplementation.cpp:103
librevenge::RVNGStringStream::operator=
RVNGStringStream & operator=(const RVNGStringStream &)
librevenge::RVNGFileStream::getSubStreamByName
RVNGInputStream * getSubStreamByName(const char *name)
Extracts a named stream from an OLE2 storage.
Definition: RVNGStreamImplementation.cpp:345
librevenge::RVNGStringStream::subStreamName
const char * subStreamName(unsigned)
Definition: RVNGStreamImplementation.cpp:493
REVENGE_STREAM_API
#define REVENGE_STREAM_API
Definition: librevenge-stream-api.h:34
librevenge::OLE2
@ OLE2
Definition: RVNGStreamImplementation.cpp:41
librevenge::RVNGStringStreamPrivate
Definition: RVNGStreamImplementation.cpp:61
librevenge::RVNGFileStream::operator=
RVNGFileStream & operator=(const RVNGFileStream &)
librevenge::RVNGStringStream::getSubStreamByName
RVNGInputStream * getSubStreamByName(const char *name)
Extracts a named stream from an OLE2 storage.
Definition: RVNGStreamImplementation.cpp:523
librevenge::RVNGInputStream
Definition: RVNGStream.h:34
offset
unsigned offset
Definition: RVNGZipStream.cpp:77
librevenge::RVNGZipStream::isZipFile
static bool isZipFile(RVNGInputStream *input)
Definition: RVNGZipStream.cpp:398
librevenge::RVNG_SEEK_TYPE
RVNG_SEEK_TYPE
Definition: RVNGStream.h:27
librevenge::RVNGStringStream::existsSubStream
bool existsSubStream(const char *name)
Definition: RVNGStreamImplementation.cpp:500
librevenge::RVNGStringStream::isStructured
bool isStructured()
Analyses the content of the input stream to see whether it is an OLE2 storage.
Definition: RVNGStreamImplementation.cpp:454
librevenge
Definition: RVNGBinaryData.cpp:39
librevenge::RVNGFileStreamPrivate::file
FILE * file
Definition: RVNGStreamImplementation.cpp:48
librevenge::RVNGFileStream::RVNGFileStream
RVNGFileStream(const char *filename)
Definition: RVNGStreamImplementation.cpp:107
librevenge::RVNGFileStreamPrivate::~RVNGFileStreamPrivate
~RVNGFileStreamPrivate()
Definition: RVNGStreamImplementation.cpp:85
librevenge::RVNGFileStream::d
RVNGFileStreamPrivate * d
Definition: RVNGStreamImplementation.h:51
librevenge::RVNGFileStreamPrivate
Definition: RVNGStreamImplementation.cpp:44
librevenge::RVNGFileStream::seek
int seek(long offset, RVNG_SEEK_TYPE seekType)
Moves to the next location inside the input stream.
Definition: RVNGStreamImplementation.cpp:227
librevenge::RVNGStringStream::subStreamCount
unsigned subStreamCount()
Definition: RVNGStreamImplementation.cpp:487
librevenge::Storage::getSubStreamNamesList
std::vector< std::string > getSubStreamNamesList()
Returns the list of substream name.
Definition: RVNGOLEStream.cpp:1767
librevenge::RVNGStringStream::seek
int seek(long offset, RVNG_SEEK_TYPE seekType)
Moves to the next location inside the input stream.
Definition: RVNGStreamImplementation.cpp:423
librevenge::Storage
Definition: RVNGOLEStream.h:48

Generated for librevenge by doxygen 1.8.18