Memory stream class.
More...
#include <PGFstream.h>
Memory stream class.
A PGF stream subclass for internal memory.
- Author
- C. Stamm
Definition at line 106 of file PGFstream.h.
◆ CPGFMemoryStream() [1/2]
CPGFMemoryStream::CPGFMemoryStream |
( |
size_t |
size | ) |
|
Constructor
- Parameters
-
size | Size of new allocated memory buffer |
Allocate memory block of given size
- Parameters
-
Definition at line 78 of file PGFstream.cpp.
82 if (!
m_buffer) ReturnWithError(InsufficientMemory);
◆ CPGFMemoryStream() [2/2]
CPGFMemoryStream::CPGFMemoryStream |
( |
UINT8 * |
pBuffer, |
|
|
size_t |
size |
|
) |
| |
Constructor. Use already allocated memory of given size
- Parameters
-
pBuffer | Memory location |
size | Memory size |
Use already allocated memory of given size
- Parameters
-
pBuffer | Memory location |
size | Memory size |
Definition at line 89 of file PGFstream.cpp.
92 ,
m_eos(pBuffer + size)
◆ ~CPGFMemoryStream()
virtual CPGFMemoryStream::~CPGFMemoryStream |
( |
| ) |
|
|
inlinevirtual |
◆ GetBuffer() [1/2]
UINT8* CPGFMemoryStream::GetBuffer |
( |
| ) |
|
|
inline |
◆ GetBuffer() [2/2]
const UINT8* CPGFMemoryStream::GetBuffer |
( |
| ) |
const |
|
inline |
◆ GetEOS()
UINT64 CPGFMemoryStream::GetEOS |
( |
| ) |
const |
|
inline |
- Returns
- relative position of end of stream (= stream length)
Definition at line 149 of file PGFstream.h.
◆ GetPos()
virtual UINT64 CPGFMemoryStream::GetPos |
( |
| ) |
const |
|
inlinevirtual |
Get current stream position.
- Returns
- Current stream position
Implements CPGFStream.
Definition at line 139 of file PGFstream.h.
◆ GetSize()
size_t CPGFMemoryStream::GetSize |
( |
| ) |
const |
|
inline |
◆ IsValid()
virtual bool CPGFMemoryStream::IsValid |
( |
| ) |
const |
|
inlinevirtual |
Check stream validity.
- Returns
- True if stream and current position is valid
Implements CPGFStream.
Definition at line 140 of file PGFstream.h.
◆ Read()
void CPGFMemoryStream::Read |
( |
int * |
count, |
|
|
void * |
buffer |
|
) |
| |
|
virtual |
Read some bytes from this stream and stores them into a buffer.
- Parameters
-
count | A pointer to a value containing the number of bytes should be read. After this call it contains the number of read bytes. |
buffer | A memory buffer |
Implements CPGFStream.
Definition at line 148 of file PGFstream.cpp.
156 memcpy(buffPtr,
m_pos, *count);
161 memcpy(buffPtr,
m_pos, *count);
◆ Reinitialize()
void CPGFMemoryStream::Reinitialize |
( |
UINT8 * |
pBuffer, |
|
|
size_t |
size |
|
) |
| |
Use already allocated memory of given size
- Parameters
-
pBuffer | Memory location |
size | Memory size |
Definition at line 102 of file PGFstream.cpp.
◆ SetEOS()
void CPGFMemoryStream::SetEOS |
( |
UINT64 |
length | ) |
|
|
inline |
- Parameters
-
length | Stream length (= relative position of end of stream) |
Definition at line 151 of file PGFstream.h.
◆ SetPos()
void CPGFMemoryStream::SetPos |
( |
short |
posMode, |
|
|
INT64 |
posOff |
|
) |
| |
|
virtual |
Set stream position either absolute or relative.
- Parameters
-
posMode | A position mode (FSFromStart, FSFromCurrent, FSFromEnd) |
posOff | A new stream position (absolute positioning) or a position offset (relative positioning) |
Implements CPGFStream.
Definition at line 168 of file PGFstream.cpp.
184 ReturnWithError(InvalidStreamPos);
◆ Write()
void CPGFMemoryStream::Write |
( |
int * |
count, |
|
|
void * |
buffer |
|
) |
| |
|
virtual |
Write some bytes out of a buffer into this stream.
- Parameters
-
count | A pointer to a value containing the number of bytes should be written. After this call it contains the number of written bytes. |
buffer | A memory buffer |
Implements CPGFStream.
Definition at line 111 of file PGFstream.cpp.
115 const size_t deltaSize = 0x4000 + *count;
118 memcpy(
m_pos, buffPtr, *count);
128 ReturnWithError(InsufficientMemory);
138 memcpy(
m_pos, buffPtr, *count);
142 ReturnWithError(InsufficientMemory);
◆ m_allocated
bool CPGFMemoryStream::m_allocated |
|
protected |
indicates a new allocated buffer
Definition at line 111 of file PGFstream.h.
◆ m_buffer
UINT8* CPGFMemoryStream::m_buffer |
|
protected |
◆ m_eos
UINT8* CPGFMemoryStream::m_eos |
|
protected |
end of stream (first address beyond written area)
Definition at line 109 of file PGFstream.h.
◆ m_pos
UINT8 * CPGFMemoryStream::m_pos |
|
protected |
buffer start address and current buffer address
Definition at line 108 of file PGFstream.h.
◆ m_size
size_t CPGFMemoryStream::m_size |
|
protected |
The documentation for this class was generated from the following files: