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
ptr_util.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_PTR_UTIL_H_
6#define CORE_FXCRT_PTR_UTIL_H_
7
8#include <memory>
9#include <type_traits>
10
11namespace pdfium {
12
13// Helper to transfer ownership of a raw pointer to a std::unique_ptr<T>.
14// Note that std::unique_ptr<T> has very different semantics from
15// std::unique_ptr<T[]>: do not use this helper for array allocations.
16template <typename T>
18 static_assert(!std::is_array<T>::value, "array types are unsupported");
19 static_assert(std::is_object<T>::value, "non-object types are unsupported");
20 return std::unique_ptr<T>(ptr);
21}
22
23} // namespace pdfium
24
25#endif // CORE_FXCRT_PTR_UTIL_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
Definition cpdf_array.h:29
bool KeyExist(const ByteString &key) const
int GetIntegerFor(const ByteString &key) const
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
FX_FILESIZE GetHintStart() const
uint32_t GetFirstPageObjNum() const
FX_FILESIZE GetLastXRefOffset() const
FX_FILESIZE GetFirstPageEndOffset() const
FX_FILESIZE GetMainXRefTableFirstEntryOffset() const
FX_FILESIZE GetFileSize() const
CPDF_LinearizedHeader(const CPDF_Dictionary *pDict, FX_FILESIZE szLastXRefOffset)
static constexpr uint32_t kMaxObjectNumber
Definition cpdf_parser.h:57
RetainPtr< CPDF_Object > GetIndirectObject(CPDF_IndirectObjectHolder *pObjList, ParseType parse_type)
FX_FILESIZE GetPos() const
FX_FILESIZE GetDocumentSize() const
void SetPos(FX_FILESIZE pos)
pdfium::CheckedNumeric< uint32_t > FX_SAFE_UINT32
#define FX_FILESIZE
Definition fx_types.h:19
std::unique_ptr< T > WrapUnique(T *ptr)
Definition ptr_util.h:17