Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Core::ConstexprPath< N > Class Template Reference

Fixed-size path string that supports constexpr path composition. More...

#include <Path.h>

Collaboration diagram for Engine::Core::ConstexprPath< N >:

Public Member Functions

constexpr ConstexprPath ()=default
 Creates an empty constexpr path.
constexpr ConstexprPath (const char(&literal)[N])
 Creates a constexpr path from a string literal.
constexpr std::string_view view () const
 Gets this path as a string view.
std::filesystem::path fsPath () const
 Converts this path to a filesystem path.
std::string string () const
 Converts this path to a string.
constexpr const char * c_str () const
 Gets a null-terminated character pointer.
 operator std::filesystem::path () const
 Converts this constexpr path to a filesystem path.
template<size_t M>
constexpr auto operator/ (const char(&other)[M]) const
 Appends a string literal path segment.
std::filesystem::path operator/ (const std::filesystem::path &other) const
 Appends a runtime filesystem path segment.
std::filesystem::path operator/ (std::string_view other) const
 Appends a runtime string-view path segment.

Private Attributes

std::array< char, N > path_ {}
size_t length_ = 0

Detailed Description

template<size_t N>
class Engine::Core::ConstexprPath< N >

Fixed-size path string that supports constexpr path composition.

ConstexprPath stores a string literal without dynamic allocation and can append literal path segments at compile time. Convert it to std::filesystem::path when passing it to runtime file APIs.

Template Parameters
NSize of the backing string literal, including the null terminator.

Definition at line 26 of file Path.h.

Constructor & Destructor Documentation

◆ ConstexprPath() [1/2]

template<size_t N>
Engine::Core::ConstexprPath< N >::ConstexprPath ( )
constexprdefault

Creates an empty constexpr path.

◆ ConstexprPath() [2/2]

template<size_t N>
Engine::Core::ConstexprPath< N >::ConstexprPath ( const char(&) literal[N])
inlineexplicitconstexpr

Creates a constexpr path from a string literal.

Parameters
literalNull-terminated path literal.

Definition at line 38 of file Path.h.

References length_, and path_.

Member Function Documentation

◆ c_str()

template<size_t N>
const char * Engine::Core::ConstexprPath< N >::c_str ( ) const
inlinenodiscardconstexpr

Gets a null-terminated character pointer.

Returns
Pointer to the stored path buffer.

Definition at line 74 of file Path.h.

References path_.

◆ fsPath()

template<size_t N>
std::filesystem::path Engine::Core::ConstexprPath< N >::fsPath ( ) const
inlinenodiscard

Converts this path to a filesystem path.

Returns
Runtime filesystem path.

Definition at line 56 of file Path.h.

References view().

Referenced by operator std::filesystem::path(), operator/(), and operator/().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator std::filesystem::path()

template<size_t N>
Engine::Core::ConstexprPath< N >::operator std::filesystem::path ( ) const
inline

Converts this constexpr path to a filesystem path.

Returns
Runtime filesystem path.

Definition at line 83 of file Path.h.

References fsPath().

Here is the call graph for this function:

◆ operator/() [1/3]

template<size_t N>
template<size_t M>
auto Engine::Core::ConstexprPath< N >::operator/ ( const char(&) other[M]) const
inlinenodiscardconstexpr

Appends a string literal path segment.

Template Parameters
MSize of the appended literal, including the null terminator.
Parameters
otherPath segment to append.
Returns
New constexpr path containing both segments.

Definition at line 92 of file Path.h.

References ConstexprPath, length_, and path_.

Here is the call graph for this function:

◆ operator/() [2/3]

template<size_t N>
std::filesystem::path Engine::Core::ConstexprPath< N >::operator/ ( const std::filesystem::path & other) const
inline

Appends a runtime filesystem path segment.

Parameters
otherPath segment to append.
Returns
Runtime filesystem path containing both segments.

Definition at line 119 of file Path.h.

References fsPath().

Here is the call graph for this function:

◆ operator/() [3/3]

template<size_t N>
std::filesystem::path Engine::Core::ConstexprPath< N >::operator/ ( std::string_view other) const
inline

Appends a runtime string-view path segment.

Parameters
otherPath segment to append.
Returns
Runtime filesystem path containing both segments.

Definition at line 129 of file Path.h.

References fsPath().

Here is the call graph for this function:

◆ string()

template<size_t N>
std::string Engine::Core::ConstexprPath< N >::string ( ) const
inlinenodiscard

Converts this path to a string.

Returns
Runtime string copy.

Definition at line 65 of file Path.h.

References view().

Here is the call graph for this function:

◆ view()

template<size_t N>
std::string_view Engine::Core::ConstexprPath< N >::view ( ) const
inlinenodiscardconstexpr

Gets this path as a string view.

Returns
View over the stored path characters.

Definition at line 50 of file Path.h.

References length_, and path_.

Referenced by Engine::Core::assetExists(), fsPath(), Engine::Core::operator<<(), and string().

Here is the caller graph for this function:

Member Data Documentation

◆ length_

template<size_t N>
size_t Engine::Core::ConstexprPath< N >::length_ = 0
private

Definition at line 139 of file Path.h.

Referenced by ConstexprPath(), operator/(), and view().

◆ path_

template<size_t N>
std::array<char, N> Engine::Core::ConstexprPath< N >::path_ {}
private

Definition at line 138 of file Path.h.

Referenced by c_str(), ConstexprPath(), operator/(), and view().


The documentation for this class was generated from the following file:
  • /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Files/Path.h