Public Member Functions | Protected Member Functions | Protected Attributes

sp::io::File Class Reference

File base class. More...

#include <spInputOutputFile.hpp>

Inheritance diagram for sp::io::File:
sp::io::FilePhysical sp::io::FileVirtual

List of all members.

Public Member Functions

virtual ~File ()
virtual bool open (const io::stringc &Filename, const EFilePermission Permission=FILE_READWRITE)=0
virtual void close ()=0
 Closes the file.
virtual s32 writeString (const stringc &Str, u32 Count=1)
 Writes the given characters into the file.
virtual s32 writeStringN (const stringc &Str, u32 Count=1)
 Writes the given characters into the file with a new-line character at the end (on Windows '13' and '10'; on Linux '10').
virtual s32 writeStringC (const stringc &Str, u32 Count=1)
 Writes the given characters into the file in C-style (string terminated by zero).
virtual s32 writeStringData (const stringc &Str, u32 Count=1)
 Writes the given characters into the file where an integer (4 bytes) at the beginning specifies the string's length.
virtual stringc readString (s32 Length) const
 Reads characters from the file where "Length" specifies the count of characters which are to be read.
virtual stringc readString (bool BreakPrompt=false) const
 Reads characters from the file where "BreakPrompt" specifies if reading breaks after a '13' or '10' has been read.
virtual stringc readStringC () const
 Reads characters from the file in C-style (until a zero has been read).
virtual stringc readStringData () const
 Reads characters from the file where the first four bytes (integer) specifies the count.
virtual s32 writeBuffer (const void *Buffer, u32 Size, u32 Count=1)=0
virtual s32 readBuffer (void *Buffer, u32 Size, u32 Count=1) const =0
virtual void writeColor (const video::color &Color)
virtual video::color readColor () const
virtual void setSeek (s32 Pos, const EFileSeekTypes PosType=FILEPOS_BEGIN)=0
virtual s32 getSeek () const =0
virtual bool isEOF () const =0
 Returns true if the file read position is at the End-Of-File.
virtual u32 getSize () const =0
 Returns the file's size (in bytes).
virtual void * getHandle ()=0
virtual bool opened () const =0
 Returns true if the file is currently opened.
void setFilename (const io::stringc &Filename)
stringc getFilename () const
EFileTypes getType () const
 Returns the file type.
EFilePermission getPermission () const
 Returns the file permission (read/write access etc.).
bool hasReadAccess () const
bool hasWriteAccess () const
void ignore (s32 Count)
 Ignores the following 'Count' bytes. This is aquivalent to "setSeek(Count, FILEPOS_CURRENT)".
template<typename T >
s32 writeValue (const T &Value, u32 Count=1)
template<typename T >
readValue () const
template<typename T >
void writeVector (const dim::vector3d< T > &Vec)
template<typename T >
dim::vector3d< T > readVector () const
template<typename T >
void writeMatrix (const dim::matrix4< T > &Mat)
template<typename T >
dim::matrix4< T > readMatrix () const
void writeQuaternion (const dim::quaternion &Quat)
dim::quaternion readQuaternion () const

Protected Member Functions

 File (const EFileTypes Type)

Protected Attributes

stringc Filename_
EFileTypes Type_
EFilePermission Permission_

Detailed Description

File base class.


Constructor & Destructor Documentation

sp::io::File::~File (  )  [virtual]
sp::io::File::File ( const EFileTypes  Type  )  [protected]

Member Function Documentation

virtual void sp::io::File::close (  )  [pure virtual]

Closes the file.

Implemented in sp::io::FilePhysical, and sp::io::FileVirtual.

stringc sp::io::File::getFilename (  )  const [inline]
virtual void* sp::io::File::getHandle (  )  [pure virtual]

Returns the file's handle. For FilePhysical objects this is a std::fstream* (C++ file stream), for FileVirtual objects it is the char* to the buffer (or rather array), for FileAsset objects it is an AAsset* (only for Android).

Implemented in sp::io::FilePhysical, and sp::io::FileVirtual.

EFilePermission sp::io::File::getPermission (  )  const [inline]

Returns the file permission (read/write access etc.).

virtual s32 sp::io::File::getSeek (  )  const [pure virtual]
virtual u32 sp::io::File::getSize (  )  const [pure virtual]

Returns the file's size (in bytes).

Implemented in sp::io::FilePhysical, and sp::io::FileVirtual.

EFileTypes sp::io::File::getType (  )  const [inline]

Returns the file type.

bool sp::io::File::hasReadAccess (  )  const [inline]
bool sp::io::File::hasWriteAccess (  )  const [inline]
void sp::io::File::ignore ( s32  Count  )  [inline]

Ignores the following 'Count' bytes. This is aquivalent to "setSeek(Count, FILEPOS_CURRENT)".

virtual bool sp::io::File::isEOF (  )  const [pure virtual]

Returns true if the file read position is at the End-Of-File.

Implemented in sp::io::FilePhysical, and sp::io::FileVirtual.

virtual bool sp::io::File::open ( const io::stringc Filename,
const EFilePermission  Permission = FILE_READWRITE 
) [pure virtual]

Opens the specified file. This function guarantees that the previous opened file will always closed before open the new one.

Parameters:
Filename,: Specifies the file's name. This can be a relativ or absulte filename.
Permission,: Specifies the file access permission.
Returns:
True if the file could be opened successful.

Implemented in sp::io::FilePhysical, and sp::io::FileVirtual.

virtual bool sp::io::File::opened (  )  const [pure virtual]

Returns true if the file is currently opened.

Implemented in sp::io::FilePhysical, and sp::io::FileVirtual.

virtual s32 sp::io::File::readBuffer ( void *  Buffer,
u32  Size,
u32  Count = 1 
) const [pure virtual]
video::color sp::io::File::readColor (  )  const [virtual]
template<typename T >
dim::matrix4<T> sp::io::File::readMatrix (  )  const [inline]
dim::quaternion sp::io::File::readQuaternion (  )  const [inline]
stringc sp::io::File::readString ( bool  BreakPrompt = false  )  const [virtual]

Reads characters from the file where "BreakPrompt" specifies if reading breaks after a '13' or '10' has been read.

!!

stringc sp::io::File::readString ( s32  Length  )  const [virtual]

Reads characters from the file where "Length" specifies the count of characters which are to be read.

stringc sp::io::File::readStringC (  )  const [virtual]

Reads characters from the file in C-style (until a zero has been read).

stringc sp::io::File::readStringData (  )  const [virtual]

Reads characters from the file where the first four bytes (integer) specifies the count.

template<typename T >
T sp::io::File::readValue (  )  const [inline]
template<typename T >
dim::vector3d<T> sp::io::File::readVector (  )  const [inline]
void sp::io::File::setFilename ( const io::stringc Filename  )  [inline]
virtual void sp::io::File::setSeek ( s32  Pos,
const EFileSeekTypes  PosType = FILEPOS_BEGIN 
) [pure virtual]
virtual s32 sp::io::File::writeBuffer ( const void *  Buffer,
u32  Size,
u32  Count = 1 
) [pure virtual]
void sp::io::File::writeColor ( const video::color Color  )  [virtual]
template<typename T >
void sp::io::File::writeMatrix ( const dim::matrix4< T > &  Mat  )  [inline]
void sp::io::File::writeQuaternion ( const dim::quaternion Quat  )  [inline]
s32 sp::io::File::writeString ( const stringc Str,
u32  Count = 1 
) [virtual]

Writes the given characters into the file.

s32 sp::io::File::writeStringC ( const stringc Str,
u32  Count = 1 
) [virtual]

Writes the given characters into the file in C-style (string terminated by zero).

s32 sp::io::File::writeStringData ( const stringc Str,
u32  Count = 1 
) [virtual]

Writes the given characters into the file where an integer (4 bytes) at the beginning specifies the string's length.

s32 sp::io::File::writeStringN ( const stringc Str,
u32  Count = 1 
) [virtual]

Writes the given characters into the file with a new-line character at the end (on Windows '13' and '10'; on Linux '10').

template<typename T >
s32 sp::io::File::writeValue ( const T &  Value,
u32  Count = 1 
) [inline]
template<typename T >
void sp::io::File::writeVector ( const dim::vector3d< T > &  Vec  )  [inline]

Member Data Documentation


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