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
checked_math.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_CHECKED_MATH_H_
6#define CORE_FXCRT_NUMERICS_CHECKED_MATH_H_
7
8#include <stddef.h>
9
10#include <limits>
11#include <type_traits>
12
13#include "core/fxcrt/numerics/checked_math_impl.h"
14
15namespace pdfium {
16namespace internal {
17
18template <typename T>
20 static_assert(std::is_arithmetic<T>::value,
21 "CheckedNumeric<T>: T must be a numeric type.");
22
23 public:
24 template <typename Src>
25 friend class CheckedNumeric;
26
27 using type = T;
28
29 constexpr CheckedNumeric() = default;
30
31 // Copy constructor.
32 template <typename Src>
33 constexpr CheckedNumeric(const CheckedNumeric<Src>& rhs)
34 : state_(rhs.state_.value(), rhs.IsValid()) {}
35
36 // Strictly speaking, this is not necessary, but declaring this allows class
37 // template argument deduction to be used so that it is possible to simply
38 // write `CheckedNumeric(777)` instead of `CheckedNumeric<int>(777)`.
39 // NOLINTNEXTLINE(google-explicit-constructor)
40 constexpr CheckedNumeric(T value) : state_(value) {}
41
42 // This is not an explicit constructor because we implicitly upgrade regular
43 // numerics to CheckedNumerics to make them easier to use.
44 template <typename Src,
45 typename = std::enable_if_t<std::is_arithmetic<Src>::value>>
46 // NOLINTNEXTLINE(google-explicit-constructor)
47 constexpr CheckedNumeric(Src value) : state_(value) {}
48
49 // This is not an explicit constructor because we want a seamless conversion
50 // from StrictNumeric types.
51 template <typename Src>
52 // NOLINTNEXTLINE(google-explicit-constructor)
53 constexpr CheckedNumeric(StrictNumeric<Src> value)
54 : state_(static_cast<Src>(value)) {}
55
56 // IsValid() - The public API to test if a CheckedNumeric is currently valid.
57 // A range checked destination type can be supplied using the Dst template
58 // parameter.
59 template <typename Dst = T>
60 constexpr bool IsValid() const {
61 return state_.is_valid() &&
62 IsValueInRangeForNumericType<Dst>(state_.value());
63 }
64
65 // AssignIfValid(Dst) - Assigns the underlying value if it is currently valid
66 // and is within the range supported by the destination type. Returns true if
67 // successful and false otherwise.
68 template <typename Dst>
69#if defined(__clang__) || defined(__GNUC__)
70 __attribute__((warn_unused_result))
71#elif defined(_MSC_VER)
73#endif
74 constexpr bool
75 AssignIfValid(Dst* result) const {
76 return BASE_NUMERICS_LIKELY(IsValid<Dst>())
77 ? ((*result = static_cast<Dst>(state_.value())), true)
78 : false;
79 }
80
81 // ValueOrDie() - The primary accessor for the underlying value. If the
82 // current state is not valid it will CHECK and crash.
83 // A range checked destination type can be supplied using the Dst template
84 // parameter, which will trigger a CHECK if the value is not in bounds for
85 // the destination.
86 // The CHECK behavior can be overridden by supplying a handler as a
87 // template parameter, for test code, etc. However, the handler cannot access
88 // the underlying value, and it is not available through other means.
89 template <typename Dst = T, class CheckHandler = CheckOnFailure>
90 constexpr StrictNumeric<Dst> ValueOrDie() const {
91 return BASE_NUMERICS_LIKELY(IsValid<Dst>())
92 ? static_cast<Dst>(state_.value())
93 : CheckHandler::template HandleFailure<Dst>();
94 }
95
96 // ValueOrDefault(T default_value) - A convenience method that returns the
97 // current value if the state is valid, and the supplied default_value for
98 // any other state.
99 // A range checked destination type can be supplied using the Dst template
100 // parameter. WARNING: This function may fail to compile or CHECK at runtime
101 // if the supplied default_value is not within range of the destination type.
102 template <typename Dst = T, typename Src>
103 constexpr StrictNumeric<Dst> ValueOrDefault(const Src default_value) const {
104 return BASE_NUMERICS_LIKELY(IsValid<Dst>())
105 ? static_cast<Dst>(state_.value())
106 : checked_cast<Dst>(default_value);
107 }
108
109 // Returns a checked numeric of the specified type, cast from the current
110 // CheckedNumeric. If the current state is invalid or the destination cannot
111 // represent the result then the returned CheckedNumeric will be invalid.
112 template <typename Dst>
113 constexpr CheckedNumeric<typename UnderlyingType<Dst>::type> Cast() const {
114 return *this;
115 }
116
117 // This friend method is available solely for providing more detailed logging
118 // in the tests. Do not implement it in production code, because the
119 // underlying values may change at any time.
120 template <typename U>
121 friend U GetNumericValueForTest(const CheckedNumeric<U>& src);
122
123 // Prototypes for the supported arithmetic operator overloads.
124 template <typename Src>
125 constexpr CheckedNumeric& operator+=(const Src rhs);
126 template <typename Src>
127 constexpr CheckedNumeric& operator-=(const Src rhs);
128 template <typename Src>
129 constexpr CheckedNumeric& operator*=(const Src rhs);
130 template <typename Src>
131 constexpr CheckedNumeric& operator/=(const Src rhs);
132 template <typename Src>
133 constexpr CheckedNumeric& operator%=(const Src rhs);
134 template <typename Src>
135 constexpr CheckedNumeric& operator<<=(const Src rhs);
136 template <typename Src>
137 constexpr CheckedNumeric& operator>>=(const Src rhs);
138 template <typename Src>
139 constexpr CheckedNumeric& operator&=(const Src rhs);
140 template <typename Src>
141 constexpr CheckedNumeric& operator|=(const Src rhs);
142 template <typename Src>
143 constexpr CheckedNumeric& operator^=(const Src rhs);
144
145 constexpr CheckedNumeric operator-() const {
146 // Use an optimized code path for a known run-time variable.
147 if (!IsConstantEvaluated() && std::is_signed<T>::value &&
148 std::is_floating_point<T>::value) {
149 return FastRuntimeNegate();
150 }
151 // The negation of two's complement int min is int min.
152 const bool is_valid =
153 IsValid() &&
154 (!std::is_signed<T>::value || std::is_floating_point<T>::value ||
155 NegateWrapper(state_.value()) != std::numeric_limits<T>::lowest());
156 return CheckedNumeric<T>(NegateWrapper(state_.value()), is_valid);
157 }
158
159 constexpr CheckedNumeric operator~() const {
160 return CheckedNumeric<decltype(InvertWrapper(T()))>(
161 InvertWrapper(state_.value()), IsValid());
162 }
163
164 constexpr CheckedNumeric Abs() const {
165 return !IsValueNegative(state_.value()) ? *this : -*this;
166 }
167
168 template <typename U>
170 const U rhs) const {
171 return CheckMax(*this, rhs);
172 }
173
174 template <typename U>
176 const U rhs) const {
177 return CheckMin(*this, rhs);
178 }
179
180 // This function is available only for integral types. It returns an unsigned
181 // integer of the same width as the source type, containing the absolute value
182 // of the source, and properly handling signed min.
183 constexpr CheckedNumeric<typename UnsignedOrFloatForSize<T>::type>
184 UnsignedAbs() const {
185 return CheckedNumeric<typename UnsignedOrFloatForSize<T>::type>(
186 SafeUnsignedAbs(state_.value()), state_.is_valid());
187 }
188
189 constexpr CheckedNumeric& operator++() {
190 *this += 1;
191 return *this;
192 }
193
194 constexpr CheckedNumeric operator++(int) {
195 CheckedNumeric value = *this;
196 *this += 1;
197 return value;
198 }
199
200 constexpr CheckedNumeric& operator--() {
201 *this -= 1;
202 return *this;
203 }
204
205 constexpr CheckedNumeric operator--(int) {
206 // TODO(pkasting): Consider std::exchange() once it's constexpr in C++20.
207 const CheckedNumeric value = *this;
208 *this -= 1;
209 return value;
210 }
211
212 // These perform the actual math operations on the CheckedNumerics.
213 // Binary arithmetic operations.
214 template <template <typename, typename, typename> class M,
215 typename L,
216 typename R>
217 static constexpr CheckedNumeric MathOp(const L lhs, const R rhs) {
218 using Math = typename MathWrapper<M, L, R>::math;
219 T result = 0;
220 const bool is_valid =
221 Wrapper<L>::is_valid(lhs) && Wrapper<R>::is_valid(rhs) &&
222 Math::Do(Wrapper<L>::value(lhs), Wrapper<R>::value(rhs), &result);
223 return CheckedNumeric<T>(result, is_valid);
224 }
225
226 // Assignment arithmetic operations.
227 template <template <typename, typename, typename> class M, typename R>
228 constexpr CheckedNumeric& MathOp(const R rhs) {
229 using Math = typename MathWrapper<M, T, R>::math;
230 T result = 0; // Using T as the destination saves a range check.
231 const bool is_valid =
232 state_.is_valid() && Wrapper<R>::is_valid(rhs) &&
233 Math::Do(state_.value(), Wrapper<R>::value(rhs), &result);
234 *this = CheckedNumeric<T>(result, is_valid);
235 return *this;
236 }
237
238 private:
239 CheckedNumericState<T> state_;
240
241 CheckedNumeric FastRuntimeNegate() const {
242 T result;
243 const bool success = CheckedSubOp<T, T>::Do(T(0), state_.value(), &result);
244 return CheckedNumeric<T>(result, IsValid() && success);
245 }
246
247 template <typename Src>
248 constexpr CheckedNumeric(Src value, bool is_valid)
249 : state_(value, is_valid) {}
250
251 // These wrappers allow us to handle state the same way for both
252 // CheckedNumeric and POD arithmetic types.
253 template <typename Src>
254 struct Wrapper {
255 static constexpr bool is_valid(Src) { return true; }
256 static constexpr Src value(Src value) { return value; }
257 };
258
259 template <typename Src>
260 struct Wrapper<CheckedNumeric<Src>> {
261 static constexpr bool is_valid(const CheckedNumeric<Src> v) {
262 return v.IsValid();
263 }
264 static constexpr Src value(const CheckedNumeric<Src> v) {
265 return v.state_.value();
266 }
267 };
268
269 template <typename Src>
270 struct Wrapper<StrictNumeric<Src>> {
271 static constexpr bool is_valid(const StrictNumeric<Src>) { return true; }
272 static constexpr Src value(const StrictNumeric<Src> v) {
273 return static_cast<Src>(v);
274 }
275 };
276};
277
278// Convenience functions to avoid the ugly template disambiguator syntax.
279template <typename Dst, typename Src>
280constexpr bool IsValidForType(const CheckedNumeric<Src> value) {
281 return value.template IsValid<Dst>();
282}
283
284template <typename Dst, typename Src>
286 const CheckedNumeric<Src> value) {
287 return value.template ValueOrDie<Dst>();
288}
289
290template <typename Dst, typename Src, typename Default>
292 const CheckedNumeric<Src> value,
293 const Default default_value) {
294 return value.template ValueOrDefault<Dst>(default_value);
295}
296
297// Convenience wrapper to return a new CheckedNumeric from the provided
298// arithmetic or CheckedNumericType.
299template <typename T>
301 const T value) {
302 return value;
303}
304
305// These implement the variadic wrapper for the math operations.
306template <template <typename, typename, typename> class M,
307 typename L,
308 typename R>
310 const L lhs,
311 const R rhs) {
312 using Math = typename MathWrapper<M, L, R>::math;
313 return CheckedNumeric<typename Math::result_type>::template MathOp<M>(lhs,
314 rhs);
315}
316
317// General purpose wrapper template for arithmetic operations.
318template <template <typename, typename, typename> class M,
319 typename L,
320 typename R,
321 typename... Args>
322constexpr auto CheckMathOp(const L lhs, const R rhs, const Args... args) {
323 return CheckMathOp<M>(CheckMathOp<M>(lhs, rhs), args...);
324}
325
326BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Add, +, +=)
327BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Sub, -, -=)
328BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Mul, *, *=)
329BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Div, /, /=)
330BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Mod, %, %=)
331BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Lsh, <<, <<=)
332BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Rsh, >>, >>=)
333BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, And, &, &=)
334BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Or, |, |=)
335BASE_NUMERIC_ARITHMETIC_OPERATORS(Checked, Check, Xor, ^, ^=)
336BASE_NUMERIC_ARITHMETIC_VARIADIC(Checked, Check, Max)
337BASE_NUMERIC_ARITHMETIC_VARIADIC(Checked, Check, Min)
338
339// These are some extra StrictNumeric operators to support simple pointer
340// arithmetic with our result types. Since wrapping on a pointer is always
341// bad, we trigger the CHECK condition here.
342template <typename L, typename R>
343L* operator+(L* lhs, const StrictNumeric<R> rhs) {
344 const uintptr_t result = CheckAdd(reinterpret_cast<uintptr_t>(lhs),
345 CheckMul(sizeof(L), static_cast<R>(rhs)))
346 .template ValueOrDie<uintptr_t>();
347 return reinterpret_cast<L*>(result);
348}
349
350template <typename L, typename R>
351L* operator-(L* lhs, const StrictNumeric<R> rhs) {
352 const uintptr_t result = CheckSub(reinterpret_cast<uintptr_t>(lhs),
353 CheckMul(sizeof(L), static_cast<R>(rhs)))
354 .template ValueOrDie<uintptr_t>();
355 return reinterpret_cast<L*>(result);
356}
357
358} // namespace internal
359
360using internal::CheckAdd;
361using internal::CheckAnd;
362using internal::CheckDiv;
363using internal::CheckedNumeric;
364using internal::CheckLsh;
365using internal::CheckMax;
366using internal::CheckMin;
367using internal::CheckMod;
368using internal::CheckMul;
369using internal::CheckOr;
370using internal::CheckRsh;
371using internal::CheckSub;
372using internal::CheckXor;
373using internal::IsValidForType;
374using internal::MakeCheckedNum;
375using internal::ValueOrDefaultForType;
376using internal::ValueOrDieForType;
377
378} // namespace pdfium
379
380#endif // CORE_FXCRT_NUMERICS_CHECKED_MATH_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
#define CHECK_LE(x, y)
Definition check_op.h:14
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 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
#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 bool IsValidForType(const CheckedNumeric< Src > value)
constexpr CheckedNumeric< typename UnderlyingType< T >::type > MakeCheckedNum(const 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 StrictNumeric< Dst > ValueOrDieForType(const CheckedNumeric< Src > value)
L * operator+(L *lhs, const StrictNumeric< R > rhs)
L * operator-(L *lhs, const StrictNumeric< R > rhs)
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_NUMERICS_LIKELY(x)
#define IsConstantEvaluated()
#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
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)