]> git.saurik.com Git - wxWidgets.git/blame - interface/stream.h
further prototype revisions; rename interface/aui.h to interface/framemanager.h since...
[wxWidgets.git] / interface / stream.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: stream.h
e54c96f1 3// Purpose: interface of wxCountingOutputStream
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxCountingOutputStream
11 @wxheader{stream.h}
7c913512 12
23324ae1
FM
13 wxCountingOutputStream is a specialized output stream which does not write any
14 data anywhere,
15 instead it counts how many bytes would get written if this were a normal
16 stream. This
17 can sometimes be useful or required if some data gets serialized to a stream or
18 compressed
19 by using stream compression and thus the final size of the stream cannot be
20 known other
21 than pretending to write the stream. One case where the resulting size would
22 have to be
23 known is if the data has to be written to a piece of memory and the memory has
24 to be
25 allocated before writing to it (which is probably always the case when writing
7c913512 26 to a
23324ae1 27 memory stream).
7c913512 28
23324ae1
FM
29 @library{wxbase}
30 @category{streams}
31*/
32class wxCountingOutputStream : public wxOutputStream
33{
34public:
35 /**
36 Creates a wxCountingOutputStream object.
37 */
38 wxCountingOutputStream();
39
40 /**
41 Destructor.
42 */
43 ~wxCountingOutputStream();
44
45 /**
46 Returns the current size of the stream.
47 */
328f5751 48 size_t GetSize() const;
23324ae1
FM
49};
50
51
e54c96f1 52
23324ae1
FM
53/**
54 @class wxBufferedInputStream
55 @wxheader{stream.h}
7c913512 56
23324ae1
FM
57 This stream acts as a cache. It caches the bytes read from the specified
58 input stream (See wxFilterInputStream).
59 It uses wxStreamBuffer and sets the default in-buffer size to 1024 bytes.
60 This class may not be used without some other stream to read the data
61 from (such as a file stream or a memory stream).
7c913512 62
23324ae1
FM
63 @library{wxbase}
64 @category{streams}
7c913512 65
e54c96f1 66 @see wxStreamBuffer, wxInputStream, wxBufferedOutputStream
23324ae1
FM
67*/
68class wxBufferedInputStream : public wxFilterInputStream
69{
70public:
7c913512 71
23324ae1
FM
72};
73
74
e54c96f1 75
23324ae1
FM
76/**
77 @class wxStreamBuffer
78 @wxheader{stream.h}
7c913512
FM
79
80
23324ae1
FM
81 @library{wxbase}
82 @category{streams}
7c913512 83
e54c96f1 84 @see wxStreamBase
23324ae1 85*/
7c913512 86class wxStreamBuffer
23324ae1
FM
87{
88public:
89 //@{
90 /**
91 Constructor. It initializes the stream buffer with the data of the specified
92 stream buffer. The new stream buffer has the same attributes, size, position
93 and they share the same buffer. This will cause problems if the stream to
94 which the stream buffer belong is destroyed and the newly cloned stream
95 buffer continues to be used, trying to call functions in the (destroyed)
96 stream. It is advised to use this feature only in very local area of the
97 program.
3c4f71cc 98
4cc4bfaf 99 @see @ref setbufferio() wxStreamBuffer:SetBufferIO
23324ae1
FM
100 */
101 wxStreamBuffer(wxStreamBase& stream, BufMode mode);
7c913512
FM
102 wxStreamBuffer(BufMode mode);
103 wxStreamBuffer(const wxStreamBuffer& buffer);
23324ae1
FM
104 //@}
105
106 /**
107 Destructor. It finalizes all IO calls and frees all internal buffers if
108 necessary.
109 */
110 wxStreamBuffer();
111
112 /**
113 Fill the IO buffer.
114 */
115 bool FillBuffer();
116
117 /**
7c913512 118 Toggles the fixed flag. Usually this flag is toggled at the same time as
23324ae1
FM
119 @e flushable. This flag allows (when it has the @false value) or forbids
120 (when it has the @true value) the stream buffer to resize dynamically the IO
121 buffer.
3c4f71cc 122
4cc4bfaf 123 @see SetBufferIO()
23324ae1
FM
124 */
125 void Fixed(bool fixed);
126
127 /**
128 Flushes the IO buffer.
129 */
130 bool FlushBuffer();
131
132 /**
4cc4bfaf 133 Toggles the flushable flag. If @a flushable is disabled, no data are sent
23324ae1
FM
134 to the parent stream.
135 */
136 void Flushable(bool flushable);
137
138 /**
139 Returns a pointer on the end of the stream buffer.
140 */
328f5751 141 void* GetBufferEnd() const;
23324ae1
FM
142
143 /**
144 Returns a pointer on the current position of the stream buffer.
145 */
328f5751 146 void* GetBufferPos() const;
23324ae1
FM
147
148 /**
149 Returns the size of the buffer.
150 */
328f5751 151 size_t GetBufferSize() const;
23324ae1
FM
152
153 /**
154 Returns a pointer on the start of the stream buffer.
155 */
328f5751 156 void* GetBufferStart() const;
23324ae1
FM
157
158 /**
159 Gets a single char from the stream buffer. It acts like the Read call.
3c4f71cc 160
4cc4bfaf 161 @see Read()
23324ae1
FM
162 */
163 char GetChar();
164
165 /**
166 Returns the amount of available data in the buffer.
167 */
168 size_t GetDataLeft();
169
170 /**
171 Returns the current position (counted in bytes) in the stream buffer.
172 */
328f5751 173 off_t GetIntPosition() const;
23324ae1
FM
174
175 /**
176 Returns the amount of bytes read during the last IO call to the parent stream.
177 */
328f5751 178 size_t GetLastAccess() const;
23324ae1
FM
179
180 /**
181 Puts a single char to the stream buffer.
3c4f71cc 182
4cc4bfaf 183 @see Read()
23324ae1
FM
184 */
185 void PutChar(char c);
186
187 //@{
188 /**
4cc4bfaf 189 Copies data to @e buffer. The function returns when @a buffer is full or when
23324ae1
FM
190 there isn't
191 any more data in the current buffer.
3c4f71cc 192
4cc4bfaf 193 @see Write()
23324ae1 194 */
4cc4bfaf
FM
195 size_t Read(void* buffer, size_t size);
196 Return value size_t Read(wxStreamBuffer* buffer);
23324ae1
FM
197 //@}
198
199 /**
200 Resets to the initial state variables concerning the buffer.
201 */
202 void ResetBuffer();
203
204 /**
205 Changes the current position.
4cc4bfaf 206 @a mode may be one of the following:
3c4f71cc 207
23324ae1 208 @b wxFromStart
3c4f71cc 209
23324ae1 210 The position is counted from the start of the stream.
3c4f71cc 211
23324ae1 212 @b wxFromCurrent
3c4f71cc 213
23324ae1 214 The position is counted from the current position of the stream.
3c4f71cc 215
23324ae1 216 @b wxFromEnd
3c4f71cc 217
23324ae1 218 The position is counted from the end of the stream.
3c4f71cc 219
23324ae1 220 @returns Upon successful completion, it returns the new offset as
4cc4bfaf
FM
221 measured in bytes from the beginning of the stream.
222 Otherwise, it returns wxInvalidOffset.
23324ae1
FM
223 */
224 off_t Seek(off_t pos, wxSeekMode mode);
225
226 //@{
227 /**
228 Destroys or invalidates the previous IO buffer and allocates a new one of the
229 specified size.
3c4f71cc 230
4cc4bfaf 231 @see Fixed(), Flushable()
23324ae1
FM
232 */
233 void SetBufferIO(char* buffer_start, char* buffer_end);
7c913512
FM
234 Remarks See also
235 wxStreamBuffer constructor
23324ae1 236
7c913512 237 wxStreamBuffer::Fixed
23324ae1 238
7c913512
FM
239 wxStreamBuffer::Flushable
240 void SetBufferIO(size_t bufsize);
23324ae1
FM
241 //@}
242
243 /**
244 Sets the current position (in bytes) in the stream buffer.
245 */
246 void SetIntPosition(size_t pos);
247
248 /**
249 Returns the parent stream of the stream buffer.
250 */
251 wxStreamBase* Stream();
252
253 /**
254 Gets the current position in the stream. This position is calculated from
255 the @e real position in the stream and from the internal buffer position: so
256 it gives you the position in the @e real stream counted from the start of
257 the stream.
3c4f71cc 258
23324ae1 259 @returns Returns the current position in the stream if possible,
4cc4bfaf 260 wxInvalidOffset in the other case.
23324ae1 261 */
328f5751 262 off_t Tell() const;
23324ae1
FM
263
264 /**
265 Truncates the buffer to the current position.
23324ae1
FM
266 Note: Truncate() cannot be used to enlarge the buffer. This is
267 usually not needed since the buffer expands automatically.
268 */
269 void Truncate();
270
271 //@{
272 /**
273 See Read().
274 */
4cc4bfaf
FM
275 size_t Write(const void* buffer, size_t size);
276 size_t Write(wxStreamBuffer* buffer);
23324ae1
FM
277 //@}
278};
279
280
e54c96f1 281
23324ae1
FM
282/**
283 @class wxOutputStream
284 @wxheader{stream.h}
7c913512 285
23324ae1 286 wxOutputStream is an abstract base class which may not be used directly.
7c913512 287
23324ae1
FM
288 @library{wxbase}
289 @category{streams}
290*/
291class wxOutputStream : public wxStreamBase
292{
293public:
294 /**
295 Creates a dummy wxOutputStream object.
296 */
297 wxOutputStream();
298
299 /**
300 Destructor.
301 */
302 ~wxOutputStream();
303
304 /**
305 Closes the stream, returning @false if an error occurs. The
306 stream is closed implicitly in the destructor if Close() is not
307 called explicitly.
23324ae1
FM
308 If this stream wraps another stream or some other resource such
309 as a file, then the underlying resource is closed too if it is owned
310 by this stream, or left open otherwise.
311 */
312 bool Close();
313
314 /**
7c913512 315 Returns the number of bytes written during the last
23324ae1
FM
316 Write(). It may return 0 even if there is no
317 error on the stream if it is only temporarily impossible to write to it.
318 */
328f5751 319 size_t LastWrite() const;
23324ae1
FM
320
321 /**
322 Puts the specified character in the output queue and increments the
323 stream position.
324 */
4cc4bfaf 325 void PutC(char c);
23324ae1
FM
326
327 /**
328 Changes the stream current position.
3c4f71cc 329
7c913512 330 @param pos
4cc4bfaf 331 Offset to seek to.
7c913512 332 @param mode
4cc4bfaf 333 One of wxFromStart, wxFromEnd, wxFromCurrent.
3c4f71cc 334
23324ae1
FM
335 @returns The new stream position or wxInvalidOffset on error.
336 */
337 off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart);
338
339 /**
340 Returns the current stream position.
341 */
328f5751 342 off_t TellO() const;
23324ae1
FM
343
344 //@{
345 /**
7c913512 346 Reads data from the specified input stream and stores them
23324ae1
FM
347 in the current stream. The data is read until an error is raised
348 by one of the two streams.
349 */
4cc4bfaf 350 wxOutputStream Write(const void* buffer, size_t size);
7c913512 351 wxOutputStream Write(wxInputStream& stream_in);
23324ae1
FM
352 //@}
353};
354
355
e54c96f1 356
23324ae1
FM
357/**
358 @class wxFilterClassFactory
359 @wxheader{stream.h}
7c913512 360
23324ae1
FM
361 Allows the creation of filter streams to handle compression formats such
362 as gzip and bzip2.
7c913512 363
23324ae1
FM
364 For example, given a filename you can search for a factory that will
365 handle it and create a stream to decompress it:
7c913512 366
23324ae1
FM
367 @code
368 factory = wxFilterClassFactory::Find(filename, wxSTREAM_FILEEXT);
369 if (factory)
370 stream = factory-NewStream(new wxFFileInputStream(filename));
371 @endcode
7c913512 372
23324ae1
FM
373 wxFilterClassFactory::Find can also search
374 for a factory by MIME type, HTTP encoding or by wxFileSystem protocol.
375 The available factories can be enumerated
376 using @ref wxFilterClassFactory::getfirst "GetFirst() and GetNext".
7c913512 377
23324ae1
FM
378 @library{wxbase}
379 @category{FIXME}
7c913512 380
e54c96f1 381 @see wxFilterInputStream, wxFilterOutputStream, wxArchiveClassFactory, @ref
23324ae1
FM
382 overview_wxarc "Archive formats such as zip"
383*/
384class wxFilterClassFactory : public wxObject
385{
386public:
387 /**
388 Returns @true if this factory can handle the given protocol, MIME type, HTTP
389 encoding or file extension.
23324ae1
FM
390 When using wxSTREAM_FILEEXT for the second parameter, the first parameter
391 can be a complete filename rather than just an extension.
392 */
393 bool CanHandle(const wxString& protocol,
328f5751 394 wxStreamProtocolType type = wxSTREAM_PROTOCOL) const;
23324ae1
FM
395
396 /**
397 A static member that finds a factory that can handle a given protocol, MIME
398 type, HTTP encoding or file extension. Returns a pointer to the class
399 factory if found, or @NULL otherwise. It does not give away ownership of the
400 factory.
23324ae1
FM
401 When using wxSTREAM_FILEEXT for the second parameter, the first parameter
402 can be a complete filename rather than just an extension.
403 */
404 static const wxFilterClassFactory* Find(const wxString& protocol,
405 wxStreamProtocolType type = wxSTREAM_PROTOCOL);
406
407 //@{
408 /**
409 GetFirst and GetNext can be used to enumerate the available factories.
23324ae1 410 For example, to list them:
3c4f71cc 411
23324ae1
FM
412 GetFirst()/GetNext() return a pointer to a factory or @NULL if no more
413 are available. They do not give away ownership of the factory.
414 */
328f5751
FM
415 static const wxFilterClassFactory* GetFirst() const;
416 const wxFilterClassFactory* GetNext() const;
23324ae1
FM
417 //@}
418
419 /**
420 Returns the wxFileSystem protocol supported by this factory. Equivalent
421 to wxString(*GetProtcols()).
422 */
328f5751 423 wxString GetProtocol() const;
23324ae1
FM
424
425 /**
426 Returns the protocols, MIME types, HTTP encodings or file extensions
427 supported by this factory, as an array of null terminated strings. It does
428 not give away ownership of the array or strings.
23324ae1
FM
429 For example, to list the file extensions a factory supports:
430 */
328f5751 431 const wxChar* const* GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const;
23324ae1
FM
432
433 //@{
434 /**
435 Create a new input or output stream to decompress or compress a given stream.
23324ae1
FM
436 If the parent stream is passed as a pointer then the new filter stream
437 takes ownership of it. If it is passed by reference then it does not.
438 */
328f5751
FM
439 wxFilterInputStream* NewStream(wxInputStream& stream) const;
440 const wxFilterOutputStream* NewStream(wxOutputStream& stream) const;
441 const wxFilterInputStream* NewStream(wxInputStream* stream) const;
442 const wxFilterOutputStream* NewStream(wxOutputStream* stream) const;
23324ae1
FM
443 //@}
444
445 /**
4cc4bfaf 446 Remove the file extension of @a location if it is one of the file
23324ae1
FM
447 extensions handled by this factory.
448 */
328f5751 449 wxString PopExtension(const wxString& location) const;
23324ae1
FM
450
451 /**
452 Adds this class factory to the list returned
453 by @ref getfirst() GetFirst()/GetNext.
23324ae1 454 It is not necessary to do this to use the filter streams. It is usually
7c913512 455 used when implementing streams, typically the implementation will
23324ae1 456 add a static instance of its factory class.
23324ae1
FM
457 It can also be used to change the order of a factory already in the list,
458 bringing it to the front. This isn't a thread safe operation
459 so can't be done when other threads are running that will be using the list.
23324ae1
FM
460 The list does not take ownership of the factory.
461 */
462 void PushFront();
463
464 /**
465 Removes this class factory from the list returned
466 by @ref getfirst() GetFirst()/GetNext.
23324ae1
FM
467 Removing from the list isn't a thread safe operation
468 so can't be done when other threads are running that will be using the list.
23324ae1
FM
469 The list does not own the factories, so removing a factory does not delete it.
470 */
471 void Remove();
472};
473
474
e54c96f1 475
23324ae1
FM
476/**
477 @class wxFilterOutputStream
478 @wxheader{stream.h}
7c913512 479
23324ae1
FM
480 A filter stream has the capability of a normal
481 stream but it can be placed on top of another stream. So, for example, it
482 can compress, encrypt the data which are passed to it and write them to another
483 stream.
7c913512 484
23324ae1
FM
485 @library{wxbase}
486 @category{streams}
7c913512 487
e54c96f1 488 @see wxFilterClassFactory, wxFilterInputStream
23324ae1
FM
489*/
490class wxFilterOutputStream : public wxOutputStream
491{
492public:
493 //@{
494 /**
495 Initializes a "filter" stream.
23324ae1
FM
496 If the parent stream is passed as a pointer then the new filter stream
497 takes ownership of it. If it is passed by reference then it does not.
498 */
499 wxFilterOutputStream(wxOutputStream& stream);
7c913512 500 wxFilterOutputStream(wxOutputStream* stream);
23324ae1
FM
501 //@}
502};
503
504
e54c96f1 505
23324ae1
FM
506/**
507 @class wxFilterInputStream
508 @wxheader{stream.h}
7c913512 509
23324ae1
FM
510 A filter stream has the capability of a normal stream but it can be placed on
511 top
512 of another stream. So, for example, it can uncompress or decrypt the data which
513 are read
514 from another stream and pass it to the requester.
7c913512 515
23324ae1
FM
516 @library{wxbase}
517 @category{streams}
7c913512 518
e54c96f1 519 @see wxFilterClassFactory, wxFilterOutputStream
23324ae1
FM
520*/
521class wxFilterInputStream : public wxInputStream
522{
523public:
524 //@{
525 /**
526 Initializes a "filter" stream.
23324ae1
FM
527 If the parent stream is passed as a pointer then the new filter stream
528 takes ownership of it. If it is passed by reference then it does not.
529 */
530 wxFilterInputStream(wxInputStream& stream);
7c913512 531 wxFilterInputStream(wxInputStream* stream);
23324ae1
FM
532 //@}
533};
534
535
e54c96f1 536
23324ae1
FM
537/**
538 @class wxBufferedOutputStream
539 @wxheader{stream.h}
7c913512 540
23324ae1
FM
541 This stream acts as a cache. It caches the bytes to be written to the specified
542 output stream (See wxFilterOutputStream). The
543 data is only written when the cache is full, when the buffered stream is
544 destroyed or when calling SeekO().
7c913512 545
23324ae1
FM
546 This class may not be used without some other stream to write the data
547 to (such as a file stream or a memory stream).
7c913512 548
23324ae1
FM
549 @library{wxbase}
550 @category{streams}
7c913512 551
e54c96f1 552 @see wxStreamBuffer, wxOutputStream
23324ae1
FM
553*/
554class wxBufferedOutputStream : public wxFilterOutputStream
555{
556public:
557 /**
558 Creates a buffered stream using a buffer of a default size of 1024 bytes for
559 cashing
560 the stream @e parent.
561 */
562 wxBufferedOutputStream(const wxOutputStream& parent);
563
564 /**
565 Destructor. Calls Sync() and destroys the internal buffer.
566 */
567 ~wxBufferedOutputStream();
568
569 /**
570 Calls Sync() and changes the stream position.
571 */
572 off_t SeekO(off_t pos, wxSeekMode mode);
573
574 /**
575 Flushes the buffer and calls Sync() on the parent stream.
576 */
577 void Sync();
578};
579
580
e54c96f1 581
23324ae1
FM
582/**
583 @class wxInputStream
584 @wxheader{stream.h}
7c913512 585
23324ae1 586 wxInputStream is an abstract base class which may not be used directly.
7c913512 587
23324ae1
FM
588 @library{wxbase}
589 @category{streams}
590*/
591class wxInputStream : public wxStreamBase
592{
593public:
594 /**
595 Creates a dummy input stream.
596 */
597 wxInputStream();
598
599 /**
600 Destructor.
601 */
602 ~wxInputStream();
603
604 /**
605 Returns @true if some data is available in the stream right now, so that
606 calling Read() wouldn't block.
607 */
328f5751 608 bool CanRead() const;
23324ae1
FM
609
610 /**
611 Returns @true after an attempt has been made to read past the end of the
612 stream.
613 */
328f5751 614 bool Eof() const;
23324ae1
FM
615
616 /**
7c913512 617 Returns the first character in the input queue and removes it,
23324ae1
FM
618 blocking until it appears if necessary.
619 */
4cc4bfaf 620 char GetC();
23324ae1
FM
621
622 /**
623 Returns the last number of bytes read.
624 */
328f5751 625 size_t LastRead() const;
23324ae1
FM
626
627 /**
628 Returns the first character in the input queue without removing it.
629 */
630 char Peek();
631
632 //@{
633 /**
634 Reads data from the input queue and stores it in the specified output stream.
635 The data is read until an error is raised by one of the two streams.
3c4f71cc 636
23324ae1 637 @returns This function returns a reference on the current object, so the
4cc4bfaf 638 user can test any states of the stream right away.
23324ae1 639 */
4cc4bfaf 640 wxInputStream Read(void* buffer, size_t size);
7c913512
FM
641 Warning Return value
642 This function returns a reference on the current object, so the user can test
643 any states of the stream right away.
644 wxInputStream& Read(wxOutputStream& stream_out);
23324ae1
FM
645 //@}
646
647 /**
648 Changes the stream current position.
3c4f71cc 649
7c913512 650 @param pos
4cc4bfaf 651 Offset to seek to.
7c913512 652 @param mode
4cc4bfaf 653 One of wxFromStart, wxFromEnd, wxFromCurrent.
3c4f71cc 654
23324ae1
FM
655 @returns The new stream position or wxInvalidOffset on error.
656 */
657 off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart);
658
659 /**
660 Returns the current stream position.
661 */
328f5751 662 off_t TellI() const;
23324ae1
FM
663
664 //@{
665 /**
666 This function acts like the previous one except that it takes only one
667 character: it is sometimes shorter to use than the generic function.
668 */
669 size_t Ungetch(const char* buffer, size_t size);
7c913512 670 Return value bool Ungetch(char c);
23324ae1
FM
671 //@}
672};
673
674
e54c96f1 675
23324ae1
FM
676/**
677 @class wxStreamBase
678 @wxheader{stream.h}
7c913512 679
23324ae1
FM
680 This class is the base class of most stream related classes in wxWidgets. It
681 must
682 not be used directly.
7c913512 683
23324ae1
FM
684 @library{wxbase}
685 @category{streams}
7c913512 686
e54c96f1 687 @see wxStreamBuffer
23324ae1 688*/
7c913512 689class wxStreamBase
23324ae1
FM
690{
691public:
692 /**
693 Creates a dummy stream object. It doesn't do anything.
694 */
695 wxStreamBase();
696
697 /**
698 Destructor.
699 */
700 ~wxStreamBase();
701
702 /**
703 This function returns the last error.
3c4f71cc 704
23324ae1 705 @b wxSTREAM_NO_ERROR
3c4f71cc 706
23324ae1 707 No error occurred.
3c4f71cc 708
23324ae1 709 @b wxSTREAM_EOF
3c4f71cc 710
23324ae1 711 An End-Of-File occurred.
3c4f71cc 712
23324ae1 713 @b wxSTREAM_WRITE_ERROR
3c4f71cc 714
23324ae1 715 A generic error occurred on the last write call.
3c4f71cc 716
23324ae1 717 @b wxSTREAM_READ_ERROR
3c4f71cc 718
23324ae1
FM
719 A generic error occurred on the last read call.
720 */
328f5751 721 wxStreamError GetLastError() const;
23324ae1
FM
722
723 /**
724 Returns the length of the stream in bytes. If the length cannot be determined
7c913512 725 (this is always the case for socket streams for example), returns
23324ae1 726 @c wxInvalidOffset.
3c4f71cc 727
e54c96f1 728 @wxsince{2.5.4}
23324ae1 729 */
328f5751 730 wxFileOffset GetLength() const;
23324ae1
FM
731
732 /**
733 GetLength()
23324ae1
FM
734 This function returns the size of the stream. For example, for a file it is the
735 size of the file.
736 */
328f5751 737 size_t GetSize() const;
23324ae1
FM
738
739 /**
740 Returns @true if no error occurred on the stream.
3c4f71cc 741
4cc4bfaf 742 @see GetLastError()
23324ae1 743 */
328f5751 744 virtual bool IsOk() const;
23324ae1
FM
745
746 /**
747 Returns @true if the streams supports seeking to arbitrary offsets.
748 */
328f5751 749 bool IsSeekable() const;
23324ae1
FM
750
751 /**
752 Internal function. It is called when the stream wants to read data of the
753 specified size. It should return the size that was actually read.
754 */
755 size_t OnSysRead(void* buffer, size_t bufsize);
756
757 /**
758 Internal function. It is called when the stream needs to change the
759 current position.
760 */
761 off_t OnSysSeek(off_t pos, wxSeekMode mode);
762
763 /**
764 Internal function. Is is called when the stream needs to know the
765 real position.
766 */
328f5751 767 off_t OnSysTell() const;
23324ae1
FM
768
769 /**
770 See OnSysRead().
771 */
4cc4bfaf 772 size_t OnSysWrite(const void* buffer, size_t bufsize);
23324ae1 773};
e54c96f1 774