aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.ucl/object.ccm
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-27 12:08:58 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-27 12:08:58 +0100
commit001c9917ace09f7b1c80d96eb067e1d37e86c546 (patch)
tree89e360961b9659a8c6b897c5412b7d6834b8eed9 /nihil.ucl/object.ccm
parent90aa957ca9b7c217af7569009d1675e0f3ff8e9b (diff)
downloadnihil-001c9917ace09f7b1c80d96eb067e1d37e86c546.tar.gz
nihil-001c9917ace09f7b1c80d96eb067e1d37e86c546.tar.bz2
improve error handling
Diffstat (limited to 'nihil.ucl/object.ccm')
-rw-r--r--nihil.ucl/object.ccm24
1 files changed, 13 insertions, 11 deletions
diff --git a/nihil.ucl/object.ccm b/nihil.ucl/object.ccm
index 9b48256..40f2088 100644
--- a/nihil.ucl/object.ccm
+++ b/nihil.ucl/object.ccm
@@ -16,11 +16,9 @@ module;
#include <ucl.h>
-import nihil;
-
export module nihil.ucl:object;
-import :error;
+import nihil;
import :type;
namespace nihil::ucl {
@@ -56,22 +54,24 @@ export struct object {
auto operator=(this object &self, object const &other) -> object &;
// Increase the refcount of this object.
- auto ref(this object const &self) -> object;
+ [[nodiscard]] auto ref(this object const &self) -> object;
// Return the type of this object.
- auto type(this object const &self) -> object_type;
+ [[nodiscard]] auto type(this object const &self) -> object_type;
// Return the underlying object.
- auto get_ucl_object(this object &self) -> ::ucl_object_t *;
+ [[nodiscard]] auto get_ucl_object(this object &self)
+ -> ::ucl_object_t *;
- auto get_ucl_object(this object const &self) -> ::ucl_object_t const *;
+ [[nodiscard]] auto get_ucl_object(this object const &self)
+ -> ::ucl_object_t const *;
// Return the key of this object.
- auto key(this object const &self) -> std::string_view;
+ [[nodiscard]] auto key(this object const &self) -> std::string_view;
protected:
// The object we're wrapping.
- ::ucl_object_t *_object = nullptr;
+ ::ucl_object_t *m_object = nullptr;
friend auto swap(object &a, object &b) -> void;
};
@@ -80,8 +80,10 @@ protected:
* Object comparison.
*/
-export auto operator==(object const &lhs, object const &rhs) -> bool;
-export auto operator<=>(object const &lhs, object const &rhs)
+export [[nodiscard]] auto operator==(object const &lhs, object const &rhs)
+ -> bool;
+
+export [[nodiscard]] auto operator<=>(object const &lhs, object const &rhs)
-> std::strong_ordering;
} // namespace nihil::ucl