Pass string_view instead of const char* to callback functions
This commit is contained in:
parent
f84234cede
commit
6f4b0ce094
7 changed files with 63 additions and 42 deletions
|
@ -63,18 +63,15 @@ class MyConfig : public wren::DefConfiguration {
|
|||
public:
|
||||
wren::foreign_method_t foreign_method_fn (
|
||||
wren::VM* vm,
|
||||
const char* module_ptr,
|
||||
const char* class_name_ptr,
|
||||
std::string_view module,
|
||||
std::string_view class_name,
|
||||
bool is_static,
|
||||
const char* signature_ptr
|
||||
std::string_view signature
|
||||
) {
|
||||
//std::cout << "VM " << vm << " requested foreign method " <<
|
||||
// class_name_ptr << "::" << signature_ptr <<
|
||||
// " in module " << module_ptr << "\n";
|
||||
// class_name << "::" << signature <<
|
||||
// " in module " << module << "\n";
|
||||
|
||||
std::string_view module(module_ptr);
|
||||
std::string_view class_name(class_name_ptr);
|
||||
std::string_view signature(signature_ptr);
|
||||
if ("User" == class_name and "main" == module and "get_env(_)" == signature)
|
||||
return &user_get_env;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue