12 #ifndef SCRIPT_SCANNER_HPP 13 #define SCRIPT_SCANNER_HPP 16 #include "../fileio_func.h" 17 #include "../core/string_compare_type.hpp" 19 typedef std::map<const char *, class ScriptInfo *, StringCompare>
ScriptInfoList;
27 virtual void Initialize() = 0;
62 char *
GetConsoleList(
char *p,
const char *last,
bool newest_only)
const;
80 bool AddFile(
const char *filename,
size_t basepath_length,
const char *tar_filename);
const ScriptInfoList * GetUniqueInfoList()
Get the list of the latest version of all registered scripts.
const char * GetMainScript()
Get the current main script the ScanDir is currently tracking.
const char * GetTarFile()
Get the current tar file the ScanDir is currently tracking.
virtual void RegisterAPI(class Squirrel *engine)=0
Register the API for this ScriptInfo.
Subdirectory
The different kinds of subdirectories OpenTTD uses.
std::map< const char *, class ScriptInfo *, StringCompare > ScriptInfoList
A list that maps AI names to their AIInfo object.
const ScriptInfoList * GetInfoList()
Get the list of all registered scripts.
char * tar_file
If, which tar file the script was in.
Helper for scanning for files with a given name.
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.
void RegisterScript(class ScriptInfo *info)
Register a ScriptInfo to the scanner.
class Squirrel * GetEngine()
Get the engine of the main squirrel handler (it indexes all available scripts).
virtual Subdirectory GetDirectory() const =0
Get the directory to scan in.
std::map< const char *, class ScriptInfo *, StringCompare > ScriptInfoList
Type for the list of scripts.
All static information from an Script like name, version, etc.
char * main_script
The full path of the script.
virtual const char * GetFileName() const =0
Get the filename to scan for this type of script.
virtual void GetScriptName(ScriptInfo *info, char *name, const char *last)=0
Get the script name how to store the script in memory.
ScriptInfoList info_list
The list of all script.
void RescanDir()
Rescan the script dir.
bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename)
Add a file with the given filename.
void Reset()
Reset all allocated lists.
const char * FindMainScript(const ContentInfo *ci, bool md5sum)
Find a script of a ContentInfo.
char * GetConsoleList(char *p, const char *last, bool newest_only) const
Get the list of registered scripts to print on the console.
void ResetEngine()
Reset the engine to ensure a clean environment for further steps.
ScriptInfoList info_single_list
The list of all unique script. The best script (highest version) is shown.
void Initialize()
Perform all initialization steps to create the engine.
Container for all important information about a piece of content.
virtual const char * GetScannerName() const =0
Get the type of the script, in plural.
class Squirrel * engine
The engine we're scanning with.