10 template <
class CharT>
41 template <std::convertible_to<std::basic_
string_view<value_type>> T>
44 return *
this =
static_cast<std::basic_string_view<value_type>
>(std::forward<T>(a_string));
49 assert(a_pos <
size());
58 const auto proxy = get_proxy();
59 const auto cstr = proxy ? proxy->template data<value_type>() :
nullptr;
60 return cstr ? cstr : EMPTY;
65 [[nodiscard]] constexpr
operator std::basic_string_view<value_type>()
const {
return {
c_str(),
length() }; }
67 [[nodiscard]] constexpr
bool empty() const noexcept {
return size() == 0; }
71 const auto proxy = get_proxy();
72 return proxy ? proxy->size() : 0;
79 return a_lhs._data == a_rhs._data || a_lhs.empty() && a_rhs.empty();
86 if (a_lhs.
empty() && a_rhs.empty()) {
91 return strncmp(a_lhs.
c_str(), a_rhs.data(),
length) == 0;
95 [[nodiscard]]
inline friend bool operator!=(
const BSFixedString& a_lhs, std::basic_string_view<value_type> a_rhs) {
return !(a_lhs == a_rhs); }
96 [[nodiscard]]
inline friend bool operator==(std::basic_string_view<value_type> a_lhs,
const BSFixedString& a_rhs) {
return a_rhs == a_lhs; }
97 [[nodiscard]]
inline friend bool operator!=(std::basic_string_view<value_type> a_lhs,
const BSFixedString& a_rhs) {
return !(a_lhs == a_rhs); }
105 [[nodiscard]]
static inline int strncmp(
const char* a_lhs,
const char* a_rhs, std::size_t a_length)
107 return _strnicmp(a_lhs, a_rhs, a_length);
110 [[nodiscard]]
static inline int strncmp(
const wchar_t* a_lhs,
const wchar_t* a_rhs, std::size_t a_length)
112 return _wcsnicmp(a_lhs, a_rhs, a_length);
120 [[nodiscard]]
inline BSStringPool::Entry* get_proxy() noexcept
123 reinterpret_cast<BSStringPool::Entry*
>(
const_cast<pointer>(_data)) - 1 :
127 [[nodiscard]]
inline const BSStringPool::Entry* get_proxy() const noexcept
130 reinterpret_cast<const BSStringPool::Entry*
>(_data) - 1 :
137 static constexpr
const value_type EMPTY[]{ 0 };
143 extern template class BSFixedString<char>;
144 extern template class BSFixedString<wchar_t>;
151 template <
class CharT>
Definition: BSFixedString.h:12
constexpr size_type length() const noexcept
Definition: BSFixedString.h:75
friend bool operator==(std::basic_string_view< value_type > a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:96
value_type & reference
Definition: BSFixedString.h:18
constexpr BSFixedString() noexcept=default
CharT value_type
Definition: BSFixedString.h:15
BSFixedString & operator=(BSFixedString &&a_rhs) noexcept
friend bool operator!=(const BSFixedString &a_lhs, std::basic_string_view< value_type > a_rhs)
Definition: BSFixedString.h:95
const_reference front() const noexcept
Definition: BSFixedString.h:53
friend bool operator!=(const BSFixedString &a_lhs, const BSFixedString &a_rhs) noexcept
Definition: BSFixedString.h:82
friend bool operator!=(std::basic_string_view< value_type > a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:97
value_type * pointer
Definition: BSFixedString.h:16
friend bool operator==(const BSFixedString &a_lhs, const BSFixedString &a_rhs) noexcept
Definition: BSFixedString.h:77
friend bool operator==(const BSFixedString &a_lhs, const_pointer a_rhs)
Definition: BSFixedString.h:99
friend bool operator==(const_pointer a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:101
friend bool operator!=(const_pointer a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:102
BSFixedString & operator=(std::basic_string_view< value_type > a_view)
const_reference back() const noexcept
Definition: BSFixedString.h:54
const_pointer c_str() const noexcept
Definition: BSFixedString.h:63
BSFixedString & operator=(T &&a_string)
Definition: BSFixedString.h:42
BSFixedString & operator=(const_pointer a_string)
const value_type & const_reference
Definition: BSFixedString.h:19
friend bool operator==(const BSFixedString &a_lhs, std::basic_string_view< value_type > a_rhs)
Definition: BSFixedString.h:84
const_reference operator[](size_type a_pos) const noexcept
Definition: BSFixedString.h:47
const_pointer data() const noexcept
Definition: BSFixedString.h:56
const value_type * const_pointer
Definition: BSFixedString.h:17
constexpr bool empty() const noexcept
Definition: BSFixedString.h:67
friend bool operator!=(const BSFixedString &a_lhs, const_pointer a_rhs)
Definition: BSFixedString.h:100
constexpr size_type size() const noexcept
Definition: BSFixedString.h:69
std::uint32_t size_type
Definition: BSFixedString.h:14
BSFixedString & operator=(const BSFixedString &a_rhs)
Definition: AbsorbEffect.h:6
detail::BSFixedString< char > BSFixedString
Definition: BSFixedString.h:147
Definition: NiBinaryStream.h:94
std::uint32_t operator()(const detail::BSFixedString< CharT > &a_key) const noexcept
Definition: BSFixedString.h:155