diff --git a/src/common/cstring.h b/src/common/cstring.h index fb29443ee..aeed33fb1 100644 --- a/src/common/cstring.h +++ b/src/common/cstring.h @@ -81,28 +81,28 @@ public: return std::basic_string_view{data}; } - char* begin() { + T* begin() { if (this == nullptr) { return nullptr; } return data; } - const char* begin() const { + const T* begin() const { if (this == nullptr) { return nullptr; } return data; } - char* end() { + T* end() { if (this == nullptr) { return nullptr; } return data + N; } - const char* end() const { + const T* end() const { if (this == nullptr) { return nullptr; } @@ -152,6 +152,24 @@ public: static_assert(sizeof(CString<13>) == sizeof(char[13])); // Ensure size still matches a simple array static_assert(std::weakly_incrementable::Iterator>); +/** + * @brief A null-terminated wide string with a fixed maximum length + * This class is not meant to be used as a general-purpose string class + * It is meant to be used as `char[N]` where memory layout is fixed + * @tparam N Maximum length of the string + */ +template +using CWString = CString; + +/** + * @brief A null-terminated 16-bit char string with a fixed maximum length + * This class is not meant to be used as a general-purpose string class + * It is meant to be used as `char[N]` where memory layout is fixed + * @tparam N Maximum length of the string + */ +template +using CU16String = CString; + #pragma clang diagnostic pop } // namespace Common \ No newline at end of file