JASSv2
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
JASS::instream_memory Class Reference

Subclass of instream for reading data from a memory buffer. More...

#include <instream_memory.h>

Inheritance diagram for JASS::instream_memory:
Inheritance graph
[legend]
Collaboration diagram for JASS::instream_memory:
Collaboration graph
[legend]

Public Member Functions

 instream_memory (const void *memory, size_t length)
 Constructor. More...
 
virtual void read (document &buffer)
 Read buffer.size() bytes of data into buffer.contents, resizing on eof. More...
 
- Public Member Functions inherited from JASS::instream
 instream (std::shared_ptr< instream > &source, std::shared_ptr< allocator > &memory)
 Constructor. More...
 
 instream (std::shared_ptr< instream > &source)
 Constructor. More...
 
 instream (void)
 Constructor.
 
virtual ~instream ()
 Destructor. More...
 
size_t fetch (void *buffer, size_t bytes)
 fetch() generates a document object, sets its contents to the passed buffer, calls read() and returns the number of bytes of data read More...
 

Static Public Member Functions

static void unittest (void)
 Unit test this class.
 

Protected Attributes

size_t bytes_read
 The number of bytes this object has read for the buffer.
 
const uint8_t * file
 A pointer to the in-memory buffer (thought of as an in-place file)
 
size_t file_length
 The length of the in-memory buffer.
 
- Protected Attributes inherited from JASS::instream
std::shared_ptr< instreamsource
 If this object is reading from another instream then this is that instream.
 
std::shared_ptr< allocatormemory
 Any and all memory allocation must happen using this object.
 

Detailed Description

Subclass of instream for reading data from a memory buffer.

Constructor & Destructor Documentation

◆ instream_memory()

JASS::instream_memory::instream_memory ( const void *  memory,
size_t  length 
)
inline

Constructor.

Parameters
memory[in] A pointer to the start of the buffer
length[in] The length of the buffer

Member Function Documentation

◆ read()

void JASS::instream_memory::read ( document buffer)
virtual

Read buffer.size() bytes of data into buffer.contents, resizing on eof.

Parameters
buffer[out] buffer.contents.size() bytes of data are read from source into buffer which is resized to the number of bytes read on eof.

Implements JASS::instream.


The documentation for this class was generated from the following files: