diff options
Diffstat (limited to 'Kernel/NewKit')
| -rw-r--r-- | Kernel/NewKit/ErrorOr.hpp | 2 | ||||
| -rw-r--r-- | Kernel/NewKit/Json.hxx | 10 | ||||
| -rw-r--r-- | Kernel/NewKit/New.hpp | 2 | ||||
| -rw-r--r-- | Kernel/NewKit/Ref.hpp | 5 | ||||
| -rw-r--r-- | Kernel/NewKit/String.hpp | 13 |
5 files changed, 27 insertions, 5 deletions
diff --git a/Kernel/NewKit/ErrorOr.hpp b/Kernel/NewKit/ErrorOr.hpp index 482b85e0..a528de57 100644 --- a/Kernel/NewKit/ErrorOr.hpp +++ b/Kernel/NewKit/ErrorOr.hpp @@ -34,7 +34,7 @@ namespace Kernel } explicit ErrorOr(T Class) - : mRef(Class) + : mRef(Class, true) { } diff --git a/Kernel/NewKit/Json.hxx b/Kernel/NewKit/Json.hxx index 8d4f3a8d..4b994606 100644 --- a/Kernel/NewKit/Json.hxx +++ b/Kernel/NewKit/Json.hxx @@ -15,7 +15,8 @@ #include <NewKit/String.hpp> #include <NewKit/Utils.hpp> -#define cMaxJsonPath 4096 +#define cMaxJsonPath 4096 +#define cUndefinedLen 32 namespace Kernel { @@ -24,8 +25,10 @@ namespace Kernel { public: explicit JsonType() - : Kernel::JsonType(1, 1) + : Kernel::JsonType(cUndefinedLen, cUndefinedLen) { + this->AsKey() += "undefined"; + this->AsValue() += "undefined"; } explicit JsonType(SizeT lhsLen, SizeT rhsLen) @@ -37,7 +40,10 @@ namespace Kernel NEWOS_COPY_DEFAULT(JsonType); + Bool IsUndefined() { return fUndefined; } + private: + Bool fUndefined; // is this instance undefined? StringView fKey; StringView fValue; diff --git a/Kernel/NewKit/New.hpp b/Kernel/NewKit/New.hpp index fae35f3b..eade355d 100644 --- a/Kernel/NewKit/New.hpp +++ b/Kernel/NewKit/New.hpp @@ -6,7 +6,7 @@ ------------------------------------------- */ #pragma once -#include <KernelKit/KernelHeap.hpp> +#include <KernelKit/Heap.hxx> typedef __SIZE_TYPE__ size_t; // gcc will complain about that diff --git a/Kernel/NewKit/Ref.hpp b/Kernel/NewKit/Ref.hpp index da5d6206..0b0f89cc 100644 --- a/Kernel/NewKit/Ref.hpp +++ b/Kernel/NewKit/Ref.hpp @@ -43,6 +43,11 @@ namespace Kernel return fClass; } + T& Fetch() const noexcept + { + return fClass; + } + T operator*() { return fClass; diff --git a/Kernel/NewKit/String.hpp b/Kernel/NewKit/String.hpp index cfff3e3c..7440900c 100644 --- a/Kernel/NewKit/String.hpp +++ b/Kernel/NewKit/String.hpp @@ -8,6 +8,7 @@ #include <NewKit/Defines.hpp> #include <NewKit/ErrorOr.hpp> +#include <NewKit/Utils.hpp> #include <NewKit/KernelCheck.hpp> namespace Kernel @@ -15,7 +16,15 @@ namespace Kernel class StringView final { public: - explicit StringView() = default; + explicit StringView() + { + fSz = 4096; + + fData = new Char[fSz]; + MUST_PASS(fData); + + rt_set_memory(fData, 0, fSz); + } explicit StringView(Size Sz) : fSz(Sz) @@ -23,6 +32,8 @@ namespace Kernel MUST_PASS(Sz > 1); fData = new Char[Sz]; MUST_PASS(fData); + + rt_set_memory(fData, 0, Sz); } ~StringView() |
