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

Subclass of the instream base class used for reading data from a disk file. More...

#include <instream_file.h>

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

Public Member Functions

 instream_file (const std::string &filename)
 Constructor. More...
 
virtual ~instream_file ()
 Destructor.
 
virtual void read (document &buffer)
 Read buffer.contents.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 Member Functions

 instream_file (FILE *file)
 Constructor. More...
 

Protected Attributes

file disk_file
 The file to read from.
 
size_t file_length
 The length of the file.
 
size_t bytes_read
 The number of bytes that have been read from the file.
 
- 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 the instream base class used for reading data from a disk file.

Examples:
parser_use.cpp.

Constructor & Destructor Documentation

◆ instream_file() [1/2]

JASS::instream_file::instream_file ( FILE *  file)
protected

Constructor.

Parameters
file[in] the FILE * object that this instream_file object should use (see instream_file_star.h)

◆ instream_file() [2/2]

JASS::instream_file::instream_file ( const std::string &  filename)

Constructor.

Parameters
filename[in] The name of the file to use as the input stream

Member Function Documentation

◆ read()

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

Read buffer.contents.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: