![]() |
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
![]() |
#include <FXFileIO.h>
Inheritance diagram for FXEX::FXFileIO::
Public Methods | |
FXFileIO (FXApp *a, const FXString &file="", FXObject *tgt=NULL, FXSelector sel=0, FXuint opts=0) | |
FXFileIO (FXInputHandle f, FXApp *a, FXObject *tgt=NULL, FXSelector sel=0) | |
FXFileIO (FXApp *a, FXObject *tgt=NULL, FXSelector=0) | |
virtual void | create () |
FXString | name () const |
void | name (const FXString &file) |
void | mode (FXuint m) |
FXuint | mode () |
virtual FXbool | open () |
virtual void | close () |
FXlong | size () |
FXbool | isTemp () const |
void | setTemp (FXbool t=TRUE) |
virtual void | enable () |
virtual void | disable () |
void | sync () |
FXlong | current () |
FXbool | seekbegin (FXlong pos=0) |
FXbool | seek (FXlong pos) |
FXbool | seekend (FXlong pos=0) |
FXbool | truncate (FXlong len) |
FXbool | lock () |
FXbool | unlock (FXlong len) |
FXint | isLocked (FXlong len=0) |
FXbool | readLock (FXlong len=0, FXint timeout=0) |
FXbool | writeLock (FXlong len=0, FXint timeout=0) |
void | setLockRetry (FXuint retry) |
FXbool | map (FXlong len, FXbool writeable=TRUE) |
void | unmap () |
FXbool | isMapped () |
void * | getMapping () |
FXFileIO * | duplicate (FXInputHandle newHandle=INVALID_HANDLE) |
virtual void | save (FXStream &store) const |
virtual void | load (FXStream &store) |
virtual | ~FXFileIO () |
Static Public Methods | |
void | modeDefault (FXuint mode) |
FXuint | modeDefault () |
|
get access to a file.
|
|
use an already open file :-).
|
|
create a temporary file, deletes on close.
|
|
Destructor If the object contains a mapped region, the region is unmapped before destruction.
|
|
create resource.
Reimplemented from FXEX::FXBaseObject. |
|
get the filename.
|
|
set to new file, but only if the file is not open (fails silently).
|
|
Set file permissions (mode flags). The permissions that can be set, are taken from the 'unix way' - I have looked at the Win32 security permissions/ACL's for files; get this, there is a permission to stop you deleting a file, but you can happily truncate to file to zero bytes - what the? If you have write access, then you might as well have delete access. In any case, if a better idea comes along we can always change it... If the file exists, the permission is applied to a file immediately. If the file is yet to be opened, it is applied to the file on opening time. |
|
Returns the permission (mode flags) on the file; if the file exists, the permission is the value from the file; if the file doesn't exist, the value returned is the 'default' value if no previous call to modeDefault() has been called, otherwise it is the value passed in the modeDefault() call.
|
|
open the file.
Reimplemented from FXEX::FXIOHandle. |
|
close the file.
Reimplemented from FXEX::FXIOHandle. |
|
get the current size.
|
|
is the file a temp file.
Definition at line 122 of file FXFileIO.h. |
|
mark the file, as a temp file - temp files are removed on close.
|
|
Enable FXFileIO to detect when new data is available from the file. This moves the file pointer to the end of the file, reading in the file as it moves. It then tries to maintain the file pointer at the end of the file. The idea is that you can treat a file, like a socket, ie continually incoming data. It is also used to enable 'auto-open' feature of FXFileIO which will detect when the filename exists, and if enabled will open the file for you. If you want to have the 'auto-open' but not the 'new-data-available' functionality, handle SEL_IO_CONNECT in your app, then disable the FXFileIO object, finally return 0. eg FXMAPFUNC(SEL_IO_CONNECT,App::ID_FILE,App::onAutoOpen), long App::onAutoOpen(FXObject *sender,FXSelector,void*){ sender->handle(this,FXSEL(SEL_COMMAND,ID_DISABLE),NULL); return 0; } Reimplemented from FXEX::FXBaseObject. |
|
Disable the ability to detect when mroe data is available from the file.
Reimplemented from FXEX::FXBaseObject. |
|
Flush/sync data to disk - returns when sync is complete. Used to sunchronise memory mapped files, or when FILEIO_SYNC is not specified. |
|
what is current file pointer position.
|
|
move to the start of file plus some number of pos bytes.
|
|
move to some point in the file, from where it is currently.
|
|
move to the end of the file minus pos Note: zero is the first byte beyond the end of the file, -1 is one past the end of the file (differs from lseek).
|
|
truncate the file to some length Note: you should really check the size of the file, after you call truncate.
|
|
nice and simple lock interface.
Definition at line 177 of file FXFileIO.h. |
|
nice and simple unlock interface.
|
|
is the file already locked - a length of zero implies the whole file - for the simple interface, a non-zero return code implies some form of lock - otherwise, returns 'Unlocked' (0) if not locked, or the type of lock.
|
|
lock a file - read lock - multiple read locks can be in-force (by multiple processes) at any given time - never unlocks any other lock - locking with a length of zero means lock the whole file - otherwise lock the number of bytes, begining from the current position - timeout is in milliseconds.
|
|
lock a file - write lock - only one lock can be in force at any given time, ie the write lock - cannot unlock any other lock - a write lock still allows you to read the file (ie it is a more powerful read lock) - locking with a length of zero means lock the whole file - otherwise lock the number of bytes, begining from the current position - timeout is in milliseconds.
|
|
this allows us to adjust or retry interval when trying to set a lock - retry in nanoseconds.
Definition at line 207 of file FXFileIO.h. |
|
this class supports memory mapping of the file, but only one region at a time... load part of the file into memory, from the current seek position.
|
|
unload part of a file from memory.
|
|
is the file mapped into memory.
Definition at line 217 of file FXFileIO.h. |
|
return pointer to mapped memory.
Definition at line 220 of file FXFileIO.h. |
|
duplicate this file handle.
Reimplemented from FXEX::FXIOHandle. |
|
set the default mode for all new FileIO objects.
Definition at line 226 of file FXFileIO.h. |
|
get the default mode of all new FileIO objects.
Definition at line 229 of file FXFileIO.h. |
|
save object to stream.
Reimplemented from FXEX::FXIOHandle. |
|
load object from stream.
Reimplemented from FXEX::FXIOHandle. |