diff options
Diffstat (limited to 'src/common/fs/fs_util.h')
| -rw-r--r-- | src/common/fs/fs_util.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/fs/fs_util.h b/src/common/fs/fs_util.h index 1ec82eb35..1620d38c9 100644 --- a/src/common/fs/fs_util.h +++ b/src/common/fs/fs_util.h | |||
| @@ -38,6 +38,15 @@ concept IsChar = std::same_as<T, char>; | |||
| 38 | [[nodiscard]] std::u8string BufferToU8String(std::span<const u8> buffer); | 38 | [[nodiscard]] std::u8string BufferToU8String(std::span<const u8> buffer); |
| 39 | 39 | ||
| 40 | /** | 40 | /** |
| 41 | * Same as BufferToU8String, but returns a string view of the buffer. | ||
| 42 | * | ||
| 43 | * @param buffer Buffer of bytes | ||
| 44 | * | ||
| 45 | * @returns UTF-8 encoded std::u8string_view. | ||
| 46 | */ | ||
| 47 | [[nodiscard]] std::u8string_view BufferToU8StringView(std::span<const u8> buffer); | ||
| 48 | |||
| 49 | /** | ||
| 41 | * Converts a std::u8string or std::u8string_view to a UTF-8 encoded std::string. | 50 | * Converts a std::u8string or std::u8string_view to a UTF-8 encoded std::string. |
| 42 | * | 51 | * |
| 43 | * @param u8_string UTF-8 encoded u8string | 52 | * @param u8_string UTF-8 encoded u8string |
| @@ -58,6 +67,15 @@ concept IsChar = std::same_as<T, char>; | |||
| 58 | [[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer); | 67 | [[nodiscard]] std::string BufferToUTF8String(std::span<const u8> buffer); |
| 59 | 68 | ||
| 60 | /** | 69 | /** |
| 70 | * Same as BufferToUTF8String, but returns a string view of the buffer. | ||
| 71 | * | ||
| 72 | * @param buffer Buffer of bytes | ||
| 73 | * | ||
| 74 | * @returns UTF-8 encoded std::string_view. | ||
| 75 | */ | ||
| 76 | [[nodiscard]] std::string_view BufferToUTF8StringView(std::span<const u8> buffer); | ||
| 77 | |||
| 78 | /** | ||
| 61 | * Converts a filesystem path to a UTF-8 encoded std::string. | 79 | * Converts a filesystem path to a UTF-8 encoded std::string. |
| 62 | * | 80 | * |
| 63 | * @param path Filesystem path | 81 | * @param path Filesystem path |