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); }
164 [[nodiscard]]
inline bool contains(std::basic_string_view<value_type> a_rhs)
const
166 if (a_rhs.length() >
length()) {
170 if (strncmp(&
c_str()[i], a_rhs.data(), a_rhs.length()) == 0) {
178 [[nodiscard]]
static inline int strncmp(
const char* a_lhs,
const char* a_rhs, std::size_t a_length)
180 return _strnicmp(a_lhs, a_rhs, a_length);
183 [[nodiscard]]
static inline int strncmp(
const wchar_t* a_lhs,
const wchar_t* a_rhs, std::size_t a_length)
185 return _wcsnicmp(a_lhs, a_rhs, a_length);
188 inline BSFixedString* ctor(
const char* a_data) {
return ctor8(a_data); }
189 inline BSFixedString* ctor(
const wchar_t* a_data) {
return ctor16(a_data); }
193 using func_t = decltype(&BSFixedString::ctor8);
195 return func(
this, a_data);
200 using func_t = decltype(&BSFixedString::ctor16);
202 return func(
this, a_data);
205 [[nodiscard]]
inline BSStringPool::Entry* get_proxy() noexcept
208 reinterpret_cast<BSStringPool::Entry*
>(
const_cast<pointer>(_data)) - 1 :
212 [[nodiscard]]
inline const BSStringPool::Entry* get_proxy() const noexcept
215 reinterpret_cast<const BSStringPool::Entry*
>(_data) - 1 :
219 inline void try_acquire()
221 const auto proxy = get_proxy();
229 static constexpr
const value_type EMPTY[]{ 0 };
235 extern template class BSFixedString<char>;
236 extern template class BSFixedString<wchar_t>;
243 template <
class CharT>
#define RELOCATION_ID(SE, AE)
Definition: PCH.h:505
Definition: Relocation.h:210
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
BSFixedString(BSFixedString &&a_rhs) noexcept
Definition: BSFixedString.h:29
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
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
friend bool operator==(const_pointer a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:161
bool contains(std::basic_string_view< value_type > a_rhs) const
Definition: BSFixedString.h:164
friend bool operator!=(const_pointer a_lhs, const BSFixedString &a_rhs)
Definition: BSFixedString.h:162
const_reference back() const noexcept
Definition: BSFixedString.h:114
const_pointer c_str() const noexcept
Definition: BSFixedString.h:123
BSFixedString & operator=(const_pointer a_string)
Definition: BSFixedString.h:80
const value_type & const_reference
Definition: BSFixedString.h:19
~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
BSFixedString & operator=(BSFixedString &&a_rhs)
Definition: BSFixedString.h:70
constexpr bool empty() const noexcept
Definition: BSFixedString.h:127
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
BSFixedString & operator=(const T &a_string)
Definition: BSFixedString.h:97
BSFixedString & operator=(const BSFixedString &a_rhs)
Definition: BSFixedString.h:60
Definition: AbsorbEffect.h:6
detail::BSFixedString< char > BSFixedString
Definition: BSFixedString.h:239
std::uint32_t operator()(const detail::BSFixedString< CharT > &a_key) const noexcept
Definition: BSFixedString.h:247