From e0024d9ea688ee91a77abc0e28c5ea24b13ca67d Mon Sep 17 00:00:00 2001 From: Amlal Date: Mon, 28 Oct 2024 07:01:58 +0100 Subject: IMP: Refactor whole source code to make it even. - That is because previously the source was both in lowercase and lettercase. Signed-off-by: Amlal --- dev/ZKAKit/NewKit/Array.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 dev/ZKAKit/NewKit/Array.h (limited to 'dev/ZKAKit/NewKit/Array.h') diff --git a/dev/ZKAKit/NewKit/Array.h b/dev/ZKAKit/NewKit/Array.h new file mode 100644 index 00000000..31a6a6d0 --- /dev/null +++ b/dev/ZKAKit/NewKit/Array.h @@ -0,0 +1,74 @@ +/* ------------------------------------------- + + Copyright ZKA Web Services Co. + +------------------------------------------- */ + +#pragma once + +#include +#include +#include + +namespace Kernel +{ + template + class Array final + { + public: + explicit Array() + { + for (SizeT i = 0; i < N; i++) + { + if (!fArray[i]) + fArray[i] = T(); + } + } + + ~Array() = default; + + Array& operator=(const Array&) = default; + Array(const Array&) = default; + + T& operator[](const SizeT& At) + { + return fArray[At]; + } + + Boolean Empty() const + { + return No; + } + + const SizeT Capacity() + { + return N; + } + + const SizeT Count() + { + SizeT count = 0; + + for (SizeT i = 0; i < N; i++) + { + if (fArray[i]) + ++count; + } + + return count; + } + + const T* CData() + { + return fArray; + } + + operator bool() + { + return !Empty(); + } + + private: + T fArray[N]; + }; +} // namespace Kernel -- cgit v1.2.3