#include <cxxtools/filedevice.h>

Inheritance diagram for cxxtools::FileDevice:
cxxtools::IODevice cxxtools::Selectable cxxtools::NonCopyable

Public Member Functions

 FileDevice ()
 FileDevice (const std::string &path, IODevice::OpenMode mode, bool inherit=true)
 ~FileDevice ()
void open (const std::string &path, IODevice::OpenMode mode, bool inherit=true)
const char * path () const
size_t size () const
- Public Member Functions inherited from cxxtools::IODevice
virtual ~IODevice ()
 Destructor.
void beginRead (char *buffer, size_t n)
size_t endRead ()
size_t read (char *buffer, size_t n)
 Read data from I/O device.
size_t beginWrite (const char *buffer, size_t n)
size_t endWrite ()
size_t write (const char *buffer, size_t n)
 Write data to I/O device.
void cancel ()
 Cancels asynchronous reading and writing.
bool seekable () const
 Returns true if device is seekable.
pos_type seek (off_type offset, std::ios::seekdir sd)
 Move the next read position to the given offset.
size_t peek (char *buffer, size_t n)
 Read data from I/O device without consuming them.
void sync ()
 Synchronize device.
pos_type position ()
 Returns the current I/O position.
bool eof () const
 Returns if the device has reached EOF.
bool async () const
 Returns true if the device operates in asynchronous mode.
virtual IODeviceImpl & ioimpl ()=0
bool reading () const
bool writing () const
char * rbuf () const
size_t rbuflen () const
size_t ravail () const
const char * wbuf () const
size_t wbuflen () const
size_t wavail () const
- Public Member Functions inherited from cxxtools::Selectable
virtual ~Selectable ()
 Destructor.
void setSelector (SelectorBase *parent)
SelectorBaseselector ()
const SelectorBaseselector () const
void close ()
 Closes the I/O device.
bool wait (std::size_t msecs=WaitInfinite)
bool enabled () const
 Test if the I/O device object is enabled.
bool idle () const
bool busy () const
bool avail () const
virtual SelectableImpl & simpl ()=0

Protected Member Functions

size_t onBeginRead (char *buffer, size_t n, bool &eof)
size_t onEndRead (bool &eof)
size_t onBeginWrite (const char *buffer, size_t n)
size_t onEndWrite ()
void onClose ()
 Closes the Selector.
void onSetTimeout (size_t timeout)
bool onSeekable () const
 Returns true if device is seekable.
pos_type onSeek (off_type offset, std::ios::seekdir sd)
 Move the next read position to the given offset.
size_t onRead (char *buffer, size_t count, bool &eof)
 Read bytes from device.
size_t onWrite (const char *buffer, size_t count)
 Write bytes to device.
void onCancel ()
size_t onPeek (char *buffer, size_t count)
 Read data from I/O device without consuming them.
void onSync () const
 Synchronize device.
- Protected Member Functions inherited from cxxtools::IODevice
 IODevice ()
 Default Constructor.
virtual size_t onSize () const
 Returns the size of the device.
void setEof (bool eof)
 Sets or unsets the device to eof.
void setAsync (bool async)
 Sets or unsets the device to async.
- Protected Member Functions inherited from cxxtools::Selectable
 Selectable ()
 Default Constructor.
void setEnabled (bool isEnabled)
 Sets or unsets the device enabled.
void setState (State state)
virtual bool onWait (std::size_t msecs)=0
virtual void onAttach (SelectorBase &)=0
virtual void onDetach (SelectorBase &)=0
- Protected Member Functions inherited from cxxtools::NonCopyable
 NonCopyable ()

Friends

class FileDeviceImpl

Additional Inherited Members

- Public Types inherited from cxxtools::IODevice
typedef std::char_traits< char >
::pos_type 
pos_type
typedef std::char_traits< char >
::off_type 
off_type
typedef std::ios_base::seekdir SeekDir
typedef IOS_OpenMode OpenMode
- Public Attributes inherited from cxxtools::IODevice
Signal< IODevice & > inputReady
 Notifies about available data.
Signal< IODevice & > outputReady
 Notifies when data can be written.
- Static Public Attributes inherited from cxxtools::IODevice
static const OpenMode Sync = IOS_Sync
static const OpenMode Async = IOS_Async
static const OpenMode Read = IOS_Read
static const OpenMode Write = IOS_Write
static const OpenMode AtEnd = IOS_AtEnd
static const OpenMode Append = IOS_Append
static const OpenMode Trunc = IOS_Trunc
- Protected Attributes inherited from cxxtools::IODevice
char * _rbuf
size_t _rbuflen
size_t _ravail
const char * _wbuf
size_t _wbuflen
size_t _wavail
void * _reserved

Constructor & Destructor Documentation

cxxtools::FileDevice::FileDevice ( )
cxxtools::FileDevice::FileDevice ( const std::string &  path,
IODevice::OpenMode  mode,
bool  inherit = true 
)
cxxtools::FileDevice::~FileDevice ( )

Member Function Documentation

size_t cxxtools::FileDevice::onBeginRead ( char *  buffer,
size_t  n,
bool &  eof 
)
protectedvirtual

Implements cxxtools::IODevice.

size_t cxxtools::FileDevice::onBeginWrite ( const char *  buffer,
size_t  n 
)
protectedvirtual

Implements cxxtools::IODevice.

void cxxtools::FileDevice::onCancel ( )
protectedvirtual

Implements cxxtools::IODevice.

void cxxtools::FileDevice::onClose ( )
protectedvirtual

Closes the Selector.

Implements cxxtools::Selectable.

size_t cxxtools::FileDevice::onEndRead ( bool &  eof)
protectedvirtual

Implements cxxtools::IODevice.

size_t cxxtools::FileDevice::onEndWrite ( )
protectedvirtual

Implements cxxtools::IODevice.

size_t cxxtools::FileDevice::onPeek ( char *  ,
size_t   
)
protectedvirtual

Read data from I/O device without consuming them.

Reimplemented from cxxtools::IODevice.

size_t cxxtools::FileDevice::onRead ( char *  buffer,
size_t  count,
bool &  eof 
)
protectedvirtual

Read bytes from device.

Implements cxxtools::IODevice.

pos_type cxxtools::FileDevice::onSeek ( off_type  ,
std::ios::seekdir   
)
protectedvirtual

Move the next read position to the given offset.

Reimplemented from cxxtools::IODevice.

bool cxxtools::FileDevice::onSeekable ( ) const
inlineprotectedvirtual

Returns true if device is seekable.

Reimplemented from cxxtools::IODevice.

void cxxtools::FileDevice::onSetTimeout ( size_t  timeout)
protected
void cxxtools::FileDevice::onSync ( ) const
protectedvirtual

Synchronize device.

Reimplemented from cxxtools::IODevice.

size_t cxxtools::FileDevice::onWrite ( const char *  buffer,
size_t  count 
)
protectedvirtual

Write bytes to device.

Implements cxxtools::IODevice.

void cxxtools::FileDevice::open ( const std::string &  path,
IODevice::OpenMode  mode,
bool  inherit = true 
)
const char* cxxtools::FileDevice::path ( ) const
inline
size_t cxxtools::FileDevice::size ( ) const

Friends And Related Function Documentation

friend class FileDeviceImpl
friend

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