forked from xNVSE/NVSE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIBufferStream.h
More file actions
35 lines (26 loc) · 725 Bytes
/
Copy pathIBufferStream.h
File metadata and controls
35 lines (26 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include "common/IDataStream.h"
class IBufferStream : public IDataStream
{
public:
IBufferStream();
IBufferStream(const IBufferStream & rhs);
IBufferStream(void * buf, UInt64 inLength);
virtual ~IBufferStream();
IBufferStream & operator=(IBufferStream & rhs);
void SetBuffer(void * buf, UInt64 inLength);
void * GetBuffer(void) { return streamBuf; }
void OwnBuffer(void) { flags |= kFlag_OwnedBuf; }
void DisownBuffer(void) { flags &= ~kFlag_OwnedBuf; }
// read
virtual void ReadBuf(void * buf, UInt32 inLength);
// write
virtual void WriteBuf(const void * buf, UInt32 inLength);
protected:
UInt8 * streamBuf;
UInt32 flags;
enum
{
kFlag_OwnedBuf = 1 << 0
};
};