7 template <
class T, std::u
int32_t N>
28 auto mem = malloc<value_type>(size);
29 std::memset(mem, 0, size);
36 template <
class T, std::u
int32_t N>
51 if (
this != std::addressof(a_rhs)) {
59 if (
this != std::addressof(a_rhs)) {
67 return a_num > N ? 0 : _buffer;
75 std::memcpy(_buffer, a_rhs._buffer,
sizeof(
value_type) * N);
81 template <
class CharT, std::u
int32_t N,
template <
class, std::u
int32_t>
class Allocator>
85 static constexpr
auto MAX =
static_cast<std::uint16_t
>(N);
105 set_cstr(a_rhs.
c_str());
112 _capacity(a_rhs._capacity)
114 a_rhs._data =
nullptr;
126 set_cstr(a_rhs.data(), a_rhs.size());
137 if (
this != std::addressof(a_rhs)) {
139 set_cstr(a_rhs.
c_str());
146 if (
this != std::addressof(a_rhs)) {
150 a_rhs._data =
nullptr;
155 _capacity = a_rhs._capacity;
169 set_cstr(a_rhs.data(), a_rhs.size());
175 assert(a_pos <=
size());
176 return data()[a_pos];
181 assert(a_pos <=
size());
182 return data()[a_pos];
191 [[nodiscard]] constexpr
pointer data() noexcept {
return _data ? _data : EMPTY; }
196 [[nodiscard]]
operator std::basic_string_view<value_type>() const noexcept {
return {
data(),
size() }; }
198 [[nodiscard]] constexpr
bool empty() const noexcept {
return size() == 0; }
200 [[nodiscard]] constexpr
size_type size() const noexcept {
return _size != MAX ? _size :
static_cast<size_type>(traits_type::length(
data())); }
206 [[nodiscard]]
inline friend bool operator==(
const BSStringT& a_lhs,
const value_type* a_rhs) {
return (a_lhs._data == a_rhs || stricmp(a_lhs._data, a_rhs) == 0); }
212 [[nodiscard]]
inline friend bool operator==(
const BSStringT& a_lhs,
const std::string_view& a_rhs) {
return a_lhs._data == a_rhs.data() || strnicmp(a_lhs._data, a_rhs.data(), a_rhs.size()); }
213 [[nodiscard]]
inline friend bool operator!=(
const BSStringT& a_lhs,
const std::string_view& a_rhs) {
return !(a_lhs == a_rhs); }
214 [[nodiscard]]
inline friend bool operator==(
const std::string_view& a_lhs,
const BSStringT& a_rhs) {
return a_rhs == a_lhs; }
215 [[nodiscard]]
inline friend bool operator!=(
const std::string_view& a_lhs,
const BSStringT& a_rhs) {
return !(a_lhs == a_rhs); }
220 [[nodiscard]]
static int stricmp(
const char* a_lhs,
const char* a_rhs) {
return _stricmp(a_lhs, a_rhs); }
222 [[nodiscard]]
static int stricmp(
const wchar_t* a_lhs,
const wchar_t* a_rhs) {
return _wcsicmp(a_lhs, a_rhs); }
224 [[nodiscard]]
static int strnicmp(
const char* a_lhs,
const char* a_rhs, std::size_t len) {
return _strnicmp(a_lhs, a_rhs, len); }
226 [[nodiscard]]
static int strnicmp(
const wchar_t* a_lhs,
const wchar_t* a_rhs, std::size_t len) {
return _wcsnicmp(a_lhs, a_rhs, len); }
228 [[nodiscard]]
pointer allocate(std::uint32_t a_num) {
return allocator_type::allocate(a_num); }
230 void deallocate(
pointer a_ptr) { allocator_type::deallocate(a_ptr); }
234 auto len =
static_cast<std::uint16_t
>(a_len);
235 if (_data == a_str) {
240 len =
static_cast<std::uint16_t
>(traits_type::length(a_str));
243 const size_type newSize = len > MAX ? MAX : len;
245 const size_type newCap = len > MAX ? MAX : len;
247 if (len <= _capacity) {
248 traits_type::copy(_data, a_str, len);
253 const auto newData = allocate(len);
258 traits_type::copy(newData, a_str, len);
275 std::uint32_t _pad0C{ 0 };
279 static_assert(
sizeof(
BSString) == 0x10);
281 template <std::u
int32_t N>
Definition: BSString.h:283
Definition: BSString.h:83
friend bool operator!=(const BSStringT &a_lhs, const value_type *a_rhs)
Definition: BSString.h:207
BSStringT & operator=(BSStringT &&a_rhs)
Definition: BSString.h:144
BSStringT & operator=(const std::basic_string_view< value_type > &a_rhs)
Definition: BSString.h:167
friend bool operator==(const BSStringT &a_lhs, const BSStringT &a_rhs)
Definition: BSString.h:210
value_type & reference
Definition: BSString.h:92
constexpr const_reference operator[](size_type a_pos) const noexcept
Definition: BSString.h:179
CharT value_type
Definition: BSString.h:88
constexpr const_pointer c_str() const noexcept
Definition: BSString.h:194
constexpr reference operator[](size_type a_pos) noexcept
Definition: BSString.h:173
std::char_traits< value_type > traits_type
Definition: BSString.h:89
const value_type & const_reference
Definition: BSString.h:93
friend bool operator!=(const std::string_view &a_lhs, const BSStringT &a_rhs)
Definition: BSString.h:215
BSStringT(const std::string_view &a_rhs)
Definition: BSString.h:124
value_type * pointer
Definition: BSString.h:94
friend bool operator!=(const BSStringT &a_lhs, const std::string_view &a_rhs)
Definition: BSString.h:213
friend bool operator!=(const value_type *a_lhs, const BSStringT &a_rhs)
Definition: BSString.h:209
constexpr size_type length() const noexcept
Definition: BSString.h:202
constexpr const_reference back() const noexcept
Definition: BSString.h:189
constexpr bool empty() const noexcept
Definition: BSString.h:198
BSStringT & operator=(const BSStringT &a_rhs)
Definition: BSString.h:135
friend bool operator!=(const BSStringT &a_lhs, const BSStringT &a_rhs)
Definition: BSString.h:211
friend bool operator==(const BSStringT &a_lhs, const value_type *a_rhs)
Definition: BSString.h:206
BSStringT()
Definition: BSString.h:97
BSStringT(const value_type *a_rhs)
Definition: BSString.h:119
constexpr size_type size() const noexcept
Definition: BSString.h:200
Allocator< value_type, N > allocator_type
Definition: BSString.h:90
constexpr reference front() noexcept
Definition: BSString.h:185
friend bool operator==(const std::string_view &a_lhs, const BSStringT &a_rhs)
Definition: BSString.h:214
constexpr reference back() noexcept
Definition: BSString.h:188
friend bool operator==(const BSStringT &a_lhs, const std::string_view &a_rhs)
Definition: BSString.h:212
BSStringT & operator=(const_pointer a_rhs)
Definition: BSString.h:161
~BSStringT()
Definition: BSString.h:129
void clear()
Definition: BSString.h:204
const value_type * const_pointer
Definition: BSString.h:95
friend bool operator==(const value_type *a_lhs, const BSStringT &a_rhs)
Definition: BSString.h:208
constexpr pointer data() noexcept
Definition: BSString.h:191
BSStringT(BSStringT &&a_rhs)
Definition: BSString.h:108
constexpr const_pointer data() const noexcept
Definition: BSString.h:192
std::uint16_t size_type
Definition: BSString.h:91
constexpr const_reference front() const noexcept
Definition: BSString.h:186
BSStringT(const BSStringT &a_rhs)
Definition: BSString.h:102
void deallocate(value_type *a_ptr)
Definition: BSString.h:33
constexpr DynamicMemoryManagementPol() noexcept=default
value_type * allocate(std::uint32_t a_num)
Definition: BSString.h:21
T value_type
Definition: BSString.h:11
Definition: BSString.h:38
T value_type
Definition: BSString.h:40
~FixedLengthMemoryManagementPol()=default
value_type * allocate(std::uint32_t a_num)
Definition: BSString.h:65
FixedLengthMemoryManagementPol(FixedLengthMemoryManagementPol &&a_rhs)
Definition: BSString.h:45
void deallocate(value_type *)
Definition: BSString.h:70
constexpr FixedLengthMemoryManagementPol() noexcept=default
FixedLengthMemoryManagementPol & operator=(FixedLengthMemoryManagementPol &&a_rhs)
Definition: BSString.h:57
FixedLengthMemoryManagementPol & operator=(const FixedLengthMemoryManagementPol &a_rhs)
Definition: BSString.h:49
Definition: AbsorbEffect.h:6
void free(void *a_ptr)
Definition: MemoryManager.h:187
Definition: ActorValueList.h:28