#pragma once #include #include #include class PathParser { public: static Result create(const char* path); PathParser(PathParser&& other); PathParser(const PathParser&) = delete; static Result join(StringView path1, StringView path2); static Result realpath(StringView path); static bool is_absolute(StringView path) { return *path.chars() == '/'; } ~PathParser(); bool is_absolute() const { return is_absolute(StringView { m_original }); } Result basename(); Result dirname(); Option next(); private: PathParser(const char* original, char* copy); const char* m_original { nullptr }; char* m_copy { nullptr }; bool m_already_called_next { false }; };