1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-16 07:07:13 +02:00

Implement script loading with notification.

This commit is contained in:
Sandu Liviu Catalin
2021-07-03 19:46:39 +03:00
parent a710ceebff
commit f2c1f8afd7
6 changed files with 120 additions and 28 deletions

View File

@ -148,8 +148,9 @@ void ScriptSrc::Process()
}
// ------------------------------------------------------------------------------------------------
ScriptSrc::ScriptSrc(const String & path, bool delay, bool info) // NOLINT(modernize-pass-by-value)
ScriptSrc::ScriptSrc(const String & path, Function & cb, bool delay, bool info) // NOLINT(modernize-pass-by-value)
: mExec()
, mFunc(std::move(cb))
, mPath(path)
, mData()
, mLine()

View File

@ -19,20 +19,19 @@ class Core;
/* ------------------------------------------------------------------------------------------------
* Hold a information about loaded scripts as it's contents and executable code.
*/
class ScriptSrc
struct ScriptSrc
{
public:
// --------------------------------------------------------------------------------------------
typedef std::vector< std::pair< uint32_t, uint32_t > > Line;
// --------------------------------------------------------------------------------------------
Script mExec; // Reference to the script object.
String mPath; // Path to the script file.
String mData; // The contents of the script file.
Line mLine; // List of lines of code in the data.
bool mInfo; // Whether this script contains line information.
bool mDelay; // Don't execute immediately after compilation.
Script mExec{}; // Reference to the script object.
Function mFunc{}; // Callback to invoke after script was executed.
String mPath{}; // Path to the script file.
String mData{}; // The contents of the script file.
Line mLine{}; // List of lines of code in the data.
bool mInfo{false}; // Whether this script contains line information.
bool mDelay{false}; // Don't execute immediately after compilation.
/* --------------------------------------------------------------------------------------------
* Read file contents and calculate information about the lines of code.
@ -42,7 +41,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Base constructor.
*/
explicit ScriptSrc(const String & path, bool delay = false, bool info = false);
explicit ScriptSrc(const String & path, Function & cb, bool delay = false, bool info = false);
/* --------------------------------------------------------------------------------------------
* Copy constructor.