1 //-----------------------------------------------------------------------------
4 // Category : SDK Core Interfaces
5 // Filename : pluginterfaces/base/ibstream.h
6 // Created by : Steinberg, 01/2004
7 // Description : Interface for reading/writing streams
9 //-----------------------------------------------------------------------------
10 // This file is part of a Steinberg SDK. It is subject to the license terms
11 // in the LICENSE file found in the top-level directory of this distribution
12 // and at www.steinberg.net/sdklicenses.
13 // No part of the SDK, including this file, may be copied, modified, propagated,
14 // or distributed except according to the terms contained in the LICENSE file.
15 //-----------------------------------------------------------------------------
23 //------------------------------------------------------------------------
24 /** Base class for streams.
26 - read/write binary data from/to stream
27 - get/set stream read-write position (read and write position is the same)
29 class IBStream
: public FUnknown
34 kIBSeekSet
= 0, ///< set absolute seek position
35 kIBSeekCur
, ///< set seek position relative to current position
36 kIBSeekEnd
///< set seek position relative to stream end
39 //------------------------------------------------------------------------
40 /** Reads binary data from stream.
41 \param buffer : destination buffer
42 \param numBytes : amount of bytes to be read
43 \param numBytesRead : result - how many bytes have been read from stream (set to 0 if this is of no interest) */
44 virtual tresult PLUGIN_API
read (void* buffer
, int32 numBytes
, int32
* numBytesRead
= nullptr) = 0;
46 /** Writes binary data to stream.
47 \param buffer : source buffer
48 \param numBytes : amount of bytes to write
49 \param numBytesWritten : result - how many bytes have been written to stream (set to 0 if this is of no interest) */
50 virtual tresult PLUGIN_API
write (void* buffer
, int32 numBytes
, int32
* numBytesWritten
= nullptr) = 0;
52 /** Sets stream read-write position.
53 \param pos : new stream position (dependent on mode)
54 \param mode : value of enum IStreamSeekMode
55 \param result : new seek position (set to 0 if this is of no interest) */
56 virtual tresult PLUGIN_API
seek (int64 pos
, int32 mode
, int64
* result
= nullptr) = 0;
58 /** Gets current stream read-write position.
59 \param pos : is assigned the current position if function succeeds */
60 virtual tresult PLUGIN_API
tell (int64
* pos
) = 0;
61 //------------------------------------------------------------------------
62 static const FUID iid
;
65 DECLARE_CLASS_IID (IBStream
, 0xC3BF6EA2, 0x30994752, 0x9B6BF990, 0x1EE33E9B)
67 //------------------------------------------------------------------------
68 /** Stream with a size.
70 [extends IBStream] when stream type supports it (like file and memory stream)
72 class ISizeableStream
: public FUnknown
75 //------------------------------------------------------------------------
76 /** Return the stream size */
77 virtual tresult PLUGIN_API
getStreamSize (int64
& size
) = 0;
78 /** Set the steam size. File streams can only be resized if they are write enabled. */
79 virtual tresult PLUGIN_API
setStreamSize (int64 size
) = 0;
81 //------------------------------------------------------------------------
82 static const FUID iid
;
84 DECLARE_CLASS_IID (ISizeableStream
, 0x04F9549E, 0xE02F4E6E, 0x87E86A87, 0x47F4E17F)
86 //------------------------------------------------------------------------
87 } // namespace Steinberg