diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2024-10-28 19:29:04 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2024-10-28 19:29:04 +0100 |
| commit | 0511c53e648e5f253cd9e83c9e211aa6600db377 (patch) | |
| tree | 84cabfcb7c3b77d554c6c217ff32c1c5c39d74d5 /dev/ZKAKit/NewKit | |
| parent | d5c125378d54ceaad7e34e8bac337d9b4665573e (diff) | |
META: Bumping source code.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/NewKit')
| -rw-r--r-- | dev/ZKAKit/NewKit/ErrorOr.h | 5 | ||||
| -rw-r--r-- | dev/ZKAKit/NewKit/Json.h | 12 | ||||
| -rw-r--r-- | dev/ZKAKit/NewKit/KString.h (renamed from dev/ZKAKit/NewKit/String.h) | 25 | ||||
| -rw-r--r-- | dev/ZKAKit/NewKit/Ref.h | 5 | ||||
| -rw-r--r-- | dev/ZKAKit/NewKit/Variant.h | 4 |
5 files changed, 32 insertions, 19 deletions
diff --git a/dev/ZKAKit/NewKit/ErrorOr.h b/dev/ZKAKit/NewKit/ErrorOr.h index eae5bcd1..addeb6e5 100644 --- a/dev/ZKAKit/NewKit/ErrorOr.h +++ b/dev/ZKAKit/NewKit/ErrorOr.h @@ -33,6 +33,11 @@ namespace Kernel { } + explicit ErrorOr(T* Class) + : mRef(Class) + { + } + explicit ErrorOr(T Class) : mRef(Class) { diff --git a/dev/ZKAKit/NewKit/Json.h b/dev/ZKAKit/NewKit/Json.h index 68210e00..66533885 100644 --- a/dev/ZKAKit/NewKit/Json.h +++ b/dev/ZKAKit/NewKit/Json.h @@ -12,7 +12,7 @@ #include <CompilerKit/CompilerKit.h> #include <NewKit/Defines.h> #include <NewKit/Stream.h> -#include <NewKit/String.h> +#include <NewKit/KString.h> #include <NewKit/Utils.h> #define cMaxJsonPath 4096 @@ -28,7 +28,7 @@ namespace Kernel explicit JSON() { auto len = cJSONLen; - StringView key = StringView(len); + KString key = KString(len); key += cJSONNull; this->AsKey() = key; @@ -51,20 +51,20 @@ namespace Kernel private: Bool fUndefined; // is this instance undefined? - StringView fKey; - StringView fValue; + KString fKey; + KString fValue; public: /// @brief returns the key of the json /// @return the key as string view. - StringView& AsKey() + KString& AsKey() { return fKey; } /// @brief returns the value of the json. /// @return the key as string view. - StringView& AsValue() + KString& AsValue() { return fValue; } diff --git a/dev/ZKAKit/NewKit/String.h b/dev/ZKAKit/NewKit/KString.h index 8e77b61b..65ab13e5 100644 --- a/dev/ZKAKit/NewKit/String.h +++ b/dev/ZKAKit/NewKit/KString.h @@ -16,11 +16,11 @@ namespace Kernel { - /// @brief StringView class, using dynamic or static memory. - class StringView final + /// @brief KString static string class. + class KString final { public: - explicit StringView() + explicit KString() { fDataSz = cMinimumStringSize; @@ -30,7 +30,7 @@ namespace Kernel rt_set_memory(fData, 0, fDataSz); } - explicit StringView(const SizeT& Sz) + explicit KString(const SizeT& Sz) : fDataSz(Sz) { MUST_PASS(Sz > 1); @@ -41,13 +41,16 @@ namespace Kernel rt_set_memory(fData, 0, Sz); } - ~StringView() + ~KString() { if (fData) + { delete[] fData; + fData = nullptr; + } } - ZKA_COPY_DEFAULT(StringView); + ZKA_COPY_DEFAULT(KString); Char* Data(); const Char* CData() const; @@ -56,11 +59,11 @@ namespace Kernel bool operator==(const Char* rhs) const; bool operator!=(const Char* rhs) const; - bool operator==(const StringView& rhs) const; - bool operator!=(const StringView& rhs) const; + bool operator==(const KString& rhs) const; + bool operator!=(const KString& rhs) const; - StringView& operator+=(const Char* rhs); - StringView& operator+=(const StringView& rhs); + KString& operator+=(const Char* rhs); + KString& operator+=(const KString& rhs); operator bool() { @@ -82,7 +85,7 @@ namespace Kernel struct StringBuilder final { - static ErrorOr<StringView> Construct(const Char* data); + static ErrorOr<KString> Construct(const Char* data); static const Char* FromBool(const Char* fmt, bool n); static const Char* Format(const Char* fmt, const Char* from); static bool Equals(const Char* lhs, const Char* rhs); diff --git a/dev/ZKAKit/NewKit/Ref.h b/dev/ZKAKit/NewKit/Ref.h index cc6821c0..0cd43f6e 100644 --- a/dev/ZKAKit/NewKit/Ref.h +++ b/dev/ZKAKit/NewKit/Ref.h @@ -27,6 +27,11 @@ namespace Kernel } public: + Ref(T* cls) + : fClass(cls) + { + } + Ref(T cls) : fClass(&cls) { diff --git a/dev/ZKAKit/NewKit/Variant.h b/dev/ZKAKit/NewKit/Variant.h index 92eee500..8aec9bff 100644 --- a/dev/ZKAKit/NewKit/Variant.h +++ b/dev/ZKAKit/NewKit/Variant.h @@ -7,7 +7,7 @@ #pragma once #include <NewKit/Defines.h> -#include <NewKit/String.h> +#include <NewKit/KString.h> #include <NewKit/Json.h> namespace Kernel @@ -33,7 +33,7 @@ namespace Kernel ~Variant() = default; public: - explicit Variant(StringView* stringView) + explicit Variant(KString* stringView) : fPtr((VoidPtr)stringView), fKind(VariantKind::kString) { } |
