Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
string_view_template.h
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
8#define CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
9
10#include <ctype.h>
11
12#include <algorithm>
13#include <iterator>
14#include <type_traits>
15
16#include "core/fxcrt/fx_memcpy_wrappers.h"
17#include "core/fxcrt/fx_system.h"
18#include "third_party/abseil-cpp/absl/types/optional.h"
19#include "third_party/base/containers/span.h"
20
21namespace fxcrt {
22
23// An immutable string with caller-provided storage which must outlive the
24// string itself. These are not necessarily nul-terminated, so that substring
25// extraction (via the Substr(), First(), and Last() methods) is copy-free.
26//
27// String view arguments should be passed by value, since they are small,
28// rather than const-ref, even if they are not modified.
29//
30// Front() and Back() tolerate empty strings and must return NUL in those
31// cases. Substr(), First(), and Last() tolerate out-of-range indices and
32// must return an empty string view in those cases. The aim here is allowing
33// callers to avoid range-checking first.
34template <typename T>
36 public:
37 using CharType = T;
38 using UnsignedType = typename std::make_unsigned<CharType>::type;
39 using const_iterator = const CharType*;
40 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
41
42 constexpr StringViewTemplate() noexcept = default;
43 constexpr StringViewTemplate(const StringViewTemplate& src) noexcept =
44 default;
45
46 // Deliberately implicit to avoid calling on every string literal.
47 // NOLINTNEXTLINE(runtime/explicit)
48 StringViewTemplate(const CharType* ptr) noexcept
49 : m_Span(reinterpret_cast<const UnsignedType*>(ptr),
50 ptr ? FXSYS_len(ptr) : 0) {}
51
52 constexpr StringViewTemplate(const CharType* ptr, size_t size) noexcept
53 : m_Span(reinterpret_cast<const UnsignedType*>(ptr), size) {}
54
55 template <typename E = typename std::enable_if<
57 constexpr StringViewTemplate(const UnsignedType* ptr, size_t size) noexcept
58 : m_Span(ptr, size) {}
59
60 explicit constexpr StringViewTemplate(
61 const pdfium::span<const CharType>& other) noexcept
62 : m_Span(!other.empty()
63 ? reinterpret_cast<const UnsignedType*>(other.data())
64 : nullptr,
65 other.size()) {}
66
67 template <typename E = typename std::enable_if<
70 const pdfium::span<const UnsignedType>& other) noexcept
71 : m_Span(!other.empty() ? other.data() : nullptr, other.size()) {}
72
73 // Deliberately implicit to avoid calling on every char literal.
74 // |ch| must be an lvalue that outlives the StringViewTemplate.
75 // NOLINTNEXTLINE(runtime/explicit)
76 constexpr StringViewTemplate(const CharType& ch) noexcept
77 : m_Span(reinterpret_cast<const UnsignedType*>(&ch), 1u) {}
78
79 StringViewTemplate& operator=(const CharType* src) {
80 m_Span = pdfium::span<const UnsignedType>(
81 reinterpret_cast<const UnsignedType*>(src), src ? FXSYS_len(src) : 0);
82 return *this;
83 }
84
86 m_Span = src.m_Span;
87 return *this;
88 }
89
90 const_iterator begin() const {
91 return reinterpret_cast<const_iterator>(m_Span.begin());
92 }
93 const_iterator end() const {
94 return reinterpret_cast<const_iterator>(m_Span.end());
95 }
96 const_reverse_iterator rbegin() const {
97 return const_reverse_iterator(end());
98 }
99 const_reverse_iterator rend() const {
100 return const_reverse_iterator(begin());
101 }
102
103 bool operator==(const StringViewTemplate& other) const {
104 return std::equal(m_Span.begin(), m_Span.end(), other.m_Span.begin(),
105 other.m_Span.end());
106 }
107 bool operator==(const CharType* ptr) const {
108 StringViewTemplate other(ptr);
109 return *this == other;
110 }
111 bool operator!=(const CharType* ptr) const { return !(*this == ptr); }
112 bool operator!=(const StringViewTemplate& other) const {
113 return !(*this == other);
114 }
115
116 bool IsASCII() const {
117 for (auto c : *this) {
118 if (c <= 0 || c > 127) // Questionable signedness of |c|.
119 return false;
120 }
121 return true;
122 }
123
124 bool EqualsASCII(const StringViewTemplate<char>& that) const {
125 size_t length = GetLength();
126 if (length != that.GetLength())
127 return false;
128
129 for (size_t i = 0; i < length; ++i) {
130 auto c = (*this)[i];
131 if (c <= 0 || c > 127 || c != that[i]) // Questionable signedness of |c|.
132 return false;
133 }
134 return true;
135 }
136
137 bool EqualsASCIINoCase(const StringViewTemplate<char>& that) const {
138 size_t length = GetLength();
139 if (length != that.GetLength())
140 return false;
141
142 for (size_t i = 0; i < length; ++i) {
143 auto c = (*this)[i];
144 if (c <= 0 || c > 127 || tolower(c) != tolower(that[i]))
145 return false;
146 }
147 return true;
148 }
149
150 uint32_t GetID() const {
151 if (m_Span.empty())
152 return 0;
153
154 uint32_t strid = 0;
155 size_t size = std::min(static_cast<size_t>(4), m_Span.size());
156 for (size_t i = 0; i < size; i++)
157 strid = strid * 256 + m_Span[i];
158
159 return strid << ((4 - size) * 8);
160 }
161
162 pdfium::span<const UnsignedType> raw_span() const { return m_Span; }
163 pdfium::span<const CharType> span() const {
164 return pdfium::make_span(reinterpret_cast<const CharType*>(m_Span.data()),
165 m_Span.size());
166 }
167 const UnsignedType* raw_str() const { return m_Span.data(); }
168 const CharType* unterminated_c_str() const {
169 return reinterpret_cast<const CharType*>(m_Span.data());
170 }
171
172 size_t GetLength() const { return m_Span.size(); }
173 bool IsEmpty() const { return m_Span.empty(); }
174 bool IsValidIndex(size_t index) const { return index < m_Span.size(); }
175 bool IsValidLength(size_t length) const { return length <= m_Span.size(); }
176
177 const UnsignedType& operator[](const size_t index) const {
178 return m_Span[index];
179 }
180
181 UnsignedType Front() const { return !m_Span.empty() ? m_Span[0] : 0; }
182 UnsignedType Back() const {
183 return !m_Span.empty() ? m_Span[m_Span.size() - 1] : 0;
184 }
185
186 CharType CharAt(const size_t index) const {
187 return static_cast<CharType>(m_Span[index]);
188 }
189
190 absl::optional<size_t> Find(CharType ch) const {
191 const auto* found = reinterpret_cast<const UnsignedType*>(FXSYS_chr(
192 reinterpret_cast<const CharType*>(m_Span.data()), ch, m_Span.size()));
193
194 return found ? absl::optional<size_t>(found - m_Span.data())
195 : absl::nullopt;
196 }
197
198 bool Contains(CharType ch) const { return Find(ch).has_value(); }
199
200 StringViewTemplate Substr(size_t offset) const {
201 // Unsigned underflow is well-defined and out-of-range is handled by
202 // Substr().
203 return Substr(offset, GetLength() - offset);
204 }
205
206 StringViewTemplate Substr(size_t first, size_t count) const {
207 if (!m_Span.data())
208 return StringViewTemplate();
209
210 if (!IsValidIndex(first))
211 return StringViewTemplate();
212
213 if (count == 0 || !IsValidLength(count))
214 return StringViewTemplate();
215
216 if (!IsValidIndex(first + count - 1))
217 return StringViewTemplate();
218
219 return StringViewTemplate(m_Span.subspan(first, count));
220 }
221
222 StringViewTemplate First(size_t count) const {
223 return Substr(0, count);
224 }
225
226 StringViewTemplate Last(size_t count) const {
227 // Unsigned underflow is well-defined and out-of-range is handled by
228 // Substr().
229 return Substr(GetLength() - count, count);
230 }
231
232 StringViewTemplate TrimmedRight(CharType ch) const {
233 if (IsEmpty())
234 return StringViewTemplate();
235
236 size_t pos = GetLength();
237 while (pos && CharAt(pos - 1) == ch)
238 pos--;
239
240 if (pos == 0)
241 return StringViewTemplate();
242
243 return StringViewTemplate(m_Span.data(), pos);
244 }
245
246 bool operator<(const StringViewTemplate& that) const {
247 int result =
248 FXSYS_cmp(reinterpret_cast<const CharType*>(m_Span.data()),
249 reinterpret_cast<const CharType*>(that.m_Span.data()),
250 std::min(m_Span.size(), that.m_Span.size()));
251 return result < 0 || (result == 0 && m_Span.size() < that.m_Span.size());
252 }
253
254 bool operator>(const StringViewTemplate& that) const {
255 int result =
256 FXSYS_cmp(reinterpret_cast<const CharType*>(m_Span.data()),
257 reinterpret_cast<const CharType*>(that.m_Span.data()),
258 std::min(m_Span.size(), that.m_Span.size()));
259 return result > 0 || (result == 0 && m_Span.size() > that.m_Span.size());
260 }
261
262 protected:
263 pdfium::span<const UnsignedType> m_Span;
264
265 private:
266 void* operator new(size_t) throw() { return nullptr; }
267};
268
269template <typename T>
270inline bool operator==(const T* lhs, const StringViewTemplate<T>& rhs) {
271 return rhs == lhs;
272}
273template <typename T>
274inline bool operator!=(const T* lhs, const StringViewTemplate<T>& rhs) {
275 return rhs != lhs;
276}
277template <typename T>
278inline bool operator<(const T* lhs, const StringViewTemplate<T>& rhs) {
279 return rhs > lhs;
280}
281
282extern template class StringViewTemplate<char>;
283extern template class StringViewTemplate<wchar_t>;
284
285using ByteStringView = StringViewTemplate<char>;
286using WideStringView = StringViewTemplate<wchar_t>;
287
288} // namespace fxcrt
289
290using ByteStringView = fxcrt::ByteStringView;
291using WideStringView = fxcrt::WideStringView;
292
293#endif // CORE_FXCRT_STRING_VIEW_TEMPLATE_H_
uint32_t FX_HashCode_GetLoweredAsIfW(ByteStringView str)
uint32_t FX_HashCode_GetLoweredA(ByteStringView str)
uint32_t FX_HashCode_GetAsIfW(ByteStringView str)
uint32_t FX_HashCode_GetA(ByteStringView str)
CPDF_Creator(CPDF_Document *pDoc, RetainPtr< IFX_RetainableWriteStream > archive)
bool SetFileVersion(int32_t fileVersion)
void RemoveSecurity()
bool Create(uint32_t flags)
virtual FX_FILESIZE CurrentOffset() const =0
static RetainPtr< IFX_SeekableReadStream > CreateFromFilename(const char *filename)
Definition fx_stream.cpp:68
virtual size_t ReadBlock(pdfium::span< uint8_t > buffer)
Definition fx_stream.cpp:88
virtual FX_FILESIZE GetPosition()
Definition fx_stream.cpp:84
virtual bool ReadBlockAtOffset(pdfium::span< uint8_t > buffer, FX_FILESIZE offset)=0
virtual bool IsEOF()
Definition fx_stream.cpp:80
bool WriteBlock(pdfium::span< const uint8_t > buffer) override
Definition fx_stream.cpp:92
virtual bool WriteBlockAtOffset(pdfium::span< const uint8_t > data, FX_FILESIZE offset)=0
bool WriteBlock(pdfium::span< const uint8_t > buffer) override
Definition fx_stream.cpp:76
virtual bool Flush()=0
virtual FX_FILESIZE GetSize()=0
bool WriteFilesize(FX_FILESIZE size)
Definition fx_stream.cpp:61
bool WriteByte(uint8_t byte)
Definition fx_stream.cpp:51
bool WriteString(ByteStringView str)
Definition fx_stream.cpp:47
virtual ~IFX_WriteStream()=default
bool WriteDWord(uint32_t i)
Definition fx_stream.cpp:55
virtual bool WriteBlock(pdfium::span< const uint8_t > data)=0
void TrimLeft(ByteStringView targets)
bool IsValidLength(size_t length) const
Definition bytestring.h:121
bool Contains(ByteStringView lpszSub, size_t start=0) const
Definition bytestring.h:187
const_iterator begin() const
Definition bytestring.h:102
bool IsValidIndex(size_t index) const
Definition bytestring.h:120
static ByteString FormatFloat(float f)
ByteStringView AsStringView() const
Definition bytestring.h:87
uint32_t GetID() const
Definition bytestring.h:213
void Reserve(size_t len)
ByteString(const char *ptr)
bool EqualNoCase(ByteStringView str) const
static ByteString Format(const char *pFormat,...)
ByteString & operator+=(const ByteString &str)
bool operator!=(ByteStringView str) const
Definition bytestring.h:131
size_t GetLength() const
Definition bytestring.h:115
ByteString Substr(size_t first, size_t count) const
size_t GetStringLength() const
Definition bytestring.h:116
size_t InsertAtBack(char ch)
Definition bytestring.h:162
bool operator==(ByteStringView str) const
pdfium::span< const uint8_t > raw_span() const
Definition bytestring.h:97
void AllocCopy(ByteString &dest, size_t nCopyLen, size_t nCopyIndex) const
void AssignCopy(const char *pSrcData, size_t nSrcLen)
bool Contains(char ch, size_t start=0) const
Definition bytestring.h:191
absl::optional< size_t > ReverseFind(char ch) const
intptr_t ReferenceCountForTesting() const
size_t Delete(size_t index, size_t count=1)
const_reverse_iterator rend() const
Definition bytestring.h:111
ByteString & operator+=(char ch)
const uint8_t * raw_str() const
Definition bytestring.h:80
void ReallocBeforeWrite(size_t nNewLen)
ByteString(ByteStringView bstrc)
RetainPtr< StringData > m_pData
Definition bytestring.h:225
static ByteString FormatInteger(int i)
pdfium::span< char > GetBuffer(size_t nMinBufLength)
void Trim(char target)
bool operator==(const ByteString &other) const
bool operator==(const char *ptr) const
const_iterator end() const
Definition bytestring.h:103
ByteString(const ByteString &other)
size_t Remove(char ch)
ByteString(const char *pStr, size_t len)
bool operator<(ByteStringView str) const
ByteString(wchar_t)=delete
ByteString & operator+=(const char *str)
ByteString & operator+=(ByteStringView str)
ByteString(const uint8_t *pStr, size_t len)
size_t Replace(ByteStringView pOld, ByteStringView pNew)
absl::optional< size_t > Find(ByteStringView subStr, size_t start=0) const
bool operator!=(const ByteString &other) const
Definition bytestring.h:132
void SetAt(size_t index, char c)
ByteString & operator=(ByteStringView str)
ByteString(ByteStringView str1, ByteStringView str2)
void Trim(ByteStringView targets)
ByteString & operator=(const char *str)
static ByteString FormatV(const char *pFormat, va_list argList)
void TrimRight(char target)
const char * c_str() const
Definition bytestring.h:76
ByteString Substr(size_t offset) const
ByteString & operator=(const ByteString &that)
ByteString & operator=(ByteString &&that) noexcept
bool IsEmpty() const
Definition bytestring.h:119
void TrimRight(ByteStringView targets)
bool operator<(const ByteString &other) const
ByteString(const std::initializer_list< ByteStringView > &list)
CharType operator[](const size_t index) const
Definition bytestring.h:150
const_reverse_iterator rbegin() const
Definition bytestring.h:108
CharType Back() const
Definition bytestring.h:156
CharType Front() const
Definition bytestring.h:155
bool operator!=(const char *ptr) const
Definition bytestring.h:130
int Compare(ByteStringView str) const
size_t Insert(size_t index, char ch)
void ReleaseBuffer(size_t nNewLength)
ByteString(const fxcrt::ostringstream &outStream)
void TrimLeft(char target)
size_t InsertAtFront(char ch)
Definition bytestring.h:161
ByteString First(size_t count) const
void AllocBeforeWrite(size_t nNewLen)
bool operator<(const char *ptr) const
void Concat(const char *pSrcData, size_t nSrcLen)
absl::optional< size_t > Find(char ch, size_t start=0) const
ByteString(ByteString &&other) noexcept
ByteString Last(size_t count) const
U * AsRaw() const
Definition retain_ptr.h:107
RetainPtr & operator=(const RetainPtr< U > &that)
Definition retain_ptr.h:89
operator bool() const
Definition retain_ptr.h:149
void Unleak(T *ptr)
Definition retain_ptr.h:130
RetainPtr(std::nullptr_t ptr)
Definition retain_ptr.h:35
void Reset(T *obj=nullptr)
Definition retain_ptr.h:116
bool operator!=(const RetainPtr &that) const
Definition retain_ptr.h:133
void Swap(RetainPtr &that)
Definition retain_ptr.h:126
RetainPtr() noexcept=default
RetainPtr(RetainPtr &&that) noexcept
Definition retain_ptr.h:48
bool operator!=(const U &that) const
Definition retain_ptr.h:141
RetainPtr & operator=(const RetainPtr &that)
Definition retain_ptr.h:72
bool operator==(const RetainPtr &that) const
Definition retain_ptr.h:132
T & operator*() const
Definition retain_ptr.h:150
bool operator==(const U &that) const
Definition retain_ptr.h:136
RetainPtr & operator=(RetainPtr &&that) noexcept
Definition retain_ptr.h:80
T * operator->() const
Definition retain_ptr.h:151
RetainPtr & operator=(RetainPtr< U > &&that) noexcept
Definition retain_ptr.h:99
RetainPtr(const RetainPtr< U > &that)
Definition retain_ptr.h:54
T * Get() const noexcept
Definition retain_ptr.h:123
~RetainPtr()=default
bool operator<(const RetainPtr &that) const
Definition retain_ptr.h:145
RetainPtr(const RetainPtr &that) noexcept
Definition retain_ptr.h:44
operator T*() const noexcept
Definition retain_ptr.h:122
RetainPtr & operator=(std::nullptr_t) noexcept
Definition retain_ptr.h:65
UnownedPtr< T > BackPointer() const
Definition retain_ptr.h:125
RetainPtr(RetainPtr< U > &&that) noexcept
Definition retain_ptr.h:60
RetainPtr< U > As() const
Definition retain_ptr.h:112
RetainPtr(T *pObj) noexcept
Definition retain_ptr.h:37
bool HasOneRef() const
Definition retain_ptr.h:162
Retainable()=default
virtual ~Retainable()=default
void CopyContents(const CharType *pStr, size_t nLen)
static StringDataTemplate * Create(size_t nLen)
void CopyContents(const StringDataTemplate &other)
bool CanOperateInPlace(size_t nTotalLen) const
static StringDataTemplate * Create(const CharType *pStr, size_t nLen)
void CopyContentsAt(size_t offset, const CharType *pStr, size_t nLen)
absl::optional< size_t > Find(CharType ch) const
bool operator>(const StringViewTemplate &that) const
StringViewTemplate(const CharType *ptr) noexcept
bool operator<(const StringViewTemplate &that) const
constexpr StringViewTemplate(const UnsignedType *ptr, size_t size) noexcept
bool IsValidLength(size_t length) const
constexpr StringViewTemplate(const CharType *ptr, size_t size) noexcept
bool operator!=(const CharType *ptr) const
StringViewTemplate TrimmedRight(CharType ch) const
pdfium::span< const UnsignedType > m_Span
bool EqualsASCII(const StringViewTemplate< char > &that) const
const CharType * unterminated_c_str() const
bool operator==(const CharType *ptr) const
bool Contains(CharType ch) const
bool EqualsASCIINoCase(const StringViewTemplate< char > &that) const
pdfium::span< const UnsignedType > raw_span() const
StringViewTemplate Substr(size_t first, size_t count) const
bool operator==(const StringViewTemplate &other) const
const_iterator end() const
const UnsignedType & operator[](const size_t index) const
StringViewTemplate Last(size_t count) const
CharType CharAt(const size_t index) const
bool operator!=(const StringViewTemplate &other) const
StringViewTemplate First(size_t count) const
constexpr StringViewTemplate(const pdfium::span< const CharType > &other) noexcept
constexpr StringViewTemplate(const StringViewTemplate &src) noexcept=default
const_iterator begin() const
StringViewTemplate & operator=(const StringViewTemplate &src)
const_reverse_iterator rend() const
StringViewTemplate & operator=(const CharType *src)
StringViewTemplate Substr(size_t offset) const
constexpr StringViewTemplate() noexcept=default
constexpr StringViewTemplate(const CharType &ch) noexcept
const_reverse_iterator rbegin() const
const UnsignedType * raw_str() const
bool IsValidIndex(size_t index) const
constexpr StringViewTemplate(const pdfium::span< const UnsignedType > &other) noexcept
T * get() const noexcept
UnownedPtr(const UnownedPtr< U > &that)
Definition unowned_ptr.h:98
bool operator==(const UnownedPtr &that) const
operator T*() const noexcept
UnownedPtr(UnownedPtr< U > &&that) noexcept
UnownedPtr & operator=(UnownedPtr< U > &&that) noexcept
constexpr UnownedPtr(const UnownedPtr &that) noexcept=default
constexpr UnownedPtr(T *pObj) noexcept
Definition unowned_ptr.h:83
UnownedPtr & operator=(T *that) noexcept
bool operator==(std::nullptr_t ptr) const
UnownedPtr & operator=(UnownedPtr &&that) noexcept
UnownedPtr & operator=(std::nullptr_t) noexcept
UnownedPtr & operator=(const UnownedPtr< U > &that) noexcept
T * operator->() const
constexpr UnownedPtr() noexcept=default
bool operator<(const UnownedPtr &that) const
UnownedPtr & operator=(const UnownedPtr &that) noexcept=default
T & operator*() const
constexpr UnownedPtr(UnownedPtr &&that) noexcept
Definition unowned_ptr.h:91
constexpr UnownedPtr(std::nullptr_t ptr)
Definition unowned_ptr.h:81
#define FPDFCREATE_INCREMENTAL
#define FPDFCREATE_NO_ORIGINAL
NOINLINE void FX_OutOfMemoryTerminate(size_t size)
Definition fx_memory.cpp:37
void FXMEM_DefaultFree(void *pointer)
Definition fx_memory.cpp:33
void * FXMEM_DefaultAlloc(size_t byte_size)
Definition fx_memory.cpp:21
void * FXMEM_DefaultCalloc(size_t num_elems, size_t byte_size)
Definition fx_memory.cpp:25
void * FXMEM_DefaultRealloc(void *pointer, size_t new_size)
Definition fx_memory.cpp:29
void * FX_ArrayBufferAllocate(size_t length)
void FX_InitializeMemoryAllocators()
void FX_ArrayBufferFree(void *data)
void * FX_ArrayBufferAllocateUninitialized(size_t length)
void * FX_Random_MT_Start(uint32_t dwSeed)
Definition fx_random.cpp:85
uint32_t FX_Random_MT_Generate(void *pContext)
Definition fx_random.cpp:96
void FX_Random_MT_Close(void *pContext)
#define FX_FILESIZE
Definition fx_types.h:19
bool operator==(const char *lhs, const ByteString &rhs)
Definition bytestring.h:233
bool operator<(const ByteStringView &lhs, const char *rhs)
Definition bytestring.h:251
ByteString operator+(const ByteString &str1, const ByteString &str2)
Definition bytestring.h:270
ByteString operator+(ByteStringView str1, const char *str2)
Definition bytestring.h:258
bool operator<(const ByteStringView &lhs, const ByteString &rhs)
Definition bytestring.h:248
bool operator==(const T *lhs, const StringViewTemplate< T > &rhs)
bool operator<(const T *lhs, const StringViewTemplate< T > &rhs)
ByteString operator+(const ByteString &str1, char ch)
Definition bytestring.h:273
ByteString operator+(const ByteString &str1, const char *str2)
Definition bytestring.h:279
void PrintTo(const ByteString &str, std::ostream *os)
bool operator!=(const T *lhs, const StringViewTemplate< T > &rhs)
ByteString operator+(char ch, const ByteString &str2)
Definition bytestring.h:276
ByteString operator+(const ByteString &str1, ByteStringView str2)
Definition bytestring.h:285
ByteString operator+(const char *str1, const ByteString &str2)
Definition bytestring.h:282
bool operator!=(ByteStringView lhs, const ByteString &rhs)
Definition bytestring.h:242
bool operator!=(const char *lhs, const ByteString &rhs)
Definition bytestring.h:239
ByteString operator+(ByteStringView str1, ByteStringView str2)
Definition bytestring.h:255
ByteString operator+(ByteStringView str1, char ch)
Definition bytestring.h:264
bool operator<(const char *lhs, const ByteString &rhs)
Definition bytestring.h:245
ByteString operator+(char ch, ByteStringView str2)
Definition bytestring.h:267
ByteString operator+(ByteStringView str1, const ByteString &str2)
Definition bytestring.h:288
ByteString operator+(const char *str1, ByteStringView str2)
Definition bytestring.h:261
bool operator==(ByteStringView lhs, const ByteString &rhs)
Definition bytestring.h:236
void * CallocOrDie2D(size_t w, size_t h, size_t member_size)
Definition fx_memory.cpp:79
void * AllocOrDie2D(size_t w, size_t h, size_t member_size)
Definition fx_memory.cpp:65
void * StringAllocOrDie(size_t num_members, size_t member_size)
Definition fx_memory.cpp:94
void * Alloc(size_t num_members, size_t member_size)
void * StringAlloc(size_t num_members, size_t member_size)
void * ReallocOrDie(void *ptr, size_t num_members, size_t member_size)
Definition fx_memory.cpp:86
void * Realloc(void *ptr, size_t num_members, size_t member_size)
void StringDealloc(void *ptr)
void * AllocOrDie(size_t num_members, size_t member_size)
Definition fx_memory.cpp:57
void * Calloc(size_t num_members, size_t member_size)
void * CallocOrDie(size_t num_members, size_t member_size)
Definition fx_memory.cpp:71
void Dealloc(void *ptr)
UnownedPtr< T > WrapUnowned(T *that)
RetainPtr< T > MakeRetain(Args &&... args)
Definition retain_ptr.h:209
RetainPtr< T > WrapRetain(T *that)
Definition retain_ptr.h:216
#define CHECK(cvref)
void operator()(void *ptr) const
pointer allocate(size_type n, const void *hint=0)
void deallocate(pointer p, size_type n)
const_pointer address(const_reference x) const noexcept
FxPartitionAllocAllocator() noexcept=default
size_type max_size() const noexcept
~FxPartitionAllocAllocator()=default
pointer address(reference x) const noexcept
FxPartitionAllocAllocator(const FxPartitionAllocAllocator< U, Alloc, Free > &other) noexcept
bool operator!=(const FxPartitionAllocAllocator &that)
void construct(U *p, Args &&... args)
bool operator==(const FxPartitionAllocAllocator &that)
FxPartitionAllocAllocator(const FxPartitionAllocAllocator &other) noexcept=default
void operator()(T *ptr) const
Definition retain_ptr.h:24
size_t operator()(const ByteString &str) const
Definition bytestring.h:315
#define UNOWNED_PTR_EXCLUSION