1
/* POLE - Portable C++ library to access OLE Storage
2
Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org>
4
Redistribution and use in source and binary forms, with or without
5
modification, are permitted provided that the following conditions
7
* Redistributions of source code must retain the above copyright notice,
8
this list of conditions and the following disclaimer.
9
* Redistributions in binary form must reproduce the above copyright notice,
10
this list of conditions and the following disclaimer in the documentation
11
and/or other materials provided with the distribution.
12
* Neither the name of the authors nor the names of its contributors may be
13
used to endorse or promote products derived from this software without
14
specific prior written permission.
16
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26
THE POSSIBILITY OF SUCH DAMAGE.
45
friend class StreamOut;
49
// for Storage::result()
50
enum { Ok, OpenFailed, NotOLE, BadOLE, UnknownError };
53
* Constructs a storage with name filename.
55
explicit Storage(const char* filename);
58
* Destroys the storage.
63
* Opens the storage. Returns true if no error occurs.
73
* Returns the error code of last operation.
78
* Finds all stream and directories in given path.
80
std::list<std::string> entries(const std::string& path = "/");
83
* Returns true if specified entry name is a directory.
85
bool isDirectory(const std::string& name);
88
* Finds and returns a stream with the specified name.
89
* If reuse is true, this function returns the already created stream
90
* (if any). Otherwise it will create the stream.
92
* When errors occur, this function returns NULL.
94
* You do not need to delete the created stream, it will be handled
97
Stream* stream(const std::string& name, bool reuse = true);
98
//Stream* stream( const std::string& name, int mode = Stream::ReadOnly, bool reuse = true );
104
Storage(const Storage&);
105
Storage& operator=(const Storage&);
111
friend class Storage;
112
friend class StorageIO;
117
* Creates a new stream.
119
// name must be absolute, e.g "/Workbook"
120
Stream(Storage* storage, const std::string& name);
123
* Destroys the stream.
128
* Returns the full stream name.
130
std::string fullName();
133
* Returns the stream size.
135
unsigned long size();
138
* Returns the current read/write position.
140
unsigned long tell();
143
* Sets the read/write position.
145
void seek(unsigned long pos);
153
* Reads a block of data.
155
unsigned long read(unsigned char* data, unsigned long maxlen);
158
* Returns true if the read/write position is past the file.
163
* Returns true whenever error occurs.
171
Stream(const Stream&);
172
Stream& operator=(const Stream&);