]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/mstream.h
c6c2eacd6cb032cb6f08af0e3d64ceeecadfff84
[wxWidgets.git] / interface / wx / mstream.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mstream.h
3 // Purpose: interface of wxMemoryOutputStream
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxMemoryOutputStream
11
12 @todo describe me.
13
14 @library{wxbase}
15 @category{streams}
16
17 @see wxStreamBuffer
18 */
19 class wxMemoryOutputStream : public wxOutputStream
20 {
21 public:
22 /**
23 If @a data is @NULL, then it will initialize a new empty buffer which will
24 grow if required.
25
26 @warning
27 If the buffer is created, it will be destroyed at the destruction of the stream.
28 */
29 wxMemoryOutputStream(void* data = NULL, size_t length = 0);
30
31 /**
32 Destructor.
33 */
34 virtual ~wxMemoryOutputStream();
35
36 /**
37 Allows you to transfer data from the internal buffer of wxMemoryOutputStream
38 to an external buffer. @a len specifies the size of the buffer.
39 */
40 size_t CopyTo(void* buffer, size_t len) const;
41
42 /**
43 Returns the pointer to the stream object used as an internal buffer
44 for that stream.
45 */
46 wxStreamBuffer* GetOutputStreamBuffer() const;
47 };
48
49
50
51 /**
52 @class wxMemoryInputStream
53
54 @todo describe me.
55
56 @library{wxbase}
57 @category{streams}
58
59 @see wxStreamBuffer, wxMemoryOutputStream
60 */
61 class wxMemoryInputStream : public wxInputStream
62 {
63 public:
64 /**
65 Initializes a new read-only memory stream which will use the specified
66 buffer data of length len. The stream does not take ownership of the buffer,
67 i.e. the buffer will not be deleted in its destructor.
68 */
69 wxMemoryInputStream(const char* data, size_t len);
70
71 /**
72 Creates a new read-only memory stream, initializing it with the data from
73 the given output stream @a stream.
74 */
75 wxMemoryInputStream(const wxMemoryOutputStream& stream);
76
77 /**
78 Creates a new read-only memory stream, initializing it with the
79 data from the given input stream @a stream.
80
81 The @a len argument specifies the amount of data to read from the
82 @a stream. Setting it to @e wxInvalidOffset means that the @a stream
83 is to be read entirely (i.e. till the EOF is reached).
84 */
85 wxMemoryInputStream(wxInputStream& stream,
86 wxFileOffset len = wxInvalidOffset);
87
88 /**
89 Destructor.
90 */
91 virtual ~wxMemoryInputStream();
92
93 /**
94 Returns the pointer to the stream object used as an internal buffer
95 for that stream.
96 */
97 wxStreamBuffer* GetInputStreamBuffer() const;
98 };
99