10 #ifndef SCRIPT_SCANNER_HPP
11 #define SCRIPT_SCANNER_HPP
13 #include "../fileio_func.h"
14 #include "../string_func.h"
16 typedef std::map<std::string, class ScriptInfo *, CaseInsensitiveComparator>
ScriptInfoList;
24 virtual void Initialize() = 0;
61 void GetConsoleList(std::back_insert_iterator<std::string> &output_iterator,
bool newest_only)
const;
79 bool AddFile(
const std::string &filename,
size_t basepath_length,
const std::string &tar_filename)
override;
Helper for scanning for files with a given name.
All static information from an Script like name, version, etc.
Scanner to help finding scripts.
bool HasScript(const struct ContentInfo *ci, bool md5sum)
Check whether we have a script with the exact characteristics as ci.
const ScriptInfoList * GetUniqueInfoList()
Get the list of the latest version of all registered scripts.
bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) override
Add a file with the given filename.
virtual const char * GetFileName() const =0
Get the filename to scan for this type of script.
const char * FindMainScript(const ContentInfo *ci, bool md5sum)
Find a script of a ContentInfo.
const ScriptInfoList * GetInfoList()
Get the list of all registered scripts.
virtual const char * GetScannerName() const =0
Get the type of the script, in plural.
class Squirrel * engine
The engine we're scanning with.
std::string GetTarFile()
Get the current tar file the ScanDir is currently tracking.
std::string tar_file
If, which tar file the script was in.
class Squirrel * GetEngine()
Get the engine of the main squirrel handler (it indexes all available scripts).
void Reset()
Reset all allocated lists.
void RescanDir()
Rescan the script dir.
virtual Subdirectory GetDirectory() const =0
Get the directory to scan in.
std::string main_script
The full path of the script.
virtual void RegisterAPI(class Squirrel *engine)=0
Register the API for this ScriptInfo.
void GetConsoleList(std::back_insert_iterator< std::string > &output_iterator, bool newest_only) const
Get the list of registered scripts to print on the console.
virtual std::string GetScriptName(ScriptInfo *info)=0
Get the script name how to store the script in memory.
std::string GetMainScript()
Get the current main script the ScanDir is currently tracking.
ScriptInfoList info_list
The list of all script.
ScriptInfoList info_single_list
The list of all unique script. The best script (highest version) is shown.
void RegisterScript(class ScriptInfo *info)
Register a ScriptInfo to the scanner.
void ResetEngine()
Reset the engine to ensure a clean environment for further steps.
void Initialize()
Perform all initialization steps to create the engine.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
std::map< std::string, class ScriptInfo *, CaseInsensitiveComparator > ScriptInfoList
Type for the list of scripts.
Container for all important information about a piece of content.