Jimcpp 2.1.0
Jimcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
jpp::io::IFileList Class Referenceabstract

Provides a list of files and folders. More...

#include <jimcpp/core/engine/IFileList.hpp>

Inheritance diagram for jpp::io::IFileList:
Inheritance graph
Collaboration diagram for jpp::io::IFileList:
Collaboration graph

Public Member Functions

virtual u32 getFileCount () const =0
 Get the number of files in the filelist.
 
virtual const io::pathgetFileName (u32 index) const =0
 Gets the name of a file in the list, based on an index.
 
virtual const io::pathgetFullFileName (u32 index) const =0
 Gets the full name of a file in the list including the path, based on an index.
 
virtual u32 getFileSize (u32 index) const =0
 Returns the size of a file in the file list, based on an index.
 
virtual u32 getFileOffset (u32 index) const =0
 Returns the file offset of a file in the file list, based on an index.
 
virtual u32 getID (u32 index) const =0
 Returns the ID of a file in the file list, based on an index.
 
virtual bool isDirectory (u32 index) const =0
 Check if the file is a directory.
 
virtual s32 findFile (const io::path &filename, bool isFolder=false) const =0
 Searches for a file or folder in the list.
 
virtual const io::pathgetPath () const =0
 Returns the base path of the file list.
 
virtual u32 addItem (const io::path &fullPath, u32 offset, u32 size, bool isDirectory, u32 id=0)=0
 Add as a file or folder to the list.
 
virtual void sort ()=0
 Sorts the file list. You should call this after adding any items to the file list.
 
- Public Member Functions inherited from jpp::IReferenceCounted
 IReferenceCounted ()
 Constructor.
 
virtual ~IReferenceCounted ()
 Destructor.
 
void grab () const
 Grabs the object. Increments the reference counter by one.
 
bool drop () const
 Drops the object. Decrements the reference counter by one.
 
s32 getReferenceCount () const
 Get the reference count.
 
const c8getDebugName () const
 Returns the debug name of the object.
 

Additional Inherited Members

- Protected Member Functions inherited from jpp::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object.
 

Detailed Description

Provides a list of files and folders.

File lists usually contain a list of all files in a given folder, but can also contain a complete directory class.

Member Function Documentation

◆ addItem()

virtual u32 jpp::io::IFileList::addItem ( const io::path fullPath,
u32  offset,
u32  size,
bool  isDirectory,
u32  id = 0 
)
pure virtual

Add as a file or folder to the list.

Parameters
fullPathThe file name including path, from the root of the file list.
isDirectoryTrue if this is a directory rather than a file.
offsetThe file offset inside an archive
sizeThe size of the file in bytes.
idThe ID of the file in the archive which owns it

◆ findFile()

virtual s32 jpp::io::IFileList::findFile ( const io::path filename,
bool  isFolder = false 
) const
pure virtual

Searches for a file or folder in the list.

Searches for a file by name

Parameters
filenameThe name of the file to search for.
isFolderTrue if you are searching for a directory path, false if you are searching for a file
Returns
Returns the index of the file in the file list, or -1 if no matching name name was found.

◆ getFileCount()

virtual u32 jpp::io::IFileList::getFileCount ( ) const
pure virtual

Get the number of files in the filelist.

Returns
Amount of files and directories in the file list.

◆ getFileName()

virtual const io::path & jpp::io::IFileList::getFileName ( u32  index) const
pure virtual

Gets the name of a file in the list, based on an index.

The path is not included in this name. Use getFullFileName for this.

Parameters
indexis the zero based index of the file which name should be returned. The index must be less than the amount getFileCount() returns.
Returns
File name of the file. Returns 0, if an error occurred.

◆ getFileOffset()

virtual u32 jpp::io::IFileList::getFileOffset ( u32  index) const
pure virtual

Returns the file offset of a file in the file list, based on an index.

Parameters
indexis the zero based index of the file which should be returned. The index must be less than the amount getFileCount() returns.
Returns
The offset of the file in bytes.

◆ getFileSize()

virtual u32 jpp::io::IFileList::getFileSize ( u32  index) const
pure virtual

Returns the size of a file in the file list, based on an index.

Parameters
indexis the zero based index of the file which should be returned. The index must be less than the amount getFileCount() returns.
Returns
The size of the file in bytes.

◆ getFullFileName()

virtual const io::path & jpp::io::IFileList::getFullFileName ( u32  index) const
pure virtual

Gets the full name of a file in the list including the path, based on an index.

Parameters
indexis the zero based index of the file which name should be returned. The index must be less than the amount getFileCount() returns.
Returns
File name of the file. Returns 0 if an error occurred.

◆ getID()

virtual u32 jpp::io::IFileList::getID ( u32  index) const
pure virtual

Returns the ID of a file in the file list, based on an index.

This optional ID can be used to link the file list entry to information held elsewhere. For example this could be an index in an IFileArchive, linking the entry to its data offset, uncompressed size and CRC.

Parameters
indexis the zero based index of the file which should be returned. The index must be less than the amount getFileCount() returns.
Returns
The ID of the file.

◆ isDirectory()

virtual bool jpp::io::IFileList::isDirectory ( u32  index) const
pure virtual

Check if the file is a directory.

Parameters
indexThe zero based index which will be checked. The index must be less than the amount getFileCount() returns.
Returns
True if the file is a directory, else false.

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

Jimcpp    @cppfx.xyz

K