RVNGOLEStream.h Source File documentation

RVNGOLEStream.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
4 Original source: POLE - Portable C++ library to access OLE Storage
5 Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org>
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
9 are met:
10 * Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright notice,
13 this list of conditions and the following disclaimer in the documentation
14 and/or other materials provided with the distribution.
15 * Neither the name of the authors nor the names of its contributors may be
16 used to endorse or promote products derived from this software without
17 specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29 THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32#ifndef RVNGOLESTREAM_H
33#define RVNGOLESTREAM_H
34
35#include <memory>
36#include <string>
37#include <vector>
38
39namespace librevenge
40{
41
42class RVNGInputStream;
43
44class IStorage;
45class Stream;
46class IStream;
47
48 class Storage
49{
50 friend class Stream;
51
52public:
53
54 // for Storage::result()
55 enum Result { Ok, OpenFailed, NotOLE, BadOLE, UnknownError };
56
60 Storage(RVNGInputStream *is);
61
65 ~Storage();
66
70 bool isStructured();
71
75 std::vector<std::string> getSubStreamNamesList();
76
80 Result result();
81
82private:
83 std::unique_ptr<IStorage> m_io;
84
85 // no copy or assign
86 Storage(const Storage &);
87 Storage &operator=(const Storage &);
88
89};
90
91 class Stream
92{
93 friend class Storage;
94 friend class IStorage;
95
96public:
97
101 Stream(Storage *storage, const std::string &name);
102
106 ~Stream();
107
111 unsigned long size();
112
116 unsigned long read(unsigned char *data, unsigned long maxlen);
117
118private:
119 std::unique_ptr<IStream> m_io;
120
121 // no copy or assign
122 Stream(const Stream &);
123 Stream &operator=(const Stream &);
124};
125
126} // namespace librevenge
127
128#endif // RVNGOLESTREAM_H
129/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
librevenge::IStorage
Definition RVNGOLEStream.cpp:468
librevenge::IStream
Definition RVNGOLEStream.cpp:688
librevenge::RVNGInputStream
Definition RVNGStream.h:34
librevenge::Storage::~Storage
~Storage()
Destroys the storage.
Definition RVNGOLEStream.cpp:1768
librevenge::Storage::isStructured
bool isStructured()
Checks whether the storage is OLE2 storage.
Definition RVNGOLEStream.cpp:1777
librevenge::Storage::Result
Result
Definition RVNGOLEStream.h:55
librevenge::Storage::NotOLE
@ NotOLE
Definition RVNGOLEStream.h:55
librevenge::Storage::BadOLE
@ BadOLE
Definition RVNGOLEStream.h:55
librevenge::Storage::Ok
@ Ok
Definition RVNGOLEStream.h:55
librevenge::Storage::UnknownError
@ UnknownError
Definition RVNGOLEStream.h:55
librevenge::Storage::OpenFailed
@ OpenFailed
Definition RVNGOLEStream.h:55
librevenge::Storage::operator=
Storage & operator=(const Storage &)
librevenge::Storage::getSubStreamNamesList
std::vector< std::string > getSubStreamNamesList()
Returns the list of substream name.
Definition RVNGOLEStream.cpp:1782
librevenge::Storage::Storage
Storage(RVNGInputStream *is)
Constructs a storage with data.
Definition RVNGOLEStream.cpp:1763
librevenge::Storage::result
Result result()
Returns the error code of last operation.
Definition RVNGOLEStream.cpp:1772
librevenge::Storage::m_io
std::unique_ptr< IStorage > m_io
Definition RVNGOLEStream.h:83
librevenge::Storage::Stream
friend class Stream
Definition RVNGOLEStream.h:50
librevenge::Storage::Storage
Storage(const Storage &)
librevenge::Stream
Definition RVNGOLEStream.h:92
librevenge::Stream::Stream
Stream(const Stream &)
librevenge::Stream::read
unsigned long read(unsigned char *data, unsigned long maxlen)
Reads a block of data.
Definition RVNGOLEStream.cpp:1815
librevenge::Stream::m_io
std::unique_ptr< IStream > m_io
Definition RVNGOLEStream.h:119
librevenge::Stream::Storage
friend class Storage
Definition RVNGOLEStream.h:93
librevenge::Stream::operator=
Stream & operator=(const Stream &)
librevenge::Stream::Stream
Stream(Storage *storage, const std::string &name)
Creates a new stream.
Definition RVNGOLEStream.cpp:1800
librevenge::Stream::~Stream
~Stream()
Destroys the stream.
Definition RVNGOLEStream.cpp:1806
librevenge::Stream::size
unsigned long size()
Returns the stream size.
Definition RVNGOLEStream.cpp:1810
librevenge::Stream::IStorage
friend class IStorage
Definition RVNGOLEStream.h:94
librevenge
Definition RVNGBinaryData.cpp:40