2#include "../foray_basics.hpp"
3#include "../foray_logger.hpp"
47 Utf8Path(
const std::vector<std::string_view>& sections,
bool relative);
55 template <
typename StringViewLike>
67 operator const std::string&()
const;
69 operator const char*()
const;
71 operator std::filesystem::path()
const;
95 struct hash<
foray::osi::Utf8Path>
Utf8 encoded path wrapper.
Definition foray_env.hpp:28
static void sBuildFromSections(std::string &path, const std::vector< std::string_view > §ions)
Builds a new path string (stored to path parameter) from sections.
bool mRelative
If true, the path is a relative path.
Definition foray_env.hpp:33
bool operator==(const Utf8Path &other) const
Utf8Path()
Default constructs with empty relative path.
Utf8Path(const Utf8Path &other)
Definition foray_env.hpp:50
std::string mPath
The stored path, encoded as UTF-8.
Definition foray_env.hpp:31
Utf8Path MakeAbsolute() const
Returns this path appended to the current working directory.
bool operator>(const Utf8Path &other) const
bool operator<(const Utf8Path &other) const
Utf8Path(Utf8Path &&other)
Definition foray_env.hpp:51
Utf8Path & operator=(const Utf8Path &other)
Utf8Path & operator/=(const Utf8Path &other)
Update this paths by navigating relative to self as dictated by other.
Utf8Path(const StringViewLike &path)
Definition foray_env.hpp:56
bool IsRelative() const
Returns true, if the path is detected to be relative.
bool operator!=(const Utf8Path &other) const
void BuildSectionVector()
Updates mPathSections.
Utf8Path operator/(const Utf8Path &other) const
Combine paths, interpreted as navigating relative of this path to the other path.
void VerifyPath()
Detects absolute paths, and clears '../' and './' navigators where possible.
Utf8Path(const std::vector< std::string_view > §ions, bool relative)
Builds mPath member by concatenating mPathSections.
operator std::filesystem::path() const
Gets the internally stored path.
std::vector< std::string_view > mPathSections
Directory and file names making up this path. References sections in mPath, result of splitting by '/...
Definition foray_env.hpp:35
#define FORAY_GETTER_V(member)
Return value.
Definition foray_basics.hpp:39
#define FORAY_GETTER_CR(member)
Return constant reference.
Definition foray_basics.hpp:60
Definition foray_env.hpp:7
std::string MakeRelativePath(const std::string_view relative)
std::filesystem::path FromUtf8Path(std::string_view utf8path)
Convert UTF8 string path to absolute std::filesystem::path type.
std::string ToUtf8Path(std::filesystem::path path)
Convert std::filesystem::path type to UTF8 path.
std::string_view CurrentWorkingDirectory()
void OverrideCurrentWorkingDirectory(std::string_view path)
Definition foray_api.hpp:19
Definition foray_env.hpp:92
size_t operator()(const foray::osi::Utf8Path &p) const
Definition foray_env.hpp:97