Nebula
Loading...
Searching...
No Matches
IO::FileStream Class Reference

#include <filestream.h>

Detailed Description

A stream to which offers read/write access to filesystem files.

Inherits IO::Stream.

Inherited by IO::SafeFileStream.

Public Member Functions

 FileStream ()
 constructor
 
virtual ~FileStream ()
 destructor
 
virtual bool CanRead () const override
 supports reading?
 
virtual bool CanWrite () const override
 supports writing?
 
virtual bool CanSeek () const override
 supports seeking?
 
virtual bool CanBeMapped () const override
 supports memory mapping (read-only)?
 
virtual Size GetSize () const override
 get the size of the stream in bytes
 
virtual Position GetPosition () const override
 get the current position of the read/write cursor
 
virtual bool Open () override
 open the stream
 
virtual void Close () override
 close the stream
 
virtual void Write (const void *ptr, Size numBytes) override
 directly write to the stream
 
virtual Size Read (void *ptr, Size numBytes) override
 directly read from the stream
 
virtual void Seek (Offset offset, SeekOrigin origin) override
 seek in stream
 
virtual void Flush () override
 flush unsaved data
 
virtual bool Eof () const override
 return true if end-of-stream reached
 
virtual void * Map () override
 map stream to memory
 
virtual void Unmap () override
 unmap stream
 
virtual void * MemoryMap () override
 memory map stream to memory
 
virtual void MemoryUnmap () override
 unmap memory stream
 
- Public Member Functions inherited from IO::Stream
 Stream ()
 constructor
 
virtual ~Stream ()
 destructor
 
void SetURI (const URI &u)
 set stream location as URI
 
const URIGetURI () const
 get stream URI
 
virtual void SetSize (Size s)
 set a new size for the stream
 
void SetAccessMode (AccessMode m)
 set the access mode of the stream (default is ReadAccess)
 
AccessMode GetAccessMode () const
 get the access mode of the stream
 
void SetAccessPattern (AccessPattern p)
 set the prefered access pattern (default is Sequential)
 
AccessPattern GetAccessPattern () const
 get the prefered access pattern
 
void SetMediaType (const MediaType &t)
 set optional media type of stream content
 
const MediaTypeGetMediaType () const
 get optional media type
 
bool IsOpen () const
 return true if currently open
 
bool IsMapped () const
 return true if stream is currently mapped to memory
 
- Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
 
int GetRefCount () const
 get the current refcount
 
void AddRef ()
 increment refcount by one
 
void Release ()
 decrement refcount and destroy object if refcount is zero
 
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
 
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
 
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
 
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
 
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
 
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
 
const Util::StringGetClassName () const
 get the class name
 
Util::FourCC GetClassFourCC () const
 get the class FourCC code
 

Protected Attributes

FSWrapper::Handle handle
 
FSWrapper::Handle mapHandle
 
void * mappedContent
 
- Protected Attributes inherited from IO::Stream
URI uri
 
AccessMode accessMode
 
AccessPattern accessPattern
 
bool isOpen
 
bool isMapped
 
MediaType mediaType
 

Private Member Functions

 __DeclareClass (FileStream)
 

Additional Inherited Members

- Public Types inherited from IO::Stream
enum  AccessMode { ReadAccess , WriteAccess , AppendAccess , ReadWriteAccess }
 access modes More...
 
enum  AccessPattern { Random , Sequential }
 access prefered pattern More...
 
enum  SeekOrigin { Begin , Current , End }
 seek origins More...
 
typedef int64_t Position
 typedefs
 
typedef int64_t Offset
 
typedef int64_t Size
 
- Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
 
- Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)
 

Constructor & Destructor Documentation

◆ FileStream()

IO::FileStream::FileStream ( )

constructor

◆ ~FileStream()

IO::FileStream::~FileStream ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

IO::FileStream::__DeclareClass ( FileStream )
private

◆ CanBeMapped()

bool IO::FileStream::CanBeMapped ( ) const
overridevirtual

supports memory mapping (read-only)?

FileStreams support mapping (only read access for now).

Reimplemented from IO::Stream.

◆ CanRead()

bool IO::FileStream::CanRead ( ) const
overridevirtual

supports reading?

Reimplemented from IO::Stream.

◆ CanSeek()

bool IO::FileStream::CanSeek ( ) const
overridevirtual

supports seeking?

Reimplemented from IO::Stream.

◆ CanWrite()

bool IO::FileStream::CanWrite ( ) const
overridevirtual

supports writing?

Reimplemented from IO::Stream.

◆ Close()

void IO::FileStream::Close ( )
overridevirtual

close the stream

Reimplemented from IO::Stream.

Reimplemented in IO::SafeFileStream.

◆ Eof()

bool IO::FileStream::Eof ( ) const
overridevirtual

return true if end-of-stream reached

Reimplemented from IO::Stream.

◆ Flush()

void IO::FileStream::Flush ( )
overridevirtual

flush unsaved data

Reimplemented from IO::Stream.

◆ GetPosition()

Stream::Position IO::FileStream::GetPosition ( ) const
overridevirtual

get the current position of the read/write cursor

Reimplemented from IO::Stream.

◆ GetSize()

Stream::Size IO::FileStream::GetSize ( ) const
overridevirtual

get the size of the stream in bytes

Reimplemented from IO::Stream.

◆ Map()

void * IO::FileStream::Map ( )
overridevirtual

map stream to memory

Reimplemented from IO::Stream.

◆ MemoryMap()

void * IO::FileStream::MemoryMap ( )
overridevirtual

memory map stream to memory

Reimplemented from IO::Stream.

◆ MemoryUnmap()

void IO::FileStream::MemoryUnmap ( )
overridevirtual

unmap memory stream

Reimplemented from IO::Stream.

◆ Open()

bool IO::FileStream::Open ( )
overridevirtual

open the stream

Reimplemented from IO::Stream.

Reimplemented in IO::SafeFileStream.

◆ Read()

Stream::Size IO::FileStream::Read ( void * ptr,
Size numBytes )
overridevirtual

directly read from the stream

Reimplemented from IO::Stream.

◆ Seek()

void IO::FileStream::Seek ( Offset offset,
SeekOrigin origin )
overridevirtual

seek in stream

Reimplemented from IO::Stream.

◆ Unmap()

void IO::FileStream::Unmap ( )
overridevirtual

unmap stream

Reimplemented from IO::Stream.

◆ Write()

void IO::FileStream::Write ( const void * ptr,
Size numBytes )
overridevirtual

directly write to the stream

Reimplemented from IO::Stream.

Member Data Documentation

◆ handle

FSWrapper::Handle IO::FileStream::handle
protected

◆ mapHandle

FSWrapper::Handle IO::FileStream::mapHandle
protected

◆ mappedContent

void* IO::FileStream::mappedContent
protected

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