Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

PG_File Class Reference

List of all members.

Detailed Description

file abstraction for the PhsicsFS (used in conjunction with PG_FileArchive)

Author:
Alexander Pipelka


Public Member Functions

 ~PG_File ()
int read (void *buffer, unsigned int bytestoread)
 read bytes from the stream

int write (void *buffer, unsigned int bytestowrite)
 write bytes to the stream

int write (string &buffer)
 write bytes to the stream

int write (const char *buffer)
 write bytes to the stream

int read (void *buffer, unsigned int objSize, unsigned int objCount)
 read records from the stream

int write (void *buffer, unsigned int objSize, unsigned int objCount)
 write records to the stream

bool eof ()
 check for the end of the file.

int tell ()
 get the current position in the file stream

bool seek (int pos)
 set the file pointer to a given position

int fileLength ()
 return the length of the file (in bytes)

char getc ()
 get a single character from the file

string getline ()
 read a line from the file.

void putline (const string &line)
 write a line to the file


Protected Member Functions

 PG_File (void *f)
 The constructor can only be called from PG_FileArchive or any subclass.


Friends

class PG_FileArchive


Constructor & Destructor Documentation

PG_File::PG_File void *  f  )  [protected]
 

The constructor can only be called from PG_FileArchive or any subclass.

PG_File object are create by PG_FileArchive::OpenFile(...)

Parameters:
f pointer to PhysicsFS file

PG_File::~PG_File  ) 
 


Member Function Documentation

bool PG_File::eof  ) 
 

check for the end of the file.

Returns:
true if we touched the end of the file.

int PG_File::fileLength  ) 
 

return the length of the file (in bytes)

Returns:
length of the file

char PG_File::getc  ) 
 

get a single character from the file

string PG_File::getline  ) 
 

read a line from the file.

This function reads a CR/LF terminated line of text from the file. Any trailing carriage return and linefeed characters will be skipped.

void PG_File::putline const string &  line  ) 
 

write a line to the file

Parameters:
line text to write This functions writes a line of text to a file. Carriage return (and linefeed) characters will be added.

int PG_File::read void *  buffer,
unsigned int  objSize,
unsigned int  objCount
 

read records from the stream

Parameters:
buffer buffer to fill
objSize size (in bytes) of a record
objCount number of records to read
Returns:
number of records read

int PG_File::read void *  buffer,
unsigned int  bytestoread
 

read bytes from the stream

Parameters:
buffer buffer to fill
bytestoread number of bytes to read from the stream
Returns:
number of bytes read

bool PG_File::seek int  pos  ) 
 

set the file pointer to a given position

Parameters:
pos position to set
Returns:
true on success

int PG_File::tell  ) 
 

get the current position in the file stream

Returns:
current file stream position

int PG_File::write void *  buffer,
unsigned int  objSize,
unsigned int  objCount
 

write records to the stream

Parameters:
buffer buffer to write
objSize size (in bytes) of a record
objCount number of records to write
Returns:
number of records written

int PG_File::write const char *  buffer  ) 
 

write bytes to the stream

Parameters:
buffer buffer to write
Returns:
number of bytes written

int PG_File::write string &  buffer  ) 
 

write bytes to the stream

Parameters:
buffer buffer to write
Returns:
number of bytes written

int PG_File::write void *  buffer,
unsigned int  bytestowrite
 

write bytes to the stream

Parameters:
buffer buffer to write
bytestowrite number of bytes to write to the stream
Returns:
number of bytes written


Friends And Related Function Documentation

friend class PG_FileArchive [friend]
 



The ParaGUI Project - Alexander Pipelka