Public Member Functions | Protected Member Functions | Protected Attributes

# ScriptScanner Class Reference

Scanner to help finding scripts. More...

`#include <script_scanner.hpp>`

Inheritance diagram for ScriptScanner:

## Public Member Functions
virtual void | Initialize ()=0
class Squirrel * | GetEngine ()
| Get the engine of the main squirrel handler (it indexes all available 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.
const ScriptInfoList * | GetInfoList ()
| Get the list of all registered scripts.
const ScriptInfoList * | GetUniqueInfoList ()
| Get the list of the latest version of all registered scripts.
void | RegisterScript (class ScriptInfo *info)
| Register a ScriptInfo to the scanner.
char * | GetConsoleList (char *p, const char *last, bool newest_only) const
| Get the list of registered scripts to print on the console.
bool | HasScript (const struct ContentInfo *ci, bool md5sum)
| Check whether we have a script with the exact characteristics as ci.
bool | AddFile (const char *filename, size_t basepath_length, const char *tar_filename)
| Add a file with the given filename.
void | RescanDir ()
| Rescan the script dir.
## Protected Member Functions
void | Initialize (const char *name)
| Initialize the scanner.
virtual void | GetScriptName (ScriptInfo *info, char *name, int len)=0
| Get the script name how to store the script in memory.
virtual const char * | GetFileName () const =0
| Get the filename to scan for this type of script.
virtual Subdirectory | GetDirectory () const =0
| Get the directory to scan in.
virtual void | RegisterAPI (class Squirrel *engine)=0
| Register the API for this ScriptInfo.
virtual const char * | GetScannerName () const =0
| Get the type of the script, in plural.
void | Reset ()
| Reset all allocated lists.
## Protected Attributes
class Squirrel * | engine
| The engine we're scanning with.
char * | main_script
| The full path of the script.
char * | tar_file
| If, which tar file the script was in.
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.

## Detailed Description

Scanner to help finding scripts.

Definition at line 22 of file script_scanner.hpp.

## Member Function Documentation

bool ScriptScanner::AddFile | ( | const char * | filename,
|  | size_t | basepath_length,
|  | const char * | tar_filename |
| ) |  |  | `[virtual]`

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 21 of file script_scanner.cpp.

References engine, FioCheckFileExists(), free(), Squirrel::LoadScript(), main_script, Squirrel::ResetCrashed(), strecpy(), FileScanner::subdir, and tar_file.

bool ScriptScanner::HasScript | ( | const struct ContentInfo * | ci,
|  | bool | md5sum |
| ) |  |  |

Check whether we have a script with the exact characteristics as ci.

Parameters:

  | ci | The characteristics to search on (shortname and md5sum).
  | md5sum | Whether to check the MD5 checksum.

Returns:
  True iff we have a script matching.

void ScriptScanner::Initialize | ( | const char * | name | ) | `[protected]`

Initialize the scanner.

Parameters:

  | name | The name of the scanner ("AIScanner", "GSScanner", ..).

Definition at line 61 of file script_scanner.cpp.

References engine, RegisterAPI(), RescanDir(), Squirrel::ResetCrashed(), and Squirrel::SetGlobalPointer().

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

- src/script/script_scanner.hpp
- src/script/script_scanner.cpp