HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FS_IStreamDevice Class Reference

#include <FS_IStreamDevice.h>

Classes

struct  category
 

Public Types

using char_type = char
 
using stream_offset = bios::stream_offset
 

Public Member Functions

 FS_IStreamDevice (const char *path, const UT_Options *opts=nullptr)
 
 FS_IStreamDevice (UT_IStream *stream)
 
 ~FS_IStreamDevice ()
 
bool isValid () const
 Test whether stream is valid. More...
 
std::streamsize write (const char *, std::streamsize)
 Writing always fails. More...
 
void close ()
 Close the input stream. More...
 
std::streamsize read (char *buffer, std::streamsize n)
 Try to read data from the stream. More...
 
bool putback (char_type c)
 Putback a character. More...
 
stream_offset seek (stream_offset off, std::ios_base::seekdir way)
 Seek in the stream. More...
 

Detailed Description

This class is a wrapper to create a std::istream using FS to handle stream I/O. There are three objects involved when using this code. The device, the stream buffer and the stream itself. You need code like:

auto reader = new FS_IStreamDevice(path);
if (!reader->isValid())
{
delete reader;
return false;
}
auto streambuf = new FS_IStreamDeviceBuffer(*reader);
auto stream = new std::istream(streambuf);
...
delete reader;
delete stream;
delete streambuf;

Definition at line 38 of file FS_IStreamDevice.h.

Member Typedef Documentation

Definition at line 41 of file FS_IStreamDevice.h.

using FS_IStreamDevice::stream_offset = bios::stream_offset

Definition at line 42 of file FS_IStreamDevice.h.

Constructor & Destructor Documentation

FS_IStreamDevice::FS_IStreamDevice ( const char *  path,
const UT_Options opts = nullptr 
)
inline

Definition at line 50 of file FS_IStreamDevice.h.

FS_IStreamDevice::FS_IStreamDevice ( UT_IStream stream)
inline

Definition at line 55 of file FS_IStreamDevice.h.

FS_IStreamDevice::~FS_IStreamDevice ( )
inline

Definition at line 59 of file FS_IStreamDevice.h.

Member Function Documentation

void FS_IStreamDevice::close ( )
inline

Close the input stream.

Definition at line 67 of file FS_IStreamDevice.h.

bool FS_IStreamDevice::isValid ( ) const
inline

Test whether stream is valid.

Definition at line 62 of file FS_IStreamDevice.h.

bool FS_IStreamDevice::putback ( char_type  c)
inline

Putback a character.

Definition at line 79 of file FS_IStreamDevice.h.

std::streamsize FS_IStreamDevice::read ( char *  buffer,
std::streamsize  n 
)
inline

Try to read data from the stream.

Definition at line 74 of file FS_IStreamDevice.h.

stream_offset FS_IStreamDevice::seek ( stream_offset  off,
std::ios_base::seekdir  way 
)
inline

Seek in the stream.

Definition at line 84 of file FS_IStreamDevice.h.

std::streamsize FS_IStreamDevice::write ( const char *  ,
std::streamsize   
)
inline

Writing always fails.

Definition at line 65 of file FS_IStreamDevice.h.


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