Utility class implementing a IFileInterface base class. More...

#include "murl_util_file_interface.h"

Inheritance diagram for Murl::Util::FileInterface:

Public Member Functions

 FileInterface ()
 The constructor.
 
 ~FileInterface () override
 The destructor.
 
Bool GetAbsoluteName (const String &relativeName, IEnums::FileCategory category, String &absoluteName) override
 Implementation of IFileInterface::GetAbsoluteName(). More...
 
Bool GetAllFileNames (const String &relativePath, IEnums::FileCategory category, StringArray &names) override
 Implementation of IFileInterface::GetAllFileNames(). More...
 
Bool GetAllFolderNames (const String &relativePath, IEnums::FileCategory category, StringArray &names) override
 Implementation of IFileInterface::GetAllFolderNames(). More...
 
IFileOpenFile (const String &name, IEnums::FileCategory category, IEnums::FileAccessMode mode, Bool createFolders) override
 Implementation of IFileInterface::OpenFile(). More...
 
Bool CloseFile (IFile *&handle) override
 Implementation of IFileInterface::CloseFile(). More...
 
Bool MapFileData (const String &name, IEnums::FileCategory category, ConstData &data) override
 Implementation of IFileInterface::MapFileData(). More...
 
Bool UnmapFileData (ConstData &data) override
 Implementation of IFileInterface::UnmapFileData(). More...
 
- Public Member Functions inherited from Murl::IFileInterface
virtual Bool FileExists (const String &name, IEnums::FileCategory category)=0
 Check if a file exists. More...
 
virtual Bool FolderExists (const String &name, IEnums::FileCategory category)=0
 Check if a folder exists. More...
 

Protected Member Functions

virtual Bool MapFile (const String &name, IEnums::FileCategory category, const UInt8 *&data, UInt64 &byteSize)=0
 Memory-map a read-only file. More...
 
virtual Bool UnmapFile (const UInt8 *data)=0
 Unmap a memory mapped file. More...
 
virtual Bool CreateFolder (const String &absolutePath)=0
 Create a folder. More...
 
virtual Bool GetAbsolutePath (IEnums::FileCategory category, String &absolutePath)=0
 Get the absolute folder path to a file category. More...
 

Detailed Description

Utility class implementing a IFileInterface base class.

Member Function Documentation

◆ GetAbsoluteName()

Bool Murl::Util::FileInterface::GetAbsoluteName ( const String relativeName,
IEnums::FileCategory  category,
String absoluteName 
)
overridevirtual

Implementation of IFileInterface::GetAbsoluteName().

Parameters
relativeNameThe name of the file.
categoryThe category where the file reside.
absoluteNameThe absolute file name return value.
Returns
true if successful, if false the 'absoluteName' return value is unchanged.

Implements Murl::IFileInterface.

◆ GetAllFileNames()

Bool Murl::Util::FileInterface::GetAllFileNames ( const String relativePath,
IEnums::FileCategory  category,
StringArray names 
)
overridevirtual

Implementation of IFileInterface::GetAllFileNames().

Parameters
relativePathThe name of the folder.
categoryThe category where the folder reside.
namesThe array of file names return value.
Returns
true if successful, if false the 'names' return value is unchanged.

Implements Murl::IFileInterface.

◆ GetAllFolderNames()

Bool Murl::Util::FileInterface::GetAllFolderNames ( const String relativePath,
IEnums::FileCategory  category,
StringArray names 
)
overridevirtual

Implementation of IFileInterface::GetAllFolderNames().

Parameters
relativePathThe name of the folder.
categoryThe category where the folder reside.
namesThe array of folder names return value.
Returns
true if successful, if false the 'names' return value is unchanged.

Implements Murl::IFileInterface.

◆ OpenFile()

IFile* Murl::Util::FileInterface::OpenFile ( const String name,
IEnums::FileCategory  category,
IEnums::FileAccessMode  mode,
Bool  createFolders 
)
overridevirtual

Implementation of IFileInterface::OpenFile().

Parameters
nameThe name of the file.
categoryThe category where the file reside.
modeThe access mode for the file to open.
createFoldersCreate the folders constained in file name if the folders do not exist.
Returns
The file interface or null if not successful.

Implements Murl::IFileInterface.

◆ CloseFile()

Bool Murl::Util::FileInterface::CloseFile ( IFile *&  handle)
overridevirtual

Implementation of IFileInterface::CloseFile().

Parameters
handleA reference to the file interface to close. After destruction the pointer is set to null.
Returns
true if successful.

Implements Murl::IFileInterface.

◆ MapFileData()

Bool Murl::Util::FileInterface::MapFileData ( const String name,
IEnums::FileCategory  category,
ConstData data 
)
overridevirtual

Implementation of IFileInterface::MapFileData().

Parameters
nameThe name of the file.
categoryThe category where the file reside.
dataThe file data object return value.
Returns
true if successful, if false the 'data' return value is unchanged.

Implements Murl::IFileInterface.

◆ UnmapFileData()

Bool Murl::Util::FileInterface::UnmapFileData ( ConstData data)
overridevirtual

Implementation of IFileInterface::UnmapFileData().

Parameters
dataThe file data object to the memory mapped file. After unmapping the data object is empty.
Returns
true if successful.

Implements Murl::IFileInterface.

◆ MapFile()

virtual Bool Murl::Util::FileInterface::MapFile ( const String name,
IEnums::FileCategory  category,
const UInt8 *&  data,
UInt64 byteSize 
)
protectedpure virtual

Memory-map a read-only file.

Parameters
nameThe name of the file.
categoryThe category where the file reside.
dataThe file data pointer return value.
byteSizeThe byte size return value.
Returns
true if successful, if false the return values stay unchanged.

Implemented in Murl::Util::ToolsFileInterface.

◆ UnmapFile()

virtual Bool Murl::Util::FileInterface::UnmapFile ( const UInt8 data)
protectedpure virtual

Unmap a memory mapped file.

Parameters
dataThe mapped file data pointer.
Returns
true if successful.

Implemented in Murl::Util::ToolsFileInterface.

◆ CreateFolder()

virtual Bool Murl::Util::FileInterface::CreateFolder ( const String absolutePath)
protectedpure virtual

Create a folder.

Parameters
absolutePathThe path of the folder to create.
Returns
true if successful.

Implemented in Murl::Util::ToolsFileInterface.

◆ GetAbsolutePath()

virtual Bool Murl::Util::FileInterface::GetAbsolutePath ( IEnums::FileCategory  category,
String absolutePath 
)
protectedpure virtual

Get the absolute folder path to a file category.

Parameters
categoryThe category of the folder.
absolutePathThe path of the folder return value.
Returns
true if successful.

Implemented in Murl::Util::ToolsFileInterface.


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


Copyright © 2011-2024 Spraylight GmbH.