WPSOLEStream.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* POLE - Portable C++ library to access OLE Storage
3  Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org>
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions
7  are met:
8  * Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13  * Neither the name of the authors nor the names of its contributors may be
14  used to endorse or promote products derived from this software without
15  specific prior written permission.
16 
17  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27  THE POSSIBILITY OF SUCH DAMAGE.
28 */
29 
30 #ifndef WPSOLESTREAM_H
31 #define WPSOLESTREAM_H
32 
33 #include <string>
34 #include <fstream>
35 #include <vector>
36 
37 #include "libwps_internal.h"
38 
39 class WPXInputStream;
40 
41 namespace libwps
42 {
43 
44 class StorageIO;
45 class Stream;
46 class StreamIO;
47 
48 class Storage
49 {
50  friend class Stream;
51 
52 public:
53 
54  // for Storage::result()
56 
60  Storage( shared_ptr<WPXInputStream> is );
61 
65  ~Storage();
66 
70  bool isOLEStream();
71 
75  int result();
76 
80  std::vector<std::string> getOLENames();
81 
85  shared_ptr<WPXInputStream> getDocumentOLEStream(const std::string &name);
86 
87 private:
89 
90  // no copy or assign
91  Storage( const Storage & );
92  Storage &operator=( const Storage & );
93 
94 };
95 
96 class Stream
97 {
98  friend class Storage;
99  friend class StorageIO;
100 
101 public:
102 
106  Stream( Storage *storage, const std::string &name );
107 
111  ~Stream();
112 
116  unsigned long size();
117 
121  unsigned long read( unsigned char *data, unsigned long maxlen );
122 
123 private:
125 
126  // no copy or assign
127  Stream( const Stream & );
128  Stream &operator=( const Stream & );
129 };
130 
131 } // namespace libwps
132 
133 #endif // WPXOLESTREAM_H
134 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
std::vector< std::string > getOLENames()
Returns the list of all ole leaves names.
Definition: WPSOLEStream.cpp:1034
Definition: WPSOLEStream.h:55
Definition: WPSOLEStream.h:55
unsigned long read(unsigned char *data, unsigned long maxlen)
Reads a block of data.
Definition: WPSOLEStream.cpp:1093
~Stream()
Destroys the stream.
Definition: WPSOLEStream.cpp:1083
~Storage()
Destroys the storage.
Definition: WPSOLEStream.cpp:1019
Stream & operator=(const Stream &)
Storage & operator=(const Storage &)
shared_ptr< WPXInputStream > getDocumentOLEStream(const std::string &name)
Returns a WPXInputStream corresponding to a name.
Definition: WPSOLEStream.cpp:1039
StreamIO * io
Definition: WPSOLEStream.h:124
unsigned long size()
Returns the stream size.
Definition: WPSOLEStream.cpp:1088
Definition: WPSOLEStream.cpp:259
StorageIO * io
Definition: WPSOLEStream.h:88
bool isOLEStream()
Checks whether the storage is OLE2 storage.
Definition: WPSOLEStream.cpp:1029
std::string name(long id)
returns the name given Windows© id
Definition: libwps_tools_win.cpp:409
Definition: WPSOLEStream.h:55
Storage(shared_ptr< WPXInputStream > is)
Constructs a storage with data.
Definition: WPSOLEStream.cpp:1014
Definition: WPSOLEStream.h:48
Definition: WPSOLEStream.h:96
Stream(Storage *storage, const std::string &name)
Creates a new stream.
Definition: WPSOLEStream.cpp:1077
Definition: WPSOLEStream.h:55
Definition: WPSOLEStream.cpp:219
int result()
Returns the error code of last operation.
Definition: WPSOLEStream.cpp:1024
Definition: WPSOLEStream.h:55

Generated on Wed Jun 11 2014 02:26:01 for libwps by doxygen 1.8.5