aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.core/errc.ccm
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-29 17:16:22 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-29 17:16:22 +0100
commit4fa6821e0645ff61a9380cd090abff472205c630 (patch)
treebd95f13b2dc0bd9692681f50c365d2914a520bfe /nihil.core/errc.ccm
parente5180acf5f2dfac788e8c12886095ed1ac66fae5 (diff)
downloadnihil-4fa6821e0645ff61a9380cd090abff472205c630.tar.gz
nihil-4fa6821e0645ff61a9380cd090abff472205c630.tar.bz2
add clang-tidy support
Diffstat (limited to 'nihil.core/errc.ccm')
-rw-r--r--nihil.core/errc.ccm44
1 files changed, 44 insertions, 0 deletions
diff --git a/nihil.core/errc.ccm b/nihil.core/errc.ccm
new file mode 100644
index 0000000..c597faf
--- /dev/null
+++ b/nihil.core/errc.ccm
@@ -0,0 +1,44 @@
+/*
+ * This source code is released into the public domain.
+ */
+
+module;
+
+#include <string>
+#include <system_error>
+
+export module nihil.core:errc;
+
+namespace nihil {
+
+export enum struct errc {
+ no_error = 0,
+
+ /*
+ * nihil.command
+ */
+
+ incomplete_command,
+
+ /*
+ * nihil.util
+ */
+
+ // Empty string is not allowed.
+ empty_string,
+
+ // Invalid unit, e.g. in parse_size()
+ invalid_unit,
+};
+
+export [[nodiscard]] auto nihil_category() noexcept -> std::error_category &;
+export [[nodiscard]] auto make_error_condition(errc ec) -> std::error_condition;
+
+} // namespace nihil
+
+namespace std {
+
+export template<>
+struct is_error_condition_enum<nihil::errc> : true_type {};
+
+} // namespace std