diff options
author | 2021-01-20 17:46:03 -0500 | |
---|---|---|
committer | 2021-01-20 18:06:15 -0500 | |
commit | 91921618c2e06bd0ed073b8efccd31a127c9012d (patch) | |
tree | d3958b32d8db82540cd31083766b22991eb8e8ae /src/emu/fileio.cpp | |
parent | c691b79cce315acdfabe1901cb2b5a1e39957bc1 (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/emu/fileio.cpp')
-rw-r--r-- | src/emu/fileio.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/emu/fileio.cpp b/src/emu/fileio.cpp index 6149e65a048..a1c983da39f 100644 --- a/src/emu/fileio.cpp +++ b/src/emu/fileio.cpp @@ -135,7 +135,7 @@ bool path_iterator::next(std::string &buffer, const char *name) //------------------------------------------------- -// path_iteratr::reset - let's go again +// path_iterator::reset - let's go again //------------------------------------------------- void path_iterator::reset() @@ -255,16 +255,16 @@ emu_file::operator util::core_file &() // hash - returns the hash for a file //------------------------------------------------- -util::hash_collection &emu_file::hashes(const char *types) +util::hash_collection &emu_file::hashes(std::string_view types) { // determine the hashes we already have std::string already_have = m_hashes.hash_types(); // determine which hashes we need std::string needed; - for (const char *scan = types; *scan != 0; scan++) - if (already_have.find_first_of(*scan) == -1) - needed.push_back(*scan); + for (char scan : types) + if (already_have.find_first_of(scan) == -1) + needed.push_back(scan); // if we need nothing, skip it if (needed.empty()) @@ -298,10 +298,10 @@ util::hash_collection &emu_file::hashes(const char *types) // open - open a file by searching paths //------------------------------------------------- -osd_file::error emu_file::open(const std::string &name) +osd_file::error emu_file::open(std::string &&name) { // remember the filename and CRC info - m_filename = name; + m_filename = std::move(name); m_crc = 0; m_openflags &= ~OPEN_FLAG_HAS_CRC; @@ -310,10 +310,10 @@ osd_file::error emu_file::open(const std::string &name) return open_next(); } -osd_file::error emu_file::open(const std::string &name, u32 crc) +osd_file::error emu_file::open(std::string &&name, u32 crc) { // remember the filename and CRC info - m_filename = name; + m_filename = std::move(name); m_crc = crc; m_openflags |= OPEN_FLAG_HAS_CRC; |