Humble Framework for SkyOS


Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

HFile Class Reference
[System]

#include <HFile.h>

Inheritance diagram for HFile:

HObjNoCopy HObj HSettings HZipFile HResMgr

Detailed Description

The HFile class manages a single instance of a stdio file, which can be used for either input or output (or both).

Definition at line 365 of file HFile.h.

Public Member Functions

virtual ErrCode Close (void)
 Closes the file.
virtual ErrCode Open (HFilename fs, uint32 uFlags=(O_BINARY|O_CREAT|O_RDWR))
 Opens the file.
virtual uint32 Read (HMemory &buffer)
 Reads binary data in from the file.
virtual uint32 Read (void *pData, const uint32 uBytes)
 Reads binary data in from the file.
virtual int32 ReadLine (TextPtr pszLine, const uint32 uMaxLen)
 Reads a line of text from a file.
int32 Seek (int32 lOffset, const int nFrom) const
 Moves the file pointer to an absolute or relative offset.
virtual uint32 Write (PtrConst pData, uint32 uBytes) const
 Writes binary data out to the file.
virtual uint32 Write (HMemory const &buffer) const
 Writes binary data out to the file.
virtual uint32 WriteLine (StringPtr pstr=NULL) const
 Writes a string out to the file.
bool IsAtEOF (void) const
 Determines if the file is at the EOF.
bool IsBinary (void) const
 Determines if a file was opened in binary mode.
bool IsOpen (void) const
 Determines if a file is open or not.
bool IsWritable (void) const
 Determines if a file was opened for writing.

Static Public Member Functions

static ErrCode Delete (const HFilename &fs)
 Deletes ("unlinks") a file.
static bool Exists (const HFilename &fs)
 Determines if a file exists and is accessible.
static ErrCode GetAppDirectory (HFilename &fsAppDir)
 Returns the folder the application was started in...
static ErrCode GetLength (const HFilename &fs, uint32 &uBytes)
 Returns the length of the file in bytes.

Protected Attributes

bool m_bEOF
 Flag to signify end of file hit.
FILE * m_pFile
 File ptr.
uint32 m_uFlags
 Flags used to open the file.


Member Function Documentation

static ErrCode HFile::Delete const HFilename fs  )  [static]
 

Returns:
NO_ERROR if successful, error code otherwise
Parameters:
fs Fully qualified file name

Definition at line 397 of file HFile.h.

static bool HFile::Exists const HFilename fs  )  [static]
 

Returns:
True if the file is accessible, false otherwise
Parameters:
fs Fully qualified file name

Definition at line 431 of file HFile.h.

virtual ErrCode HFile::Close void   )  [virtual]
 

Returns:
NO_ERROR on success, error code otherwise

Reimplemented in HZipFile.

Definition at line 448 of file HFile.h.

virtual ErrCode HFile::Open HFilename  fs,
uint32  uFlags = (O_BINARY|O_CREAT|O_RDWR)
[virtual]
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
fs Filespec of file to open
uFlags [optional] flags, default is "create a binary file"

Definition at line 473 of file HFile.h.

virtual uint32 HFile::Read HMemory buffer  )  [virtual]
 

Returns:
count of bytes read in
Parameters:
buffer Buffer to read into

Definition at line 535 of file HFile.h.

virtual uint32 HFile::Read void *  pData,
const uint32  uBytes
[virtual]
 

Returns:
count of bytes read in
Parameters:
pData pointer to buffer to receive the data
uBytes count of bytes to be read in

Definition at line 545 of file HFile.h.

virtual int32 HFile::ReadLine TextPtr  pszLine,
const uint32  uMaxLen
[virtual]
 

Returns:
Line length on success, -1 on error
Parameters:
pszLine Pointer to buffer to recieve text
uMaxLen Length of buffer in characters

Definition at line 579 of file HFile.h.

int32 HFile::Seek int32  lOffset,
const int  nFrom
const
 

Returns:
current position in file or 0xFFFFFFFF on error
Parameters:
lOffset Number of bytes to move (may be zero)
nFrom SEEK_CUR, SEEK_END, or SEEK_SET

Definition at line 627 of file HFile.h.

virtual uint32 HFile::Write PtrConst  pData,
uint32  uBytes
const [virtual]
 

Returns:
count of bytes written to the file
Parameters:
pData pointer to data to be written
uBytes count of bytes to be written

Definition at line 650 of file HFile.h.

virtual uint32 HFile::Write HMemory const &  buffer  )  const [virtual]
 

Returns:
count of bytes written to the file
Parameters:
buffer Buffer of data to be written

Definition at line 676 of file HFile.h.

virtual uint32 HFile::WriteLine StringPtr  pstr = NULL  )  const [virtual]
 

Returns:
count of characters written to the file
Parameters:
pstr ptr to string to write out (or NULL for EOL)

Definition at line 685 of file HFile.h.

static ErrCode HFile::GetAppDirectory HFilename fsAppDir  )  [static]
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
fsAppDir Application directory

Definition at line 716 of file HFile.h.

static ErrCode HFile::GetLength const HFilename fs,
uint32 &  uBytes
[static]
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
fs Fully qualified file name
[out] uBytes Length of the file in bytes

Definition at line 735 of file HFile.h.

bool HFile::IsAtEOF void   )  const
 

Returns:
True if file at EOF

Definition at line 760 of file HFile.h.

bool HFile::IsBinary void   )  const
 

Returns:
True if file opened in binary mode, false if closed

Definition at line 764 of file HFile.h.

bool HFile::IsOpen void   )  const
 

Returns:
True if the file is currently open, or false if closed

Definition at line 768 of file HFile.h.

bool HFile::IsWritable void   )  const
 

Returns:
True if file can be written too, false if closed or read-only

Definition at line 772 of file HFile.h.


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

2006.01.09-16:37