IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
ice::path Namespace Reference

Typedefs

template<ice::concepts::StringType StringT>
using Path = typename StringT::PathType

Functions

bool is_absolute (ice::String path) noexcept
bool is_absolute_root (ice::String path) noexcept
auto length (ice::String path) noexcept -> ice::u32
auto extension (ice::String path) noexcept -> ice::String
auto filename (ice::String path) noexcept -> ice::String
auto basename (ice::String path) noexcept -> ice::String
auto directory (ice::String path) noexcept -> ice::String
auto join (ice::HeapString<> &path, ice::String right_path) noexcept -> ice::String
 Joins two paths together if possible, the result is stored in the first first variable.
auto normalize (ice::HeapString<> &path) noexcept -> ice::String
 Normalizes the given path in using simple rules.
auto replace_filename (ice::HeapString<> &path, ice::String filename) noexcept -> ice::String
 Replaces the filename of in the path. (including the extension).
auto replace_extension (ice::HeapString<> &path, ice::String extension) noexcept -> ice::String
 Replaces the extension (if any) in the path.
bool is_absolute (ice::WString path) noexcept
bool is_absolute_root (ice::WString path) noexcept
auto length (ice::WString path) noexcept -> ice::u32
auto extension (ice::WString path) noexcept -> ice::WString
auto filename (ice::WString path) noexcept -> ice::WString
auto basename (ice::WString path) noexcept -> ice::WString
auto directory (ice::WString path) noexcept -> ice::WString
auto join (ice::HeapString< ice::wchar > &path, ice::WString right_path) noexcept -> ice::WString
auto normalize (ice::HeapString< ice::wchar > &path) noexcept -> ice::WString
auto replace_filename (ice::HeapString< ice::wchar > &path, ice::WString filename) noexcept -> ice::WString
auto replace_extension (ice::HeapString< ice::wchar > &path, ice::WString extension) noexcept -> ice::WString

Detailed Description

Copyright 2022 - 2026, Dandielo dandi.nosp@m.elo@.nosp@m.icesh.nosp@m.ard..nosp@m.net SPDX-License-Identifier: MIT

Typedef Documentation

◆ Path

template<ice::concepts::StringType StringT>
using ice::path::Path = typename StringT::PathType

Function Documentation

◆ basename() [1/2]

auto ice::path::basename ( ice::String path) -> ice::String
noexcept
Returns
The characters after the last directory separator character. (excluding the file extension)

◆ basename() [2/2]

auto ice::path::basename ( ice::WString path) -> ice::WString
noexcept

◆ directory() [1/2]

auto ice::path::directory ( ice::String path) -> ice::String
noexcept
Returns
The characters before the last directory separator character.
Note
If the path is ending with a separator character, it will only strip that character. (ex: /path/ -> /path)

◆ directory() [2/2]

auto ice::path::directory ( ice::WString path) -> ice::WString
noexcept

◆ extension() [1/2]

auto ice::path::extension ( ice::String path) -> ice::String
noexcept
Returns
The last extension part (with the dot character) or empty string if no extension was found.

◆ extension() [2/2]

auto ice::path::extension ( ice::WString path) -> ice::WString
noexcept

◆ filename() [1/2]

auto ice::path::filename ( ice::String path) -> ice::String
noexcept
Returns
The characters after the last directory separator character. (including the file extension)

◆ filename() [2/2]

auto ice::path::filename ( ice::WString path) -> ice::WString
noexcept

◆ is_absolute() [1/2]

bool ice::path::is_absolute ( ice::String path)
noexcept
Note
On windows: starts with a drive letter, on linux: checks for starting backslash.
Returns
true If the path is absolute.

◆ is_absolute() [2/2]

bool ice::path::is_absolute ( ice::WString path)
noexcept

◆ is_absolute_root() [1/2]

bool ice::path::is_absolute_root ( ice::String path)
noexcept
Returns
true If the path is just the root part. (ex. 'C:/' or '/')

◆ is_absolute_root() [2/2]

bool ice::path::is_absolute_root ( ice::WString path)
noexcept

◆ join() [1/2]

auto ice::path::join ( ice::HeapString< ice::wchar > & path,
ice::WString right_path ) -> ice::WString
noexcept

◆ join() [2/2]

auto ice::path::join ( ice::HeapString<> & path,
ice::String right_path ) -> ice::String
noexcept

Joins two paths together if possible, the result is stored in the first first variable.

Note
If the second path is an absolute path, it returns it without changes.
The resulting path may not be normalized.
Returns
The given path as a String value.

◆ length() [1/2]

auto ice::path::length ( ice::String path) -> ice::u32
noexcept
Returns
The lenght of the path.

◆ length() [2/2]

auto ice::path::length ( ice::WString path) -> ice::u32
noexcept

◆ normalize() [1/2]

auto ice::path::normalize ( ice::HeapString< ice::wchar > & path) -> ice::WString
noexcept

◆ normalize() [2/2]

auto ice::path::normalize ( ice::HeapString<> & path) -> ice::String
noexcept

Normalizes the given path in using simple rules.

Note
Replaces forward slashes with backslashes. (\ -> /)
Removes duplicate backslashes.
Resolves (if possible) all backtracking path parts. (../../)
Returns
The given path as a String value.

◆ replace_extension() [1/2]

auto ice::path::replace_extension ( ice::HeapString< ice::wchar > & path,
ice::WString extension ) -> ice::WString
noexcept

◆ replace_extension() [2/2]

auto ice::path::replace_extension ( ice::HeapString<> & path,
ice::String extension ) -> ice::String
noexcept

Replaces the extension (if any) in the path.

Note
Only replaces the last extension part.
Removes the last extension part if a empty string is provided.
Appends the given extension if no extension was found.
Returns
The given path as a String value.

◆ replace_filename() [1/2]

auto ice::path::replace_filename ( ice::HeapString< ice::wchar > & path,
ice::WString filename ) -> ice::WString
noexcept

◆ replace_filename() [2/2]

auto ice::path::replace_filename ( ice::HeapString<> & path,
ice::String filename ) -> ice::String
noexcept

Replaces the filename of in the path. (including the extension).

Returns
The given path as a String value.