xentara-utils v2.0.4
The Xentara Utility Library
|
File systen tools. More...
Namespaces | |
namespace | path |
Filesystem path functionality. | |
Classes | |
class | StandardPathIterator |
An iterator that traverses all directories in a standard system search path. More... | |
Enumerations | |
enum class | StandardPath { Config , Data } |
Standard system search paths. More... | |
Functions | |
auto | replace (const std::filesystem::path &oldPath, const std::filesystem::path &newPath) -> void |
Replaces one file with another, preserving the properties. | |
auto | replace (const std::filesystem::path &oldPath, const std::filesystem::path &newPath, std::error_code &errorCode) noexcept -> void |
Replaces one file with another, preserving the properties. | |
auto | begin (StandardPath path) -> StandardPathIterator |
Gets a begin iterator for a standard path. | |
auto | end (StandardPath) -> std::default_sentinel_t |
Gets an end iterator for a standard path. | |
String Conversion | |
template<tools::CharType Char, typename CharTraits = std::char_traits<Char>, typename Allocator = std::allocator<Char>> | |
auto | toBasicString (const std::filesystem::path &path, const Allocator &allocator=Allocator()) -> decltype(auto) |
Converts a path to a string. | |
auto | toString (const std::filesystem::path &path) -> decltype(auto) |
Converts a path to a string of type char | |
auto | toWString (const std::filesystem::path &path) -> decltype(auto) |
Converts a path to a string of type wchar_t | |
auto | toU8String (const std::filesystem::path &path) -> decltype(auto) |
Converts a path to a string of type char8_t | |
auto | toU16String (const std::filesystem::path &path) -> decltype(auto) |
Converts a path to a string of type char16_t | |
auto | toU32String (const std::filesystem::path &path) -> decltype(auto) |
Converts a path to a string of type char32_t | |
File systen tools.
This namespace contains facilities used for file system access in conjunbction with the std::filesystem namespace.
|
strong |
Standard system search paths.
This iterator supplies freestanding [begin()](xentara::utils::windows::wmi::begin(StandardPath)) and [end()](xentara::utils::windows::wmi::end(StandardPath)) functions, so they can be used in range-based for loops to iterate over the directories in the path without manually creating a StandardPathIterator:
#include <xentara/utils/filesystem/StandardPathIterator.hpp>
Enumerator | |
---|---|
Config | Search path for configuration files. |
Data | Search path for data files. |
auto begin | ( | StandardPath | path | ) | -> StandardPathIterator |
Gets a begin iterator for a standard path.
This function enables the use of StandardPath in range-based for loops
#include <xentara/utils/filesystem/StandardPathIterator.hpp>
path | The type of path to iterate over |
auto end | ( | StandardPath | ) | -> std::default_sentinel_t |
Gets an end iterator for a standard path.
This function enables the use of StandardPath in range-based for loops
#include <xentara/utils/filesystem/StandardPathIterator.hpp>
auto xentara::utils::filesystem::replace | ( | const std::filesystem::path & | oldPath, |
const std::filesystem::path & | newPath | ||
) | -> void |
Replaces one file with another, preserving the properties.
This function renames the file oldPath to newPath similar to std::filesystem::rename(). However, the file will inherit all properties, like creation time, access mode, etc., from an existing file already located at newPath.
#include <xentara/utils/filesystem/replace.hpp>
oldPath | The current path of the file |
newPath | The new path for the file. If there is already a file with this path, it is overwritten, and the new file assumes its properties. |
|
noexcept |
Replaces one file with another, preserving the properties.
This function renames the file oldPath to newPath similar to std::filesystem::rename(). However, the file will inherit all properties, like creation time, access mode, etc., from an existing file already located at newPath.
#include <xentara/utils/filesystem/replace.hpp>
oldPath | The current path of the file |
newPath | The new path for the file. If there is already a file with this path, it is overwritten, and the new file assumes its properties. |
errorCode | Receives the error code on error. On success, errorCode.clear() is called. |
auto xentara::utils::filesystem::toBasicString | ( | const std::filesystem::path & | path, |
const Allocator & | allocator = Allocator() |
||
) | -> decltype(auto) |
Converts a path to a string.
This function converts the path to a human readable string. The string always uses the preperred path separator.
#include <xentara/utils/filesystem/toString.hpp>
path | The path |
allocator | The allocator to use for the returned string |
auto xentara::utils::filesystem::toString | ( | const std::filesystem::path & | path | ) | -> decltype(auto) |
Converts a path to a string of type char
This function converts the path to a human readable string. The string always uses the preperred path separator.
#include <xentara/utils/filesystem/toString.hpp>
path | The path |
auto xentara::utils::filesystem::toU16String | ( | const std::filesystem::path & | path | ) | -> decltype(auto) |
Converts a path to a string of type char16_t
This function converts the path to a human readable string. The string always uses the preperred path separator.
#include <xentara/utils/filesystem/toString.hpp>
path | The path |
auto xentara::utils::filesystem::toU32String | ( | const std::filesystem::path & | path | ) | -> decltype(auto) |
Converts a path to a string of type char32_t
This function converts the path to a human readable string. The string always uses the preperred path separator.
#include <xentara/utils/filesystem/toString.hpp>
path | The path |
auto xentara::utils::filesystem::toU8String | ( | const std::filesystem::path & | path | ) | -> decltype(auto) |
Converts a path to a string of type char8_t
This function converts the path to a human readable string. The string always uses the preperred path separator.
#include <xentara/utils/filesystem/toString.hpp>
path | The path |
auto xentara::utils::filesystem::toWString | ( | const std::filesystem::path & | path | ) | -> decltype(auto) |
Converts a path to a string of type wchar_t
This function converts the path to a human readable string. The string always uses the preperred path separator.
#include <xentara/utils/filesystem/toString.hpp>
path | The path |