Codechange: use std::string_view for sq_getstring

This commit is contained in:
Rubidium
2025-05-02 18:46:50 +02:00
committed by rubidium42
parent f4f05dea33
commit 278aee2c19
12 changed files with 74 additions and 73 deletions

View File

@@ -26,7 +26,7 @@ class Squirrel {
friend class ScriptInstance;
private:
typedef void (SQPrintFunc)(bool error_msg, const std::string &message);
using SQPrintFunc = void (bool error_msg, std::string_view message);
HSQUIRRELVM vm; ///< The VirtualMachine instance for squirrel
void *global_pointer; ///< Can be set by who ever initializes Squirrel
@@ -60,17 +60,17 @@ protected:
/**
* The RunError handler.
*/
static void RunError(HSQUIRRELVM vm, const SQChar *error);
static void RunError(HSQUIRRELVM vm, std::string_view error);
/**
* If a user runs 'print' inside a script, this function gets the params.
*/
static void PrintFunc(HSQUIRRELVM vm, const std::string &s);
static void PrintFunc(HSQUIRRELVM vm, std::string_view s);
/**
* If an error has to be print, this function is called.
*/
static void ErrorPrintFunc(HSQUIRRELVM vm, const std::string &s);
static void ErrorPrintFunc(HSQUIRRELVM vm, std::string_view s);
public:
Squirrel(std::string_view api_name);