30 #ifndef STRING_VIEW_HXX
31 #define STRING_VIEW_HXX
48 _data != nullptr ? strlen(_data) : 0) {}
59 static_assert(n > 0,
"");
60 return {_data, n - 1};
85 size = _data !=
nullptr ? strlen(_data) : 0;
91 return size >= needle.size &&
92 memcmp(
data, needle.data, needle.size) == 0;
97 return size == other.size &&
108 return size == other.size &&
109 strncasecmp(
data, other.data,
size) == 0;
StringView & operator=(pointer_type _data) noexcept
void StripLeft() noexcept
Skip all whitespace at the beginning.
static constexpr StringView Literal(const char(&_data)[n])
static constexpr StringView Literal()
gcc_pure pointer_type Find(char ch) const noexcept
gcc_pure bool Equals(StringView other) const noexcept
constexpr StringView(pointer_type _data, size_type _size)
const char * pointer_type
bool EqualsLiteral(const char(&other)[n]) const noexcept
gcc_pure bool StartsWith(StringView needle) const noexcept
gcc_pure bool EqualsIgnoreCase(StringView other) const noexcept
bool EqualsLiteralIgnoreCase(const char(&other)[n]) const noexcept
static constexpr StringView Empty()
StringView(pointer_type _data)
A reference to a memory area that is read-only.
StringView & operator=(std::nullptr_t) noexcept
constexpr StringView(std::nullptr_t n)
void StripRight() noexcept
Skip all whitespace at the end.
constexpr StringView(pointer_type _begin, pointer_type _end)