OpenTTD
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions
TarScanner Class Reference

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

#include <fileio_func.h>

Inheritance diagram for TarScanner:
FileScanner

Public Types

enum  Mode {
  NONE = 0, BASESET = 1 << 0, NEWGRF = 1 << 1, AI = 1 << 2,
  SCENARIO = 1 << 3, GAME = 1 << 4, ALL = BASESET | NEWGRF | AI | SCENARIO | GAME
}
 The mode of tar scanning. More...

Public Member Functions

bool AddFile (const char *filename, size_t basepath_length, const char *tar_filename=NULL)
bool AddFile (Subdirectory sd, const char *filename)
 Add a single file to the scanned files of a tar, circumventing the scanning code.

Static Public Member Functions

static uint DoScan (TarScanner::Mode mode)
 Do the scan for Tars.

Private Member Functions

uint DoScan (Subdirectory sd)
 Perform the scanning of a particular subdirectory.
- Private Member Functions inherited from FileScanner
virtual ~FileScanner ()
 Destruct the proper one...
uint Scan (const char *extension, Subdirectory sd, bool tars=true, bool recursive=true)
 Scan for files with the given extension in the given search path.
uint Scan (const char *extension, const char *directory, bool recursive=true)
 Scan for files with the given extension in the given search path.
virtual bool AddFile (const char *filename, size_t basepath_length, const char *tar_filename)=0
 Add a file with the given filename.

Additional Inherited Members

Detailed Description

Helper for scanning for files with tar as extension.

Definition at line 95 of file fileio_func.h.

Member Enumeration Documentation

The mode of tar scanning.

Enumerator:
NONE 

Scan nothing.

BASESET 

Scan for base sets.

NEWGRF 

Scan for non-base sets.

AI 

Scan for AIs and its libraries.

SCENARIO 

Scan for scenarios and heightmaps.

GAME 

Scan for game scripts.

ALL 

Scan for everything.

Definition at line 99 of file fileio_func.h.

Member Function Documentation

bool TarScanner::AddFile ( const char *  filename,
size_t  basepath_length,
const char *  tar_filename = NULL 
)

< Name of the file

< Size of the file, in ASCII

< Path of the file

< Temporary list to collect links

Definition at line 720 of file fileio.cpp.

References Align(), DEBUG, lastof, SimplifyFileName(), strecat(), strecpy(), stredup(), and FileScanner::subdir.

Referenced by AddFile(), and ClientNetworkContentSocketHandler::AfterDownload().

bool TarScanner::AddFile ( Subdirectory  sd,
const char *  filename 
)

Add a single file to the scanned files of a tar, circumventing the scanning code.

Parameters
sdThe sub directory the file is in.
filenameThe name of the file to add.
Returns
True if the additions went correctly.

Definition at line 714 of file fileio.cpp.

References AddFile().

uint TarScanner::DoScan ( Subdirectory  sd)
private

Perform the scanning of a particular subdirectory.

Parameters
subdirThe subdirectory to scan.
Returns
The number of found tar files.

Definition at line 672 of file fileio.cpp.

References BASESET_DIR, NEWGRF_DIR, OLD_DATA_DIR, and FileScanner::Scan().

Referenced by DoScan(), DoScanNewGRFFiles(), Game::Initialize(), AI::Initialize(), AfterNewGRFScan::OnNewGRFsScanned(), openttd_main(), AI::Rescan(), and NetworkContentDownloadStatusWindow::~NetworkContentDownloadStatusWindow().

uint TarScanner::DoScan ( TarScanner::Mode  mode)
static

Do the scan for Tars.

Definition at line 681 of file fileio.cpp.

References AI, AI_DIR, AI_LIBRARY_DIR, BASESET, BASESET_DIR, DEBUG, DoScan(), GAME, GAME_DIR, GAME_LIBRARY_DIR, HEIGHTMAP_DIR, NEWGRF, NEWGRF_DIR, SCENARIO, and SCENARIO_DIR.


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