Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
foray::osi::Utf8Path Class Reference

Utf8 encoded path wrapper. More...

#include <foray_env.hpp>

Public Member Functions

 Utf8Path (const Utf8Path &other)
 
 Utf8Path (Utf8Path &&other)
 
Utf8Pathoperator= (const Utf8Path &other)
 
 Utf8Path ()
 Default constructs with empty relative path.
 
template<typename StringViewLike >
 Utf8Path (const StringViewLike &path)
 
Utf8Path operator/ (const Utf8Path &other) const
 Combine paths, interpreted as navigating relative of this path to the other path.
 
Utf8Pathoperator/= (const Utf8Path &other)
 Update this paths by navigating relative to self as dictated by other.
 
 operator const std::string & () const
 Gets the internally stored path.
 
 operator const char * () const
 Gets the internally stored path.
 
 operator std::filesystem::path () const
 Gets the internally stored path.
 
bool operator== (const Utf8Path &other) const
 
bool operator!= (const Utf8Path &other) const
 
bool operator< (const Utf8Path &other) const
 
bool operator> (const Utf8Path &other) const
 
bool IsRelative () const
 Returns true, if the path is detected to be relative.
 
Utf8Path MakeAbsolute () const
 Returns this path appended to the current working directory.
 

Protected Member Functions

void VerifyPath ()
 Detects absolute paths, and clears '../' and './' navigators where possible.
 
void BuildSectionVector ()
 Updates mPathSections.
 
 Utf8Path (const std::vector< std::string_view > &sections, bool relative)
 Builds mPath member by concatenating mPathSections.
 

Static Protected Member Functions

static void sBuildFromSections (std::string &path, const std::vector< std::string_view > &sections)
 Builds a new path string (stored to path parameter) from sections.
 

Protected Attributes

std::string mPath
 The stored path, encoded as UTF-8.
 
bool mRelative
 If true, the path is a relative path.
 
std::vector< std::string_view > mPathSections
 Directory and file names making up this path. References sections in mPath, result of splitting by '/'. May contain empty entries (for example absolute paths on unix systems)
 

Detailed Description

Utf8 encoded path wrapper.

Versus std::filesystem::path:

Constructor & Destructor Documentation

◆ Utf8Path() [1/5]

foray::osi::Utf8Path::Utf8Path ( const std::vector< std::string_view > &  sections,
bool  relative 
)
protected

Builds mPath member by concatenating mPathSections.

Parameters
sectionsmPathSections
relativemRelative

◆ Utf8Path() [2/5]

foray::osi::Utf8Path::Utf8Path ( const Utf8Path other)
inline

◆ Utf8Path() [3/5]

foray::osi::Utf8Path::Utf8Path ( Utf8Path &&  other)
inline

◆ Utf8Path() [4/5]

foray::osi::Utf8Path::Utf8Path ( )

Default constructs with empty relative path.

◆ Utf8Path() [5/5]

template<typename StringViewLike >
foray::osi::Utf8Path::Utf8Path ( const StringViewLike &  path)
inline

Member Function Documentation

◆ BuildSectionVector()

void foray::osi::Utf8Path::BuildSectionVector ( )
protected

Updates mPathSections.

◆ IsRelative()

bool foray::osi::Utf8Path::IsRelative ( ) const

Returns true, if the path is detected to be relative.

Detection:

  • Unix: Absolute paths begin with '/' or '~/'
  • Windows: Absolute Paths begin with '?:\' where ? is a single character wildcard

◆ MakeAbsolute()

Utf8Path foray::osi::Utf8Path::MakeAbsolute ( ) const

Returns this path appended to the current working directory.

◆ operator const char *()

foray::osi::Utf8Path::operator const char * ( ) const

Gets the internally stored path.

◆ operator const std::string &()

foray::osi::Utf8Path::operator const std::string & ( ) const

Gets the internally stored path.

◆ operator std::filesystem::path()

foray::osi::Utf8Path::operator std::filesystem::path ( ) const

Gets the internally stored path.

◆ operator!=()

bool foray::osi::Utf8Path::operator!= ( const Utf8Path other) const

◆ operator/()

Utf8Path foray::osi::Utf8Path::operator/ ( const Utf8Path other) const

Combine paths, interpreted as navigating relative of this path to the other path.

◆ operator/=()

Utf8Path & foray::osi::Utf8Path::operator/= ( const Utf8Path other)

Update this paths by navigating relative to self as dictated by other.

◆ operator<()

bool foray::osi::Utf8Path::operator< ( const Utf8Path other) const

◆ operator=()

Utf8Path & foray::osi::Utf8Path::operator= ( const Utf8Path other)

◆ operator==()

bool foray::osi::Utf8Path::operator== ( const Utf8Path other) const

◆ operator>()

bool foray::osi::Utf8Path::operator> ( const Utf8Path other) const

◆ sBuildFromSections()

static void foray::osi::Utf8Path::sBuildFromSections ( std::string &  path,
const std::vector< std::string_view > &  sections 
)
staticprotected

Builds a new path string (stored to path parameter) from sections.

◆ VerifyPath()

void foray::osi::Utf8Path::VerifyPath ( )
protected

Detects absolute paths, and clears '../' and './' navigators where possible.

Member Data Documentation

◆ mPath

std::string foray::osi::Utf8Path::mPath
protected

The stored path, encoded as UTF-8.

◆ mPathSections

std::vector<std::string_view> foray::osi::Utf8Path::mPathSections
protected

Directory and file names making up this path. References sections in mPath, result of splitting by '/'. May contain empty entries (for example absolute paths on unix systems)

◆ mRelative

bool foray::osi::Utf8Path::mRelative
protected

If true, the path is a relative path.


The documentation for this class was generated from the following file: