Jazz2::Scripting::ScriptLoader class

Generic AngelScript script loader with #include and #pragma directive support.

Derived classes

class LevelScriptLoader
Binds an AngelScript script file to LevelHandler and executes the script.

Public static functions

template<typename T = ScriptLoader, class = typename std::enable_if<std::is_base_of<ScriptLoader, T>::value>::type>
static auto FromActiveContext() -> T*
Returns ScriptLoader instance from active AngelScript context.

Constructors, destructors, conversion operators

ScriptLoader()
~ScriptLoader() virtual

Public functions

auto GetEngine() const -> asIScriptEngine*
Returns AngelScript engine.
auto GetMainModule() const -> asIScriptModule*
Returns AngelScript main module.
auto GetContextType() const -> ScriptContextType
Returns context type.

Protected static functions

static auto MakeRelativePath(StringView path, StringView relativeToFile) -> String
Creates a relative path.

Protected functions

auto AddScriptFromFile(StringView path, const HashMap<String, bool>& definedSymbols) -> ScriptContextType
Adds a script path from file to the main module.
auto Build() -> ScriptBuildResult
Builds the main module and extracts metadata.
void SetContextType(ScriptContextType value)
Sets context type.
auto GetMetadataForType(std::int32_t typeId) -> ArrayView<String>
Returns metadata for specified type.
auto GetMetadataForFunction(asIScriptFunction* func) -> ArrayView<String>
Returns metadata for specified function.
auto GetMetadataForVariable(std::int32_t varIdx) -> ArrayView<String>
Returns metadata for specified variable.
auto GetMetadataForTypeProperty(std::int32_t typeId, std::int32_t varIdx) -> ArrayView<String>
Returns metadata for specified property.
auto GetMetadataForTypeMethod(std::int32_t typeId, asIScriptFunction* method) -> ArrayView<String>
Returns metadata for specified method.
auto OnProcessInclude(StringView includePath, StringView scriptPath) -> String pure virtual
Called when #include directive is encountered in a script file.
void OnProcessPragma(StringView content, ScriptContextType& contextType) pure virtual
Called when #pragma directive is encountered in a script file.