diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/file_system/object_type.hpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/buildtool/file_system/object_type.hpp b/src/buildtool/file_system/object_type.hpp index 04457582..ae307513 100644 --- a/src/buildtool/file_system/object_type.hpp +++ b/src/buildtool/file_system/object_type.hpp @@ -25,7 +25,7 @@ enum class ObjectType : std::int8_t { Symlink // non-upwards symbolic link }; -[[nodiscard]] constexpr auto FromChar(char c) -> ObjectType { +[[nodiscard]] constexpr auto FromChar(char c) noexcept -> ObjectType { switch (c) { case 'x': return ObjectType::Executable; @@ -39,7 +39,7 @@ enum class ObjectType : std::int8_t { Ensures(false); // unreachable } -[[nodiscard]] constexpr auto ToChar(ObjectType type) -> char { +[[nodiscard]] constexpr auto ToChar(ObjectType type) noexcept -> char { switch (type) { case ObjectType::File: return 'f'; @@ -53,31 +53,33 @@ enum class ObjectType : std::int8_t { Ensures(false); // unreachable } -[[nodiscard]] constexpr auto IsFileObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsFileObject(ObjectType type) noexcept -> bool { return type == ObjectType::Executable or type == ObjectType::File; } -[[nodiscard]] constexpr auto IsExecutableObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsExecutableObject(ObjectType type) noexcept + -> bool { return type == ObjectType::Executable; } -[[nodiscard]] constexpr auto IsTreeObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsTreeObject(ObjectType type) noexcept -> bool { return type == ObjectType::Tree; } /// \brief Non-upwards symlinks are designated as first-class citizens. -[[nodiscard]] constexpr auto IsSymlinkObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsSymlinkObject(ObjectType type) noexcept -> bool { return type == ObjectType::Symlink; } /// \brief Valid blob sources can be files, executables, or symlinks. -[[nodiscard]] constexpr auto IsBlobObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsBlobObject(ObjectType type) noexcept -> bool { return type == ObjectType::Executable or type == ObjectType::File or type == ObjectType::Symlink; } /// \brief Only regular files, executables, and trees are non-special entries. -[[nodiscard]] constexpr auto IsNonSpecialObject(ObjectType type) -> bool { +[[nodiscard]] constexpr auto IsNonSpecialObject(ObjectType type) noexcept + -> bool { return type == ObjectType::File or type == ObjectType::Executable or type == ObjectType::Tree; } |