Platform_FileSystem Class Reference
[Platform]
Platform independent abstraction of the file system.
More...

Public Member Functions | |
| virtual | ~Platform_FileSystem () |
| virtual void | SetLogging (bool enabled)=0 |
| virtual Platform_FileSystem_Directory * | CreateDirectoryObject (const char *path)=0 |
| virtual Platform_FileSystem_File * | CreateFileObject (const char *path)=0 |
| virtual void | RescanDevices ()=0 |
| virtual int | GetDeviceCount ()=0 |
| virtual const Platform_FileSystem_Device * | GetDevice (int index)=0 |
Detailed Description
Platform independent abstraction of the file system.Handles access to files, folders and device names. This system gives to advantages over the standard c-runtime functions: you can enable logging of file access (to find out where in the game your loading occurs, which can sometimes be non-obvious with several layers of abstraction and automated systems), but more importantlu, it handles endian-ness automatically, making sure all data is converted to little-endian when written, and converted from little-endian to whatever is used by the current platform when read.
Definition at line 31 of file Platform_FileSystem.h.
Constructor & Destructor Documentation
| virtual Platform_FileSystem::~Platform_FileSystem | ( | ) | [virtual] |
Destructor
Definition at line 37 of file Platform_FileSystem.h.
Member Function Documentation
| virtual void Platform_FileSystem::SetLogging | ( | bool | enabled | ) | [pure virtual] |
Sometimes, for debug purposes, it might be useful to find out where and when things are loaded. If logging is enabled (it is disabled by default) a debug text string will be written every time a file or directory object is requested through the Platform_FileSystem, including the full path of the file/directory.
- Parameters:
-
enabled True if you want file access to be logged, false if you don't
Implemented in Platform_NULL_FileSystem, and Platform_Win32_FileSystem.
| virtual Platform_FileSystem_Directory* Platform_FileSystem::CreateDirectoryObject | ( | const char * | path | ) | [pure virtual] |
Creates a platform independent directory object corresponding to the specified path. The directory may or may not exist - the directory object is merely representational, and can be queried for whether the directory exists or not, and used to create/delete it as necessary.
The returned object needs to be destroyed by the caller (using the delete keyword) when it is no longer needed.
The path can be a full or relative path, with directories separated by a forward slash (/). It is up to the platform specific implementation to replace these separators with whatever is used on that platform.
- Returns:
- A new Platform_FileSystem_Directory object representing the directory
- Parameters:
-
path Path to create a directory object for
Implemented in Platform_NULL_FileSystem, and Platform_Win32_FileSystem.
| virtual Platform_FileSystem_File* Platform_FileSystem::CreateFileObject | ( | const char * | path | ) | [pure virtual] |
Creates a platform independent file object corresponding to the specified path. The file may or may not exist - the file object is merely representational, and can be queried for whether the file exists or not, and used to create, open or delete the file as necessary.
The returned object needs to be destroyed by the caller (using the delete keyword) when it is no longer needed.
The path can be a full or relative path, with directories separated by a forward slash (/). It is up to the platform specific implementation to replace these separators with whatever is used on that platform.
- Returns:
- A new Platform_FileSystem_File object representing the file
- Parameters:
-
path Path (including filename) to create a file object for
Implemented in Platform_NULL_FileSystem, and Platform_Win32_FileSystem.
| virtual void Platform_FileSystem::RescanDevices | ( | ) | [pure virtual] |
When Platform_FileSystem is created, it makes an internal list of the devices that are present in the system. This list can be updated by a call to this method, if you have reason to believe that the available devices have changed.
Implemented in Platform_NULL_FileSystem, and Platform_Win32_FileSystem.
| virtual int Platform_FileSystem::GetDeviceCount | ( | ) | [pure virtual] |
Retrieves the number of available devices for the system
- Returns:
- The number of available devices
Implemented in Platform_NULL_FileSystem, and Platform_Win32_FileSystem.
| virtual const Platform_FileSystem_Device* Platform_FileSystem::GetDevice | ( | int | index | ) | [pure virtual] |
Retrieves the device with the specified index, from 0 to the value returned by GetDeviceCount. The object returned is owned and controlled by Platform_FileSystem, and shouldn't be deleted by the caller
- Returns:
- A device object representing the device at the specified index
- Parameters:
-
index > Index of the device
Implemented in Platform_NULL_FileSystem, and Platform_Win32_FileSystem.
Reproduction/republishing of any material on this site without permission is strictly prohibited.
