From da70596895d8135e08f8caac6978117697b4c021 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 18 Aug 2024 21:39:29 +0200 Subject: [REFACTOR] Improved project structure. Signed-off-by: Amlal El Mahrouss --- dev/Kernel/NewKit/String.hxx | 87 -------------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 dev/Kernel/NewKit/String.hxx (limited to 'dev/Kernel/NewKit/String.hxx') diff --git a/dev/Kernel/NewKit/String.hxx b/dev/Kernel/NewKit/String.hxx deleted file mode 100644 index 2f3d2096..00000000 --- a/dev/Kernel/NewKit/String.hxx +++ /dev/null @@ -1,87 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#pragma once - -#include -#include -#include -#include - -namespace Kernel -{ - class StringView final - { - public: - explicit StringView() - { - fSz = 4096; - - fData = new Char[fSz]; - MUST_PASS(fData); - - rt_set_memory(fData, 0, fSz); - } - - explicit StringView(Size Sz) - : fSz(Sz) - { - MUST_PASS(Sz > 1); - fData = new Char[Sz]; - MUST_PASS(fData); - - rt_set_memory(fData, 0, Sz); - } - - ~StringView() - { - if (fData) - delete[] fData; - } - - StringView& operator=(const StringView&) = default; - StringView(const StringView&) = default; - - Char* Data(); - const Char* CData() const; - Size Length() const; - - bool operator==(const Char* rhs) const; - bool operator!=(const Char* rhs) const; - - bool operator==(const StringView& rhs) const; - bool operator!=(const StringView& rhs) const; - - StringView& operator+=(const Char* rhs); - StringView& operator+=(const StringView& rhs); - - operator bool() - { - return fData; - } - - bool operator!() - { - return fData; - } - - private: - Char* fData{nullptr}; - Size fSz{0}; - Size fCur{0}; - - friend class StringBuilder; - }; - - struct StringBuilder final - { - static ErrorOr Construct(const Char* data); - static const char* FromInt(const char* fmt, int n); - 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); - }; -} // namespace Kernel -- cgit v1.2.3