From 80310f3c5cea8934ba668631cf0d54a4aff1066e Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Fri, 29 Dec 2023 23:32:14 +0100 Subject: [PATCH] Added some constructors and an empty() check to path references. --- source/mijin/virtual_filesystem/filesystem.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/mijin/virtual_filesystem/filesystem.hpp b/source/mijin/virtual_filesystem/filesystem.hpp index 54d70a3..bc6863b 100644 --- a/source/mijin/virtual_filesystem/filesystem.hpp +++ b/source/mijin/virtual_filesystem/filesystem.hpp @@ -45,13 +45,20 @@ struct FileInfo class PathReference { private: - class FileSystemAdapter* adapter_; - fs::path path_; + class FileSystemAdapter* adapter_ = nullptr; + fs::path path_ = {}; public: + PathReference() = default; + PathReference(const PathReference&) = default; + PathReference(PathReference&&) = default; PathReference(class FileSystemAdapter* adapter, fs::path path) noexcept : adapter_(adapter), path_(std::move(path)) {} + PathReference& operator=(const PathReference&) = default; + PathReference& operator=(PathReference&&) = default; + auto operator<=>(const PathReference& other) const noexcept = default; + [[nodiscard]] bool empty() const noexcept { return adapter_ == nullptr; } [[nodiscard]] class FileSystemAdapter* getAdapter() const noexcept { return adapter_; } [[nodiscard]] const fs::path& getPath() const noexcept { return path_; } [[nodiscard]] inline FileInfo getInfo() const;