Public Member Functions | Static Public Member Functions

sp::io::FileSystem Class Reference

#include <spInputOutputFileSystem.hpp>

List of all members.

Public Member Functions

 FileSystem ()
 ~FileSystem ()
FileopenFile (const EFileTypes Type)
 Opens a new File object. To start reading or writing call "File::open".
FilePhysicalopenFile (const stringc &Filename, const EFilePermission Permission=FILE_READWRITE)
 Opens a new FilePhysical object with the specified filename and the specified permission.
FileVirtualopenFile (const EFilePermission Permission=FILE_READWRITE)
 Opens a new FileVirtual object with the specified permission.
FileVirtualreadFile (const io::stringc &Filename)
 Reads the whole specified file from HDD into the new FileVirtual's buffer.
FilereadResourceFile (const stringc &Filename)
io::stringc readFileString (const io::stringc &Filename) const
 Reads the whole file into the return string.
void closeFile (File *&FileObject)
 Closes and deletes the specified File object.
bool findFile (const stringc &Filename) const
 Returns true if the specified file does exist on HDD (hard-disk drive).
u32 getFileSize (const io::stringc &Filename) const
 Returns size of the specified file on hard-disk drive (in bytes).
bool createFile (const stringc &Filename)
bool deleteFile (const stringc &Filename)
bool copyFile (const stringc &Filename, const stringc &NewFilename)
bool moveFile (const stringc &Filename, const stringc &NewFilename)
void setCurrentDirectory (const stringc &Path)
 Sets the new working directory. If you are handling files with relative paths be aware about the current working directory!
stringc getCurrentDirectory () const
bool createDirectory (const stringc &Path)
bool deleteDirectory (const stringc &Path)

Static Public Member Functions

static void setResourceConfig (const EResourceConfigs Config)
 Sets the resource cofiguration. By default RESOURCE_ASSET for Android and RESOURCE_PHYSICAL for other OS.
static EResourceConfigs getResourceConfig ()

Detailed Description

FileSystem can be used for easy file operations such as reading and writing from and to the disk. Internally the ANSI C "FILE" pointer with its standard C file functions are used.


Constructor & Destructor Documentation

sp::io::FileSystem::FileSystem (  ) 
sp::io::FileSystem::~FileSystem (  ) 

Member Function Documentation

void sp::io::FileSystem::closeFile ( File *&  FileObject  ) 

Closes and deletes the specified File object.

bool sp::io::FileSystem::copyFile ( const stringc Filename,
const stringc NewFilename 
)
bool sp::io::FileSystem::createDirectory ( const stringc Path  ) 
bool sp::io::FileSystem::createFile ( const stringc Filename  ) 

Creates a new file on HDD.

Returns:
True if succeed. Otherwise false.
Note:
If this file already exist it will be cleared. Be careful!
bool sp::io::FileSystem::deleteDirectory ( const stringc Path  ) 
bool sp::io::FileSystem::deleteFile ( const stringc Filename  ) 
bool sp::io::FileSystem::findFile ( const stringc Filename  )  const

Returns true if the specified file does exist on HDD (hard-disk drive).

stringc sp::io::FileSystem::getCurrentDirectory (  )  const
u32 sp::io::FileSystem::getFileSize ( const io::stringc Filename  )  const

Returns size of the specified file on hard-disk drive (in bytes).

EResourceConfigs sp::io::FileSystem::getResourceConfig (  )  [static]
bool sp::io::FileSystem::moveFile ( const stringc Filename,
const stringc NewFilename 
)
FileVirtual * sp::io::FileSystem::openFile ( const EFilePermission  Permission = FILE_READWRITE  ) 

Opens a new FileVirtual object with the specified permission.

File * sp::io::FileSystem::openFile ( const EFileTypes  Type  ) 

Opens a new File object. To start reading or writing call "File::open".

FilePhysical * sp::io::FileSystem::openFile ( const stringc Filename,
const EFilePermission  Permission = FILE_READWRITE 
)

Opens a new FilePhysical object with the specified filename and the specified permission.

FileVirtual * sp::io::FileSystem::readFile ( const io::stringc Filename  ) 

Reads the whole specified file from HDD into the new FileVirtual's buffer.

io::stringc sp::io::FileSystem::readFileString ( const io::stringc Filename  )  const

Reads the whole file into the return string.

File * sp::io::FileSystem::readResourceFile ( const stringc Filename  ) 

Reads a resource file. This can be an asset or an HDD file which depends on the current configuration.

Parameters:
Filename,: Specifies the resource filename.
Returns:
Pointer to the new File object.
See also:
{setResourceConfig}
void sp::io::FileSystem::setCurrentDirectory ( const stringc Path  ) 

Sets the new working directory. If you are handling files with relative paths be aware about the current working directory!

void sp::io::FileSystem::setResourceConfig ( const EResourceConfigs  Config  )  [static]

Sets the resource cofiguration. By default RESOURCE_ASSET for Android and RESOURCE_PHYSICAL for other OS.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines