WPSStringStream.h Source File documentation

WPSStringStream.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
3 /* libwps
4 * Version: MPL 2.0 / LGPLv2.1+
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 *
10 * Major Contributor(s):
11 * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
12 * Copyright (C) 2006, 2007 Andrew Ziem
13 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
14 * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
15 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
16 *
17 * For minor contributions see the git repository.
18 *
19 * Alternatively, the contents of this file may be used under the terms
20 * of the GNU Lesser General Public License Version 2.1 or later
21 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
22 * applicable instead of those above.
23 *
24 * For further information visit http://libwps.sourceforge.net
25 */
26
27 #ifndef WPS_STRING_STREAM_H
28 #define WPS_STRING_STREAM_H
29
30 #include <memory>
31
32 #include <librevenge-stream/librevenge-stream.h>
33
34 class WPSStringStreamPrivate;
35
41 class WPSStringStream final: public librevenge::RVNGInputStream
42 {
43 public:
45 WPSStringStream(const unsigned char *data, const unsigned int dataSize);
47 ~WPSStringStream() final;
48
50 void append(const unsigned char *data, const unsigned int dataSize);
55 const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) final;
57 long tell() final;
61 int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) final;
63 bool isEnd() final;
64
68 bool isStructured() final;
72 unsigned subStreamCount() final;
76 const char *subStreamName(unsigned) final;
80 bool existsSubStream(const char *name) final;
84 librevenge::RVNGInputStream *getSubStreamByName(const char *name) final;
88 librevenge::RVNGInputStream *getSubStreamById(unsigned) final;
89
90 private:
92 std::unique_ptr<WPSStringStreamPrivate> m_data;
93 WPSStringStream(const WPSStringStream &) = delete; // copy is not allowed
94 WPSStringStream &operator=(const WPSStringStream &) = delete; // assignment is not allowed
95 };
96
97 #endif
98
99 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPSStringStream::~WPSStringStream
~WPSStringStream() final
destructor
Definition: WPSStringStream.cpp:81
WPSStringStream::append
void append(const unsigned char *data, const unsigned int dataSize)
append some data at the end of the string
Definition: WPSStringStream.cpp:85
WPSStringStream::WPSStringStream
WPSStringStream(const unsigned char *data, const unsigned int dataSize)
constructor
Definition: WPSStringStream.cpp:75
WPSStringStream::tell
long tell() final
returns actual offset position
Definition: WPSStringStream.cpp:116
WPSStringStream::getSubStreamByName
librevenge::RVNGInputStream * getSubStreamByName(const char *name) final
return a new stream for a ole zone
Definition: WPSStringStream.cpp:178
WPSStringStreamPrivate::m_offset
long m_offset
the stream offset
Definition: WPSStringStream.cpp:46
WPSStringStream::subStreamCount
unsigned subStreamCount() final
returns the number of sub streams.
Definition: WPSStringStream.cpp:158
WPSStringStream::read
const unsigned char * read(unsigned long numBytes, unsigned long &numBytesRead) final
! reads numbytes data.
Definition: WPSStringStream.cpp:90
WPSStringStreamPrivate
internal data of a WPSStringStream
Definition: WPSStringStream.cpp:34
WPSStringStreamPrivate::~WPSStringStreamPrivate
~WPSStringStreamPrivate()
destructor
Definition: WPSStringStream.cpp:63
WPSStringStreamPrivate::m_buffer
std::vector< unsigned char > m_buffer
the stream buffer
Definition: WPSStringStream.cpp:44
WPSStringStream::getSubStreamById
librevenge::RVNGInputStream * getSubStreamById(unsigned) final
return a new stream for a ole zone
Definition: WPSStringStream.cpp:173
WPSStringStream
internal class used to create a RVNGInputStream from a unsigned char's pointer
Definition: WPSStringStream.h:41
WPSStringStream::subStreamName
const char * subStreamName(unsigned) final
returns the ith sub streams name
Definition: WPSStringStream.cpp:163
WPSStringStream::isEnd
bool isEnd() final
returns true if we are at the end of the section/file
Definition: WPSStringStream.cpp:145
WPSStringStreamPrivate::operator=
WPSStringStreamPrivate & operator=(const WPSStringStreamPrivate &)=delete
WPSStringStream::operator=
WPSStringStream & operator=(const WPSStringStream &)=delete
WPSStringStreamPrivate::WPSStringStreamPrivate
WPSStringStreamPrivate(const unsigned char *data, unsigned dataSize)
constructor
Definition: WPSStringStream.cpp:52
WPSStringStream::seek
int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) final
seeks to a offset position, from actual, beginning or ending position
Definition: WPSStringStream.cpp:121
WPSStringStream::m_data
std::unique_ptr< WPSStringStreamPrivate > m_data
the string stream data
Definition: WPSStringStream.h:92
libwps_tools_win::Language::name
std::string name(long id)
returns the name given Windows© id
Definition: libwps_tools_win.cpp:7332
WPSStringStream::existsSubStream
bool existsSubStream(const char *name) final
returns true if a substream with name exists
Definition: WPSStringStream.cpp:168
WPSStringStream::isStructured
bool isStructured() final
returns true if the stream is ole
Definition: WPSStringStream.cpp:153
librevenge
Definition: WPSOLEStream.h:33
WPSStringStream.h
WPSStringStreamPrivate::append
void append(const unsigned char *data, unsigned dataSize)
append some data at the end of the actual stream
Definition: WPSStringStream.cpp:67