|
LibSWOC++ 1.5.14
Solid Wall of C++
|
#include <unistd.h>#include <sys/stat.h>#include <string>#include <string_view>#include <system_error>#include <chrono>#include "swoc/swoc_version.h"#include "swoc/TextView.h"

Go to the source code of this file.
Classes | |
| struct | swoc::file::unique_fd |
| Scoped container for a file descriptor. More... | |
| class | swoc::file::path |
| class | swoc::file::file_status |
| Information about a file. More... | |
| struct | std::hash< swoc::file::path > |
| Enable use of path as a key in STL hashed containers. More... | |
Namespaces | |
| namespace | swoc |
| For template deduction guides. | |
| namespace | std |
| STL namespace. | |
Typedefs | |
| using | swoc::file::file_time_type = std::chrono::system_clock::time_point |
Enumerations | |
| enum class | file_type : signed char { none = 0 , not_found = -1 , regular = 1 , directory = 2 , symlink = 3 , block = 4 , character = 5 , fifo = 6 , socket = 7 , unknown = 8 } |
Functions | |
| file_status | swoc::file::status (path const &file, std::error_code &ec) |
| int | swoc::file::file_type (const file_status &fs) |
| Return the file type value. | |
| bool | swoc::file::is_regular_file (const file_status &fs) |
| Check if the path is to a regular file. | |
| bool | swoc::file::is_dir (const file_status &p) |
| Check if the path is to a directory. | |
| bool | swoc::file::is_char_device (const file_status &fs) |
| Check if the path is to a character device. | |
| bool | swoc::file::is_block_device (const file_status &fs) |
| Check if the path is to a block device. | |
| uintmax_t | swoc::file::file_size (const file_status &fs) |
| Size of the file or block device. | |
| bool | swoc::file::is_readable (const path &s) |
| Check if file is readable. | |
| bool | swoc::file::exists (const path &p) |
| Check if path exists. | |
| bool | swoc::file::exists (const file_status &fs) |
| Check if path exists. | |
| path | swoc::file::absolute (path const &src, std::error_code &ec) |
| path | swoc::file::temp_directory_path () |
| Directory location suitable for temporary files. | |
| path | swoc::file::current_path () |
| Current working directory. | |
| path | swoc::file::canonical (const path &p, std::error_code &ec) |
| bool | swoc::file::create_directory (const path &path, std::error_code &ec, mode_t mode) noexcept |
| bool | swoc::file::create_directories (const path &p, std::error_code &ec, mode_t mode) noexcept |
| bool | swoc::file::copy (const path &from, const path &to, std::error_code &ec) |
| bool | swoc::file::remove (path const &p, std::error_code &ec) |
| uintmax_t | swoc::file::remove_all (const path &p, std::error_code &ec) |
| file_time_type | swoc::file::modify_time (file_status const &fs) |
| file_time_type | swoc::file::last_write_time (file_status const &fs) |
| file_time_type | swoc::file::last_write_time (path const &p, std::error_code &ec) |
| file_time_type | swoc::file::access_time (file_status const &fs) |
| file_time_type | swoc::file::status_time (file_status const &fs) |
| std::string | swoc::file::load (const path &p, std::error_code &ec) |
| bool | swoc::file::operator== (path const &lhs, path const &rhs) |
| bool | swoc::file::operator!= (path const &lhs, path const &rhs) |
| path | swoc::file::operator/ (const path &lhs, const path &rhs) |
| path | swoc::file::operator/ (path &&lhs, const path &rhs) |
| path | swoc::file::operator/ (const path &lhs, std::string_view rhs) |
| path | swoc::file::operator/ (path &&lhs, std::string_view rhs) |
| BufferWriter & | swoc::bwformat (BufferWriter &w, bwf::Spec const &spec, file::path const &p) |
Simple path and file utilities.
Definition in file swoc_file.h.
| using swoc::file::file_time_type = std::chrono::system_clock::time_point |
Definition at line 24 of file swoc_file.h.
|
strong |
Definition at line 26 of file swoc_file.h.
| path swoc::file::absolute | ( | path const & | src, |
| std::error_code & | ec ) |
Convert to absolute path.
| src | Original path |
| ec | Error code. |
If path is already absolute, a copy of it is returned. Otherwise an absolute path is constructed that refers to the same item in the file system as src. If an error occurs then ec is set to indicate the type of error.
Definition at line 124 of file swoc_file.cc.
| file_time_type swoc::file::access_time | ( | file_status const & | fs | ) |
Definition at line 200 of file swoc_file.cc.
| path swoc::file::canonical | ( | const path & | p, |
| std::error_code & | ec ) |
Definition at line 251 of file swoc_file.cc.
Copy files.
| from | Source file |
| to | Destination file. |
| ec | Error code return. |
true if from was copied, false on error.Definition at line 327 of file swoc_file.cc.
|
noexcept |
Create directories.
| p | Path to directory. |
| ec | Error code return. |
| mode | Permissions for created directories. |
true if p was created, false otherwise.Definition at line 294 of file swoc_file.cc.
|
noexcept |
Create directory.
| p | Path to directory. |
| ec | Error code return. |
| mode | Permissions for created directory. |
true if p was created, false otherwise.Definition at line 272 of file swoc_file.cc.
| path swoc::file::current_path | ( | ) |
Current working directory.
Definition at line 237 of file swoc_file.cc.
|
inline |
Check if path exists.
Definition at line 525 of file swoc_file.h.
| bool swoc::file::exists | ( | const path & | p | ) |
Check if path exists.
Definition at line 117 of file swoc_file.cc.
| uintmax_t swoc::file::file_size | ( | const file_status & | fs | ) |
Size of the file or block device.
Definition at line 112 of file swoc_file.cc.
| int swoc::file::file_type | ( | const file_status & | fs | ) |
Return the file type value.
Definition at line 107 of file swoc_file.cc.
|
inline |
Check if the path is to a block device.
Definition at line 510 of file swoc_file.h.
|
inline |
Check if the path is to a character device.
Definition at line 505 of file swoc_file.h.
|
inline |
Check if the path is to a directory.
Definition at line 520 of file swoc_file.h.
| bool swoc::file::is_readable | ( | const path & | p | ) |
Check if file is readable.
Definition at line 219 of file swoc_file.cc.
|
inline |
Check if the path is to a regular file.
Definition at line 515 of file swoc_file.h.
| file_time_type swoc::file::last_write_time | ( | file_status const & | fs | ) |
Definition at line 195 of file swoc_file.cc.
| file_time_type swoc::file::last_write_time | ( | path const & | p, |
| std::error_code & | ec ) |
Modification time.
| p | Path to target. |
file_time_type::min() on error. Definition at line 210 of file swoc_file.cc.
| std::string swoc::file::load | ( | const path & | p, |
| std::error_code & | ec ) |
Load the file at p into a std::string.
| p | Path to file |
| ec | Error code result of the file operation. |
Definition at line 454 of file swoc_file.cc.
|
inline |
Definition at line 530 of file swoc_file.h.
Compare two paths.
true if lhs is not identical to rhs. Definition at line 447 of file swoc_file.h.
Combine two strings as file paths.
path with the combined path. Definition at line 456 of file swoc_file.h.
|
inline |
Combine two strings as file paths.
path with the combined path. Definition at line 474 of file swoc_file.h.
Combine two strings as file paths.
path with the combined path. Definition at line 465 of file swoc_file.h.
|
inline |
Combine two strings as file paths.
path with the combined path. Definition at line 489 of file swoc_file.h.
Compare two paths.
true if lhs is identical to rhs. Definition at line 438 of file swoc_file.h.
| bool swoc::file::remove | ( | const path & | path, |
| std::error_code & | ec ) |
Remove a file or empty directory.
| path | Target. |
| ec | Error return. |
true if the operation succeeded, false if ec has an error code. Definition at line 430 of file swoc_file.cc.
| uintmax_t swoc::file::remove_all | ( | const path & | path, |
| std::error_code & | ec ) |
Remove a file or a directory and all nested files.
| path | Target. |
| ec | Error return. |
Definition at line 375 of file swoc_file.cc.
|
noexcept |
Get the status of the file at p.
| file | Path to file. |
| ec | Error code return. |
Definition at line 92 of file swoc_file.cc.
| file_time_type swoc::file::status_time | ( | file_status const & | fs | ) |
Definition at line 205 of file swoc_file.cc.
| path swoc::file::temp_directory_path | ( | ) |
Directory location suitable for temporary files.
Definition at line 224 of file swoc_file.cc.