10 template <
class CharT>
32 a_rhs._data =
nullptr;
46 std::is_convertible<const T&, std::basic_string_view<value_type>>,
48 std::is_convertible<const T&, const_pointer>>>,
52 const auto view =
static_cast<std::basic_string_view<value_type>
>(a_string);
62 if (
this != std::addressof(a_rhs)) {
72 if (
this != std::addressof(a_rhs)) {
75 a_rhs._data =
nullptr;
93 std::is_convertible<const T&, std::basic_string_view<value_type>>,
95 std::is_convertible<const T&, const_pointer>>>,
99 const auto view =
static_cast<std::basic_string_view<value_type>
>(a_string);
109 assert(a_pos <
size());
118 const auto proxy = get_proxy();
119 const auto cstr = proxy ? proxy->template data<value_type>() :
nullptr;
120 return cstr ? cstr : EMPTY;
125 [[nodiscard]]
constexpr operator std::basic_string_view<value_type>()
const {
return {
c_str(),
length() }; }
127 [[nodiscard]]
constexpr bool empty() const noexcept {
return size() == 0; }
131 const auto proxy = get_proxy();
132 return proxy ? proxy->size() : 0;
139 return a_lhs._data == a_rhs._data || a_lhs.empty() && a_rhs.empty();
146 if (a_lhs.
empty() && a_rhs.empty()) {
151 return strncmp(a_lhs.
c_str(), a_rhs.data(),
length) == 0;
155 [[nodiscard]]
inline friend bool operator!=(
const BSFixedString& a_lhs, std::basic_string_view<value_type> a_rhs) {
return !(a_lhs == a_rhs); }
156 [[nodiscard]]
inline friend bool operator==(std::basic_string_view<value_type> a_lhs,
const BSFixedString& a_rhs) {
return a_rhs == a_lhs; }
157 [[nodiscard]]
inline friend bool operator!=(std::basic_string_view<value_type> a_lhs,
const BSFixedString& a_rhs) {
return !(a_lhs == a_rhs); }
165 [[nodiscard]]
static inline int strncmp(
const char* a_lhs,
const char* a_rhs, std::size_t a_length)
167 return _strnicmp(a_lhs, a_rhs, a_length);
170 [[nodiscard]]
static inline int strncmp(
const wchar_t* a_lhs,
const wchar_t* a_rhs, std::size_t a_length)
172 return _wcsnicmp(a_lhs, a_rhs, a_length);
175 inline BSFixedString* ctor(
const char* a_data) {
return ctor8(a_data); }
176 inline BSFixedString* ctor(
const wchar_t* a_data) {
return ctor16(a_data); }
180 using func_t =
decltype(&BSFixedString::ctor8);
182 return func(
this, a_data);
187 using func_t =
decltype(&BSFixedString::ctor16);
189 return func(
this, a_data);
192 [[nodiscard]]
inline BSStringPool::Entry* get_proxy() noexcept
195 reinterpret_cast<BSStringPool::Entry*
>(
const_cast<pointer>(_data)) - 1 :
199 [[nodiscard]]
inline const BSStringPool::Entry* get_proxy() const noexcept
202 reinterpret_cast<const BSStringPool::Entry*
>(_data) - 1 :
206 inline void try_acquire()
208 const auto proxy = get_proxy();
216 static constexpr const value_type EMPTY[]{ 0 };
222 extern template class BSFixedString<char>;
223 extern template class BSFixedString<wchar_t>;
230 template <
class CharT>
static void release(const char *&a_entry)
Definition: BSStringPool.h:23
Definition: BSFixedString.h:12
constexpr size_type length() const noexcept
Definition: BSFixedString.h:135
friend bool operator==(std::basic_string_view< value_type > a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:156
value_type & reference
Definition: BSFixedString.h:18
constexpr BSFixedString() noexcept=default
CharT value_type
Definition: BSFixedString.h:15
BSFixedString(BSFixedString &&a_rhs)
Definition: BSFixedString.h:29
friend bool operator!=(const BSFixedString &a_lhs, std::basic_string_view< value_type > a_rhs)
Definition: BSFixedString.h:155
const_reference front() const noexcept
Definition: BSFixedString.h:113
friend bool operator!=(const BSFixedString &a_lhs, const BSFixedString &a_rhs) noexcept
Definition: BSFixedString.h:142
BSFixedString(const_pointer a_string)
Definition: BSFixedString.h:35
friend bool operator!=(std::basic_string_view< value_type > a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:157
value_type * pointer
Definition: BSFixedString.h:16
BSFixedString(const T &a_string)
Definition: BSFixedString.h:50
friend bool operator==(const BSFixedString &a_lhs, const BSFixedString &a_rhs) noexcept
Definition: BSFixedString.h:137
friend bool operator==(const BSFixedString &a_lhs, const_pointer a_rhs)
Definition: BSFixedString.h:159
BSFixedString & operator=(BSFixedString &&a_rhs)
Definition: BSFixedString.h:70
friend bool operator==(const_pointer a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:161
friend bool operator!=(const_pointer a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:162
BSFixedString & operator=(const_pointer a_string)
Definition: BSFixedString.h:80
const_reference back() const noexcept
Definition: BSFixedString.h:114
const_pointer c_str() const noexcept
Definition: BSFixedString.h:123
const value_type & const_reference
Definition: BSFixedString.h:19
BSFixedString & operator=(const T &a_string)
Definition: BSFixedString.h:97
~BSFixedString()
Definition: BSFixedString.h:58
friend bool operator==(const BSFixedString &a_lhs, std::basic_string_view< value_type > a_rhs)
Definition: BSFixedString.h:144
const_reference operator[](size_type a_pos) const noexcept
Definition: BSFixedString.h:107
const_pointer data() const noexcept
Definition: BSFixedString.h:116
const value_type * const_pointer
Definition: BSFixedString.h:17
constexpr bool empty() const noexcept
Definition: BSFixedString.h:127
BSFixedString & operator=(const BSFixedString &a_rhs)
Definition: BSFixedString.h:60
friend bool operator!=(const BSFixedString &a_lhs, const_pointer a_rhs)
Definition: BSFixedString.h:160
constexpr size_type size() const noexcept
Definition: BSFixedString.h:129
std::uint32_t size_type
Definition: BSFixedString.h:14
Definition: Relocation.h:858
Definition: AbsorbEffect.h:6
detail::BSFixedString< char > BSFixedString
Definition: BSFixedString.h:226
std::uint32_t operator()(const detail::BSFixedString< CharT > &a_key) const noexcept
Definition: BSFixedString.h:234