|
CommonLib
|
Typedefs | |
| template<typename T> | |
| using | hash_progress_callback_t = std::function<bool(T in_hash, uint64_t in_processed_bytes, uint64_t in_total_bytes)> |
Functions | |
| template<typename T> | |
| bool | try_compute_hash (hash::hash_provider< T > &in_hash_provider, std::ifstream &in_file, T &out_hash, bool in_from_beginning, hash_progress_callback_t< T > in_callback) |
| template<hash::hash_provider_t T> | |
| bool | try_compute_hash (std::ifstream &in_file, typename T::type &out_hash, bool in_from_beginning, hash_progress_callback_t< typename T::type > in_callback) |
| template<typename T> | |
| bool | try_compute_hash (hash::hash_provider< T > &in_hash_provider, const std::filesystem::path &in_path, T &out_hash, hash_progress_callback_t< T > in_callback) |
| template<hash::hash_provider_t T> | |
| bool | try_compute_hash (const std::filesystem::path &in_path, typename T::type &out_hash, hash_progress_callback_t< typename T::type > in_callback) |
| template<hash::hash_provider_t T> | |
| bool | compare (std::ifstream &in_left, std::ifstream &in_right, bool in_from_beginning, hash_progress_callback_t< typename T::type > in_left_callback, hash_progress_callback_t< typename T::type > in_right_callback) |
| template<hash::hash_provider_t T> | |
| bool | compare (const std::filesystem::path &in_left, const std::filesystem::path &in_right, hash_progress_callback_t< typename T::type > in_left_callback, hash_progress_callback_t< typename T::type > in_right_callback) |
| ut::encoding::encoding_type | get_encoding (const std::filesystem::path &in_path, ut::encoding::encoding_type *out_bom, bool in_native) |
| template<ut::expr::basic_string T> | |
| T | read_all_text (const std::filesystem::path &in_path) |
| template<ut::expr::any_string T, ut::encoding::encoding_type target_encoding> | |
| bool | write_all_text (const std::filesystem::path &in_path, const T &in_str, bool in_write_bom) |
| template<ut::encoding::encoding_type target_encoding, ut::expr::any_string T> | |
| bool | write_all_text (const std::filesystem::path &in_path, const T &in_str, bool in_write_bom) |
Variables | |
| constexpr uint64_t | k_optimal_buffer_size = 0x10000 |
| using hedgedev::csl::io::file::hash_progress_callback_t = std::function<bool(T in_hash, uint64_t in_processed_bytes, uint64_t in_total_bytes)> |
|
inline |
Compares the contents of two files.
| T | The provider of the hashes for the files. Uses xxHash64 by default. |
| in_left | The first file. |
| in_right | The second file. |
|
inline |
Compares the contents of two files.
| T | The provider of the hashes for the files. Uses xxHash64 by default. |
| in_left | The first file. |
| in_right | The second file. |
| in_from_beginning | Determines whether to seek to the beginning of the stream before computing the hash. The original position will be restored after completion. |
|
inline |
Gets the text encoding of a file heuristically.
| in_path | The path to the file to check. |
| out_bom | The byte order mark, if present. |
| in_native | Determines whether to transform the encoding type to the native endianness. |
|
inline |
Reads a text file into a string.
| T | The string type. If this doesn't match the file encoding, the text will be converted automatically. |
| in_path | The path to the file to read. |
|
inline |
Computes a file hash.
| T | The provider of the hash for the file. Uses xxHash64 by default. |
| in_path | The path to the file to hash. |
| out_hash | The hash of the file. |
|
inline |
Computes a file hash.
| in_hash_provider | The provider of the hash for the file. |
| in_path | The path to the file to hash. |
| out_hash | The hash of the file. |
|
inline |
Computes a file hash.
| in_hash_provider | The provider of the hash for the file. |
| in_path | The file to hash. |
| out_hash | The hash of the file. |
| in_from_beginning | Determines whether to seek to the beginning of the stream before computing the hash. The original position will be restored after completion. |
|
inline |
Computes a file hash.
| T | The provider of the hash for the file. Uses xxHash64 by default. |
| in_file | The file to hash. |
| out_hash | The hash of the file. |
| in_from_beginning | Determines whether to seek to the beginning of the stream before computing the hash. The original position will be restored after completion. |
|
inline |
Writes a string to a file.
| target_encoding | The encoding of the file. |
| T | The string type. |
| in_path | The path to the file to write. |
| in_str | The string to write to the file. |
| in_write_bom | Determines whether to write a byte order mark at the beginning of the file. This behaviour is automatically determined by the encoding type, but can be overridden if needed. Avoid writing a byte order mark for UTF-8, as it is unnecessary. |
|
inline |
Writes a string to a file.
| T | The string type. |
| target_encoding | The encoding of the file inferred from the string type. |
| in_path | The path to the file to write. |
| in_str | The string to write to the file. |
| in_write_bom | Determines whether to write a byte order mark at the beginning of the file. This behaviour is automatically determined by the encoding type, but can be overridden if needed. Avoid writing a byte order mark for UTF-8, as it is unnecessary. |
Writes a string to a file.
| target_encoding | The encoding of the file. |
| T | The string type. |
| in_path | The path to the file to write. |
| in_str | The string to write to the file. |
| in_write_bom | Determines whether to write a byte order mark at the beginning of the file. This behaviour is automatically determined by the encoding type, but can be overridden if needed. Avoid writing a byte order mark for UTF-8, as it is unnecessary. |
|
inlineconstexpr |