diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-02-18 13:55:39 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-02-18 15:59:03 +0100 |
commit | 0b1623d07db963ecf3789aba7163321812cba88e (patch) | |
tree | 93c9e387915ef9e8e500750a32f0ff650698f9ee /include | |
parent | f21e4f264ab285817bfad1698dbb8b8b300c9ece (diff) | |
download | qpdf-0b1623d07db963ecf3789aba7163321812cba88e.tar.zst |
Add QUtil::path_basename
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QUtil.hh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 769c5fd7..dd42fe1c 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -130,14 +130,22 @@ namespace QUtil // Write the contents of filename as a binary file to the // pipeline. QPDF_DLL - void - pipe_file(char const* filename, Pipeline* p); + void pipe_file(char const* filename, Pipeline* p); // Return a function that will send the contents of the given file // through the given pipeline as binary data. QPDF_DLL - std::function<void(Pipeline*)> - file_provider(std::string const& filename); + std::function<void(Pipeline*)> file_provider(std::string const& filename); + + // Return the last path element. On Windows, either / or \ are + // path separators. Otherwise, only / is a path separator. Strip + // any trailing path separators. Then, if any path separators + // remain, return everything after the last path separator. + // Otherwise, return the whole string. As a special case, if a + // string consists entirely of path separators, the first + // character is returned. + QPDF_DLL + std::string path_basename(std::string const& filename); QPDF_DLL char* copy_string(std::string const&); |