OpenTTD
FileList Class Reference

List of file information. More...

#include <fios.h>

Inheritance diagram for FileList:
ConsoleFileList

Public Member Functions

FiosItemAppend ()
 Construct a new entry in the file list. More...
 
size_t Length () const
 Get the number of files in the list. More...
 
const FiosItemBegin () const
 Get a pointer to the first file information. More...
 
const FiosItemEnd () const
 Get a pointer behind the last file information. More...
 
const FiosItemGet (size_t index) const
 Get a pointer to the indicated file information. More...
 
FiosItemGet (size_t index)
 Get a pointer to the indicated file information. More...
 
const FiosItemoperator[] (size_t index) const
 
FiosItemoperator[] (size_t index)
 Get a reference to the indicated file information. More...
 
void Clear ()
 Remove all items from the list. More...
 
void Compact ()
 Compact the list down to the smallest block size boundary. More...
 
void BuildFileList (AbstractFileType abstract_filetype, SaveLoadOperation fop)
 Construct a file list with the given kind of files, for the stated purpose. More...
 
const FiosItemFindItem (const char *file)
 Find file information of a file by its name from the file list. More...
 

Data Fields

std::vector< FiosItemfiles
 The list of files.
 

Detailed Description

List of file information.

Definition at line 112 of file fios.h.

Member Function Documentation

◆ Append()

FiosItem* FileList::Append ( )
inline

Construct a new entry in the file list.

Returns
Pointer to the new items to be initialized.

Definition at line 120 of file fios.h.

◆ Begin()

const FiosItem* FileList::Begin ( ) const
inline

Get a pointer to the first file information.

Returns
Address of the first file information.

Definition at line 139 of file fios.h.

Referenced by SortSaveGameList().

◆ BuildFileList()

void FileList::BuildFileList ( AbstractFileType  abstract_filetype,
SaveLoadOperation  fop 
)

Construct a file list with the given kind of files, for the stated purpose.

Parameters
abstract_filetypeKind of files to collect.
fopPurpose of the collection, either SLO_LOAD or SLO_SAVE.

Definition at line 74 of file fios.cpp.

Referenced by ConsoleFileList::ValidateFileList().

◆ Clear()

void FileList::Clear ( )
inline

Remove all items from the list.

Definition at line 186 of file fios.h.

Referenced by ConsoleFileList::InvalidateFileList().

◆ Compact()

void FileList::Compact ( )
inline

Compact the list down to the smallest block size boundary.

Definition at line 192 of file fios.h.

◆ End()

const FiosItem* FileList::End ( ) const
inline

Get a pointer behind the last file information.

Returns
Address behind the last file information.

Definition at line 148 of file fios.h.

Referenced by SortSaveGameList().

◆ FindItem()

const FiosItem * FileList::FindItem ( const char *  file)

Find file information of a file by its name from the file list.

Parameters
fileThe filename to return information about. Can be the actual name or a numbered entry into the filename list.
Returns
The information on the file, or nullptr if the file is not available.

Definition at line 106 of file fios.cpp.

References IsInsideMM().

Referenced by DEF_CONSOLE_CMD().

◆ Get() [1/2]

const FiosItem* FileList::Get ( size_t  index) const
inline

Get a pointer to the indicated file information.

File information must exist.

Returns
Address of the indicated existing file information.

Definition at line 157 of file fios.h.

◆ Get() [2/2]

FiosItem* FileList::Get ( size_t  index)
inline

Get a pointer to the indicated file information.

File information must exist.

Returns
Address of the indicated existing file information.

Definition at line 166 of file fios.h.

◆ Length()

size_t FileList::Length ( ) const
inline

Get the number of files in the list.

Returns
The number of files stored in the list.

Definition at line 130 of file fios.h.

Referenced by DEF_CONSOLE_CMD().

◆ operator[]()

FiosItem& FileList::operator[] ( size_t  index)
inline

Get a reference to the indicated file information.

File information must exist.

Returns
The requested file information.

Definition at line 180 of file fios.h.


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