From 6cda526bd4efcee31b1ea7405dc46d7985ba64e6 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 4 Jan 2024 21:36:54 +0100 Subject: masm: fix assembler bug where addr1, 0x0 (add r1, 0x0) doesn't error out. cc/ccplus: minor compiler changes, will get to them very soon... refactor: rename C++Kit to CompilerKit. Signed-off-by: Amlal El Mahrouss --- CompilerKit/StdKit/String.hpp | 72 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 CompilerKit/StdKit/String.hpp (limited to 'CompilerKit/StdKit/String.hpp') diff --git a/CompilerKit/StdKit/String.hpp b/CompilerKit/StdKit/String.hpp new file mode 100644 index 0000000..592c244 --- /dev/null +++ b/CompilerKit/StdKit/String.hpp @@ -0,0 +1,72 @@ +/* + * ======================================================== + * + * CompilerKit + * Copyright Western Company, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include +#include + +namespace CompilerKit +{ + class StringView final + { + public: + StringView() = delete; + + explicit StringView(SizeType Sz) : m_Sz(Sz) + { + + } + + ~StringView() = default; + + CXXKIT_COPY_DEFAULT(StringView); + + CharType *Data(); + const CharType *CData() const; + SizeType Length() const; + + bool operator==(const CharType *rhs) const; + bool operator!=(const CharType *rhs) const; + + bool operator==(const StringView &rhs) const; + bool operator!=(const StringView &rhs) const; + + StringView &operator+=(const CharType *rhs); + StringView &operator+=(const StringView &rhs); + + operator bool() + { + return m_Data.empty() == false; + } + + bool operator!() + { + return m_Data.empty() == true; + } + + private: + std::basic_string m_Data{""}; + SizeType m_Sz{0}; + SizeType m_Cur{0}; + + friend class StringBuilder; + + }; + + struct StringBuilder final + { + static StringView Construct(const CharType *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 CompilerKit -- cgit v1.2.3