Added support for completely disabling noexcept using MIJIN_TEST_NO_NOEXCEPT (for testing).
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <vector>
|
||||
#include "../container/optional.hpp"
|
||||
#include "../io/stream.hpp"
|
||||
#include "../internal/common.hpp"
|
||||
#include "../util/hash.hpp"
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
@@ -52,16 +53,16 @@ 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) MIJIN_NOEXCEPT : adapter_(adapter), path_(std::move(path)) {}
|
||||
|
||||
PathReference& operator=(const PathReference&) = default;
|
||||
PathReference& operator=(PathReference&&) = default;
|
||||
PathReference& operator=(PathReference&&) MIJIN_NOEXCEPT = default;
|
||||
|
||||
auto operator<=>(const PathReference& other) const noexcept = default;
|
||||
auto operator<=>(const PathReference& other) const MIJIN_NOEXCEPT = default;
|
||||
|
||||
[[nodiscard]] bool empty() const noexcept { return adapter_ == nullptr; }
|
||||
[[nodiscard]] bool empty() const MIJIN_NOEXCEPT { return adapter_ == nullptr; }
|
||||
[[nodiscard]] class FileSystemAdapter* getAdapter() const noexcept { return adapter_; }
|
||||
[[nodiscard]] const fs::path& getPath() const noexcept { return path_; }
|
||||
[[nodiscard]] const fs::path& getPath() const MIJIN_NOEXCEPT { return path_; }
|
||||
[[nodiscard]] inline FileInfo getInfo() const;
|
||||
[[nodiscard]] inline Optional<fs::path> getNativePath() const;
|
||||
[[nodiscard]] inline StreamError open(FileOpenMode mode, std::unique_ptr<Stream>& outStream) const;
|
||||
@@ -79,7 +80,7 @@ public:
|
||||
[[nodiscard]] virtual Optional<fs::path> getNativePath(const fs::path& /* file */) { return NULL_OPTIONAL; }
|
||||
[[nodiscard]] virtual StreamError open(const fs::path& path, FileOpenMode mode, std::unique_ptr<Stream>& outStream) = 0;
|
||||
|
||||
[[nodiscard]] PathReference getPath(fs::path path) noexcept { return PathReference(this, std::move(path)); }
|
||||
[[nodiscard]] PathReference getPath(fs::path path) MIJIN_NOEXCEPT { return PathReference(this, std::move(path)); }
|
||||
};
|
||||
|
||||
class OSFileSystemAdapter : public FileSystemAdapter
|
||||
@@ -151,7 +152,7 @@ inline std::string formatFileSize(std::size_t sizeInBytes)
|
||||
template<>
|
||||
struct std::hash<mijin::PathReference>
|
||||
{
|
||||
std::size_t operator()(const mijin::PathReference& pathRef) const noexcept
|
||||
std::size_t operator()(const mijin::PathReference& pathRef) const MIJIN_NOEXCEPT
|
||||
{
|
||||
std::size_t hash = 0;
|
||||
mijin::hashCombine(hash, pathRef.getAdapter());
|
||||
|
||||
Reference in New Issue
Block a user