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
 
void rename (const iaString &newFileName, bool replaceExisting=false)
 
iaFile copy (const iaString &newFileName) const
 
bool exists () const
 
iaString getPath () const
 
iaString getFileName () const
 
iaString getStem () const
 
iaString getFullFileName () 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
 

Static Public Member Functions

static bool exists (const iaString &filename)
 
static bool remove (const iaString &filename)
 
static iaTime getLastModifiedTime (const iaString &filename)
 

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

◆ copy()

iaFile iaux::iaFile::copy ( const iaString newFileName) const

copys the file to a new destination

Parameters
newFileNamename of copy destination

◆ exists() [1/2]

bool iaux::iaFile::exists ( ) const

checks if the file exist

Returns
true: if file exists; false: if not

◆ exists() [2/2]

bool iaux::iaFile::exists ( const iaString filename)
static

checks if some file exist

Parameters
filenamethe file to be checked for
Returns
true: if file exists; false: if not

◆ getExtension()

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

◆ getFileName()

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

◆ getFileOpenMode()

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

◆ getFullFileName()

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

◆ getLastModifiedTime() [1/2]

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

◆ getLastModifiedTime() [2/2]

iaTime iaux::iaFile::getLastModifiedTime ( const iaString filename)
static
Returns
last modified time of file
Parameters
filenamethe given filename

◆ getPath()

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

◆ getSize()

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

◆ getStem()

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

◆ remove()

bool iaux::iaFile::remove ( const iaString filename)
static

deletes/removes file from filesystem

Parameters
filenamethe file to remove

◆ rename()

void iaux::iaFile::rename ( const iaString newFileName,
bool  replaceExisting = false 
)

renames the file to a new name

Parameters
newFileNamethe new file name
replaceExistingtrue: destination will be replaced; false: no action will be taken if destination already exists

◆ 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: