Introduction
Downloads
Documentation
Tutorials
Pixie Lite
Forum

Home

Platform_FileSystem_File Class Reference
[Platform]

Platform independent abstraction of the file system file. More...

Inheritance diagram for Platform_FileSystem_File:

Platform_NULL_FileSystem_File Platform_Win32_FileSystem_File

List of all members.


Public Types

enum  SetPositionOrigin { ORIGIN_START = 0, ORIGIN_CURRENT = 1, ORIGIN_END = 2 }

Public Member Functions

virtual ~Platform_FileSystem_File ()
virtual const char * GetPath ()=0
virtual bool Exists ()=0
virtual bool Create ()=0
virtual bool Open ()=0
virtual bool Close ()=0
virtual void Delete ()=0
virtual int SetPosition (int position, SetPositionOrigin origin=ORIGIN_START)=0
virtual int GetPosition ()=0
virtual int Write (const char *value, int count=1)=0
virtual int Write (const short *value, int count=1)=0
virtual int Write (const int *value, int count=1)=0
virtual int Write (const long *value, int count=1)=0
virtual int Write (const unsigned char *value, int count=1)=0
virtual int Write (const unsigned short *value, int count=1)=0
virtual int Write (const unsigned int *value, int count=1)=0
virtual int Write (const unsigned long *value, int count=1)=0
virtual int Write (const float *value, int count=1)=0
virtual int Write (const double *value, int count=1)=0
virtual int Write (const bool *value, int count=1)=0
virtual int Read (char *value, int count=1)=0
virtual int Read (short *value, int count=1)=0
virtual int Read (int *value, int count=1)=0
virtual int Read (long *value, int count=1)=0
virtual int Read (unsigned char *value, int count=1)=0
virtual int Read (unsigned short *value, int count=1)=0
virtual int Read (unsigned int *value, int count=1)=0
virtual int Read (unsigned long *value, int count=1)=0
virtual int Read (float *value, int count=1)=0
virtual int Read (double *value, int count=1)=0
virtual int Read (bool *value, int count=1)=0

Detailed Description

Platform independent abstraction of the file system file.

Author:
Mattias Gustavsson
Handles file manipulation and allows for checking if files exist, read, write and delete. Endian-ness is handled automatically, and the data is always written as little-endian, and converted at read to the native format of the platform.

Definition at line 23 of file Platform_FileSystem_File.h.


Member Enumeration Documentation

Enumeration of possible values to use for the SetPosition method, when specifying what origin the specified position value is relative to.

Enumerator:
ORIGIN_START  Set position relative to the start of the file.
ORIGIN_CURRENT  Set position relative to the current position in the file.
ORIGIN_END  Set position relative to the end of the file.

Definition at line 85 of file Platform_FileSystem_File.h.


Constructor & Destructor Documentation

virtual Platform_FileSystem_File::~Platform_FileSystem_File (  )  [virtual]

Destructor

Definition at line 29 of file Platform_FileSystem_File.h.


Member Function Documentation

virtual const char* Platform_FileSystem_File::GetPath (  )  [pure virtual]

Retrieves the path specified when this file object was created

Returns:
The path for the file object

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual bool Platform_FileSystem_File::Exists (  )  [pure virtual]

Checks if the file which this file object represents exists.

Returns:
True if the file exists, false if it doesn't

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual bool Platform_FileSystem_File::Create (  )  [pure virtual]

Creates the file which this file object represent. If it already exists, it will be replaced. The file is then left open for writing, and should be closed by a call to Close.

Returns:
True if the file was successfully created, false if there was an error

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual bool Platform_FileSystem_File::Open (  )  [pure virtual]

Opens the file which this file object represent, leaving it ready for reading from. When done, it should be closed by a call to Close.

Returns:
True if the file was successfully opened, false if there was an error

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual bool Platform_FileSystem_File::Close (  )  [pure virtual]

Close a file which was opened for reading by a call to Open, or for writing by a call to Create.

Returns:
True if the file was successfully closed, false if there was an error

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual void Platform_FileSystem_File::Delete (  )  [pure virtual]

Deletes the file which this file object represent, if it exists.

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual int Platform_FileSystem_File::SetPosition ( int  position,
SetPositionOrigin  origin = ORIGIN_START 
) [pure virtual]

Sets the read or write position of a file which is currently open for reading or writing, respectively. The specified position can be relative to the current position, the start of the file or the end of the file, as specified.

Returns:
The new position
Parameters:
position The new position
origin What origin the specified position value is relative to

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual int Platform_FileSystem_File::GetPosition (  )  [pure virtual]

Retrieves the current read or write position of a file which is currently open for reading or writing, respectively. The returned position is relative to the start of the file.

Returns:
The current position of the file

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual int Platform_FileSystem_File::Write ( const char *  value,
int  count = 1 
) [pure virtual]

Writes the specified values to the file. Endianness is handled automatically by the platform-specific implementation, such that everything is written to file as little endian. This is to ensure binary file compatibility across platforms.

Parameters:
value Pointer to the value(s) which is to be written
count Number of values to write
Returns:
The number of values that was successfully written

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual int Platform_FileSystem_File::Write ( const short *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const int *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const long *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const unsigned char *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const unsigned short *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const unsigned int *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const unsigned long *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const float *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const double *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Write ( const bool *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( char *  value,
int  count = 1 
) [pure virtual]

Reads the specified number of values from the file, into the specified memory area. Endianness is handled automatically by the platform-specific implementation, assuming that values stored in the file are all little endian. This is to ensure binary file compatibility across platforms.

Parameters:
value Pointer to the memory where the values are to be read
count Number of values to read
Returns:
The number of values that was successfully read

Implemented in Platform_NULL_FileSystem_File, and Platform_Win32_FileSystem_File.

virtual int Platform_FileSystem_File::Read ( short *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( int *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( long *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( unsigned char *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( unsigned short *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( unsigned int *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( unsigned long *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( float *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( double *  value,
int  count = 1 
) [pure virtual]

virtual int Platform_FileSystem_File::Read ( bool *  value,
int  count = 1 
) [pure virtual]



Pixie University and the Pixie Game Engine is created and managed by Mattias Gustavsson.
Reproduction/republishing of any material on this site without permission is strictly prohibited.