#include <cascade/util/CascadeFile.h>
Inheritance diagram for CascadeFile:
Public Types | |
typedef bool() | FileCopyCallback (u64 inTotal, u64 inComplete, void *pClientData) |
Public Member Functions | |
CascadeFile () | |
CascadeFile (const char *pName) | |
virtual | ~CascadeFile () |
virtual bool | Open (const char *pMode) |
virtual bool | Close () |
virtual bool | Delete () |
virtual bool | CopyInto (CascadeDirectory &inDestination, FSCopyError &outError, FileCopyCallback *inCallback=NULL, void *inClientData=NULL, bool inReplace=false) |
virtual bool | IsOpen () const |
virtual bool | SetName (const char *pName) |
virtual bool | Read (void *pBuff, u32 nBytes) |
virtual bool | Write (void *pBuff, u32 nBytes) |
virtual u64 | GetFileSize () const |
virtual bool | SeekToBeginning () |
virtual bool | SeekForward (u32 nBytes) |
virtual bool | SeekBackward (u32 nBytes) |
virtual bool | SeekToEnd () |
virtual bool | SeekToPosition (u64 nPosition) |
virtual void * | GetHandle () const |
virtual bool | IsDirectory (void) const |
CascadeFile provides easy to use object-based access to stdio filing operations.
|
callback function for CopyInto method Create a callback function of this signature to pass to the CopyInto method. Information is provided to calculate the progress of the copy operation. Return true from your callback to allow the copy to proceed. Return false to cause the copy to stop. (The copy will return a false return value if canceled in this way.)
|
|
default constructor This constructor constructs an unnamed file. |
|
parameterized constructor This constructor constructs a file with name pName.
|
|
destructor This is the CascadeFile destructor. If the file is open when the destructor is called, it will be closed by the destructor.
|
|
closes the file Close() closes the file returning true if successful, false otherwise.
|
|
copy this file into the destination directory Copies this file into the destination directory. If the copy is canceled via the callback, the destination file is deleted and the function returns false, with outError set to CascadeFSObject::eFSCopyCanceled
|
|
deletes the file Delete() deletes the file referred to by this object.
|
|
gets the file size GetFileSize() returns the size of the file in bytes. If the file is not open, GetFileSize() returns 0. GetFileSize() returns a 64 bit quantity. Whether or not 64 bit file sizes are supported is dependent on the underlying file system.
|
|
gets the internal FILE * of the file GetHandle() returns the operating system file handle for the open file or NULL if the file is not open. This value may safely be cast to a FILE * and the function fileno() may be used on the handle returned to turn it into a file descriptor.
|
|
determines whether or not the file is a directory IsDirectory() determines if the file refers to a directory.
Implements CascadeFSObject. |
|
determines whether or not the file is open IsOpen() returns true if the file is already open.
|
|
opens the file Open() opens the file with mode pMode. The modes are the same as the modes for fopen. If the file is already open, Open() returns false.
|
|
reads data from the file Read() reads nBytes from the file into *pBuff returning true if successful, false otherwise.
|
|
seeks backward in the file SeekBackward() seeks an open file backward nBytes from the current position returning true if successful, false otherwise.
|
|
seeks forward in the file SeekForward() seeks an open file forward nBytes from the current position returning true if successful, false otherwise.
|
|
seeks to the beginning of the file SeekToBeginning() seeks an open file to the beginning returning true if successful, false otherwise.
|
|
seeks to the end of the file SeekToEnd() seeks an open file to the end returning true if successful, false otherwise.
|
|
seeks to a position in the file SeekToPosition() seeks an open file to the absolute byte position identified by nPosition returning true if successful, false otherwise. Whether or not 64 bit file positions are supported is dependent on the underlying file system.
|
|
sets the file name SetName() sets the name of the file object to pName. If the file is already open SetName() returns false. The file name must be set with SetName() (or with a name setting constructor) before a file open will succeed.
Reimplemented from CascadeFSObject. |
|
writes data to the file Write() writes nBytes from *pBuff to the file returning true if successful, false otherwise.
|