The system file access class. More...

#include "murl_system_file.h"

Inheritance diagram for Murl::System::File:

Public Member Functions

 File ()
 The default constructor.
 
virtual ~File ()
 The destructor. More...
 
Bool Open (const String &fileName, IEnums::FileAccessMode mode=IEnums::FILE_ACCESS_MODE_READ_ONLY)
 Open a file. More...
 
Bool Close ()
 Close the file. More...
 
Bool IsOpen () const
 Check if the file is open. More...
 
UInt64 GetSize () const
 Get the size of the file. More...
 
UInt64 GetPosition () const
 Get the file pointer position. More...
 
void SetPosition (UInt64 position)
 Set the file pointer position. More...
 
UInt64 Read (void *data, UInt64 byteSize)
 Read from the file at the current file pointer position. More...
 
UInt64 Write (const void *data, UInt64 byteSize)
 Write to the file at the current file pointer position. More...
 

Static Public Member Functions

static StringArray GetFiles (const String &path)
 Get all file names from a specified path. More...
 
static Bool FileExists (const String &path)
 Check if a file exists. More...
 
static Bool DeleteFile (const String &path)
 Delete a file. More...
 
static Bool MoveFile (const String &oldPath, const String &newPath)
 Move/rename a file. More...
 
static UInt64 GetFileSize (const String &path)
 Get the size of a file in bytes. More...
 
static StringArray GetFolders (const String &path)
 Get all folder names from a specified path. More...
 
static Bool FolderExists (const String &path)
 Check if a folder exists. More...
 
static Bool CreateFolder (const String &path)
 Create a folder. More...
 
static Bool DeleteFolder (const String &path, Bool recursively)
 Delete a folder. More...
 
static Bool MoveFolder (const String &oldPath, const String &newPath)
 Move/rename a folder. More...
 
static Bool GetItemCreationTime (const String &path, Time &time)
 Get the creation time of a file or folder. More...
 
static Bool GetItemModificationTime (const String &path, Time &time)
 Get the time a file or folder was most recently modified. More...
 

Protected Attributes

FileHandle * mHandle
 The anonymous file handle for internal use only.
 
IEnums::FileAccessMode mMode
 The mode used for opening the file.
 

Detailed Description

The system file access class.

Constructor & Destructor Documentation

◆ ~File()

virtual Murl::System::File::~File ( )
virtual

The destructor.

Close the file if open.

Member Function Documentation

◆ GetFiles()

static StringArray Murl::System::File::GetFiles ( const String path)
static

Get all file names from a specified path.

Parameters
pathThe path to examine the files.
Returns
A string array containing all files names.

◆ FileExists()

static Bool Murl::System::File::FileExists ( const String path)
static

Check if a file exists.

Parameters
pathThe path and filename.
Returns
true if the file exists.

◆ DeleteFile()

static Bool Murl::System::File::DeleteFile ( const String path)
static

Delete a file.

Parameters
pathThe path to the file to delete.
Returns
true if successful.

◆ MoveFile()

static Bool Murl::System::File::MoveFile ( const String oldPath,
const String newPath 
)
static

Move/rename a file.

Parameters
oldPathThe current path to the file to move.
newPathThe new path of the file.
Returns
true if successful.

◆ GetFileSize()

static UInt64 Murl::System::File::GetFileSize ( const String path)
static

Get the size of a file in bytes.

Parameters
pathThe path to the file to check.
Returns
The file's size in bytes.

◆ GetFolders()

static StringArray Murl::System::File::GetFolders ( const String path)
static

Get all folder names from a specified path.

Parameters
pathThe path to examine the folders.
Returns
A string array containing all folder names.

◆ FolderExists()

static Bool Murl::System::File::FolderExists ( const String path)
static

Check if a folder exists.

Parameters
pathThe path and the folder.
Returns
true if the folder exists.

◆ CreateFolder()

static Bool Murl::System::File::CreateFolder ( const String path)
static

Create a folder.

Parameters
pathThe path and the folder to create.
Returns
true if successful.

◆ DeleteFolder()

static Bool Murl::System::File::DeleteFolder ( const String path,
Bool  recursively 
)
static

Delete a folder.

Parameters
pathThe path and the folder to delete.
recursivelyIf true, the folder and all contents are deleted. If false, the function fails when the folder is not empty.
Returns
true if successful.

◆ MoveFolder()

static Bool Murl::System::File::MoveFolder ( const String oldPath,
const String newPath 
)
static

Move/rename a folder.

Parameters
oldPathThe current path to the folder to move.
newPathThe new path of the folder.
Returns
true if successful.

◆ GetItemCreationTime()

static Bool Murl::System::File::GetItemCreationTime ( const String path,
Time time 
)
static

Get the creation time of a file or folder.

Parameters
pathThe path to the file or folder to query.
timeA reference to a time object to receive the creation time.
Returns
true if successful.

◆ GetItemModificationTime()

static Bool Murl::System::File::GetItemModificationTime ( const String path,
Time time 
)
static

Get the time a file or folder was most recently modified.

Parameters
pathThe path to the file or folder to query.
timeA reference to a time object to receive the last modification time.
Returns
true if successful.

◆ Open()

Bool Murl::System::File::Open ( const String fileName,
IEnums::FileAccessMode  mode = IEnums::FILE_ACCESS_MODE_READ_ONLY 
)

Open a file.

Parameters
fileNameThe file name to open.
modeThe access mode for opening the file.
Returns
true if successful.

◆ Close()

Bool Murl::System::File::Close ( )

Close the file.

Returns
true if successful.

◆ IsOpen()

Bool Murl::System::File::IsOpen ( ) const

Check if the file is open.

Returns
true if the file is open.

◆ GetSize()

UInt64 Murl::System::File::GetSize ( ) const

Get the size of the file.

Returns
The byte size of the file.

◆ GetPosition()

UInt64 Murl::System::File::GetPosition ( ) const

Get the file pointer position.

Returns
The file pointer position in bytes.

◆ SetPosition()

void Murl::System::File::SetPosition ( UInt64  position)

Set the file pointer position.

Parameters
positionThe file pointer position in bytes.

◆ Read()

UInt64 Murl::System::File::Read ( void *  data,
UInt64  byteSize 
)

Read from the file at the current file pointer position.

Parameters
dataPointer to the memory to read into.
byteSizeThe byte size of the memory.
Returns
The number of bytes read from the file.

◆ Write()

UInt64 Murl::System::File::Write ( const void *  data,
UInt64  byteSize 
)

Write to the file at the current file pointer position.

Parameters
dataPointer to the memory to read from.
byteSizeThe byte size of the memory.
Returns
The number of bytes written to the file.

The documentation for this class was generated from the following file:
  • murl_system_file.h


Copyright © 2011-2024 Spraylight GmbH.