OpenTTD Source: GRFFileScanner Class Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Static Public Member Functions | Private Attributes
GRFFileScanner Class Reference

Helper for scanning for files with GRF as extension. More...

Inheritance diagram for GRFFileScanner:

## Public Member Functions
bool | AddFile (const std::string &filename, size_t basepath_length, const std::string &tar_filename) override
| Add a file with the given filename.

## Static Public Member Functions
static uint | DoScan ()
| Do the scan for GRFs.

## Private Attributes
std::chrono::steady_clock::time_point | next_update
| The next moment we do update the screen.
uint | num_scanned
| The number of GRFs we have scanned.
Private Attributes inherited from FileScanner
Subdirectory | subdir
| The current sub directory we are searching through.

## Additional Inherited Members
Private Member Functions inherited from FileScanner
virtual | ~FileScanner ()=default
| Destruct the proper one...
uint | Scan (std::string_view extension, Subdirectory sd, bool tars=true, bool recursive=true)
| Scan for files with the given extension in the given search path.
uint | Scan (std::string_view extension, const std::string &directory, bool recursive=true)
| Scan for files with the given extension in the given search path.

## Detailed Description

Helper for scanning for files with GRF as extension.

Definition at line 508 of file newgrf_config.cpp.

## Constructor & Destructor Documentation

## ◆ GRFFileScanner()

GRFFileScanner::GRFFileScanner | ( |  | ) |
| inline

Definition at line 513 of file newgrf_config.cpp.

## Member Function Documentation

## ◆ AddFile()

bool GRFFileScanner::AddFile | ( | const std::string & | filename,
|  | size_t | basepath_length,
|  | const std::string & | tar_filename
| ) |  |
| overridevirtual

Add a file with the given filename.

Parameters

  filename | the full path to the file to read
  basepath_length | amount of characters to chop of before to get a filename relative to the search path.
  tar_filename | the name of the tar file the file is read from.

Returns
  true if the file is added.

Implements FileScanner.

Definition at line 537 of file newgrf_config.cpp.

References _all_grfs, GRFConfig::filename, FillGRFDetails(), VideoDriver::GameLoopPause(), GetGRFStringFromGRFText(), VideoDriver::GetInstance(), GRFConfig::GetName(), GRFIdentifier::grfid, GRFConfig::ident, GRFIdentifier::md5sum, GRFConfig::name, GRFConfig::next, num_scanned, StrCompareIgnoreCase(), and UpdateNewGRFScanStatus().

## ◆ DoScan()

static uint GRFFileScanner::DoScan | ( |  | ) |
| inlinestatic

Do the scan for GRFs.

Definition at line 521 of file newgrf_config.cpp.

References _settings_client, _skip_all_newgrf_scanning, ClientSettings::gui, GUISettings::last_newgrf_count, NEWGRF_DIR, num_scanned, and FileScanner::Scan().

Referenced by DoScanNewGRFFiles().

## Field Documentation

## ◆ next_update

std::chrono::steady_clock::time_point GRFFileScanner::next_update
| private

The next moment we do update the screen.

Definition at line 509 of file newgrf_config.cpp.

## ◆ num_scanned

uint GRFFileScanner::num_scanned
| private

The number of GRFs we have scanned.

Definition at line 510 of file newgrf_config.cpp.

Referenced by AddFile(), and DoScan().

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

- src/newgrf_config.cpp