OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::Script Class Reference

スクリプト (AngelScript) More...

#include <Script.hpp>

Inherits s3d::AssetHandle< Script >.

Public Member Functions

SIV3D_NODISCARD_CXX20 Script ()
 デフォルトコンストラクタ More...
 
SIV3D_NODISCARD_CXX20 Script (FilePathView path, ScriptCompileOption compileOption=ScriptCompileOption::Default)
 スクリプトをファイルからロードしてコンパイルします。 More...
 
SIV3D_NODISCARD_CXX20 Script (Arg::code_< StringView > code, ScriptCompileOption compileOption=ScriptCompileOption::Default)
 スクリプトをコードからコンパイルします。 More...
 
virtual ~Script ()
 デストラクタ More...
 
Array< StringgetFunctionDeclarations (IncludeParamNames includeParamNames=IncludeParamNames::Yes) const
 スクリプトに含まれる関数宣言の一覧を返します。 More...
 
template<class Fty >
ScriptFunction< Fty > getFunction (StringView decl) const
 スクリプト関数を取得します。 More...
 
bool compiled () const
 ロードしたスクリプトのコンパイルに成功しているかを返します。 More...
 
bool reload (ScriptCompileOption compileOption=ScriptCompileOption::Default)
 スクリプトをリロードして再コンパイルします。 More...
 
void setSystemUpdateCallback (const std::function< bool()> &callback)
 スクリプト内での System::Update() で呼び出す関数を登録します。 More...
 
const Array< FilePath > & getIncludedFiles () const noexcept
 インクルードされているファイル一覧を返します。 More...
 
const Array< String > & getMessages () const
 コンパイル時に出力されたメッセージ一覧を返します。 More...
 
const FilePathpath () const
 スクリプトのファイルパスを返します。 More...
 
void swap (Script &other) noexcept
 別のスクリプトと中身を交換します。 More...
 
- Public Member Functions inherited from s3d::AssetHandle< Script >
SIV3D_NODISCARD_CXX20 AssetHandle ()
 
SIV3D_NODISCARD_CXX20 AssetHandle (std::shared_ptr< AssetIDWrapperType > &&id)
 
IDType id () const noexcept
 アセットの内部管理 ID を返します。 More...
 
bool isEmpty () const noexcept
 アセットが空であるかを返します。 More...
 
 operator bool () const noexcept
 アセットが空でないかを返します。 More...
 
bool operator== (const AssetHandle &other) const noexcept
 2 つのアセットが同じオブジェクトであるかを返します。 More...
 
bool operator!= (const AssetHandle &other) const noexcept
 2 つのアセットが異なるオブジェクトであるかを返します。 More...
 
void release ()
 このハンドルが管理するアセットを解放します。 More...
 

Static Public Member Functions

static AngelScript::asIScriptEngine * GetEngine ()
 AngelScript の高度な機能にアクセスするためのエンジンポインタを返します(上級者向け) More...
 

Protected Member Functions

const std::shared_ptr< ScriptModule > & _getModule () const
 
AngelScript::asIScriptFunction * _getFunction (StringView decl) const
 

Additional Inherited Members

- Public Types inherited from s3d::AssetHandle< Script >
using AssetIDWrapperType = AssetIDWrapper< AssetHandle >
 アセット ID ラッパー型 More...
 
using IDType = typename AssetIDWrapperType::IDType
 アセット ID 型 More...
 
- Protected Attributes inherited from s3d::AssetHandle< Script >
std::shared_ptr< AssetIDWrapperTypem_handle
 

Detailed Description

スクリプト (AngelScript)

Constructor & Destructor Documentation

◆ Script() [1/3]

SIV3D_NODISCARD_CXX20 s3d::Script::Script ( )

デフォルトコンストラクタ

◆ Script() [2/3]

SIV3D_NODISCARD_CXX20 s3d::Script::Script ( FilePathView  path,
ScriptCompileOption  compileOption = ScriptCompileOption::Default 
)
explicit

スクリプトをファイルからロードしてコンパイルします。

Parameters
pathスクリプトファイルのパス
compileOptionコンパイルオプション

◆ Script() [3/3]

SIV3D_NODISCARD_CXX20 s3d::Script::Script ( Arg::code_< StringView code,
ScriptCompileOption  compileOption = ScriptCompileOption::Default 
)
explicit

スクリプトをコードからコンパイルします。

Parameters
codeコード
compileOptionコンパイルオプション

◆ ~Script()

virtual s3d::Script::~Script ( )
virtual

デストラクタ

Member Function Documentation

◆ _getFunction()

AngelScript::asIScriptFunction* s3d::Script::_getFunction ( StringView  decl) const
protected

◆ _getModule()

const std::shared_ptr<ScriptModule>& s3d::Script::_getModule ( ) const
protected

◆ compiled()

bool s3d::Script::compiled ( ) const

ロードしたスクリプトのコンパイルに成功しているかを返します。

Returns
ロードしたスクリプトのコンパイルに成功している場合 true, それ以外の場合は false

◆ GetEngine()

static AngelScript::asIScriptEngine* s3d::Script::GetEngine ( )
static

AngelScript の高度な機能にアクセスするためのエンジンポインタを返します(上級者向け)

Returns
AngelScript の高度な機能にアクセスするためのエンジンポインタ

◆ getFunction()

template<class Fty >
ScriptFunction<Fty> s3d::Script::getFunction ( StringView  decl) const

スクリプト関数を取得します。

Template Parameters
Fty関数の型
Parameters
decl関数の名前または関数宣言
Returns
スクリプト関数。取得に失敗した場合は空のスクリプト関数

◆ getFunctionDeclarations()

Array<String> s3d::Script::getFunctionDeclarations ( IncludeParamNames  includeParamNames = IncludeParamNames::Yes) const

スクリプトに含まれる関数宣言の一覧を返します。

Parameters
includeParamNamesパラメータ名を含む場合 IncludeParamNames::Yes, それ以外の場合は IncludeParamNames::No
Returns
スクリプトに含まれる関数宣言の一覧

◆ getIncludedFiles()

const Array<FilePath>& s3d::Script::getIncludedFiles ( ) const
noexcept

インクルードされているファイル一覧を返します。

Returns
インクルードされているファイル一覧

◆ getMessages()

const Array<String>& s3d::Script::getMessages ( ) const

コンパイル時に出力されたメッセージ一覧を返します。

Returns
コンパイル時に出力されたメッセージ一覧

◆ path()

const FilePath& s3d::Script::path ( ) const

スクリプトのファイルパスを返します。

Returns
スクリプトのファイルパス。存在しない場合は空の文字列

◆ reload()

bool s3d::Script::reload ( ScriptCompileOption  compileOption = ScriptCompileOption::Default)

スクリプトをリロードして再コンパイルします。

Parameters
compileOptionコンパイルオプション
Returns
リロードと再コンパイルに成功した場合 true, それ以外の場合は false

◆ setSystemUpdateCallback()

void s3d::Script::setSystemUpdateCallback ( const std::function< bool()> &  callback)

スクリプト内での System::Update() で呼び出す関数を登録します。

Parameters
callback登録する関数

◆ swap()

void s3d::Script::swap ( Script other)
noexcept

別のスクリプトと中身を交換します。

Parameters
other別のスクリプト

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