~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to filters/kpresenter/powerpoint/pole.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* POLE - Portable C++ library to access OLE Storage
2
 
   Copyright (C) 2002-2005 Ariya Hidayat <ariya@kde.org>
3
 
 
4
 
   Redistribution and use in source and binary forms, with or without
5
 
   modification, are permitted provided that the following conditions
6
 
   are met:
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.
15
 
 
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.
27
 
*/
28
 
 
29
 
#ifndef POLE_H
30
 
#define POLE_H
31
 
 
32
 
#include <string>
33
 
#include <list>
34
 
 
35
 
namespace POLE
36
 
{
37
 
 
38
 
class StorageIO;
39
 
class Stream;
40
 
class StreamIO;
41
 
 
42
 
class Storage
43
 
{
44
 
    friend class Stream;
45
 
    friend class StreamOut;
46
 
 
47
 
public:
48
 
 
49
 
    // for Storage::result()
50
 
    enum { Ok, OpenFailed, NotOLE, BadOLE, UnknownError };
51
 
 
52
 
    /**
53
 
     * Constructs a storage with name filename.
54
 
     **/
55
 
    explicit Storage(const char* filename);
56
 
 
57
 
    /**
58
 
     * Destroys the storage.
59
 
     **/
60
 
    ~Storage();
61
 
 
62
 
    /**
63
 
     * Opens the storage. Returns true if no error occurs.
64
 
     **/
65
 
    bool open();
66
 
 
67
 
    /**
68
 
     * Closes the storage.
69
 
     **/
70
 
    void close();
71
 
 
72
 
    /**
73
 
     * Returns the error code of last operation.
74
 
     **/
75
 
    int result();
76
 
 
77
 
    /**
78
 
     * Finds all stream and directories in given path.
79
 
     **/
80
 
    std::list<std::string> entries(const std::string& path = "/");
81
 
 
82
 
    /**
83
 
     * Returns true if specified entry name is a directory.
84
 
     */
85
 
    bool isDirectory(const std::string& name);
86
 
 
87
 
    /**
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.
91
 
     *
92
 
     * When errors occur, this function returns NULL.
93
 
     *
94
 
     * You do not need to delete the created stream, it will be handled
95
 
     * automatically.
96
 
     **/
97
 
    Stream* stream(const std::string& name, bool reuse = true);
98
 
    //Stream* stream( const std::string& name, int mode = Stream::ReadOnly, bool reuse = true );
99
 
 
100
 
private:
101
 
    StorageIO* io;
102
 
 
103
 
    // no copy or assign
104
 
    Storage(const Storage&);
105
 
    Storage& operator=(const Storage&);
106
 
 
107
 
};
108
 
 
109
 
class Stream
110
 
{
111
 
    friend class Storage;
112
 
    friend class StorageIO;
113
 
 
114
 
public:
115
 
 
116
 
    /**
117
 
     * Creates a new stream.
118
 
     */
119
 
    // name must be absolute, e.g "/Workbook"
120
 
    Stream(Storage* storage, const std::string& name);
121
 
 
122
 
    /**
123
 
     * Destroys the stream.
124
 
     */
125
 
    ~Stream();
126
 
 
127
 
    /**
128
 
     * Returns the full stream name.
129
 
     */
130
 
    std::string fullName();
131
 
 
132
 
    /**
133
 
     * Returns the stream size.
134
 
     **/
135
 
    unsigned long size();
136
 
 
137
 
    /**
138
 
     * Returns the current read/write position.
139
 
     **/
140
 
    unsigned long tell();
141
 
 
142
 
    /**
143
 
     * Sets the read/write position.
144
 
     **/
145
 
    void seek(unsigned long pos);
146
 
 
147
 
    /**
148
 
     * Reads a byte.
149
 
     **/
150
 
    int getch();
151
 
 
152
 
    /**
153
 
     * Reads a block of data.
154
 
     **/
155
 
    unsigned long read(unsigned char* data, unsigned long maxlen);
156
 
 
157
 
    /**
158
 
     * Returns true if the read/write position is past the file.
159
 
     **/
160
 
    bool eof();
161
 
 
162
 
    /**
163
 
     * Returns true whenever error occurs.
164
 
     **/
165
 
    bool fail();
166
 
 
167
 
private:
168
 
    StreamIO* io;
169
 
 
170
 
    // no copy or assign
171
 
    Stream(const Stream&);
172
 
    Stream& operator=(const Stream&);
173
 
};
174
 
 
175
 
}
176
 
 
177
 
#endif // POLE_H