Debian Codegraph @

src/lib/WPSStringStream.h

raw symbols SCIP
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 ([email protected])
12 * Copyright (C) 2006, 2007 Andrew Ziem
13 * Copyright (C) 2004-2006 Fridrich Strba ([email protected])
14 * Copyright (C) 2004 Marc Maurer ([email protected])
15 * Copyright (C) 2003-2005 William Lachance ([email protected])
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
36 /** internal class used to create a RVNGInputStream from a unsigned char's pointer
37
38 \note this class (highly inspired from librevenge) does not
39 implement the isStructured's protocol, ie. it only returns false.
40 */
41 class WPSStringStream final: public librevenge::RVNGInputStream
42 {
43 public:
44 //! constructor
45 WPSStringStream(const unsigned char *data, const unsigned int dataSize);
46 //! destructor
47 ~WPSStringStream() final;
48
49 //! append some data at the end of the string
50 void append(const unsigned char *data, const unsigned int dataSize);
51 /**! reads numbytes data.
52
53 * \return a pointer to the read elements
54 */
55 const unsigned char *read(unsigned long numBytes, unsigned long &numBytesRead) final;
56 //! returns actual offset position
57 long tell() final;
58 /*! \brief seeks to a offset position, from actual, beginning or ending position
59 * \return 0 if ok
60 */
61 int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) final;
62 //! returns true if we are at the end of the section/file
63 bool isEnd() final;
64
65 /** returns true if the stream is ole
66
67 \sa returns always false*/
68 bool isStructured() final;
69 /** returns the number of sub streams.
70
71 \sa returns always 0*/
72 unsigned subStreamCount() final;
73 /** returns the ith sub streams name
74
75 \sa returns always 0*/
76 const char *subStreamName(unsigned) final;
77 /** returns true if a substream with name exists
78
79 \sa returns always false*/
80 bool existsSubStream(const char *name) final;
81 /** return a new stream for a ole zone
82
83 \sa returns always 0 */
84 librevenge::RVNGInputStream *getSubStreamByName(const char *name) final;
85 /** return a new stream for a ole zone
86
87 \sa returns always 0 */
88 librevenge::RVNGInputStream *getSubStreamById(unsigned) final;
89
90 private:
91 /// the string stream data
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: */