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

PG_File Class Reference

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

#include <pgfile.h>

List of all members.

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 (std::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
std::string getline ()
 read a line from the file.
void putline (const std::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


Detailed Description

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

Author:
Alexander Pipelka

Definition at line 50 of file pgfile.h.


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

Definition at line 32 of file pgfile.cpp.

PG_File::~PG_File  ) 
 

Definition at line 35 of file pgfile.cpp.


Member Function Documentation

bool PG_File::eof  ) 
 

check for the end of the file.

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

Definition at line 65 of file pgfile.cpp.

Referenced by getline(), and PG_Theme::Load().

int PG_File::fileLength  ) 
 

return the length of the file (in bytes)

Returns:
length of the file

Definition at line 77 of file pgfile.cpp.

Referenced by PG_Layout::Load(), and PG_FileArchive::ReadFile().

char PG_File::getc  ) 
 

get a single character from the file

Definition at line 81 of file pgfile.cpp.

References read().

Referenced by getline().

std::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.

Definition at line 90 of file pgfile.cpp.

References eof(), and getc().

void PG_File::putline const std::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.

Definition at line 105 of file pgfile.cpp.

References write().

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

Definition at line 57 of file pgfile.cpp.

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

Definition at line 41 of file pgfile.cpp.

Referenced by getc(), PG_Theme::Load(), PG_Layout::Load(), and PG_FileArchive::ReadFile().

bool PG_File::seek int  pos  ) 
 

set the file pointer to a given position

Parameters:
pos position to set
Returns:
true on success

Definition at line 73 of file pgfile.cpp.

int PG_File::tell  ) 
 

get the current position in the file stream

Returns:
current file stream position

Definition at line 69 of file pgfile.cpp.

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

Definition at line 61 of file pgfile.cpp.

int PG_File::write const char *  buffer  ) 
 

write bytes to the stream

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

Definition at line 53 of file pgfile.cpp.

References write().

int PG_File::write std::string &  buffer  ) 
 

write bytes to the stream

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

Definition at line 49 of file pgfile.cpp.

References write().

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

Definition at line 45 of file pgfile.cpp.

Referenced by putline(), and write().


Friends And Related Function Documentation

friend class PG_FileArchive [friend]
 

Definition at line 162 of file pgfile.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:18:53 2008 for Advanced Strategic Command by  doxygen 1.4.2