Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::io::RandomAccessStream Class Referenceabstract

#include <elm/io/RandomAccessStream.h>

+ Inheritance diagram for elm::io::RandomAccessStream:

Public Types

typedef t::uint64 pos_t
 
typedef t::uint64 size_t
 
typedef int access_t
 

Public Member Functions

virtual pos_t pos (void) const =0
 
virtual size_t size (void) const =0
 
virtual bool moveTo (pos_t pos)=0
 
virtual bool moveForward (pos_t pos)=0
 
virtual bool moveBackward (pos_t pos)=0
 
virtual void resetPos (void)
 
- Public Member Functions inherited from elm::io::InStream
virtual ~InStream (void)
 
virtual int read (void *buffer, int size)=0
 
virtual int read (void)
 
virtual CString lastErrorMessage (void)
 
- Public Member Functions inherited from elm::io::OutStream
virtual ~OutStream (void)
 
virtual int write (const char *buffer, int size)=0
 
virtual int write (char byte)
 
virtual int flush (void)=0
 
virtual CString lastErrorMessage (void)
 

Static Public Member Functions

static RandomAccessStreamopenFile (const sys::Path &path, access_t access=READ) throw (sys::SystemException)
 
static RandomAccessStreamcreateFile (const sys::Path &path, access_t access=WRITE) throw (sys::SystemException)
 

Static Public Attributes

static const int READ = 1
 
static const int WRITE = 2
 
static const int READ_WRITE = READ | WRITE
 
- Static Public Attributes inherited from elm::io::InStream
static const int FAILED = -1
 
static const int ENDED = -2
 
static InStreamnull = _null
 
- Static Public Attributes inherited from elm::io::OutStream
static OutStreamnull = _null
 

Detailed Description

A stream allowing to move the read/write head along the file.

Member Typedef Documentation

Member Function Documentation

RandomAccessStream * elm::io::RandomAccessStream::createFile ( const sys::Path path,
access_t  access = WRITE 
)
throw (sys::SystemException
)
static

Create a random access stream from a file, removing it if it already exists.

Parameters
pathPath of the file to open.
accessType of access (one of READ, WRITE, READ_WRITE).
Returns
Opened file.
Exceptions
IOExceptionThrown if there is an error.

References elm::sys::System::createRandomFile().

bool elm::io::RandomAccessStream::moveBackward ( pos_t  pos)
pure virtual

Move the read/write pointer to the given position, relatively back from the current position.

Parameters
posRelative position to move backward from.
Returns
True if the operation succeeded, false else.
bool elm::io::RandomAccessStream::moveForward ( pos_t  pos)
pure virtual

Move the read/write pointer to the given position, relatively to the current position.

Parameters
posRelative position to move to.
Returns
True if the operation succeeded, false else.
bool elm::io::RandomAccessStream::moveTo ( pos_t  pos)
pure virtual

size_t RandomAccessStream::size(void) const; Get the size of the current stream.

Returns
Stream size.

Move the read/write pointer to the given position.

Parameters
posPosition to set the pointer to.
Returns
True if the operation succeeded, false else.

Referenced by resetPos().

RandomAccessStream * elm::io::RandomAccessStream::openFile ( const sys::Path path,
access_t  access = READ 
)
throw (sys::SystemException
)
static

Open a random access stream from a file.

Parameters
pathPath of the file to open.
accessType of access (one of READ, WRITE, READ_WRITE).
Returns
Opened file.
Exceptions
IOExceptionThrown if there is an error.

References elm::sys::System::openRandomFile().

pos_t elm::io::RandomAccessStream::pos ( void  ) const
pure virtual

Get the current position in the file.

Returns
Current position.
void elm::io::RandomAccessStream::resetPos ( void  )
virtual

Reset the position of the read/write pointer to the start of the file.

References moveTo().

virtual size_t elm::io::RandomAccessStream::size ( void  ) const
pure virtual

Member Data Documentation

const int elm::io::RandomAccessStream::READ = 1
static
const int elm::io::RandomAccessStream::READ_WRITE = READ | WRITE
static
const int elm::io::RandomAccessStream::WRITE = 2
static

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