From 54993268c7c4ff541cf13c90b96f200ede126fe0 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Mon, 19 Dec 2022 19:33:19 -0330 Subject: [PATCH] Yet more conversion of 'const string&' to 'string_view'. --- src/common/HighScoresManager.cxx | 12 ++++++------ src/common/HighScoresManager.hxx | 10 +++++----- src/common/KeyMap.cxx | 3 ++- src/common/KeyMap.hxx | 2 +- src/common/PJoystickHandler.cxx | 6 +++--- src/common/PJoystickHandler.hxx | 2 +- src/common/PKeyboardHandler.cxx | 3 ++- src/common/PKeyboardHandler.hxx | 2 +- src/common/PhysicalJoystick.cxx | 12 ++++++------ src/common/PhysicalJoystick.hxx | 7 ++++--- src/common/StringParser.hxx | 4 ++-- src/common/VideoModeHandler.cxx | 14 +++++++------- src/common/VideoModeHandler.hxx | 4 ++-- src/common/repository/sqlite/SqliteError.hxx | 2 +- src/debugger/gui/CartDebugWidget.cxx | 4 ++-- src/debugger/gui/CartDebugWidget.hxx | 4 ++-- src/debugger/gui/RomWidget.cxx | 2 +- src/debugger/gui/RomWidget.hxx | 3 +-- src/debugger/gui/TiaOutputWidget.cxx | 2 +- src/debugger/gui/TiaOutputWidget.hxx | 2 +- src/emucore/Bankswitch.cxx | 3 ++- src/emucore/Bankswitch.hxx | 2 +- src/emucore/Cart0840.cxx | 2 +- src/emucore/Cart0840.hxx | 2 +- src/emucore/Cart0FA0.cxx | 2 +- src/emucore/Cart0FA0.hxx | 2 +- src/emucore/Cart2K.cxx | 2 +- src/emucore/Cart2K.hxx | 2 +- src/emucore/Cart3E.cxx | 2 +- src/emucore/Cart3E.hxx | 2 +- src/emucore/Cart3EPlus.cxx | 2 +- src/emucore/Cart3EPlus.hxx | 2 +- src/emucore/Cart3EX.cxx | 2 +- src/emucore/Cart3EX.hxx | 2 +- src/emucore/Cart3F.cxx | 2 +- src/emucore/Cart3F.hxx | 2 +- src/emucore/Cart4A50.cxx | 2 +- src/emucore/Cart4A50.hxx | 2 +- src/emucore/Cart4K.cxx | 2 +- src/emucore/Cart4K.hxx | 2 +- src/emucore/Cart4KSC.cxx | 2 +- src/emucore/Cart4KSC.hxx | 2 +- src/emucore/CartAR.cxx | 2 +- src/emucore/CartAR.hxx | 2 +- src/emucore/CartBF.cxx | 2 +- src/emucore/CartBF.hxx | 2 +- src/emucore/CartBFSC.cxx | 2 +- src/emucore/CartBFSC.hxx | 2 +- src/emucore/CartCM.cxx | 2 +- src/emucore/CartCM.hxx | 2 +- src/emucore/CartCTY.cxx | 2 +- src/emucore/CartCTY.hxx | 2 +- src/emucore/CartCV.cxx | 2 +- src/emucore/CartCV.hxx | 2 +- src/emucore/CartCreator.cxx | 7 ++++--- src/emucore/CartCreator.hxx | 4 ++-- src/emucore/CartDF.cxx | 2 +- src/emucore/CartDF.hxx | 2 +- src/emucore/CartDFSC.cxx | 2 +- src/emucore/CartDFSC.hxx | 2 +- src/emucore/CartDPC.cxx | 2 +- src/emucore/CartDPC.hxx | 2 +- src/emucore/CartE0.cxx | 2 +- src/emucore/CartE0.hxx | 2 +- src/emucore/CartE7.cxx | 2 +- src/emucore/CartE7.hxx | 2 +- src/emucore/CartEF.cxx | 2 +- src/emucore/CartEF.hxx | 2 +- src/emucore/CartEFSC.cxx | 2 +- src/emucore/CartEFSC.hxx | 2 +- src/emucore/CartEnhanced.cxx | 2 +- src/emucore/CartEnhanced.hxx | 2 +- src/emucore/CartF0.cxx | 2 +- src/emucore/CartF0.hxx | 2 +- src/emucore/CartF4.cxx | 2 +- src/emucore/CartF4.hxx | 2 +- src/emucore/CartF4SC.cxx | 2 +- src/emucore/CartF4SC.hxx | 2 +- src/emucore/CartF6.cxx | 2 +- src/emucore/CartF6.hxx | 2 +- src/emucore/CartF6SC.cxx | 2 +- src/emucore/CartF6SC.hxx | 2 +- src/emucore/CartF8.cxx | 2 +- src/emucore/CartF8.hxx | 2 +- src/emucore/CartF8SC.cxx | 2 +- src/emucore/CartF8SC.hxx | 2 +- src/emucore/CartFA.cxx | 2 +- src/emucore/CartFA.hxx | 2 +- src/emucore/CartFA2.cxx | 2 +- src/emucore/CartFA2.hxx | 2 +- src/emucore/CartFC.cxx | 2 +- src/emucore/CartFC.hxx | 2 +- src/emucore/CartFE.cxx | 2 +- src/emucore/CartFE.hxx | 2 +- src/emucore/CartMDM.cxx | 2 +- src/emucore/CartMDM.hxx | 2 +- src/emucore/CartMVC.cxx | 4 ++-- src/emucore/CartMVC.hxx | 2 +- src/emucore/CartSB.cxx | 2 +- src/emucore/CartSB.hxx | 2 +- src/emucore/CartTVBoy.cxx | 4 ++-- src/emucore/CartTVBoy.hxx | 2 +- src/emucore/CartUA.cxx | 2 +- src/emucore/CartUA.hxx | 2 +- src/emucore/CartWD.cxx | 2 +- src/emucore/CartWD.hxx | 2 +- src/emucore/CartX07.cxx | 2 +- src/emucore/CartX07.hxx | 2 +- src/emucore/OSystem.cxx | 4 ++-- src/emucore/PropsSet.cxx | 4 ++-- src/emucore/PropsSet.hxx | 6 +++--- src/emucore/exception/EmulationWarning.hxx | 4 ++-- src/emucore/exception/FatalEmulationError.hxx | 4 ++-- src/gui/BrowserDialog.cxx | 6 +++--- src/gui/BrowserDialog.hxx | 6 +++--- src/gui/CommandDialog.cxx | 2 +- src/gui/TimeLineWidget.cxx | 2 +- src/gui/TimeLineWidget.hxx | 2 +- src/os/unix/r77/OSystemR77.hxx | 2 +- 119 files changed, 167 insertions(+), 163 deletions(-) diff --git a/src/common/HighScoresManager.cxx b/src/common/HighScoresManager.cxx index 97581efd9..1fae42462 100644 --- a/src/common/HighScoresManager.cxx +++ b/src/common/HighScoresManager.cxx @@ -480,28 +480,28 @@ Int32 HighScoresManager::convert(Int32 val, uInt32 maxVal, bool isBCD, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool HighScoresManager::getPropBool(const json& jprops, const string& key, +bool HighScoresManager::getPropBool(const json& jprops, string_view key, bool defVal) { return jprops.contains(key) ? jprops.at(key).get() : defVal; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 HighScoresManager::getPropInt(const json& jprops, const string& key, +uInt32 HighScoresManager::getPropInt(const json& jprops, string_view key, uInt32 defVal) { return jprops.contains(key) ? jprops.at(key).get() : defVal; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string HighScoresManager::getPropStr(const json& jprops, const string& key, - const string& defVal) +string HighScoresManager::getPropStr(const json& jprops, string_view key, + string_view defVal) { - return jprops.contains(key) ? jprops.at(key).get() : defVal; + return jprops.contains(key) ? jprops.at(key).get() : string{defVal}; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt16 HighScoresManager::getPropAddr(const json& jprops, const string& key, +uInt16 HighScoresManager::getPropAddr(const json& jprops, string_view key, uInt16 defVal) { const string str = getPropStr(jprops, key); diff --git a/src/common/HighScoresManager.hxx b/src/common/HighScoresManager.hxx index 01fba6500..00f079907 100644 --- a/src/common/HighScoresManager.hxx +++ b/src/common/HighScoresManager.hxx @@ -222,13 +222,13 @@ class HighScoresManager json properties(json& jprops) const; // Get value from highscore properties for given key - static bool getPropBool(const json& jprops, const string& key, + static bool getPropBool(const json& jprops, string_view key, bool defVal = false); - static uInt32 getPropInt(const json& jprops, const string& key, + static uInt32 getPropInt(const json& jprops, string_view key, uInt32 defVal = 0); - static string getPropStr(const json& jprops, const string& key, - const string& defVal = ""); - static uInt16 getPropAddr(const json& jprops, const string& key, + static string getPropStr(const json& jprops, string_view key, + string_view defVal = ""); + static uInt16 getPropAddr(const json& jprops, string_view key, uInt16 defVal = 0); static HSM::ScoreAddresses getPropScoreAddr(const json& jprops); diff --git a/src/common/KeyMap.cxx b/src/common/KeyMap.cxx index 3ceab78a8..ba27117b6 100644 --- a/src/common/KeyMap.cxx +++ b/src/common/KeyMap.cxx @@ -286,12 +286,13 @@ int KeyMap::loadMapping(const json& mappings, const EventMode mode) { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -json KeyMap::convertLegacyMapping(string list) +json KeyMap::convertLegacyMapping(string_view lm) { json convertedMapping = json::array(); // Since istringstream swallows whitespace, we have to make the // delimiters be spaces + string list{lm}; std::replace(list.begin(), list.end(), '|', ' '); std::replace(list.begin(), list.end(), ':', ' '); std::replace(list.begin(), list.end(), ',', ' '); diff --git a/src/common/KeyMap.hxx b/src/common/KeyMap.hxx index a7a80d642..8ad996f7c 100644 --- a/src/common/KeyMap.hxx +++ b/src/common/KeyMap.hxx @@ -90,7 +90,7 @@ class KeyMap nlohmann::json saveMapping(const EventMode mode) const; int loadMapping(const nlohmann::json& mapping, const EventMode mode); - static nlohmann::json convertLegacyMapping(string list); + static nlohmann::json convertLegacyMapping(string_view list); /** Erase all mappings for given mode */ void eraseMode(const EventMode mode); diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index d855bc49c..22d23ebd0 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -47,7 +47,7 @@ PhysicalJoystickHandler::PhysicalJoystickHandler( } json mappings; - const string& serializedMapping = myOSystem.settings().getString("joymap"); + string_view serializedMapping = myOSystem.settings().getString("joymap"); try { mappings = json::parse(serializedMapping); @@ -68,11 +68,11 @@ PhysicalJoystickHandler::PhysicalJoystickHandler( } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -json PhysicalJoystickHandler::convertLegacyMapping(const string& mapping) +json PhysicalJoystickHandler::convertLegacyMapping(string_view mapping) { constexpr char CTRL_DELIM = '^'; - istringstream buf(mapping); + istringstream buf(string{mapping}); // TODO: fixed in C++20 string joymap, joyname; getline(buf, joymap, CTRL_DELIM); // event list size, ignore diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx index d44c8f561..1ad982bbc 100644 --- a/src/common/PJoystickHandler.hxx +++ b/src/common/PJoystickHandler.hxx @@ -68,7 +68,7 @@ class PhysicalJoystickHandler public: PhysicalJoystickHandler(OSystem& system, EventHandler& handler, Event& event); - static nlohmann::json convertLegacyMapping(const string& mapping); + static nlohmann::json convertLegacyMapping(string_view mapping); /** Return stick ID on success, -1 on failure. */ int add(const PhysicalJoystickPtr& stick); diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index 369490722..e17a5cf83 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -73,7 +73,8 @@ PhysicalKeyboardHandler::PhysicalKeyboardHandler(OSystem& system, EventHandler& } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PhysicalKeyboardHandler::loadSerializedMappings(const string& serializedMapping, EventMode mode) +void PhysicalKeyboardHandler::loadSerializedMappings( + string_view serializedMapping, EventMode mode) { json mapping; diff --git a/src/common/PKeyboardHandler.hxx b/src/common/PKeyboardHandler.hxx index 4e455ef12..a201c12fc 100644 --- a/src/common/PKeyboardHandler.hxx +++ b/src/common/PKeyboardHandler.hxx @@ -46,7 +46,7 @@ class PhysicalKeyboardHandler PhysicalKeyboardHandler(OSystem& system, EventHandler& handler); - void loadSerializedMappings(const string& serializedMappings, EventMode mode); + void loadSerializedMappings(string_view serializedMappings, EventMode mode); void setDefaultMapping(Event::Type event, EventMode mode, bool updateDefaults = false); diff --git a/src/common/PhysicalJoystick.cxx b/src/common/PhysicalJoystick.cxx index 0e747917e..853234974 100644 --- a/src/common/PhysicalJoystick.cxx +++ b/src/common/PhysicalJoystick.cxx @@ -32,7 +32,7 @@ namespace { return json(eventMode).get(); } - EventMode eventModeFromJsonName(const string& name) { + EventMode eventModeFromJsonName(string_view name) { EventMode result{}; from_json(json(name), result); @@ -42,7 +42,7 @@ namespace { } // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PhysicalJoystick::initialize(int index, const string& desc, +void PhysicalJoystick::initialize(int index, string_view desc, int axes, int buttons, int hats, int /*balls*/) { ID = index; @@ -108,9 +108,9 @@ bool PhysicalJoystick::setMap(const json& map) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -json PhysicalJoystick::convertLegacyMapping(const string& mapping, const string& name) +json PhysicalJoystick::convertLegacyMapping(string_view mapping, string_view name) { - istringstream buf(mapping); + istringstream buf(string{mapping}); // TODO: fixed in C++20 json convertedMapping = json::object(); string map; @@ -152,10 +152,10 @@ void PhysicalJoystick::eraseEvent(Event::Type event, EventMode mode) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PhysicalJoystick::getValues(const string& list, IntArray& map) +void PhysicalJoystick::getValues(string_view list, IntArray& map) { map.clear(); - istringstream buf(list); + istringstream buf(string{list}); // TODO: fixed in C++20 int value{0}; buf >> value; // we don't need to know the # of items at this point diff --git a/src/common/PhysicalJoystick.hxx b/src/common/PhysicalJoystick.hxx index 2e1505618..98d5dc7e6 100644 --- a/src/common/PhysicalJoystick.hxx +++ b/src/common/PhysicalJoystick.hxx @@ -48,14 +48,15 @@ class PhysicalJoystick nlohmann::json getMap() const; bool setMap(const nlohmann::json& map); - static nlohmann::json convertLegacyMapping(const string& mapping, const string& name); + static nlohmann::json convertLegacyMapping(string_view mapping, + string_view name); void eraseMap(EventMode mode); void eraseEvent(Event::Type event, EventMode mode); string about() const; protected: - void initialize(int index, const string& desc, + void initialize(int index, string_view desc, int axes, int buttons, int hats, int balls); private: @@ -76,7 +77,7 @@ class PhysicalJoystick JoyMap joyMap; private: - static void getValues(const string& list, IntArray& map); + static void getValues(string_view list, IntArray& map); friend ostream& operator<<(ostream& os, const PhysicalJoystick& s) { os << " ID: " << s.ID << ", name: " << s.name << ", numaxis: " << s.numAxes diff --git a/src/common/StringParser.hxx b/src/common/StringParser.hxx index 645d23a89..4d0862968 100644 --- a/src/common/StringParser.hxx +++ b/src/common/StringParser.hxx @@ -50,9 +50,9 @@ class StringParser @param str The string to split @param maxlen The maximum length of string to generate */ - StringParser(const string& str, uInt32 maxlen) + StringParser(string_view str, uInt32 maxlen) { - istringstream buf(str); + istringstream buf(string{str}); // TODO: fixed in C++20 string line; while(std::getline(buf, line, '\n')) diff --git a/src/common/VideoModeHandler.cxx b/src/common/VideoModeHandler.cxx index 9a72346ad..0db3da45b 100644 --- a/src/common/VideoModeHandler.cxx +++ b/src/common/VideoModeHandler.cxx @@ -95,7 +95,7 @@ VideoModeHandler::buildMode(const Settings& settings, bool inTIAMode) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, Stretch smode, - Int32 fsindex, const string& desc, + Int32 fsindex, string_view desc, float zoomLevel) : Mode(iw, ih, iw, ih, smode, fsindex, desc, zoomLevel) { @@ -103,13 +103,13 @@ VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, Stretch smode, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, - Stretch smode, Int32 fsindex, const string& desc, + Stretch smode, Int32 fsindex, string_view desc, float zoomLevel, float overscan) - : screenS(sw, sh), - stretch(smode), - description(desc), - zoom(zoomLevel), - fsIndex(fsindex) + : screenS{sw, sh}, + stretch{smode}, + description{desc}, + zoom{zoomLevel}, + fsIndex{fsindex} { // Now resize based on windowed/fullscreen mode and stretch factor if(fsIndex != -1) // fullscreen mode diff --git a/src/common/VideoModeHandler.hxx b/src/common/VideoModeHandler.hxx index 515a7485c..c0b85b5ae 100644 --- a/src/common/VideoModeHandler.hxx +++ b/src/common/VideoModeHandler.hxx @@ -49,10 +49,10 @@ class VideoModeHandler Mode() = default; Mode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Stretch smode, - Int32 fsindex = -1, const string& desc = "", + Int32 fsindex = -1, string_view desc = "", float zoomLevel = 1.F, float overscan = 1.F); Mode(uInt32 iw, uInt32 ih, Stretch smode, Int32 fsindex = -1, - const string& desc = "", float zoomLevel = 1.F); + string_view desc = "", float zoomLevel = 1.F); friend ostream& operator<<(ostream& os, const Mode& vm) { diff --git a/src/common/repository/sqlite/SqliteError.hxx b/src/common/repository/sqlite/SqliteError.hxx index 0f5bd4dd1..eca7d71f7 100644 --- a/src/common/repository/sqlite/SqliteError.hxx +++ b/src/common/repository/sqlite/SqliteError.hxx @@ -24,7 +24,7 @@ class SqliteError : public std::exception { public: - explicit SqliteError(const string& message) : myMessage{message} { } + explicit SqliteError(string_view message) : myMessage{message} { } explicit SqliteError(sqlite3* handle) : myMessage{sqlite3_errmsg(handle)} { } const char* what() const noexcept override { return myMessage.c_str(); } diff --git a/src/debugger/gui/CartDebugWidget.cxx b/src/debugger/gui/CartDebugWidget.cxx index defdd12a9..67138ff61 100644 --- a/src/debugger/gui/CartDebugWidget.cxx +++ b/src/debugger/gui/CartDebugWidget.cxx @@ -38,8 +38,8 @@ CartDebugWidget::CartDebugWidget(GuiObject* boss, const GUI::Font& lfont, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int CartDebugWidget::addBaseInformation(size_t bytes, const string& manufacturer, - const string& desc, const uInt16 maxlines) +int CartDebugWidget::addBaseInformation(size_t bytes, string_view manufacturer, + string_view desc, const uInt16 maxlines) { const int lwidth = _font.getStringWidth("Manufacturer "), fwidth = _w - lwidth - 12; diff --git a/src/debugger/gui/CartDebugWidget.hxx b/src/debugger/gui/CartDebugWidget.hxx index 3046dd5d6..ab7a9d253 100644 --- a/src/debugger/gui/CartDebugWidget.hxx +++ b/src/debugger/gui/CartDebugWidget.hxx @@ -38,8 +38,8 @@ class CartDebugWidget : public Widget, public CommandSender ~CartDebugWidget() override = default; public: - int addBaseInformation(size_t bytes, const string& manufacturer, - const string& desc, const uInt16 maxlines = 10); + int addBaseInformation(size_t bytes, string_view manufacturer, + string_view desc, const uInt16 maxlines = 10); // Inform the ROM Widget that the underlying cart has somehow changed void invalidate(); diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index 3b183f95f..93a3181c5 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -231,7 +231,7 @@ void RomWidget::disassemble(int disasm_line) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RomWidget::patchROM(int disasm_line, const string& bytes, +void RomWidget::patchROM(int disasm_line, string_view bytes, Common::Base::Fmt base) { const uInt16 address = getAddress(disasm_line); diff --git a/src/debugger/gui/RomWidget.hxx b/src/debugger/gui/RomWidget.hxx index 2ccbb0548..3cf523b18 100644 --- a/src/debugger/gui/RomWidget.hxx +++ b/src/debugger/gui/RomWidget.hxx @@ -53,8 +53,7 @@ class RomWidget : public Widget, public CommandSender void runtoPC(int disasm_line); void setTimer(int disasm_line); void disassemble(int disasm_line); - void patchROM(int disasm_line, const string& bytes, - Common::Base::Fmt base); + void patchROM(int disasm_line, string_view bytes, Common::Base::Fmt base); uInt16 getAddress(int disasm_line); private: diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx index 186debed0..6ef5ddd11 100644 --- a/src/debugger/gui/TiaOutputWidget.cxx +++ b/src/debugger/gui/TiaOutputWidget.cxx @@ -63,7 +63,7 @@ void TiaOutputWidget::loadConfig() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix, +void TiaOutputWidget::saveSnapshot(int execDepth, string_view execPrefix, bool mark) { #ifdef IMAGE_SUPPORT diff --git a/src/debugger/gui/TiaOutputWidget.hxx b/src/debugger/gui/TiaOutputWidget.hxx index cd42d277b..cd6ecb6af 100644 --- a/src/debugger/gui/TiaOutputWidget.hxx +++ b/src/debugger/gui/TiaOutputWidget.hxx @@ -36,7 +36,7 @@ class TiaOutputWidget : public Widget, public CommandSender void loadConfig() override; void setZoomWidget(TiaZoomWidget* w) { myZoom = w; } - void saveSnapshot(int execDepth = 0, const string& execPrefix = EmptyString, + void saveSnapshot(int execDepth = 0, string_view execPrefix = EmptyString, bool mark = true); // Eventually, these methods will enable access to the onscreen TIA image diff --git a/src/emucore/Bankswitch.cxx b/src/emucore/Bankswitch.cxx index a85c00f3e..d5677d7da 100644 --- a/src/emucore/Bankswitch.cxx +++ b/src/emucore/Bankswitch.cxx @@ -24,8 +24,9 @@ string Bankswitch::typeToName(Bankswitch::Type type) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Bankswitch::Type Bankswitch::nameToType(const string& name) +Bankswitch::Type Bankswitch::nameToType(string_view n) // FIXME: name { + string name{n}; const auto it = ourNameToTypes.find(name); if(it != ourNameToTypes.end()) return it->second; diff --git a/src/emucore/Bankswitch.hxx b/src/emucore/Bankswitch.hxx index eb558b2d0..8f14502de 100644 --- a/src/emucore/Bankswitch.hxx +++ b/src/emucore/Bankswitch.hxx @@ -75,7 +75,7 @@ class Bankswitch static string typeToName(Bankswitch::Type type); // Convert string to BSType enum - static Bankswitch::Type nameToType(const string& name); + static Bankswitch::Type nameToType(string_view name); // Convert BSType enum to description string static string typeToDesc(Bankswitch::Type type); diff --git a/src/emucore/Cart0840.cxx b/src/emucore/Cart0840.cxx index da43fba28..928b1e4a3 100644 --- a/src/emucore/Cart0840.cxx +++ b/src/emucore/Cart0840.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge0840::Cartridge0840(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/Cart0840.hxx b/src/emucore/Cart0840.hxx index 05fd1e611..292980a74 100644 --- a/src/emucore/Cart0840.hxx +++ b/src/emucore/Cart0840.hxx @@ -46,7 +46,7 @@ class Cartridge0840 : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - Cartridge0840(const ByteBuffer& image, size_t size, const string& md5, + Cartridge0840(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 8_KB); ~Cartridge0840() override = default; diff --git a/src/emucore/Cart0FA0.cxx b/src/emucore/Cart0FA0.cxx index fe4ef2555..d973647ef 100644 --- a/src/emucore/Cart0FA0.cxx +++ b/src/emucore/Cart0FA0.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge0FA0::Cartridge0FA0(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings) + string_view md5, const Settings& settings) : CartridgeEnhanced(image, size, md5, settings, 8_KB) { } diff --git a/src/emucore/Cart0FA0.hxx b/src/emucore/Cart0FA0.hxx index 701efd5ea..e7d317190 100644 --- a/src/emucore/Cart0FA0.hxx +++ b/src/emucore/Cart0FA0.hxx @@ -47,7 +47,7 @@ class Cartridge0FA0 : public CartridgeEnhanced @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge0FA0(const ByteBuffer& image, size_t size, const string& md5, + Cartridge0FA0(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings); ~Cartridge0FA0() override = default; diff --git a/src/emucore/Cart2K.cxx b/src/emucore/Cart2K.cxx index 64735e0af..1ca8750cc 100644 --- a/src/emucore/Cart2K.cxx +++ b/src/emucore/Cart2K.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge2K::Cartridge2K(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/Cart2K.hxx b/src/emucore/Cart2K.hxx index c936bcec2..df0e63c4a 100644 --- a/src/emucore/Cart2K.hxx +++ b/src/emucore/Cart2K.hxx @@ -49,7 +49,7 @@ class Cartridge2K : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - Cartridge2K(const ByteBuffer& image, size_t size, const string& md5, + Cartridge2K(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 2_KB); ~Cartridge2K() override = default; diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index 7b737487c..ea2730aab 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -21,7 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge3E::Cartridge3E(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize == 0 ? BSPF::nextMultipleOf(size, 2_KB) : bsSize) diff --git a/src/emucore/Cart3E.hxx b/src/emucore/Cart3E.hxx index 29188a12e..84d661a9c 100644 --- a/src/emucore/Cart3E.hxx +++ b/src/emucore/Cart3E.hxx @@ -74,7 +74,7 @@ class Cartridge3E : public CartridgeEnhanced @param bsSize The size specified by the bankswitching scheme (where 0 means variable-sized ROM) */ - Cartridge3E(const ByteBuffer& image, size_t size, const string& md5, + Cartridge3E(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 0); ~Cartridge3E() override = default; diff --git a/src/emucore/Cart3EPlus.cxx b/src/emucore/Cart3EPlus.cxx index c06cc21d7..354865288 100644 --- a/src/emucore/Cart3EPlus.cxx +++ b/src/emucore/Cart3EPlus.cxx @@ -21,7 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge3EPlus::Cartridge3EPlus(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : Cartridge3E(image, size, md5, settings, bsSize == 0 ? BSPF::nextMultipleOf(size, 1_KB) : bsSize) diff --git a/src/emucore/Cart3EPlus.hxx b/src/emucore/Cart3EPlus.hxx index eeeb83705..ae0c57853 100644 --- a/src/emucore/Cart3EPlus.hxx +++ b/src/emucore/Cart3EPlus.hxx @@ -97,7 +97,7 @@ class Cartridge3EPlus: public Cartridge3E @param bsSize The size specified by the bankswitching scheme (where 0 means variable-sized ROM) */ - Cartridge3EPlus(const ByteBuffer& image, size_t size, const string& md5, + Cartridge3EPlus(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 0); ~Cartridge3EPlus() override = default; diff --git a/src/emucore/Cart3EX.cxx b/src/emucore/Cart3EX.cxx index 7be6c99a8..640b001ef 100644 --- a/src/emucore/Cart3EX.cxx +++ b/src/emucore/Cart3EX.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge3EX::Cartridge3EX(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings) + string_view md5, const Settings& settings) : Cartridge3E(image, size, md5, settings) { // 0xFFFA contains RAM bank count - 1; diff --git a/src/emucore/Cart3EX.hxx b/src/emucore/Cart3EX.hxx index a55f48b60..07769b082 100644 --- a/src/emucore/Cart3EX.hxx +++ b/src/emucore/Cart3EX.hxx @@ -41,7 +41,7 @@ class Cartridge3EX : public Cartridge3E @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge3EX(const ByteBuffer& image, size_t size, const string& md5, + Cartridge3EX(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings); ~Cartridge3EX() override = default; diff --git a/src/emucore/Cart3F.cxx b/src/emucore/Cart3F.cxx index 32461ebc7..aa1563e69 100644 --- a/src/emucore/Cart3F.cxx +++ b/src/emucore/Cart3F.cxx @@ -21,7 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge3F::Cartridge3F(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize == 0 ? BSPF::nextPowerOfTwo(size) : bsSize) diff --git a/src/emucore/Cart3F.hxx b/src/emucore/Cart3F.hxx index 33764b736..7e703e8ba 100644 --- a/src/emucore/Cart3F.hxx +++ b/src/emucore/Cart3F.hxx @@ -53,7 +53,7 @@ class Cartridge3F : public CartridgeEnhanced @param bsSize The size specified by the bankswitching scheme (where 0 means variable-sized ROM) */ - Cartridge3F(const ByteBuffer& image, size_t size, const string& md5, + Cartridge3F(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 0); ~Cartridge3F() override = default; diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx index 46ce05e32..d88209e74 100644 --- a/src/emucore/Cart4A50.cxx +++ b/src/emucore/Cart4A50.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge4A50::Cartridge4A50(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings) + string_view md5, const Settings& settings) : Cartridge(settings, md5), myImage{make_unique(128_KB)}, mySize{size} diff --git a/src/emucore/Cart4A50.hxx b/src/emucore/Cart4A50.hxx index d0e3c193b..7ef2be75f 100644 --- a/src/emucore/Cart4A50.hxx +++ b/src/emucore/Cart4A50.hxx @@ -65,7 +65,7 @@ class Cartridge4A50 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - Cartridge4A50(const ByteBuffer& image, size_t size, const string& md5, + Cartridge4A50(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings); ~Cartridge4A50() override = default; diff --git a/src/emucore/Cart4K.cxx b/src/emucore/Cart4K.cxx index 8683db5a5..d9b6ce54c 100644 --- a/src/emucore/Cart4K.cxx +++ b/src/emucore/Cart4K.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge4K::Cartridge4K(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/Cart4K.hxx b/src/emucore/Cart4K.hxx index 9264a596b..59d24707e 100644 --- a/src/emucore/Cart4K.hxx +++ b/src/emucore/Cart4K.hxx @@ -46,7 +46,7 @@ class Cartridge4K : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - Cartridge4K(const ByteBuffer& image, size_t size, const string& md5, + Cartridge4K(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 4_KB); ~Cartridge4K() override = default; diff --git a/src/emucore/Cart4KSC.cxx b/src/emucore/Cart4KSC.cxx index 587ffb5b7..8ecf8f7d1 100644 --- a/src/emucore/Cart4KSC.cxx +++ b/src/emucore/Cart4KSC.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge4KSC::Cartridge4KSC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : Cartridge4K(image, size, md5, settings, bsSize) { diff --git a/src/emucore/Cart4KSC.hxx b/src/emucore/Cart4KSC.hxx index 5b947120c..b2a7fad6c 100644 --- a/src/emucore/Cart4KSC.hxx +++ b/src/emucore/Cart4KSC.hxx @@ -47,7 +47,7 @@ class Cartridge4KSC : public Cartridge4K @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - Cartridge4KSC(const ByteBuffer& image, size_t size, const string& md5, + Cartridge4KSC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 4_KB); ~Cartridge4KSC() override = default; diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index 126315c70..775c6e51a 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeAR::CartridgeAR(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings) + string_view md5, const Settings& settings) : Cartridge(settings, md5), mySize{std::max(size, LOAD_SIZE)} { diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index 130e2ad7b..ec4d6a446 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -57,7 +57,7 @@ class CartridgeAR : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeAR(const ByteBuffer& image, size_t size, const string& md5, + CartridgeAR(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings); ~CartridgeAR() override = default; diff --git a/src/emucore/CartBF.cxx b/src/emucore/CartBF.cxx index cc4c11ec3..b03f8e7ee 100644 --- a/src/emucore/CartBF.cxx +++ b/src/emucore/CartBF.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeBF::CartridgeBF(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartBF.hxx b/src/emucore/CartBF.hxx index b6743e0d6..6e5ddf2ae 100644 --- a/src/emucore/CartBF.hxx +++ b/src/emucore/CartBF.hxx @@ -47,7 +47,7 @@ class CartridgeBF : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeBF(const ByteBuffer& image, size_t size, const string& md5, + CartridgeBF(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 256_KB); ~CartridgeBF() override = default; diff --git a/src/emucore/CartBFSC.cxx b/src/emucore/CartBFSC.cxx index dbdb7fc60..d6e61364e 100644 --- a/src/emucore/CartBFSC.cxx +++ b/src/emucore/CartBFSC.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeBFSC::CartridgeBFSC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeBF(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartBFSC.hxx b/src/emucore/CartBFSC.hxx index db7119b94..aaf555260 100644 --- a/src/emucore/CartBFSC.hxx +++ b/src/emucore/CartBFSC.hxx @@ -47,7 +47,7 @@ class CartridgeBFSC : public CartridgeBF @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeBFSC(const ByteBuffer& image, size_t size, const string& md5, + CartridgeBFSC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 256_KB); ~CartridgeBFSC() override = default; diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 409327aab..631ac740e 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeCM::CartridgeCM(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings) + string_view md5, const Settings& settings) : Cartridge(settings, md5), myImage{make_unique(16_KB)} { diff --git a/src/emucore/CartCM.hxx b/src/emucore/CartCM.hxx index e9df66af9..18a07fb73 100644 --- a/src/emucore/CartCM.hxx +++ b/src/emucore/CartCM.hxx @@ -120,7 +120,7 @@ class CartridgeCM : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeCM(const ByteBuffer& image, size_t size, const string& md5, + CartridgeCM(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings); ~CartridgeCM() override = default; diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 17e3a615c..03876fe50 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -23,7 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeCTY::CartridgeCTY(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings) + string_view md5, const Settings& settings) : Cartridge(settings, md5), myImage{make_unique(32_KB)} { diff --git a/src/emucore/CartCTY.hxx b/src/emucore/CartCTY.hxx index 6bf93a391..6acb9dc7b 100644 --- a/src/emucore/CartCTY.hxx +++ b/src/emucore/CartCTY.hxx @@ -118,7 +118,7 @@ class CartridgeCTY : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the settings object */ - CartridgeCTY(const ByteBuffer& image, size_t size, const string& md5, + CartridgeCTY(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings); ~CartridgeCTY() override = default; diff --git a/src/emucore/CartCV.cxx b/src/emucore/CartCV.cxx index 2200226fc..4026e06e6 100644 --- a/src/emucore/CartCV.cxx +++ b/src/emucore/CartCV.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeCV::CartridgeCV(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartCV.hxx b/src/emucore/CartCV.hxx index 25d660c1b..0acc7e81c 100644 --- a/src/emucore/CartCV.hxx +++ b/src/emucore/CartCV.hxx @@ -49,7 +49,7 @@ class CartridgeCV : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeCV(const ByteBuffer& image, size_t size, const string& md5, + CartridgeCV(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 2_KB); ~CartridgeCV() override = default; diff --git a/src/emucore/CartCreator.cxx b/src/emucore/CartCreator.cxx index 4be8ec751..39bf94efb 100644 --- a/src/emucore/CartCreator.cxx +++ b/src/emucore/CartCreator.cxx @@ -72,7 +72,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr CartCreator::create(const FSNode& file, const ByteBuffer& image, size_t size, string& md5, - const string& dtype, Settings& settings) + string_view dtype, Settings& settings) { unique_ptr cartridge; Bankswitch::Type type = Bankswitch::nameToType(dtype), @@ -224,8 +224,9 @@ CartCreator::createFromMultiCart(const ByteBuffer& image, size_t& size, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr -CartCreator::createFromImage(const ByteBuffer& image, size_t size, Bankswitch::Type type, - const string& md5, Settings& settings) +CartCreator::createFromImage(const ByteBuffer& image, size_t size, + Bankswitch::Type type, string_view md5, + Settings& settings) { // We should know the cart's type by now so let's create it switch(type) diff --git a/src/emucore/CartCreator.hxx b/src/emucore/CartCreator.hxx index 676b565f4..baecf9467 100644 --- a/src/emucore/CartCreator.hxx +++ b/src/emucore/CartCreator.hxx @@ -47,7 +47,7 @@ class CartCreator */ static unique_ptr create(const FSNode& file, const ByteBuffer& image, size_t size, string& md5, - const string& dtype, Settings& settings); + string_view dtype, Settings& settings); private: /** @@ -82,7 +82,7 @@ class CartCreator */ static unique_ptr createFromImage(const ByteBuffer& image, size_t size, Bankswitch::Type type, - const string& md5, Settings& settings); + string_view md5, Settings& settings); private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartDF.cxx b/src/emucore/CartDF.cxx index 1f10ccf57..b1b9971d6 100644 --- a/src/emucore/CartDF.cxx +++ b/src/emucore/CartDF.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeDF::CartridgeDF(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartDF.hxx b/src/emucore/CartDF.hxx index fd7e81673..02da770aa 100644 --- a/src/emucore/CartDF.hxx +++ b/src/emucore/CartDF.hxx @@ -47,7 +47,7 @@ class CartridgeDF : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeDF(const ByteBuffer& image, size_t size, const string& md5, + CartridgeDF(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 128_KB); ~CartridgeDF() override = default; diff --git a/src/emucore/CartDFSC.cxx b/src/emucore/CartDFSC.cxx index 865d8e88b..cf682ffb6 100644 --- a/src/emucore/CartDFSC.cxx +++ b/src/emucore/CartDFSC.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeDFSC::CartridgeDFSC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeDF(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartDFSC.hxx b/src/emucore/CartDFSC.hxx index 35c2f361d..81adea815 100644 --- a/src/emucore/CartDFSC.hxx +++ b/src/emucore/CartDFSC.hxx @@ -47,7 +47,7 @@ class CartridgeDFSC : public CartridgeDF @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeDFSC(const ByteBuffer& image, size_t size, const string& md5, + CartridgeDFSC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 128_KB); ~CartridgeDFSC() override = default; diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index aea18931a..28522212d 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeDPC::CartridgeDPC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeF8(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartDPC.hxx b/src/emucore/CartDPC.hxx index 9f17a7741..d9539849f 100644 --- a/src/emucore/CartDPC.hxx +++ b/src/emucore/CartDPC.hxx @@ -48,7 +48,7 @@ class CartridgeDPC : public CartridgeF8 @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeDPC(const ByteBuffer& image, size_t size, const string& md5, + CartridgeDPC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 10_KB); ~CartridgeDPC() override = default; diff --git a/src/emucore/CartE0.cxx b/src/emucore/CartE0.cxx index 1ebb00ea7..e492a097e 100644 --- a/src/emucore/CartE0.cxx +++ b/src/emucore/CartE0.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeE0::CartridgeE0(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartE0.hxx b/src/emucore/CartE0.hxx index fc94d12ef..9b90d5818 100644 --- a/src/emucore/CartE0.hxx +++ b/src/emucore/CartE0.hxx @@ -55,7 +55,7 @@ class CartridgeE0 : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeE0(const ByteBuffer& image, size_t size, const string& md5, + CartridgeE0(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 8_KB); ~CartridgeE0() override = default; diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index 3957717c2..e1a7f31cc 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeE7::CartridgeE7(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings) + string_view md5, const Settings& settings) : Cartridge(settings, md5), mySize{size} { diff --git a/src/emucore/CartE7.hxx b/src/emucore/CartE7.hxx index c4634ca09..78751cea4 100644 --- a/src/emucore/CartE7.hxx +++ b/src/emucore/CartE7.hxx @@ -75,7 +75,7 @@ class CartridgeE7 : public Cartridge @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ - CartridgeE7(const ByteBuffer& image, size_t size, const string& md5, + CartridgeE7(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings); ~CartridgeE7() override = default; diff --git a/src/emucore/CartEF.cxx b/src/emucore/CartEF.cxx index 1362b10b5..9909c4232 100644 --- a/src/emucore/CartEF.cxx +++ b/src/emucore/CartEF.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeEF::CartridgeEF(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartEF.hxx b/src/emucore/CartEF.hxx index 623dff8e7..509a58543 100644 --- a/src/emucore/CartEF.hxx +++ b/src/emucore/CartEF.hxx @@ -47,7 +47,7 @@ class CartridgeEF : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeEF(const ByteBuffer& image, size_t size, const string& md5, + CartridgeEF(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 64_KB); ~CartridgeEF() override = default; diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index 2a6f4dadc..374205da9 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeEFSC::CartridgeEFSC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEF(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartEFSC.hxx b/src/emucore/CartEFSC.hxx index 1e8862a01..2e8bfd876 100644 --- a/src/emucore/CartEFSC.hxx +++ b/src/emucore/CartEFSC.hxx @@ -48,7 +48,7 @@ class CartridgeEFSC : public CartridgeEF @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeEFSC(const ByteBuffer& image, size_t size, const string& md5, + CartridgeEFSC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 64_KB); ~CartridgeEFSC() override = default; diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx index 3ed2a3702..2202f9f0e 100644 --- a/src/emucore/CartEnhanced.cxx +++ b/src/emucore/CartEnhanced.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : Cartridge(settings, md5) { diff --git a/src/emucore/CartEnhanced.hxx b/src/emucore/CartEnhanced.hxx index 1558a967b..5ad0d2a42 100644 --- a/src/emucore/CartEnhanced.hxx +++ b/src/emucore/CartEnhanced.hxx @@ -47,7 +47,7 @@ class CartridgeEnhanced : public Cartridge @param bsSize The size specified by the bankswitching scheme */ CartridgeEnhanced(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize); ~CartridgeEnhanced() override = default; diff --git a/src/emucore/CartF0.cxx b/src/emucore/CartF0.cxx index 979f6a009..7e698419e 100644 --- a/src/emucore/CartF0.cxx +++ b/src/emucore/CartF0.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF0::CartridgeF0(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartF0.hxx b/src/emucore/CartF0.hxx index 53a8d24f7..c1ea3efbe 100644 --- a/src/emucore/CartF0.hxx +++ b/src/emucore/CartF0.hxx @@ -44,7 +44,7 @@ class CartridgeF0 : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeF0(const ByteBuffer& image, size_t size, const string& md5, + CartridgeF0(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 64_KB); ~CartridgeF0() override = default; diff --git a/src/emucore/CartF4.cxx b/src/emucore/CartF4.cxx index bbced542f..dc90fa18f 100644 --- a/src/emucore/CartF4.cxx +++ b/src/emucore/CartF4.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF4::CartridgeF4(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartF4.hxx b/src/emucore/CartF4.hxx index 22238315f..9e65d580a 100644 --- a/src/emucore/CartF4.hxx +++ b/src/emucore/CartF4.hxx @@ -43,7 +43,7 @@ class CartridgeF4 : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeF4(const ByteBuffer& image, size_t size, const string& md5, + CartridgeF4(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 32_KB); ~CartridgeF4() override = default; diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index 0a9c84d04..58add5484 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF4SC::CartridgeF4SC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeF4(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartF4SC.hxx b/src/emucore/CartF4SC.hxx index 59137049e..58b55912d 100644 --- a/src/emucore/CartF4SC.hxx +++ b/src/emucore/CartF4SC.hxx @@ -44,7 +44,7 @@ class CartridgeF4SC : public CartridgeF4 @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeF4SC(const ByteBuffer& image, size_t size, const string& md5, + CartridgeF4SC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 32_KB); ~CartridgeF4SC() override = default; diff --git a/src/emucore/CartF6.cxx b/src/emucore/CartF6.cxx index 3467ee072..fb12b5805 100644 --- a/src/emucore/CartF6.cxx +++ b/src/emucore/CartF6.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF6::CartridgeF6(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartF6.hxx b/src/emucore/CartF6.hxx index 3a3520862..ca195d0bd 100644 --- a/src/emucore/CartF6.hxx +++ b/src/emucore/CartF6.hxx @@ -43,7 +43,7 @@ class CartridgeF6 : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeF6(const ByteBuffer& image, size_t size, const string& md5, + CartridgeF6(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 16_KB); ~CartridgeF6() override = default; diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index 6c006413b..2491e9b6b 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF6SC::CartridgeF6SC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeF6(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartF6SC.hxx b/src/emucore/CartF6SC.hxx index 7af00f294..22a8089c4 100644 --- a/src/emucore/CartF6SC.hxx +++ b/src/emucore/CartF6SC.hxx @@ -44,7 +44,7 @@ class CartridgeF6SC : public CartridgeF6 @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeF6SC(const ByteBuffer& image, size_t size, const string& md5, + CartridgeF6SC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 16_KB); ~CartridgeF6SC() override = default; diff --git a/src/emucore/CartF8.cxx b/src/emucore/CartF8.cxx index 01b8c5c72..51c7aef5c 100644 --- a/src/emucore/CartF8.cxx +++ b/src/emucore/CartF8.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF8::CartridgeF8(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartF8.hxx b/src/emucore/CartF8.hxx index b2aa7235e..6354a56a0 100644 --- a/src/emucore/CartF8.hxx +++ b/src/emucore/CartF8.hxx @@ -43,7 +43,7 @@ class CartridgeF8 : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeF8(const ByteBuffer& image, size_t size, const string& md5, + CartridgeF8(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 8_KB); ~CartridgeF8() override = default; diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index f52721cbb..24308f8f7 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -19,7 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF8SC::CartridgeF8SC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeF8(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartF8SC.hxx b/src/emucore/CartF8SC.hxx index 5339c1f30..df2484c4c 100644 --- a/src/emucore/CartF8SC.hxx +++ b/src/emucore/CartF8SC.hxx @@ -44,7 +44,7 @@ class CartridgeF8SC : public CartridgeF8 @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeF8SC(const ByteBuffer& image, size_t size, const string& md5, + CartridgeF8SC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 8_KB); ~CartridgeF8SC() override = default; diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index afe1e1139..6a53e49e6 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeFA::CartridgeFA(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartFA.hxx b/src/emucore/CartFA.hxx index 903db002c..9930a5ea1 100644 --- a/src/emucore/CartFA.hxx +++ b/src/emucore/CartFA.hxx @@ -47,7 +47,7 @@ class CartridgeFA : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeFA(const ByteBuffer& image, size_t size, const string& md5, + CartridgeFA(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 12_KB); ~CartridgeFA() override = default; diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index 27ad7eca9..7da6f4cc0 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeFA2::CartridgeFA2(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeFA(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartFA2.hxx b/src/emucore/CartFA2.hxx index 5007a129b..4f47db031 100644 --- a/src/emucore/CartFA2.hxx +++ b/src/emucore/CartFA2.hxx @@ -59,7 +59,7 @@ class CartridgeFA2 : public CartridgeFA @param settings A reference to the settings object @param bsSize The size specified by the bankswitching scheme */ - CartridgeFA2(const ByteBuffer& image, size_t size, const string& md5, + CartridgeFA2(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 28_KB); ~CartridgeFA2() override = default; diff --git a/src/emucore/CartFC.cxx b/src/emucore/CartFC.cxx index 5eac6a792..ce9abf1aa 100644 --- a/src/emucore/CartFC.cxx +++ b/src/emucore/CartFC.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeFC::CartridgeFC(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize == 0 ? BSPF::nextPowerOfTwo(size) : bsSize) diff --git a/src/emucore/CartFC.hxx b/src/emucore/CartFC.hxx index d234eb4cf..1ea516112 100644 --- a/src/emucore/CartFC.hxx +++ b/src/emucore/CartFC.hxx @@ -50,7 +50,7 @@ class CartridgeFC : public CartridgeEnhanced @param bsSize The size specified by the bankswitching scheme (where 0 means variable-sized ROM) */ - CartridgeFC(const ByteBuffer& image, size_t size, const string& md5, + CartridgeFC(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 0); ~CartridgeFC() override = default; diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index 79f3835ad..1c980d1b4 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -21,7 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeFE::CartridgeFE(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartFE.hxx b/src/emucore/CartFE.hxx index 26a786686..0b5ca6a07 100644 --- a/src/emucore/CartFE.hxx +++ b/src/emucore/CartFE.hxx @@ -90,7 +90,7 @@ class CartridgeFE : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeFE(const ByteBuffer& image, size_t size, const string& md5, + CartridgeFE(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 8_KB); ~CartridgeFE() override = default; diff --git a/src/emucore/CartMDM.cxx b/src/emucore/CartMDM.cxx index c116b4829..08f670e84 100644 --- a/src/emucore/CartMDM.cxx +++ b/src/emucore/CartMDM.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeMDM::CartridgeMDM(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize == 0 ? BSPF::nextPowerOfTwo(size) : bsSize) diff --git a/src/emucore/CartMDM.hxx b/src/emucore/CartMDM.hxx index 13a264372..a025271c5 100644 --- a/src/emucore/CartMDM.hxx +++ b/src/emucore/CartMDM.hxx @@ -59,7 +59,7 @@ class CartridgeMDM : public CartridgeEnhanced @param bsSize The size specified by the bankswitching scheme (where 0 means variable-sized ROM) */ - CartridgeMDM(const ByteBuffer& image, size_t size, const string& md5, + CartridgeMDM(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 0); ~CartridgeMDM() override = default; diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index beb652e72..6480d49fe 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -1557,8 +1557,8 @@ bool MovieCart::load(Serializer& in) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CartridgeMVC::CartridgeMVC(const string& path, size_t size, - const string& md5, const Settings& settings, +CartridgeMVC::CartridgeMVC(string_view path, size_t size, + string_view md5, const Settings& settings, size_t bsSize) : Cartridge(settings, md5), myImage{make_unique(bsSize)}, // not used diff --git a/src/emucore/CartMVC.hxx b/src/emucore/CartMVC.hxx index 07ff0e83c..ce85dc4ad 100644 --- a/src/emucore/CartMVC.hxx +++ b/src/emucore/CartMVC.hxx @@ -50,7 +50,7 @@ class CartridgeMVC : public Cartridge @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeMVC(const string& path, size_t size, const string& md5, + CartridgeMVC(string_view path, size_t size, string_view md5, const Settings& settings, size_t bsSize = 8_KB); ~CartridgeMVC() override; diff --git a/src/emucore/CartSB.cxx b/src/emucore/CartSB.cxx index 8a55eae4d..77f9849dc 100644 --- a/src/emucore/CartSB.cxx +++ b/src/emucore/CartSB.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeSB::CartridgeSB(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize == 0 ? BSPF::nextPowerOfTwo(size) : bsSize) diff --git a/src/emucore/CartSB.hxx b/src/emucore/CartSB.hxx index 3e9de0795..a8cf04f41 100644 --- a/src/emucore/CartSB.hxx +++ b/src/emucore/CartSB.hxx @@ -48,7 +48,7 @@ class CartridgeSB : public CartridgeEnhanced @param bsSize The size specified by the bankswitching scheme (where 0 means variable-sized ROM) */ - CartridgeSB(const ByteBuffer& image, size_t size, const string& md5, + CartridgeSB(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 0); ~CartridgeSB() override = default; diff --git a/src/emucore/CartTVBoy.cxx b/src/emucore/CartTVBoy.cxx index 95a1d5acd..b64e85013 100644 --- a/src/emucore/CartTVBoy.cxx +++ b/src/emucore/CartTVBoy.cxx @@ -20,8 +20,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeTVBoy::CartridgeTVBoy(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, - size_t bsSize) + string_view md5, const Settings& settings, + size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { } diff --git a/src/emucore/CartTVBoy.hxx b/src/emucore/CartTVBoy.hxx index 2658b583b..c8562e9a2 100644 --- a/src/emucore/CartTVBoy.hxx +++ b/src/emucore/CartTVBoy.hxx @@ -46,7 +46,7 @@ class CartridgeTVBoy : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeTVBoy(const ByteBuffer& image, size_t size, const string& md5, + CartridgeTVBoy(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 512_KB); ~CartridgeTVBoy() override = default; diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx index 8d9523f36..ded32de21 100644 --- a/src/emucore/CartUA.cxx +++ b/src/emucore/CartUA.cxx @@ -20,7 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeUA::CartridgeUA(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, bool swapHotspots) : CartridgeEnhanced(image, size, md5, settings, 8_KB), mySwappedHotspots{swapHotspots} diff --git a/src/emucore/CartUA.hxx b/src/emucore/CartUA.hxx index 6b99fefc4..2a7a60696 100644 --- a/src/emucore/CartUA.hxx +++ b/src/emucore/CartUA.hxx @@ -47,7 +47,7 @@ class CartridgeUA : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param swapHotspots Swap hotspots */ - CartridgeUA(const ByteBuffer& image, size_t size, const string& md5, + CartridgeUA(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, bool swapHotspots = false); ~CartridgeUA() override = default; diff --git a/src/emucore/CartWD.cxx b/src/emucore/CartWD.cxx index 513bcf25f..3b64524a9 100644 --- a/src/emucore/CartWD.cxx +++ b/src/emucore/CartWD.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeWD::CartridgeWD(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartWD.hxx b/src/emucore/CartWD.hxx index 2ae2be696..58564d13b 100644 --- a/src/emucore/CartWD.hxx +++ b/src/emucore/CartWD.hxx @@ -67,7 +67,7 @@ class CartridgeWD : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeWD(const ByteBuffer& image, size_t size, const string& md5, + CartridgeWD(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 8_KB); ~CartridgeWD() override = default; diff --git a/src/emucore/CartX07.cxx b/src/emucore/CartX07.cxx index bec63de9b..104089faf 100644 --- a/src/emucore/CartX07.cxx +++ b/src/emucore/CartX07.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeX07::CartridgeX07(const ByteBuffer& image, size_t size, - const string& md5, const Settings& settings, + string_view md5, const Settings& settings, size_t bsSize) : CartridgeEnhanced(image, size, md5, settings, bsSize) { diff --git a/src/emucore/CartX07.hxx b/src/emucore/CartX07.hxx index b40583f3e..becfe2326 100644 --- a/src/emucore/CartX07.hxx +++ b/src/emucore/CartX07.hxx @@ -56,7 +56,7 @@ class CartridgeX07 : public CartridgeEnhanced @param settings A reference to the various settings (read-only) @param bsSize The size specified by the bankswitching scheme */ - CartridgeX07(const ByteBuffer& image, size_t size, const string& md5, + CartridgeX07(const ByteBuffer& image, size_t size, string_view md5, const Settings& settings, size_t bsSize = 64_KB); ~CartridgeX07() override = default; diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index f304c59af..23a1779f0 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -652,9 +652,9 @@ unique_ptr OSystem::openConsole(const FSNode& romfile, string& md5) myPropSet->getMD5(md5, props); // Local helper method - const auto CMDLINE_PROPS_UPDATE = [&](const string& name, PropType prop) + const auto CMDLINE_PROPS_UPDATE = [&](string_view name, PropType prop) { - const string& s = mySettings->getString(name); + const string_view s = mySettings->getString(name); if(!s.empty()) props.set(prop, s); }; diff --git a/src/emucore/PropsSet.cxx b/src/emucore/PropsSet.cxx index a9bce49a6..a1890d301 100644 --- a/src/emucore/PropsSet.cxx +++ b/src/emucore/PropsSet.cxx @@ -39,7 +39,7 @@ void PropertiesSet::setRepository(shared_ptr reposi } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool PropertiesSet::getMD5(const string& md5, Properties& properties, +bool PropertiesSet::getMD5(string_view md5, Properties& properties, bool useDefaults) const { properties.setDefaults(); @@ -144,7 +144,7 @@ void PropertiesSet::insert(const Properties& properties, bool save) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PropertiesSet::loadPerROM(const FSNode& rom, const string& md5) +void PropertiesSet::loadPerROM(const FSNode& rom, string_view md5) { Properties props; diff --git a/src/emucore/PropsSet.hxx b/src/emucore/PropsSet.hxx index 4fb82a861..ccf6f829f 100644 --- a/src/emucore/PropsSet.hxx +++ b/src/emucore/PropsSet.hxx @@ -56,7 +56,7 @@ class PropertiesSet @return True if the set with the specified md5 was found, else false */ - bool getMD5(const string& md5, Properties& properties, + bool getMD5(string_view md5, Properties& properties, bool useDefaults = false) const; /** @@ -82,7 +82,7 @@ class PropertiesSet @param rom The node representing the rom file @param md5 The md5 of the property to get */ - void loadPerROM(const FSNode& rom, const string& md5); + void loadPerROM(const FSNode& rom, string_view md5); /** Prints the contents of the PropertiesSet as a flat file. @@ -90,7 +90,7 @@ class PropertiesSet void print() const; private: - using PropsList = std::map; + using PropsList = std::map>; // The properties read from an external 'stella.pro' file PropsList myExternalProps; diff --git a/src/emucore/exception/EmulationWarning.hxx b/src/emucore/exception/EmulationWarning.hxx index 3a0c0d185..9c17540bf 100644 --- a/src/emucore/exception/EmulationWarning.hxx +++ b/src/emucore/exception/EmulationWarning.hxx @@ -23,11 +23,11 @@ class EmulationWarning : public std::exception { public: - explicit EmulationWarning(const string& message) : myMessage{message} { } + explicit EmulationWarning(string_view message) : myMessage{message} { } const char* what() const noexcept override { return myMessage.c_str(); } - [[noreturn]] static void raise(const string& message) { + [[noreturn]] static void raise(string_view message) { throw EmulationWarning(message); } diff --git a/src/emucore/exception/FatalEmulationError.hxx b/src/emucore/exception/FatalEmulationError.hxx index e2a0a4353..03220e0ff 100644 --- a/src/emucore/exception/FatalEmulationError.hxx +++ b/src/emucore/exception/FatalEmulationError.hxx @@ -23,11 +23,11 @@ class FatalEmulationError : public std::exception { public: - explicit FatalEmulationError(const string& message) : myMessage{message} { } + explicit FatalEmulationError(string_view message) : myMessage{message} { } const char* what() const noexcept override { return myMessage.c_str(); } - [[noreturn]] static void raise(const string& message) { + [[noreturn]] static void raise(string_view message) { throw FatalEmulationError(message); } diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx index 7df3803c4..eab99965a 100644 --- a/src/gui/BrowserDialog.cxx +++ b/src/gui/BrowserDialog.cxx @@ -112,7 +112,7 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // static void BrowserDialog::show(GuiObject* parent, const GUI::Font& font, - const string& title, const string& startpath, + string_view title, string_view startpath, BrowserDialog::Mode mode, const Command& command, const FSNode::NameFilter& namefilter) @@ -133,7 +133,7 @@ void BrowserDialog::show(GuiObject* parent, const GUI::Font& font, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // static void BrowserDialog::show(GuiObject* parent, - const string& title, const string& startpath, + string_view title, string_view startpath, BrowserDialog::Mode mode, const Command& command, const FSNode::NameFilter& namefilter) @@ -150,7 +150,7 @@ void BrowserDialog::hide() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void BrowserDialog::show(const string& startpath, +void BrowserDialog::show(string_view startpath, BrowserDialog::Mode mode, const Command& command, const FSNode::NameFilter& namefilter) diff --git a/src/gui/BrowserDialog.hxx b/src/gui/BrowserDialog.hxx index 33d252701..442ba7072 100644 --- a/src/gui/BrowserDialog.hxx +++ b/src/gui/BrowserDialog.hxx @@ -63,7 +63,7 @@ class BrowserDialog : public Dialog @param namefilter Filter files/directories in browser display */ static void show(GuiObject* parent, const GUI::Font& font, - const string& title, const string& startpath, + string_view title,string_view startpath, BrowserDialog::Mode mode, const Command& command, const FSNode::NameFilter& namefilter = { @@ -80,7 +80,7 @@ class BrowserDialog : public Dialog @param namefilter Filter files/directories in browser display */ static void show(GuiObject* parent, - const string& title, const string& startpath, + string_view title, string_view startpath, BrowserDialog::Mode mode, const Command& command, const FSNode::NameFilter& namefilter = { @@ -96,7 +96,7 @@ class BrowserDialog : public Dialog private: /** Place the browser window onscreen, using the given attributes */ - void show(const string& startpath, + void show(string_view startpath, BrowserDialog::Mode mode, const Command& command, const FSNode::NameFilter& namefilter); diff --git a/src/gui/CommandDialog.cxx b/src/gui/CommandDialog.cxx index 90f0a8bb2..eb06702bb 100644 --- a/src/gui/CommandDialog.cxx +++ b/src/gui/CommandDialog.cxx @@ -49,7 +49,7 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent) WidgetArray wid; int xoffset = HBORDER, yoffset = VBORDER + _th; - const auto ADD_CD_BUTTON = [&](const string& label, int cmd, + const auto ADD_CD_BUTTON = [&](string_view label, int cmd, Event::Type event1 = Event::NoType, Event::Type event2 = Event::NoType) { auto* b = new ButtonWidget(this, _font, xoffset, yoffset, diff --git a/src/gui/TimeLineWidget.cxx b/src/gui/TimeLineWidget.cxx index dbc30fddc..c0cdfcd8d 100644 --- a/src/gui/TimeLineWidget.cxx +++ b/src/gui/TimeLineWidget.cxx @@ -31,7 +31,7 @@ static constexpr int HANDLE_H = 3; // size above/below the slider // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TimeLineWidget::TimeLineWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, - const string& label, uInt32 labelWidth, int cmd) + string_view label, uInt32 labelWidth, int cmd) : ButtonWidget(boss, font, x, y, w, h, label, cmd), _labelWidth{labelWidth} { diff --git a/src/gui/TimeLineWidget.hxx b/src/gui/TimeLineWidget.hxx index 492663388..33e607cdb 100644 --- a/src/gui/TimeLineWidget.hxx +++ b/src/gui/TimeLineWidget.hxx @@ -24,7 +24,7 @@ class TimeLineWidget : public ButtonWidget { public: TimeLineWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int w, int h, const string& label = "", + int x, int y, int w, int h, string_view label = "", uInt32 labelWidth = 0, int cmd = 0); void setValue(int value) override; diff --git a/src/os/unix/r77/OSystemR77.hxx b/src/os/unix/r77/OSystemR77.hxx index e0ef8689c..1ee36fc3e 100644 --- a/src/os/unix/r77/OSystemR77.hxx +++ b/src/os/unix/r77/OSystemR77.hxx @@ -49,7 +49,7 @@ class OSystemR77 : public OSystemStandalone they are free to ignore it */ void getBaseDirectories(string& basedir, string& homedir, - bool useappdir, const string& usedir) override; + bool useappdir, string_view usedir) override; private: // Following constructors and assignment operators not supported