summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/NeKit
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/NeKit')
-rw-r--r--src/kernel/NeKit/Domain.h (renamed from src/kernel/NeKit/Nullable.h)11
-rw-r--r--src/kernel/NeKit/Function.h2
-rw-r--r--src/kernel/NeKit/Ref.h2
-rw-r--r--src/kernel/NeKit/TOML.h2
-rw-r--r--src/kernel/NeKit/Variant.h6
-rw-r--r--src/kernel/NeKit/Vettable.h8
6 files changed, 16 insertions, 15 deletions
diff --git a/src/kernel/NeKit/Nullable.h b/src/kernel/NeKit/Domain.h
index 30ce9da4..cda63ee9 100644
--- a/src/kernel/NeKit/Nullable.h
+++ b/src/kernel/NeKit/Domain.h
@@ -4,8 +4,8 @@
======================================== */
-#ifndef __NE_KIT_NULLABLE_H__
-#define __NE_KIT_NULLABLE_H__
+#ifndef __NE_KIT_DOMAIN_H__
+#define __NE_KIT_DOMAIN_H__
#include <NeKit/Config.h>
@@ -23,10 +23,15 @@ struct IsDefined<nullPtr> final {
static constexpr bool kValue = false;
};
+using NullDomain = IsDefined<nullPtr>;
+
+template <class Type>
+using Domain = IsDefined<Type>;
+
template <class Type>
concept IsAcceptable = requires() {
{ IsDefined<Type>::kValue };
};
} // namespace Kernel
-#endif // !__NE_KIT_NULLABLE_H__ \ No newline at end of file
+#endif // !__NE_KIT_DOMAIN_H__ \ No newline at end of file
diff --git a/src/kernel/NeKit/Function.h b/src/kernel/NeKit/Function.h
index f7e47973..dfa8608a 100644
--- a/src/kernel/NeKit/Function.h
+++ b/src/kernel/NeKit/Function.h
@@ -27,8 +27,6 @@ class Function final {
T operator()(Args&&... args) { return fFn(args...); }
- T Call(Args&&... args) { return fFn(args...); }
-
explicit operator bool() { return fFn; }
bool operator!() { return !fFn; }
diff --git a/src/kernel/NeKit/Ref.h b/src/kernel/NeKit/Ref.h
index 62460568..4767f728 100644
--- a/src/kernel/NeKit/Ref.h
+++ b/src/kernel/NeKit/Ref.h
@@ -12,7 +12,7 @@
#include <KernelKit/HeapMgr.h>
#include <NeKit/Config.h>
#include <NeKit/KernelPanic.h>
-#include <NeKit/Nullable.h>
+#include <NeKit/Domain.h>
#include <NeKit/Vettable.h>
namespace Kernel {
diff --git a/src/kernel/NeKit/TOML.h b/src/kernel/NeKit/TOML.h
index dee273ad..3eaf5197 100644
--- a/src/kernel/NeKit/TOML.h
+++ b/src/kernel/NeKit/TOML.h
@@ -6,6 +6,8 @@
#pragma once
+#include <NeKit/Config.h>
+
namespace Kernel {
class TOMLObject final {
public:
diff --git a/src/kernel/NeKit/Variant.h b/src/kernel/NeKit/Variant.h
index f7b2c450..5747e9ca 100644
--- a/src/kernel/NeKit/Variant.h
+++ b/src/kernel/NeKit/Variant.h
@@ -40,13 +40,9 @@ class Variant final {
: fPtr((VoidPtr) stringView), fKind(VariantKind::kString) {}
explicit Variant(JsonObject<>* json) : fPtr((VoidPtr) json), fKind(VariantKind::kJson) {}
-
explicit Variant(TOMLObject* toml) : fPtr((VoidPtr) toml), fKind(VariantKind::kTOML) {}
-
explicit Variant(nullPtr ptr) : fPtr(ptr), fKind(VariantKind::kNull) {}
-
- explicit Variant(SWAP_DISK_HEADER* ptr) : fPtr(ptr), fKind(VariantKind::kSwap) {}
-
+ explicit Variant(SwapDiskHdr* ptr) : fPtr(ptr), fKind(VariantKind::kSwap) {}
explicit Variant(VoidPtr ptr) : fPtr(ptr), fKind(VariantKind::kBlob) {}
public:
diff --git a/src/kernel/NeKit/Vettable.h b/src/kernel/NeKit/Vettable.h
index fad1f06c..d79aaa0b 100644
--- a/src/kernel/NeKit/Vettable.h
+++ b/src/kernel/NeKit/Vettable.h
@@ -39,12 +39,12 @@ struct Vettable<IVettable> final {
static constexpr bool kValue = true;
};
-using FallbackType = bool (*)(bool type_value);
+template <class Type>
+using FallbackType = Void (*)(const PropertyResult<Type>& type_value);
-/// @brief Concept version of Vettable.
-template <typename Type, FallbackType OnFallback>
+template <class Type, FallbackType<Type> OnFallback>
concept IsVettable = requires() {
- { Vettable<Type>::kValue ? TrueResult<Type>::kValue : OnFallback(PropertyResult<Type>::kValue) };
+ { Vettable<Type>::kValue ? TrueResult<Type>{} : OnFallback(PropertyResult<Type>{}) };
};
} // namespace Kernel