summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/luaengine.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-01-20 17:46:03 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-01-20 18:06:15 -0500
commit91921618c2e06bd0ed073b8efccd31a127c9012d (patch)
treed3958b32d8db82540cd31083766b22991eb8e8ae /src/frontend/mame/luaengine.cpp
parentc691b79cce315acdfabe1901cb2b5a1e39957bc1 (diff)
Much more core std::string_view modernization
- Remove corestr.h from emu.h; update a few source files to not use it at all - Change strtrimspace, strtrimrightspace and core_filename_extract_* to be pure functions taking a std::string_view by value and returning the same type - Change strmakeupper and strmakelower to be pure functions taking a std::string_view and constructing a std::string - Remove the string-modifying version of zippath_parent - Change tag-based lookup functions in device_t to take std::string_view instead of const std::string & or const char * - Remove the subdevice tag cache from device_t (since device finders are now recommended) and replace it with a map covering directly owned subdevices only - Move the working directory setup method out of device_image_interface (only the UI seems to actually use the full version of this) - Change output_manager to use std::string_view for output name arguments - Change core_options to accept std::string_view for most name and value arguments (return values are still C strings for now) - Change miscellaneous other functions to accept std::string_view arguments - Remove a few string accessor macros from romload.h - Remove many unnecessary c_str() calls from logging/error messages
Diffstat (limited to 'src/frontend/mame/luaengine.cpp')
-rw-r--r--src/frontend/mame/luaengine.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 0c7b9c046fc..d8ec8c746db 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -26,6 +26,8 @@
#include "softlist.h"
#include "uiinput.h"
+#include "corestr.h"
+
#include <cstring>
#include <thread>
@@ -882,7 +884,7 @@ void lua_engine::initialize()
}));
file_type.set("read", [](emu_file &file, sol::buffer *buff) { buff->set_len(file.read(buff->get_ptr(), buff->get_len())); return buff; });
file_type.set("write", [](emu_file &file, const std::string &data) { return file.write(data.data(), data.size()); });
- file_type.set("open", static_cast<osd_file::error (emu_file::*)(const std::string &)>(&emu_file::open));
+ file_type.set("open", static_cast<osd_file::error (emu_file::*)(std::string_view)>(&emu_file::open));
file_type.set("open_next", &emu_file::open_next);
file_type.set("seek", sol::overload(
[](emu_file &file) { return file.tell(); },
@@ -1375,8 +1377,8 @@ void lua_engine::initialize()
device_type["memshare"] = &device_t::memshare;
device_type["membank"] = &device_t::membank;
device_type["ioport"] = &device_t::ioport;
- device_type["subdevice"] = static_cast<device_t *(device_t::*)(char const *) const>(&device_t::subdevice);
- device_type["siblingdevice"] = static_cast<device_t *(device_t::*)(char const *) const>(&device_t::siblingdevice);
+ device_type["subdevice"] = static_cast<device_t *(device_t::*)(std::string_view) const>(&device_t::subdevice);
+ device_type["siblingdevice"] = static_cast<device_t *(device_t::*)(std::string_view) const>(&device_t::siblingdevice);
device_type["parameter"] = &device_t::parameter;
device_type["tag"] = sol::property(&device_t::tag);
device_type["basetag"] = sol::property(&device_t::basetag);
@@ -1582,9 +1584,9 @@ void lua_engine::initialize()
auto image_type = sol().registry().new_usertype<device_image_interface>("image", "new", sol::no_constructor);
image_type["load"] = &device_image_interface::load;
- image_type["load_software"] = static_cast<image_init_result (device_image_interface::*)(const std::string &)>(&device_image_interface::load_software);
+ image_type["load_software"] = static_cast<image_init_result (device_image_interface::*)(std::string_view)>(&device_image_interface::load_software);
image_type["unload"] = &device_image_interface::unload;
- image_type["create"] = static_cast<image_init_result (device_image_interface::*)(const std::string &)>(&device_image_interface::create);
+ image_type["create"] = static_cast<image_init_result (device_image_interface::*)(std::string_view)>(&device_image_interface::create);
image_type["display"] = &device_image_interface::call_display;
image_type["is_readable"] = sol::property(&device_image_interface::is_readable);
image_type["is_writeable"] = sol::property(&device_image_interface::is_writeable);
@@ -1818,13 +1820,13 @@ void lua_engine::initialize()
output_type["set_indexed_value"] =
[] (output_manager &o, char const *basename, int index, int value)
{
- o.set_value(util::string_format("%s%d", basename, index).c_str(), value);
+ o.set_value(util::string_format("%s%d", basename, index), value);
};
output_type["get_value"] = &output_manager::get_value;
output_type["get_indexed_value"] =
[] (output_manager &o, char const *basename, int index)
{
- return o.get_value(util::string_format("%s%d", basename, index).c_str());
+ return o.get_value(util::string_format("%s%d", basename, index));
};
output_type["name_to_id"] = &output_manager::name_to_id;
output_type["id_to_name"] = &output_manager::id_to_name;