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
clamped_math_impl.h
Go to the documentation of this file.
1// Copyright 2024 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#ifndef CORE_FXCRT_NUMERICS_CLAMPED_MATH_IMPL_H_
6#define CORE_FXCRT_NUMERICS_CLAMPED_MATH_IMPL_H_
7
8#include <stddef.h>
9#include <stdint.h>
10
11#include <climits>
12#include <cmath>
13#include <cstdlib>
14#include <limits>
15#include <type_traits>
16
17#include "core/fxcrt/numerics/checked_math.h"
18#include "core/fxcrt/numerics/safe_conversions.h"
19#include "core/fxcrt/numerics/safe_math_shared_impl.h"
20
21namespace pdfium {
22namespace internal {
23
24template <typename T,
25 typename std::enable_if<std::is_integral<T>::value &&
26 std::is_signed<T>::value>::type* = nullptr>
27constexpr T SaturatedNegWrapper(T value) {
28 return IsConstantEvaluated() || !ClampedNegFastOp<T>::is_supported
29 ? (NegateWrapper(value) != std::numeric_limits<T>::lowest()
30 ? NegateWrapper(value)
31 : std::numeric_limits<T>::max())
32 : ClampedNegFastOp<T>::Do(value);
33}
34
35template <typename T,
36 typename std::enable_if<std::is_integral<T>::value &&
37 !std::is_signed<T>::value>::type* = nullptr>
38constexpr T SaturatedNegWrapper(T value) {
39 return T(0);
40}
41
42template <
43 typename T,
44 typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr>
45constexpr T SaturatedNegWrapper(T value) {
46 return -value;
47}
48
49template <typename T,
50 typename std::enable_if<std::is_integral<T>::value>::type* = nullptr>
51constexpr T SaturatedAbsWrapper(T value) {
52 // The calculation below is a static identity for unsigned types, but for
53 // signed integer types it provides a non-branching, saturated absolute value.
54 // This works because SafeUnsignedAbs() returns an unsigned type, which can
55 // represent the absolute value of all negative numbers of an equal-width
56 // integer type. The call to IsValueNegative() then detects overflow in the
57 // special case of numeric_limits<T>::min(), by evaluating the bit pattern as
58 // a signed integer value. If it is the overflow case, we end up subtracting
59 // one from the unsigned result, thus saturating to numeric_limits<T>::max().
60 return static_cast<T>(
61 SafeUnsignedAbs(value) -
62 IsValueNegative<T>(static_cast<T>(SafeUnsignedAbs(value))));
63}
64
65template <
66 typename T,
67 typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr>
68constexpr T SaturatedAbsWrapper(T value) {
69 return value < 0 ? -value : value;
70}
71
72template <typename T, typename U, class Enable = void>
73struct ClampedAddOp {};
74
75template <typename T, typename U>
77 U,
78 typename std::enable_if<std::is_integral<T>::value &&
79 std::is_integral<U>::value>::type> {
81 template <typename V = result_type>
82 static constexpr V Do(T x, U y) {
84 return ClampedAddFastOp<T, U>::template Do<V>(x, y);
85
86 static_assert(std::is_same<V, result_type>::value ||
88 "The saturation result cannot be determined from the "
89 "provided types.");
91 V result = {};
93 ? result
94 : saturated;
95 }
96};
97
98template <typename T, typename U, class Enable = void>
99struct ClampedSubOp {};
100
101template <typename T, typename U>
103 U,
104 typename std::enable_if<std::is_integral<T>::value &&
105 std::is_integral<U>::value>::type> {
107 template <typename V = result_type>
108 static constexpr V Do(T x, U y) {
110 return ClampedSubFastOp<T, U>::template Do<V>(x, y);
111
112 static_assert(std::is_same<V, result_type>::value ||
114 "The saturation result cannot be determined from the "
115 "provided types.");
117 V result = {};
119 ? result
120 : saturated;
121 }
122};
123
124template <typename T, typename U, class Enable = void>
125struct ClampedMulOp {};
126
127template <typename T, typename U>
129 U,
130 typename std::enable_if<std::is_integral<T>::value &&
131 std::is_integral<U>::value>::type> {
133 template <typename V = result_type>
134 static constexpr V Do(T x, U y) {
136 return ClampedMulFastOp<T, U>::template Do<V>(x, y);
137
138 V result = {};
139 const V saturated =
142 ? result
143 : saturated;
144 }
145};
146
147template <typename T, typename U, class Enable = void>
148struct ClampedDivOp {};
149
150template <typename T, typename U>
152 U,
153 typename std::enable_if<std::is_integral<T>::value &&
154 std::is_integral<U>::value>::type> {
156 template <typename V = result_type>
157 static constexpr V Do(T x, U y) {
158 V result = {};
160 return result;
161 // Saturation goes to max, min, or NaN (if x is zero).
164 }
165};
166
167template <typename T, typename U, class Enable = void>
168struct ClampedModOp {};
169
170template <typename T, typename U>
172 U,
173 typename std::enable_if<std::is_integral<T>::value &&
174 std::is_integral<U>::value>::type> {
176 template <typename V = result_type>
177 static constexpr V Do(T x, U y) {
178 V result = {};
180 ? result
181 : x;
182 }
183};
184
185template <typename T, typename U, class Enable = void>
186struct ClampedLshOp {};
187
188// Left shift. Non-zero values saturate in the direction of the sign. A zero
189// shifted by any value always results in zero.
190template <typename T, typename U>
192 U,
193 typename std::enable_if<std::is_integral<T>::value &&
194 std::is_integral<U>::value>::type> {
195 using result_type = T;
196 template <typename V = result_type>
197 static constexpr V Do(T x, U shift) {
198 static_assert(!std::is_signed<U>::value, "Shift value must be unsigned.");
200 // Shift as unsigned to avoid undefined behavior.
201 V result = static_cast<V>(as_unsigned(x) << shift);
202 // If the shift can be reversed, we know it was valid.
204 return result;
205 }
206 return x ? CommonMaxOrMin<V>(IsValueNegative(x)) : 0;
207 }
208};
209
210template <typename T, typename U, class Enable = void>
211struct ClampedRshOp {};
212
213// Right shift. Negative values saturate to -1. Positive or 0 saturates to 0.
214template <typename T, typename U>
216 U,
217 typename std::enable_if<std::is_integral<T>::value &&
218 std::is_integral<U>::value>::type> {
219 using result_type = T;
220 template <typename V = result_type>
221 static constexpr V Do(T x, U shift) {
222 static_assert(!std::is_signed<U>::value, "Shift value must be unsigned.");
223 // Signed right shift is odd, because it saturates to -1 or 0.
224 const V saturated = as_unsigned(V(0)) - IsValueNegative(x);
226 ? saturated_cast<V>(x >> shift)
227 : saturated;
228 }
229};
230
231template <typename T, typename U, class Enable = void>
232struct ClampedAndOp {};
233
234template <typename T, typename U>
236 U,
237 typename std::enable_if<std::is_integral<T>::value &&
238 std::is_integral<U>::value>::type> {
239 using result_type = typename std::make_unsigned<
240 typename MaxExponentPromotion<T, U>::type>::type;
241 template <typename V>
242 static constexpr V Do(T x, U y) {
243 return static_cast<result_type>(x) & static_cast<result_type>(y);
244 }
245};
246
247template <typename T, typename U, class Enable = void>
248struct ClampedOrOp {};
249
250// For simplicity we promote to unsigned integers.
251template <typename T, typename U>
253 U,
254 typename std::enable_if<std::is_integral<T>::value &&
255 std::is_integral<U>::value>::type> {
256 using result_type = typename std::make_unsigned<
257 typename MaxExponentPromotion<T, U>::type>::type;
258 template <typename V>
259 static constexpr V Do(T x, U y) {
260 return static_cast<result_type>(x) | static_cast<result_type>(y);
261 }
262};
263
264template <typename T, typename U, class Enable = void>
265struct ClampedXorOp {};
266
267// For simplicity we support only unsigned integers.
268template <typename T, typename U>
270 U,
271 typename std::enable_if<std::is_integral<T>::value &&
272 std::is_integral<U>::value>::type> {
273 using result_type = typename std::make_unsigned<
274 typename MaxExponentPromotion<T, U>::type>::type;
275 template <typename V>
276 static constexpr V Do(T x, U y) {
277 return static_cast<result_type>(x) ^ static_cast<result_type>(y);
278 }
279};
280
281template <typename T, typename U, class Enable = void>
282struct ClampedMaxOp {};
283
284template <typename T, typename U>
286 T,
287 U,
288 typename std::enable_if<std::is_arithmetic<T>::value &&
291 template <typename V = result_type>
292 static constexpr V Do(T x, U y) {
293 return IsGreater<T, U>::Test(x, y) ? saturated_cast<V>(x)
294 : saturated_cast<V>(y);
295 }
296};
297
298template <typename T, typename U, class Enable = void>
299struct ClampedMinOp {};
300
301template <typename T, typename U>
303 T,
304 U,
305 typename std::enable_if<std::is_arithmetic<T>::value &&
308 template <typename V = result_type>
309 static constexpr V Do(T x, U y) {
310 return IsLess<T, U>::Test(x, y) ? saturated_cast<V>(x)
311 : saturated_cast<V>(y);
312 }
313};
314
315// This is just boilerplate that wraps the standard floating point arithmetic.
316// A macro isn't the nicest solution, but it beats rewriting these repeatedly.
317#define BASE_FLOAT_ARITHMETIC_OPS(NAME, OP)
318 template <typename T, typename U>
319 struct Clamped##NAME##Op<
320 T, U,
321 typename std::enable_if<std::is_floating_point<T>::value ||
322 std::is_floating_point<U>::value>::type> {
323 using result_type = typename MaxExponentPromotion<T, U>::type;
324 template <typename V = result_type>
325 static constexpr V Do(T x, U y) {
326 return saturated_cast<V>(x OP y);
327 }
328 };
329
334
335#undef BASE_FLOAT_ARITHMETIC_OPS
336
337} // namespace internal
338} // namespace pdfium
339
340#endif // CORE_FXCRT_NUMERICS_CLAMPED_MATH_IMPL_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
#define CHECK_LE(x, y)
Definition check_op.h:14
#define BASE_FLOAT_ARITHMETIC_OPS(NAME, OP)
CPDF_ArrayLocker(RetainPtr< CPDF_Array > pArray)
const_iterator begin() const
Definition cpdf_array.h:185
const_iterator end() const
Definition cpdf_array.h:189
CPDF_ArrayLocker(const CPDF_Array *pArray)
CPDF_ArrayLocker(RetainPtr< const CPDF_Array > pArray)
size_t size() const
Definition cpdf_array.h:41
void Append(RetainPtr< CPDF_Stream > stream)=delete
bool GetBooleanAt(size_t index, bool bDefault) const
void SetAt(size_t index, RetainPtr< CPDF_Object > object)
RetainPtr< CPDF_Dictionary > GetMutableDictAt(size_t index)
RetainPtr< CPDF_Object > CloneNonCyclic(bool bDirect, std::set< const CPDF_Object * > *pVisited) const override
bool IsEmpty() const
Definition cpdf_array.h:40
RetainPtr< const CPDF_Object > GetDirectObjectAt(size_t index) const
RetainPtr< const CPDF_Stream > GetStreamAt(size_t index) const
Type GetType() const override
CPDF_Array * AsMutableArray() override
RetainPtr< const CPDF_Object > GetObjectAt(size_t index) const
RetainPtr< CPDF_Object > GetMutableObjectAt(size_t index)
std::enable_if<!CanInternStrings< T >::value, RetainPtr< T > >::type AppendNew(Args &&... args)
Definition cpdf_array.h:85
WideString GetUnicodeTextAt(size_t index) const
RetainPtr< CPDF_Array > GetMutableArrayAt(size_t index)
RetainPtr< CPDF_Object > Clone() const override
std::enable_if< CanInternStrings< T >::value, RetainPtr< T > >::type AppendNew(Args &&... args)
Definition cpdf_array.h:94
RetainPtr< const CPDF_Dictionary > GetDictAt(size_t index) const
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
Definition cpdf_array.h:29
std::enable_if<!CanInternStrings< T >::value, RetainPtr< T > >::type InsertNewAt(size_t index, Args &&... args)
Definition cpdf_array.h:115
bool IsLocked() const
Definition cpdf_array.h:150
RetainPtr< CPDF_Stream > GetMutableStreamAt(size_t index)
bool Contains(const CPDF_Object *pThat) const
void ConvertToIndirectObjectAt(size_t index, CPDF_IndirectObjectHolder *pHolder)
std::optional< size_t > Find(const CPDF_Object *pThat) const
std::enable_if< CanInternStrings< T >::value, RetainPtr< T > >::type InsertNewAt(size_t index, Args &&... args)
Definition cpdf_array.h:124
std::enable_if<!CanInternStrings< T >::value, RetainPtr< T > >::type SetNewAt(size_t index, Args &&... args)
Definition cpdf_array.h:100
bool WriteTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const override
RetainPtr< CPDF_Object > GetMutableDirectObjectAt(size_t index)
CFX_Matrix GetMatrix() const
~CPDF_Array() override
int GetIntegerAt(size_t index) const
void SetAt(size_t index, RetainPtr< CPDF_Stream > stream)=delete
void InsertAt(size_t index, RetainPtr< CPDF_Object > object)
ByteString GetByteStringAt(size_t index) const
std::enable_if< CanInternStrings< T >::value, RetainPtr< T > >::type SetNewAt(size_t index, Args &&... args)
Definition cpdf_array.h:109
void Append(RetainPtr< CPDF_Object > object)
RetainPtr< const CPDF_String > GetStringAt(size_t index) const
RetainPtr< const CPDF_Array > GetArrayAt(size_t index) const
RetainPtr< const CPDF_Number > GetNumberAt(size_t index) const
CFX_FloatRect GetRect() const
void InsertAt(size_t index, RetainPtr< CPDF_Stream > stream)=delete
void RemoveAt(size_t index)
float GetFloatAt(size_t index) const
CPDF_Creator(CPDF_Document *pDoc, RetainPtr< IFX_RetainableWriteStream > archive)
bool SetFileVersion(int32_t fileVersion)
void RemoveSecurity()
bool Create(uint32_t flags)
CPDF_Dictionary * GetMutableTrailerForTesting()
const CPDF_Dictionary * trailer() const
const ObjectInfo * GetObjectInfo(uint32_t obj_num) const
CPDF_CrossRefTable(RetainPtr< CPDF_Dictionary > trailer, uint32_t trailer_object_number)
void SetFree(uint32_t obj_num, uint16_t gen_num)
void Update(std::unique_ptr< CPDF_CrossRefTable > new_cross_ref)
const std::map< uint32_t, ObjectInfo > & objects_info() const
static std::unique_ptr< CPDF_CrossRefTable > MergeUp(std::unique_ptr< CPDF_CrossRefTable > current, std::unique_ptr< CPDF_CrossRefTable > top)
void AddCompressed(uint32_t obj_num, uint32_t archive_obj_num, uint32_t archive_obj_index)
uint32_t trailer_object_number() const
void AddNormal(uint32_t obj_num, uint16_t gen_num, bool is_object_stream, FX_FILESIZE pos)
void SetTrailer(RetainPtr< CPDF_Dictionary > trailer, uint32_t trailer_object_number)
void SetObjectMapSize(uint32_t size)
CPDF_CryptoHandler(Cipher cipher, pdfium::span< const uint8_t > key)
bool DecryptObjectTree(RetainPtr< CPDF_Object > object)
static bool IsSignatureDictionary(const CPDF_Dictionary *dictionary)
DataVector< uint8_t > EncryptContent(uint32_t objnum, uint32_t gennum, pdfium::span< const uint8_t > source) const
const_iterator end() const
CPDF_DictionaryLocker(const CPDF_Dictionary *pDictionary)
const_iterator begin() const
CPDF_DictionaryLocker(RetainPtr< const CPDF_Dictionary > pDictionary)
CPDF_DictionaryLocker(RetainPtr< CPDF_Dictionary > pDictionary)
Type GetType() const override
bool KeyExist(const ByteString &key) const
int GetIntegerFor(const ByteString &key) const
RetainPtr< const CPDF_Stream > GetStreamFor(const ByteString &key) const
RetainPtr< const CPDF_Number > GetNumberFor(const ByteString &key) const
void SetFor(const ByteString &key, RetainPtr< CPDF_Object > object)
ByteString GetByteStringFor(const ByteString &key, const ByteString &default_str) const
std::enable_if< CanInternStrings< T >::value, RetainPtr< T > >::type SetNewFor(const ByteString &key, Args &&... args)
RetainPtr< CPDF_Object > RemoveFor(ByteStringView key)
RetainPtr< CPDF_Array > GetOrCreateArrayFor(const ByteString &key)
void SetMatrixFor(const ByteString &key, const CFX_Matrix &matrix)
RetainPtr< CPDF_Stream > GetMutableStreamFor(const ByteString &key)
RetainPtr< CPDF_Object > GetMutableDirectObjectFor(const ByteString &key)
RetainPtr< const CPDF_Dictionary > GetDictFor(const ByteString &key) const
RetainPtr< CPDF_Array > GetMutableArrayFor(const ByteString &key)
float GetFloatFor(const ByteString &key) const
RetainPtr< CPDF_Dictionary > GetOrCreateDictFor(const ByteString &key)
std::enable_if<!CanInternStrings< T >::value, RetainPtr< T > >::type SetNewFor(const ByteString &key, Args &&... args)
void ConvertToIndirectObjectFor(const ByteString &key, CPDF_IndirectObjectHolder *pHolder)
WideString GetUnicodeTextFor(const ByteString &key) const
RetainPtr< CPDF_Object > Clone() const override
const CPDF_Dictionary * GetDictInternal() const override
RetainPtr< CPDF_Object > CloneNonCyclic(bool bDirect, std::set< const CPDF_Object * > *visited) const override
CPDF_Dictionary * AsMutableDictionary() override
std::vector< ByteString > GetKeys() const
bool GetBooleanFor(const ByteString &key, bool bDefault) const
ByteString GetByteStringFor(const ByteString &key) const
int GetDirectIntegerFor(const ByteString &key) const
RetainPtr< const CPDF_String > GetStringFor(const ByteString &key) const
WeakPtr< ByteStringPool > GetByteStringPool() const
void SetRectFor(const ByteString &key, const CFX_FloatRect &rect)
RetainPtr< CPDF_Dictionary > GetMutableDictFor(const ByteString &key)
RetainPtr< const CPDF_Object > GetDirectObjectFor(const ByteString &key) const
bool WriteTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const override
RetainPtr< const CPDF_Array > GetArrayFor(const ByteString &key) const
size_t size() const
RetainPtr< const CPDF_Object > GetObjectFor(const ByteString &key) const
int GetIntegerFor(const ByteString &key, int default_int) const
~CPDF_Dictionary() override
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
bool IsLocked() const
void SetFor(const ByteString &key, RetainPtr< CPDF_Stream > stream)=delete
CFX_FloatRect GetRectFor(const ByteString &key) const
ByteString GetNameFor(const ByteString &key) const
CFX_Matrix GetMatrixFor(const ByteString &key) const
RetainPtr< CPDF_Object > GetMutableObjectFor(const ByteString &key)
void ReplaceKey(const ByteString &oldkey, const ByteString &newkey)
virtual uint32_t DeletePage(int page_index)=0
virtual ~Extension()=default
virtual bool ContainsExtensionForm() const =0
virtual bool ContainsExtensionFullForm() const =0
virtual int GetPageCount() const =0
virtual bool ContainsExtensionForegroundForm() const =0
virtual ~LinkListIface()=default
void SetDocument(CPDF_Document *pDoc)
CPDF_Document * GetDocument() const
virtual void MaybePurgeImage(uint32_t objnum)=0
virtual void ClearStockFont()=0
virtual RetainPtr< CPDF_StreamAcc > GetFontFileStreamAcc(RetainPtr< const CPDF_Stream > pFontStream)=0
virtual void MaybePurgeFontFileStreamAcc(RetainPtr< CPDF_StreamAcc > &&pStreamAcc)=0
void SetDocument(CPDF_Document *pDoc)
CPDF_Document * GetDocument() const
~CPDF_Document() override
bool has_valid_cross_reference_table() const
JBig2_DocumentContext * GetOrCreateCodecContext()
CPDF_Parser::Error LoadLinearizedDoc(RetainPtr< CPDF_ReadValidator > validator, const ByteString &password)
RetainPtr< CPDF_Object > ParseIndirectObject(uint32_t objnum) override
uint32_t GetParsedPageCountForTesting()
bool IsPageLoaded(int iPage) const
RetainPtr< const CPDF_Dictionary > GetPageDictionary(int iPage)
int GetPageCount() const
RetainPtr< CPDF_Dictionary > CreateNewPage(int iPage)
void SetExtension(std::unique_ptr< Extension > pExt)
void SetLinksContext(std::unique_ptr< LinkListIface > pContext)
PageDataIface * GetPageData() const
bool IsModifiedAPStream(const CPDF_Stream *stream) const
RetainPtr< const CPDF_Array > GetFileIdentifier() const
void MaybePurgeImage(uint32_t objnum)
void MaybePurgeFontFileStreamAcc(RetainPtr< CPDF_StreamAcc > &&pStreamAcc)
RetainPtr< CPDF_Dictionary > GetMutableRoot()
RetainPtr< CPDF_Dictionary > GetInfo()
RenderDataIface * GetRenderData() const
LinkListIface * GetLinksContext() const
CPDF_Document(std::unique_ptr< RenderDataIface > pRenderData, std::unique_ptr< PageDataIface > pPageData)
CPDF_Parser::Error LoadDoc(RetainPtr< IFX_SeekableReadStream > pFileAccess, const ByteString &password)
void ResizePageListForTesting(size_t size)
CPDF_Parser * GetParser() const
RetainPtr< CPDF_Dictionary > GetMutablePageDictionary(int iPage)
bool MovePages(pdfium::span< const int > page_indices, int dest_page_index)
int GetPageIndex(uint32_t objnum)
Extension * GetExtension() const
uint32_t GetUserPermissions(bool get_owner_perms) const
void SetPageToNullObject(uint32_t page_obj_num)
RetainPtr< CPDF_StreamAcc > GetFontFileStreamAcc(RetainPtr< const CPDF_Stream > pFontStream)
RetainPtr< CPDF_Stream > CreateModifiedAPStream(RetainPtr< CPDF_Dictionary > dict)
void SetRootForTesting(RetainPtr< CPDF_Dictionary > root)
bool TryInit() override
static bool IsValidPageObject(const CPDF_Object *obj)
const CPDF_Dictionary * GetRoot() const
void SetParser(std::unique_ptr< CPDF_Parser > pParser)
uint32_t DeletePage(int iPage)
static constexpr int kPageMaxNum
void SetPageObjNum(int iPage, uint32_t objNum)
void IncrementParsedPageCount()
CPDF_Encryptor(const CPDF_CryptoHandler *pHandler, int objnum)
DataVector< uint8_t > Encrypt(pdfium::span< const uint8_t > src_data) const
bool WriteDictTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const
pdfium::span< const uint8_t > GetSpan() const
CPDF_FlateEncoder(RetainPtr< const CPDF_Stream > pStream, bool bFlateEncode)
void UpdateLength(size_t size)
RetainPtr< const CPDF_Object > GetIndirectObject(uint32_t objnum) const
std::enable_if<!CanInternStrings< T >::value, RetainPtr< T > >::type New(Args &&... args)
RetainPtr< T > NewIndirect(Args &&... args)
RetainPtr< CPDF_Object > GetOrParseIndirectObject(uint32_t objnum)
WeakPtr< ByteStringPool > GetByteStringPool() const
std::enable_if< CanInternStrings< T >::value, RetainPtr< T > >::type New(Args &&... args)
virtual RetainPtr< CPDF_Object > ParseIndirectObject(uint32_t objnum)
RetainPtr< CPDF_Object > GetMutableIndirectObject(uint32_t objnum)
uint32_t AddIndirectObject(RetainPtr< CPDF_Object > pObj)
bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum, RetainPtr< CPDF_Object > pObj)
bool WriteTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const override
float GetNumber() const override
bool IsInteger() const
Definition cpdf_number.h:30
int GetInteger() const override
RetainPtr< CPDF_Object > Clone() const override
void SetString(const ByteString &str) override
~CPDF_Number() override
ByteString GetString() const override
CPDF_Number * AsMutableNumber() override
Type GetType() const override
void SetGenNum(uint32_t gennum)
Definition cpdf_object.h:68
RetainPtr< const CPDF_Dictionary > GetDict() const
bool IsInline() const
Definition cpdf_object.h:69
uint32_t GetGenNum() const
Definition cpdf_object.h:67
virtual Type GetType() const =0
virtual WideString GetUnicodeText() const
virtual ByteString GetString() const
RetainPtr< const CPDF_Object > GetDirect() const
uint32_t m_GenNum
bool IsName() const
virtual CPDF_Null * AsMutableNull()
const CPDF_Name * AsName() const
bool IsArray() const
const CPDF_Boolean * AsBoolean() const
virtual void SetString(const ByteString &str)
const CPDF_Null * AsNull() const
bool IsDictionary() const
bool IsStream() const
virtual RetainPtr< CPDF_Reference > MakeReference(CPDF_IndirectObjectHolder *holder) const
RetainPtr< CPDF_Object > GetMutableDirect()
const CPDF_Array * AsArray() const
virtual int GetInteger() const
CPDF_Object()=default
virtual float GetNumber() const
bool IsNull() const
bool IsBoolean() const
uint32_t GetObjNum() const
Definition cpdf_object.h:65
const CPDF_Dictionary * AsDictionary() const
virtual bool WriteTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const =0
RetainPtr< CPDF_Object > CloneDirectObject() const
virtual CPDF_Stream * AsMutableStream()
bool IsString() const
virtual CPDF_Number * AsMutableNumber()
virtual CPDF_Dictionary * AsMutableDictionary()
virtual RetainPtr< CPDF_Object > Clone() const =0
bool IsNumber() const
virtual CPDF_Reference * AsMutableReference()
uint32_t m_ObjNum
CPDF_Object(const CPDF_Object &src)=delete
const CPDF_Stream * AsStream() const
static constexpr uint32_t kInvalidObjNum
Definition cpdf_object.h:52
virtual const CPDF_Object * GetDirectInternal() const
virtual CPDF_Name * AsMutableName()
bool IsReference() const
void SetObjNum(uint32_t objnum)
Definition cpdf_object.h:66
const CPDF_String * AsString() const
uint64_t KeyForCache() const
virtual CPDF_Array * AsMutableArray()
const CPDF_Reference * AsReference() const
virtual RetainPtr< CPDF_Object > CloneNonCyclic(bool bDirect, std::set< const CPDF_Object * > *pVisited) const
virtual CPDF_String * AsMutableString()
const CPDF_Number * AsNumber() const
RetainPtr< CPDF_Dictionary > GetMutableDict()
RetainPtr< CPDF_Object > CloneObjectNonCyclic(bool bDirect) const
virtual const CPDF_Dictionary * GetDictInternal() const
~CPDF_Object() override
virtual CPDF_Boolean * AsMutableBoolean()
void SetSyntaxParserForTesting(std::unique_ptr< CPDF_SyntaxParser > parser)
bool RebuildCrossRef()
uint32_t GetPermissions(bool get_owner_perms) const
const CPDF_Dictionary * GetTrailer() const
RetainPtr< CPDF_Object > ParseIndirectObjectAtForTesting(FX_FILESIZE pos)
FX_FILESIZE GetObjectPositionOrZero(uint32_t objnum) const
void SetLinearizedHeaderForTesting(std::unique_ptr< CPDF_LinearizedHeader > pLinearized)
int GetFileVersion() const
Error StartLinearizedParse(RetainPtr< CPDF_ReadValidator > validator, const ByteString &password)
uint32_t GetRootObjNum() const
RetainPtr< const CPDF_Array > GetIDArray() const
RetainPtr< const CPDF_Dictionary > GetEncryptDict() const
std::vector< unsigned int > GetTrailerEnds()
CPDF_Parser(ParsedObjectsHolder *holder)
FX_FILESIZE GetLastXRefOffset() const
Definition cpdf_parser.h:83
bool WriteToArchive(IFX_ArchiveStream *archive, FX_FILESIZE src_size)
const CPDF_LinearizedHeader * GetLinearizedHeader() const
ByteString GetPassword() const
Definition cpdf_parser.h:70
static constexpr size_t kInvalidPos
Definition cpdf_parser.h:59
const CPDF_CrossRefTable * GetCrossRefTableForTesting() const
CPDF_Dictionary * GetMutableTrailerForTesting()
uint32_t GetTrailerObjectNumber() const
static constexpr uint32_t kMaxObjectNumber
Definition cpdf_parser.h:57
bool IsXRefStream() const
uint32_t GetFirstPageNo() const
Error StartParseInternal()
ByteString GetEncodedPassword() const
FX_FILESIZE GetDocumentSize() const
bool IsValidObjectNumber(uint32_t objnum) const
Error StartParse(RetainPtr< IFX_SeekableReadStream > pFile, const ByteString &password)
std::unique_ptr< CPDF_LinearizedHeader > ParseLinearizedHeader()
FX_FILESIZE ParseStartXRef()
bool IsObjectFree(uint32_t objnum) const
RetainPtr< CPDF_Dictionary > GetCombinedTrailer() const
bool LoadCrossRefTable(FX_FILESIZE pos, bool skip)
uint32_t GetLastObjNum() const
const RetainPtr< CPDF_SecurityHandler > & GetSecurityHandler() const
Definition cpdf_parser.h:96
RetainPtr< CPDF_Object > ParseIndirectObject(uint32_t objnum)
uint32_t GetInfoObjNum() const
bool xref_table_rebuilt() const
CPDF_CryptoHandler * GetCryptoHandler() const
bool OnInit(const CPDF_Dictionary *pEncryptDict, RetainPtr< const CPDF_Array > pIdArray, const ByteString &password)
~CPDF_SecurityHandler() override
uint32_t GetPermissions(bool get_owner_perms) const
void OnCreate(CPDF_Dictionary *pEncryptDict, const CPDF_Array *pIdArray, const ByteString &password)
ByteString GetEncodedPassword(ByteStringView password) const
void SetString(const ByteString &str) override
~CPDF_String() override
CPDF_String * AsMutableString() override
Type GetType() const override
bool IsHex() const
Definition cpdf_string.h:34
bool WriteTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const override
ByteString EncodeString() const
RetainPtr< CPDF_Object > Clone() const override
WideString GetUnicodeText() const override
ByteString GetString() const override
bool IsInteger() const
Definition fx_number.cpp:86
FX_Number(int32_t value)
Definition fx_number.cpp:20
FX_Number(float value)
Definition fx_number.cpp:22
FX_Number(uint32_t value)=delete
int32_t GetSigned() const
Definition fx_number.cpp:96
float GetFloat() const
bool IsSigned() const
Definition fx_number.cpp:91
FX_Number(ByteStringView str)
Definition fx_number.cpp:24
virtual FX_FILESIZE CurrentOffset() const =0
static RetainPtr< IFX_SeekableReadStream > CreateFromFilename(const char *filename)
Definition fx_stream.cpp:68
virtual FX_FILESIZE GetPosition()
Definition fx_stream.cpp:80
virtual bool ReadBlockAtOffset(pdfium::span< uint8_t > buffer, FX_FILESIZE offset)=0
virtual bool IsEOF()
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:50
bool WriteString(ByteStringView str)
Definition fx_stream.cpp:46
virtual ~IFX_WriteStream()=default
bool WriteDWord(uint32_t i)
Definition fx_stream.cpp:54
virtual bool WriteBlock(pdfium::span< const uint8_t > data)=0
virtual size_t GetLength() const
void AppendUint8(uint8_t value)
BinaryBuffer & operator=(const BinaryBuffer &that)=delete
void AppendUint16(uint16_t value)
virtual ~BinaryBuffer()
DataVector< uint8_t > m_buffer
void AppendSpan(pdfium::span< const uint8_t > span)
size_t GetSize() const
pdfium::span< const uint8_t > GetSpan() const
void DeleteBuf(size_t start_index, size_t count)
void AppendDouble(double value)
void ExpandBuf(size_t size)
bool IsEmpty() const
void AppendString(const ByteString &str)
void EstimateSize(size_t size)
BinaryBuffer & operator=(BinaryBuffer &&that) noexcept
BinaryBuffer(BinaryBuffer &&that) noexcept
void AppendUint32(uint32_t value)
BinaryBuffer(const BinaryBuffer &that)=delete
pdfium::span< uint8_t > GetMutableSpan()
DataVector< uint8_t > DetachBuffer()
void SetAllocStep(size_t step)
static ByteString Format(const char *pFormat,...)
ByteString & operator=(ByteString &&that) noexcept
FixedSizeDataVector & operator=(FixedSizeDataVector< T > &&that) noexcept
FixedSizeDataVector & operator=(const FixedSizeDataVector &)=delete
static FixedSizeDataVector TruncatedFrom(FixedSizeDataVector &&that, size_t new_size)
static FixedSizeDataVector Uninit(size_t size)
FixedSizeDataVector(const FixedSizeDataVector &)=delete
FixedSizeDataVector(FixedSizeDataVector< T > &&that) noexcept
static FixedSizeDataVector TryZeroed(size_t size)
static FixedSizeDataVector TryUninit(size_t size)
static FixedSizeDataVector Zeroed(size_t size)
virtual void OnObservableDestroyed()=0
virtual ~ObserverIface()=default
Observable(const Observable &that)=delete
void AddObserver(ObserverIface *pObserver)
size_t ActiveObserversForTesting() const
void RemoveObserver(ObserverIface *pObserver)
Observable & operator=(const Observable &that)=delete
ObservedPtr(T *pObservable)
ObservedPtr()=default
ObservedPtr & operator=(const ObservedPtr &that)
bool operator==(const ObservedPtr &that) const
void OnObservableDestroyed() override
bool HasObservable() const
~ObservedPtr() override
void Reset(T *pObservable=nullptr)
T & operator*() const
ObservedPtr(const ObservedPtr &that)
bool operator!=(const ObservedPtr &that) const
bool operator!=(const U *that) const
bool operator==(const U *that) const
T * operator->() const
StringType Intern(const StringType &str)
T * get() const noexcept
UnownedPtr(const UnownedPtr< U > &that)
Definition unowned_ptr.h:99
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:84
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:92
constexpr UnownedPtr(std::nullptr_t ptr)
Definition unowned_ptr.h:82
bool operator==(const WeakPtr &that) const
Definition weak_ptr.h:40
void Swap(WeakPtr &that)
Definition weak_ptr.h:56
T * operator->()
Definition weak_ptr.h:34
void Reset()
Definition weak_ptr.h:52
T * Get() const
Definition weak_ptr.h:45
WeakPtr()=default
void Reset(std::unique_ptr< T, D > pObj)
Definition weak_ptr.h:53
WeakPtr(std::unique_ptr< T, D > pObj)
Definition weak_ptr.h:25
WeakPtr(const WeakPtr &that)
Definition weak_ptr.h:23
WeakPtr & operator=(const WeakPtr &that)
Definition weak_ptr.h:36
WeakPtr(std::nullptr_t arg)
Definition weak_ptr.h:30
operator bool() const
Definition weak_ptr.h:32
void DeleteObject()
Definition weak_ptr.h:46
const T * operator->() const
Definition weak_ptr.h:35
bool HasOneRef() const
Definition weak_ptr.h:33
WeakPtr(WeakPtr &&that) noexcept
Definition weak_ptr.h:24
bool operator!=(const WeakPtr &that) const
Definition weak_ptr.h:43
WideString(char)=delete
WideString(const std::initializer_list< WideStringView > &list)
WideString & operator+=(const WideString &str)
WideString(wchar_t ch)
bool operator==(const WideString &other) const
ByteString ToUTF8() const
static WideString Format(const wchar_t *pFormat,...)
UNSAFE_BUFFER_USAGE WideString(const wchar_t *pStr, size_t len)
WideString & operator=(WideString &&that) noexcept
WideString(WideStringView str1, WideStringView str2)
WideString()=default
WideString First(size_t count) const
static WideString FromUTF8(ByteStringView str)
WideString & operator+=(const wchar_t *str)
bool operator==(const wchar_t *ptr) const
WideString & operator+=(wchar_t ch)
bool operator<(WideStringView str) const
bool EqualsASCIINoCase(ByteStringView that) const
Definition widestring.h:114
~WideString()=default
WideString(const WideString &other)=default
static WideString FromDefANSI(ByteStringView str)
int GetInteger() const
int CompareNoCase(const wchar_t *str) const
WideString(const wchar_t *ptr)
static WideString FromLatin1(ByteStringView str)
WideString(WideString &&other) noexcept=default
bool IsASCII() const
Definition widestring.h:110
bool operator==(WideStringView str) const
bool operator!=(const WideString &other) const
Definition widestring.h:85
ByteString ToLatin1() const
intptr_t ReferenceCountForTesting() const
static WideString FromUTF16BE(pdfium::span< const uint8_t > data)
bool operator<(const WideString &other) const
int Compare(const wchar_t *str) const
WideString & operator=(const WideString &that)
WideString EncodeEntities() const
ByteString ToASCII() const
static WideString FromASCII(ByteStringView str)
WideString & operator+=(WideStringView str)
static WideString FromUTF16LE(pdfium::span< const uint8_t > data)
ByteString ToUCS2LE() const
WideString Last(size_t count) const
int Compare(const WideString &str) const
WideString & operator=(const wchar_t *str)
WideString Substr(size_t offset) const
WideString(WideStringView str)
bool operator!=(const wchar_t *ptr) const
Definition widestring.h:83
static WideString FormatV(const wchar_t *lpszFormat, va_list argList)
ByteString ToUTF16LE() const
static WideString FormatInteger(int i)
bool EqualsASCII(ByteStringView that) const
Definition widestring.h:111
ByteString ToDefANSI() const
bool operator<(const wchar_t *ptr) const
WideString Substr(size_t first, size_t count) const
bool operator!=(WideStringView str) const
Definition widestring.h:84
WideString & operator=(WideStringView str)
constexpr CheckedNumericState(Src value=0.0, bool is_valid=true)
constexpr CheckedNumericState(const CheckedNumericState< Src > &rhs)
constexpr CheckedNumericState(const CheckedNumericState< Src > &rhs)
constexpr CheckedNumericState(Src value=0, bool is_valid=true)
constexpr bool AssignIfValid(Dst *result) const
static constexpr CheckedNumeric MathOp(const L lhs, const R rhs)
constexpr CheckedNumeric< typename UnderlyingType< Dst >::type > Cast() const
constexpr CheckedNumeric operator-() const
constexpr CheckedNumeric & operator>>=(const Src rhs)
constexpr CheckedNumeric & operator/=(const Src rhs)
constexpr CheckedNumeric(StrictNumeric< Src > value)
constexpr CheckedNumeric(const CheckedNumeric< Src > &rhs)
constexpr CheckedNumeric operator~() const
constexpr CheckedNumeric operator++(int)
constexpr CheckedNumeric & operator^=(const Src rhs)
constexpr CheckedNumeric & operator-=(const Src rhs)
constexpr bool IsValid() const
constexpr CheckedNumeric< typename MathWrapper< CheckedMaxOp, T, U >::type > Max(const U rhs) const
constexpr CheckedNumeric & operator++()
constexpr CheckedNumeric & operator+=(const Src rhs)
constexpr CheckedNumeric operator--(int)
constexpr StrictNumeric< Dst > ValueOrDefault(const Src default_value) const
constexpr CheckedNumeric()=default
constexpr CheckedNumeric & operator|=(const Src rhs)
constexpr CheckedNumeric< typename MathWrapper< CheckedMinOp, T, U >::type > Min(const U rhs) const
constexpr CheckedNumeric< typename UnsignedOrFloatForSize< T >::type > UnsignedAbs() const
constexpr CheckedNumeric(T value)
constexpr CheckedNumeric & operator&=(const Src rhs)
friend U GetNumericValueForTest(const CheckedNumeric< U > &src)
constexpr CheckedNumeric & operator--()
constexpr CheckedNumeric Abs() const
constexpr CheckedNumeric & operator*=(const Src rhs)
constexpr CheckedNumeric & operator%=(const Src rhs)
constexpr CheckedNumeric & MathOp(const R rhs)
constexpr CheckedNumeric(Src value)
constexpr StrictNumeric< Dst > ValueOrDie() const
constexpr ClampedNumeric< typename MathWrapper< ClampedMaxOp, T, U >::type > Max(const U rhs) const
constexpr ClampedNumeric(Src value)
constexpr ClampedNumeric(T value)
constexpr ClampedNumeric< typename UnsignedOrFloatForSize< T >::type > UnsignedAbs() const
constexpr ClampedNumeric operator++(int)
constexpr ClampedNumeric(const ClampedNumeric< Src > &rhs)
constexpr ClampedNumeric & operator*=(const Src rhs)
constexpr ClampedNumeric operator-() const
constexpr ClampedNumeric< typename MathWrapper< ClampedMinOp, T, U >::type > Min(const U rhs) const
constexpr ClampedNumeric & operator^=(const Src rhs)
constexpr ClampedNumeric operator--(int)
constexpr ClampedNumeric< typename UnderlyingType< Dst >::type > Cast() const
constexpr ClampedNumeric & operator++()
constexpr ClampedNumeric & operator>>=(const Src rhs)
constexpr ClampedNumeric & operator&=(const Src rhs)
constexpr ClampedNumeric & operator%=(const Src rhs)
constexpr ClampedNumeric Abs() const
constexpr ClampedNumeric & MathOp(const R rhs)
constexpr ClampedNumeric & operator|=(const Src rhs)
constexpr ClampedNumeric & operator+=(const Src rhs)
constexpr ClampedNumeric & operator/=(const Src rhs)
constexpr ClampedNumeric operator~() const
constexpr ClampedNumeric & operator-=(const Src rhs)
static constexpr ClampedNumeric MathOp(const L lhs, const R rhs)
constexpr ClampedNumeric & operator--()
constexpr ClampedNumeric(StrictNumeric< Src > value)
#define UNSAFE_BUFFERS(...)
#define GSL_POINTER
#define TRIVIAL_ABI
#define UNSAFE_BUFFER_USAGE
CPDF_Array * ToArray(CPDF_Object *obj)
Definition cpdf_array.h:198
const CPDF_Array * ToArray(const CPDF_Object *obj)
Definition cpdf_array.h:202
RetainPtr< CPDF_Array > ToArray(RetainPtr< CPDF_Object > obj)
Definition cpdf_array.h:206
#define FPDFCREATE_INCREMENTAL
#define FPDFCREATE_NO_ORIGINAL
const CPDF_Dictionary * ToDictionary(const CPDF_Object *obj)
RetainPtr< CPDF_Dictionary > ToDictionary(RetainPtr< CPDF_Object > obj)
CPDF_Dictionary * ToDictionary(CPDF_Object *obj)
const CPDF_Number * ToNumber(const CPDF_Object *obj)
Definition cpdf_number.h:46
RetainPtr< CPDF_Number > ToNumber(RetainPtr< CPDF_Object > obj)
Definition cpdf_number.h:50
CPDF_Number * ToNumber(CPDF_Object *obj)
Definition cpdf_number.h:42
CPDF_String * ToString(CPDF_Object *obj)
Definition cpdf_string.h:50
RetainPtr< const CPDF_String > ToString(RetainPtr< const CPDF_Object > obj)
Definition cpdf_string.h:58
const CPDF_String * ToString(const CPDF_Object *obj)
Definition cpdf_string.h:54
bool PDFCharIsWhitespace(uint8_t c)
bool ValidateDictOptionalType(const CPDF_Dictionary *dict, ByteStringView type)
std::optional< FX_FILESIZE > GetHeaderOffset(const RetainPtr< IFX_SeekableReadStream > &pFile)
bool PDFCharIsOther(uint8_t c)
ByteString PDF_NameDecode(ByteStringView orig)
const char kPDFCharTypes[256]
ByteString PDF_NameEncode(const ByteString &orig)
bool PDFCharIsNumeric(uint8_t c)
uint8_t GetPDFCharTypeFromArray(uint8_t c)
bool ValidateFontResourceDict(const CPDF_Dictionary *dict)
bool ValidateDictType(const CPDF_Dictionary *dict, ByteStringView type)
std::vector< float > ReadArrayElementsToVector(const CPDF_Array *pArray, size_t nCount)
bool ValidateDictAllResourcesOfType(const CPDF_Dictionary *dict, ByteStringView type)
bool PDFCharIsDelimiter(uint8_t c)
bool PDFCharIsLineEnding(uint8_t c)
time_t FXSYS_time(time_t *tloc)
int FXSYS_WideHexCharToInt(wchar_t c)
int32_t FXSYS_towupper(wchar_t c)
bool FXSYS_IsHexDigit(char c)
void FXSYS_IntToTwoHexChars(uint8_t n, char *buf)
void FXSYS_SetTimeFunction(time_t(*func)())
bool FXSYS_IsDecimalDigit(wchar_t c)
bool FXSYS_iswalpha(wchar_t c)
bool FXSYS_iswlower(int32_t c)
float FXSYS_wcstof(WideStringView pwsStr, size_t *pUsedLen)
int FXSYS_DecimalCharToInt(char c)
bool FXSYS_IsWideHexDigit(wchar_t c)
bool FXSYS_IsOctalDigit(char c)
bool FXSYS_SafeLT(const T &lhs, const T &rhs)
bool FXSYS_iswupper(int32_t c)
bool FXSYS_IsDecimalDigit(char c)
size_t FXSYS_ToUTF16BE(uint32_t unicode, char *buf)
bool FXSYS_IsUpperASCII(int32_t c)
char FXSYS_ToUpperASCII(char c)
int FXSYS_DecimalCharToInt(wchar_t c)
int FXSYS_HexCharToInt(char c)
bool FXSYS_IsLowerASCII(int32_t c)
bool FXSYS_iswalnum(wchar_t c)
void FXSYS_IntToFourHexChars(uint16_t n, char *buf)
bool FXSYS_iswspace(wchar_t c)
struct tm * FXSYS_localtime(const time_t *tp)
bool FXSYS_SafeEQ(const T &lhs, const T &rhs)
int32_t FXSYS_towlower(wchar_t c)
UNSAFE_BUFFER_USAGE wchar_t * FXSYS_wcsncpy(wchar_t *dstStr, const wchar_t *srcStr, size_t count)
void FXSYS_SetLocaltimeFunction(struct tm *(*func)(const time_t *))
void * FX_Random_MT_Start(uint32_t dwSeed)
Definition fx_random.cpp:87
uint32_t FX_Random_MT_Generate(void *pContext)
Definition fx_random.cpp:98
void FX_Random_GenerateMT(pdfium::span< uint32_t > pBuffer)
void FX_Random_MT_Close(void *pContext)
pdfium::CheckedNumeric< FX_FILESIZE > FX_SAFE_FILESIZE
pdfium::CheckedNumeric< uint32_t > FX_SAFE_UINT32
pdfium::CheckedNumeric< int32_t > FX_SAFE_INT32
constexpr uint32_t FXBSTR_ID(uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4)
Definition fx_string.h:19
double StringToDouble(WideStringView wsStr)
float StringToFloat(ByteStringView str)
ByteString FX_UTF8Encode(WideStringView wsStr)
Definition fx_string.cpp:68
std::u16string FX_UTF16Encode(WideStringView wsStr)
Definition fx_string.cpp:76
float StringToFloat(WideStringView wsStr)
double StringToDouble(ByteStringView str)
#define FX_FILESIZE
Definition fx_types.h:19
WideString operator+(const wchar_t *str1, WideStringView str2)
Definition widestring.h:147
bool operator==(const wchar_t *lhs, const WideString &rhs)
Definition widestring.h:177
WideString operator+(const WideString &str1, const WideString &str2)
Definition widestring.h:156
StringViewTemplate< wchar_t > WideStringView
WideString operator+(const WideString &str1, WideStringView str2)
Definition widestring.h:171
WideString operator+(const WideString &str1, wchar_t ch)
Definition widestring.h:159
bool operator!=(const U *lhs, const ObservedPtr< T > &rhs)
WideString operator+(WideStringView str1, const WideString &str2)
Definition widestring.h:174
std::vector< StrType > Split(const StrType &that, typename StrType::CharType ch)
Definition fx_string.h:36
bool operator!=(WideStringView lhs, const WideString &rhs)
Definition widestring.h:186
StringViewTemplate< char > ByteStringView
bool operator==(WideStringView lhs, const WideString &rhs)
Definition widestring.h:180
bool operator!=(const wchar_t *lhs, const WideString &rhs)
Definition widestring.h:183
WideString operator+(WideStringView str1, const wchar_t *str2)
Definition widestring.h:144
WideString operator+(WideStringView str1, wchar_t ch)
Definition widestring.h:150
void PrintTo(const WideString &str, std::ostream *os)
WideString operator+(WideStringView str1, WideStringView str2)
Definition widestring.h:141
WideString operator+(wchar_t ch, WideStringView str2)
Definition widestring.h:153
WideString operator+(wchar_t ch, const WideString &str2)
Definition widestring.h:162
WideString operator+(const wchar_t *str1, const WideString &str2)
Definition widestring.h:168
bool operator<(const wchar_t *lhs, const WideString &rhs)
Definition widestring.h:189
bool operator==(const U *lhs, const ObservedPtr< T > &rhs)
WideString operator+(const WideString &str1, const wchar_t *str2)
Definition widestring.h:165
constexpr CheckedNumeric< typename MathWrapper< M, L, R >::type > CheckMathOp(const L lhs, const R rhs)
constexpr ClampedNumeric< typename MathWrapper< M, L, R >::type > ClampMathOp(const L lhs, const R rhs)
constexpr bool CheckedMulImpl(T x, T y, T *result)
constexpr bool IsValidForType(const CheckedNumeric< Src > value)
constexpr T SaturatedNegWrapper(T value)
constexpr std::make_unsigned< T >::type InvertWrapper(T value)
constexpr T SaturatedAbsWrapper(T value)
constexpr CheckedNumeric< typename UnderlyingType< T >::type > MakeCheckedNum(const T value)
constexpr T NegateWrapper(T value)
constexpr StrictNumeric< Dst > ValueOrDefaultForType(const CheckedNumeric< Src > value, const Default default_value)
constexpr auto CheckMathOp(const L lhs, const R rhs, const Args... args)
constexpr bool CheckedSubImpl(T x, T y, T *result)
constexpr T AbsWrapper(T value)
constexpr StrictNumeric< Dst > ValueOrDieForType(const CheckedNumeric< Src > value)
L * operator+(L *lhs, const StrictNumeric< R > rhs)
constexpr bool CheckedAddImpl(T x, T y, T *result)
constexpr ClampedNumeric< typename UnderlyingType< T >::type > MakeClampedNum(const T value)
L * operator-(L *lhs, const StrictNumeric< R > rhs)
constexpr auto ClampMathOp(const L lhs, const R rhs, const Args... args)
UnownedPtr< T > WrapUnowned(T *that)
bool Contains(const Container &container, const Value &value)
Definition contains.h:69
std::set< uint32_t > GetObjectsWithReferences(const CPDF_Document *document)
std::set< uint32_t > GetObjectsWithMultipleReferences(const CPDF_Document *document)
#define CHECK(cvref)
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:222
#define BASE_NUMERIC_COMPARISON_OPERATORS(CLASS, NAME, OP)
#define BASE_NUMERICS_LIKELY(x)
#define BASE_NUMERICS_UNLIKELY(x)
#define IsConstantEvaluated()
#define BASE_HAS_OPTIMIZED_SAFE_MATH
#define BASE_NUMERIC_ARITHMETIC_OPERATORS(CLASS, CL_ABBR, OP_NAME, OP, CMP_OP)
#define BASE_NUMERIC_ARITHMETIC_VARIADIC(CLASS, CL_ABBR, OP_NAME)
StringPoolTemplate< WideString > WideStringPool
StringPoolTemplate< ByteString > ByteStringPool
fxcrt::ByteStringView ByteStringView
fxcrt::WideStringView WideStringView
static constexpr bool value
static const NumericRepresentation value
typename math::result_type type
M< typename UnderlyingType< L >::type, typename UnderlyingType< R >::type, void > math
size_t operator()(const WideString &str) const
Definition widestring.h:216
#define UNOWNED_PTR_EXCLUSION
fxcrt::WideString WideString
Definition widestring.h:207
uint32_t FX_HashCode_GetLoweredW(WideStringView str)
uint32_t FX_HashCode_GetW(WideStringView str)