diff options
author | 2021-01-20 17:46:03 -0500 | |
---|---|---|
committer | 2021-01-20 18:06:15 -0500 | |
commit | 91921618c2e06bd0ed073b8efccd31a127c9012d (patch) | |
tree | d3958b32d8db82540cd31083766b22991eb8e8ae /src/lib/util/zippath.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/lib/util/zippath.cpp')
-rw-r--r-- | src/lib/util/zippath.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/src/lib/util/zippath.cpp b/src/lib/util/zippath.cpp index 27e5f123576..01d708bf2e1 100644 --- a/src/lib/util/zippath.cpp +++ b/src/lib/util/zippath.cpp @@ -65,7 +65,7 @@ bool is_root(std::string_view path) // 7-zip file // ------------------------------------------------- -bool is_7z_file(std::string const &path) +bool is_7z_file(std::string_view path) { return core_filename_ends_with(path, ".7z"); } @@ -76,7 +76,7 @@ bool is_7z_file(std::string const &path) // ZIP file // ------------------------------------------------- -bool is_zip_file(std::string const &path) +bool is_zip_file(std::string_view path) { return core_filename_ends_with(path, ".zip"); } @@ -593,7 +593,7 @@ zippath_directory::~zippath_directory() // zippath_parent - retrieves the parent directory // ------------------------------------------------- -std::string &zippath_parent(std::string &dst, std::string_view path) +std::string zippath_parent(std::string_view path) { // skip over trailing path separators std::string_view::size_type pos = path.find_last_not_of(PATH_SEPARATOR); @@ -603,23 +603,9 @@ std::string &zippath_parent(std::string &dst, std::string_view path) pos = (pos > 0) ? pos - 1 : std::string_view::npos; if (pos != std::string_view::npos) - dst = std::string(path, 0, pos + 1); + return std::string(path, 0, pos + 1); else - dst = std::string(); - return dst; -} - - - -// ------------------------------------------------- -// zippath_parent - retrieves the parent directory -// ------------------------------------------------- - -std::string zippath_parent(std::string_view path) -{ - std::string result; - zippath_parent(result, path); - return result; + return std::string(); } |