diff options
author | 2021-01-06 15:17:44 -0500 | |
---|---|---|
committer | 2021-01-06 15:17:44 -0500 | |
commit | 29e96c84a89242699ec9d19a535dfdc409686266 (patch) | |
tree | 94c5611ad063282b3bc6f5240f01d17fd1a5dfd3 /src/lib/util/zippath.h | |
parent | 979b96b6cd2ae9023349f1c7528df791004e41d1 (diff) |
zippath.cpp: Checkpoint
- Adopt std::string_view as the input parameter type for most functions. (This necessitates some explicit copying to std::string since other APIs have not been updated yet.)
- Remove zippath_parent_basename, whose implementation was utterly broken and fortunately unused.
Diffstat (limited to 'src/lib/util/zippath.h')
-rw-r--r-- | src/lib/util/zippath.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/util/zippath.h b/src/lib/util/zippath.h index cf6c2249f9c..6e0e4623996 100644 --- a/src/lib/util/zippath.h +++ b/src/lib/util/zippath.h @@ -17,6 +17,7 @@ #include "unzip.h" #include <string> +#include <string_view> namespace util { @@ -31,7 +32,7 @@ public: typedef std::unique_ptr<zippath_directory> ptr; // opens a directory - static osd_file::error open(std::string const &path, ptr &directory); + static osd_file::error open(std::string_view path, ptr &directory); // closes a directory virtual ~zippath_directory(); @@ -52,12 +53,8 @@ public: // ----- path operations ----- // retrieves the parent directory -std::string &zippath_parent(std::string &dst, const std::string &path); -std::string zippath_parent(const std::string &path); - -// retrieves the parent directory basename -std::string &zippath_parent_basename(std::string &dst, const std::string &path); -std::string zippath_parent_basename(const std::string &path); +std::string &zippath_parent(std::string &dst, std::string_view path); +std::string zippath_parent(std::string_view path); // combines two paths std::string &zippath_combine(std::string &dst, const std::string &path1, const std::string &path2); @@ -67,7 +64,7 @@ std::string zippath_combine(const std::string &path1, const std::string &path2); // ----- file operations ----- // opens a zip path file -osd_file::error zippath_fopen(const std::string &filename, uint32_t openflags, util::core_file::ptr &file, std::string &revised_path); +osd_file::error zippath_fopen(std::string_view filename, uint32_t openflags, util::core_file::ptr &file, std::string &revised_path); } // namespace util |