Added some constructors and an empty() check to path references.
This commit is contained in:
parent
1d14c1f3ff
commit
80310f3c5c
@ -45,13 +45,20 @@ struct FileInfo
|
|||||||
class PathReference
|
class PathReference
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
class FileSystemAdapter* adapter_;
|
class FileSystemAdapter* adapter_ = nullptr;
|
||||||
fs::path path_;
|
fs::path path_ = {};
|
||||||
public:
|
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(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;
|
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]] class FileSystemAdapter* getAdapter() const noexcept { return adapter_; }
|
||||||
[[nodiscard]] const fs::path& getPath() const noexcept { return path_; }
|
[[nodiscard]] const fs::path& getPath() const noexcept { return path_; }
|
||||||
[[nodiscard]] inline FileInfo getInfo() const;
|
[[nodiscard]] inline FileInfo getInfo() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user