iaux::iaFile Class Reference

File handle. More...

#include <iaFile.h>

Public Member Functions

 iaFile (const iaString &fileName)
 
 ~iaFile ()
 
bool open (const iaFileOpenMode &mode=iaFileOpenMode::ReadBinary)
 
void close ()
 
bool isOpen () const
 
const iaFileOpenModegetFileOpenMode () const
 
const iaString getParentPath () const
 
const iaString getFullFileName () const
 
const iaString getName () const
 
const iaString getStem () const
 
const iaString getExtension () const
 
int64 getSize () const
 
bool setSize (int64 size)
 
bool read (int32 size, char *destination, int64 offset=-1)
 
bool write (int32 size, const char *source, int64 offset=-1)
 
iaTime getLastModifiedTime () const
 

Protected Member Functions

bool setFilePointer (int64 position)
 

Detailed Description

File handle.

Constructor & Destructor Documentation

◆ iaFile()

iaux::iaFile::iaFile ( const iaString fileName)

creates an object for a file

Parameters
fileNamethe path to the file associated with this object

◆ ~iaFile()

iaux::iaFile::~iaFile ( )

automatic closes the file if not closed yet

Member Function Documentation

◆ close()

void iaux::iaFile::close ( )

closes the file

◆ getExtension()

const iaString iaux::iaFile::getExtension ( ) const
Returns
the file extension

◆ getFileOpenMode()

const iaFileOpenMode & iaux::iaFile::getFileOpenMode ( ) const
Returns
the file open mode if open

◆ getFullFileName()

const iaString iaux::iaFile::getFullFileName ( ) const
Returns
the full path & filename

◆ getLastModifiedTime()

iaTime iaux::iaFile::getLastModifiedTime ( ) const
Returns
last modified time of file

◆ getName()

const iaString iaux::iaFile::getName ( ) const
Returns
only the filename

◆ getParentPath()

const iaString iaux::iaFile::getParentPath ( ) const
Returns
only the parent path

◆ getSize()

int64 iaux::iaFile::getSize ( ) const
Returns
the size of the file

◆ getStem()

const iaString iaux::iaFile::getStem ( ) const
Returns
filename without extension

◆ isOpen()

bool iaux::iaFile::isOpen ( ) const
Returns
true: if the file is open; false: if the file is closed

◆ open()

bool iaux::iaFile::open ( const iaFileOpenMode mode = iaFileOpenMode::ReadBinary)

opens the file with the needed rights

Parameters
modefile open mode

◆ read()

bool iaux::iaFile::read ( int32  size,
char *  destination,
int64  offset = -1 
)

reads from offset the number of size bytes to a (allocated) destination

Parameters
offsetthe offset to start reading from (-1 reads from current file pointer position)
sizesize in bytes to read
destinationthe destination to write to

◆ setFilePointer()

bool iaux::iaFile::setFilePointer ( int64  position)
protected

sets the file pointer to a destination

Parameters
positionnew absolute position of filepointer

◆ setSize()

bool iaux::iaFile::setSize ( int64  size)

resizes the file

Parameters
newSizethe new size of the file
Returns
true: success; false: fail

◆ write()

bool iaux::iaFile::write ( int32  size,
const char *  source,
int64  offset = -1 
)

writes from offset the number of size bytes from a destination

Parameters
offsetthe offset to start writing to (-1 writes at current file pointer position)
sizesize in bytes to write
sourcethe source to read from

The documentation for this class was generated from the following files: