summaryrefslogtreecommitdiffhomepage
path: root/include/CompilerKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-12-11 13:25:12 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-12-11 13:25:12 +0100
commit37b8e34dc54f572fbfbd135742fa11c21c5e67c1 (patch)
tree94a017be79eb83306ecc6c7ca2455a7e3e242b56 /include/CompilerKit
parent30a7184205b0cbf2dfc49ed3a52543219008dc32 (diff)
chore! breaking changes in NeCTI API.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/CompilerKit')
-rw-r--r--include/CompilerKit/CodeGenerator.h8
-rw-r--r--include/CompilerKit/ErrorOr.h2
-rw-r--r--include/CompilerKit/Ref.h27
3 files changed, 19 insertions, 18 deletions
diff --git a/include/CompilerKit/CodeGenerator.h b/include/CompilerKit/CodeGenerator.h
index 8119c58..721743d 100644
--- a/include/CompilerKit/CodeGenerator.h
+++ b/include/CompilerKit/CodeGenerator.h
@@ -8,6 +8,10 @@
#include <CompilerKit/Detail/Config.h>
#include <CompilerKit/Macros.h>
+
+#include <CompilerKit/ErrorOr.h>
+#include <CompilerKit/Ref.h>
+
#include <cstring>
#define CK_ASSEMBLY_INTERFACE : public ::CompilerKit::IAssembly
@@ -42,8 +46,8 @@ class AssemblyFactory final {
Int32 Compile(STLString sourceFile, const Int32& arch) noexcept;
- void Mount(IAssembly* mountPtr) noexcept;
- IAssembly* Unmount() noexcept;
+ void Mount(WeakRef<IAssembly> mountPtr) noexcept;
+ WeakRef<IAssembly> Unmount() noexcept;
private:
IAssembly* fMounted{nullptr};
diff --git a/include/CompilerKit/ErrorOr.h b/include/CompilerKit/ErrorOr.h
index 7cc418a..1d5c2ac 100644
--- a/include/CompilerKit/ErrorOr.h
+++ b/include/CompilerKit/ErrorOr.h
@@ -17,7 +17,7 @@
#include <CompilerKit/Detail/Config.h>
#include <CompilerKit/ErrorID.h>
-#include <CompilerKit/StrongRef.h>
+#include <CompilerKit/Ref.h>
namespace CompilerKit {
using ErrorT = Int32;
diff --git a/include/CompilerKit/Ref.h b/include/CompilerKit/Ref.h
index d9b0593..c104a81 100644
--- a/include/CompilerKit/Ref.h
+++ b/include/CompilerKit/Ref.h
@@ -28,28 +28,27 @@ class StrongRef {
}
}
- NECTI_COPY_DELETE(StrongRef)
- NECTI_MOVE_DEFAULT(StrongRef)
+ NECTI_COPY_DEFAULT(StrongRef)
using Type = T;
protected:
- explicit StrongRef(Type* cls, const bool strong) : m_Class(cls), m_Strong(strong) {}
+ StrongRef(Type* cls, const bool strong) : m_Class(cls), m_Strong(strong) {}
public:
- explicit StrongRef(Type* cls) : m_Class(cls), m_Strong(true) {}
+ StrongRef(Type* cls) : m_Class(cls), m_Strong(true) {}
- StrongRef& operator=(Type ref) {
- *m_Class = ref;
+ StrongRef& operator=(Type *ref) {
+ m_Class = ref;
return *this;
}
public:
Type* operator->() const { return m_Class; }
- Type& Leak() { return *m_Class; }
+ Type* Leak() { return m_Class; }
- Type operator*() { return *m_Class; }
+ Type* operator*() { return m_Class; }
bool IsStrong() const { return m_Strong; }
@@ -61,19 +60,17 @@ class StrongRef {
};
template <typename T>
-class WeakRef final : StrongRef<T> {
+class WeakRef final : public StrongRef<T> {
public:
- WeakRef() = default;
-
+ WeakRef() = delete;
~WeakRef() = default;
- NECTI_COPY_DELETE(WeakRef)
- NECTI_MOVE_DEFAULT(WeakRef)
+ NECTI_COPY_DEFAULT(WeakRef)
public:
using Type = T;
- explicit WeakRef(Type* cls) : StrongRef<Type>(cls, false) {}
+ WeakRef(Type* cls) : StrongRef<Type>(cls, false) {}
};
/// @author Amlal El Mahrouss
@@ -82,7 +79,7 @@ template <typename Type>
class NonNullRef final {
public:
explicit NonNullRef() = delete;
- explicit NonNullRef(Type* ref) : m_Ref(ref, true) {}
+ NonNullRef(Type* ref) : m_Ref(ref, true) {}
StrongRef<Type>& operator->() {
MUST_PASS(m_Ref);