CommonLibVR
GFxWStringBuffer.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace RE
4 {
6  {
7  public:
8  using value_type = wchar_t;
9  using size_type = UPInt;
11  using const_reference = const value_type&;
12 
14  {
18  ReserveHeader(wchar_t* a_buffer, UPInt a_size);
19  ~ReserveHeader() = default;
20 
23 
24  // members
25  wchar_t* buffer; // 00
26  UPInt size; // 08
27  };
28  static_assert(sizeof(ReserveHeader) == 0x10);
29 
30  template <std::uint32_t SIZE>
31  struct Reserve : public ReserveHeader
32  {
33  Reserve() :
34  ReserveHeader(buffer, SIZE)
35  {}
36 
37  // members
38  wchar_t buffer[SIZE]; // 10
39  };
40 
41  // (constructor)
45  GFxWStringBuffer(const ReserveHeader& a_reserve);
47 
48  // (destructor)
50 
51  // operator=
54  GFxWStringBuffer& operator=(const wchar_t* a_rhs);
55  GFxWStringBuffer& operator=(const std::wstring_view& a_rhs);
56 
57  // element access
60 
61  wchar_t& front();
62  [[nodiscard]] const wchar_t& front() const;
63 
64  wchar_t& back();
65  [[nodiscard]] const wchar_t& back() const;
66 
67  [[nodiscard]] const wchar_t* data() const noexcept;
68  wchar_t* data() noexcept;
69 
70  [[nodiscard]] const wchar_t* c_str() const noexcept;
71 
72  operator std::wstring_view() const noexcept;
73 
74  // Capacity
75  [[nodiscard]] bool empty() const noexcept;
76 
77  [[nodiscard]] size_type size() const noexcept;
78 
79  [[nodiscard]] size_type length() const noexcept;
80 
81  // Operations
82  void clear() noexcept;
83 
84  void resize(size_type a_count);
85 
86  protected:
87  wchar_t* alloc(size_type a_count);
88  void release();
89 
90  // members
91  wchar_t* _text; // 00
92  UPInt _length; // 08
94  private:
95  KEEP_FOR_RE()
96  };
97  static_assert(sizeof(GFxWStringBuffer) == 0x20);
98 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: GFxWStringBuffer.h:6
value_type & reference
Definition: GFxWStringBuffer.h:10
ReserveHeader _reserved
Definition: GFxWStringBuffer.h:93
const wchar_t & back() const
GFxWStringBuffer(ReserveHeader &&a_reserve)
reference operator[](size_type a_pos)
GFxWStringBuffer & operator=(const std::wstring_view &a_rhs)
GFxWStringBuffer & operator=(const wchar_t *a_rhs)
const wchar_t & front() const
GFxWStringBuffer(const ReserveHeader &a_reserve)
GFxWStringBuffer(const GFxWStringBuffer &a_rhs)
const_reference operator[](size_type a_pos) const
GFxWStringBuffer & operator=(const GFxWStringBuffer &a_rhs)
bool empty() const noexcept
size_type length() const noexcept
const value_type & const_reference
Definition: GFxWStringBuffer.h:11
UPInt _length
Definition: GFxWStringBuffer.h:92
GFxWStringBuffer(GFxWStringBuffer &&a_rhs)
const wchar_t * data() const noexcept
UPInt size_type
Definition: GFxWStringBuffer.h:9
wchar_t value_type
Definition: GFxWStringBuffer.h:8
const wchar_t * c_str() const noexcept
wchar_t * _text
Definition: GFxWStringBuffer.h:91
wchar_t * alloc(size_type a_count)
void clear() noexcept
void resize(size_type a_count)
size_type size() const noexcept
GFxWStringBuffer & operator=(GFxWStringBuffer &&a_rhs)
Definition: AbsorbEffect.h:6
std::size_t UPInt
Definition: SFTypes.h:5
Definition: EffectArchetypes.h:65
Definition: GFxWStringBuffer.h:14
ReserveHeader & operator=(const ReserveHeader &a_rhs)
ReserveHeader(ReserveHeader &&a_rhs)
UPInt size
Definition: GFxWStringBuffer.h:26
ReserveHeader(const ReserveHeader &a_rhs)
ReserveHeader & operator=(ReserveHeader &&a_rhs)
wchar_t * buffer
Definition: GFxWStringBuffer.h:25
ReserveHeader(wchar_t *a_buffer, UPInt a_size)
Definition: GFxWStringBuffer.h:32
wchar_t buffer[SIZE]
Definition: GFxWStringBuffer.h:38
Reserve()
Definition: GFxWStringBuffer.h:33