diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-08 12:32:41 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-08 12:32:41 +0200 |
| commit | 09dd11ddf800898c00ecb04a65fb5cd10fb481fa (patch) | |
| tree | eda0b4e23d6a71da7de3a78f0bb76ec3201dd2f9 /Private/NewKit/String.hpp | |
| parent | ca83108fd138cc0398f900e6a6c0a53ad51aee31 (diff) | |
MHR-23: :boom: changes, reworked project tree.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/NewKit/String.hpp')
| -rw-r--r-- | Private/NewKit/String.hpp | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/Private/NewKit/String.hpp b/Private/NewKit/String.hpp deleted file mode 100644 index 7346c5e9..00000000 --- a/Private/NewKit/String.hpp +++ /dev/null @@ -1,76 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#pragma once - -#include <NewKit/Defines.hpp> -#include <NewKit/ErrorOr.hpp> -#include <NewKit/KernelCheck.hpp> - -namespace NewOS -{ - class StringView final - { - public: - explicit StringView() = default; - - explicit StringView(Size Sz) - : fSz(Sz) - { - MUST_PASS(Sz > 1); - fData = new Char[Sz]; - MUST_PASS(fData); - } - - ~StringView() - { - if (fData) - delete[] fData; - } - - StringView& operator=(const StringView&) = default; - StringView(const StringView&) = default; - - Char* Data(); - const Char* CData(); - 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<StringView> 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 NewOS |
