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
autorestorer.h
Go to the documentation of this file.
1// Copyright 2017 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_AUTORESTORER_H_
6#define CORE_FXCRT_AUTORESTORER_H_
7
8#include "core/fxcrt/fx_memory.h"
9#include "core/fxcrt/unowned_ptr.h"
10
11namespace fxcrt {
12
13template <typename T>
15 public:
16 FX_STACK_ALLOCATED();
17
18 explicit AutoRestorer(T* location)
19 : m_Location(location), m_OldValue(*location) {}
21 if (m_Location)
22 *m_Location = m_OldValue;
23 }
24 void AbandonRestoration() { m_Location = nullptr; }
25
26 private:
27 UnownedPtr<T> m_Location;
28 const T m_OldValue;
29};
30
31} // namespace fxcrt
32
33using fxcrt::AutoRestorer;
34
35#endif // CORE_FXCRT_AUTORESTORER_H_
FX_RECT ToFxRect() const
FX_RECT m_FontBBox
Definition cpdf_font.h:183
void CheckFontMetrics()
void LoadPDFEncoding(bool bEmbedded, bool bTrueType)
static float TextUnitToGlyphUnit(float fTextUnit)
static void TextUnitRectToGlyphUnitRect(CFX_FloatRect *pRect)
const FX_RECT & bbox() const
int width() const
CPDF_Type3Font * AsType3Font() override
void WillBeDestroyed() override
bool IsType3Font() const override
CPDF_Type3Char * LoadChar(uint32_t charcode)
void LoadGlyphMap() override
FX_RECT GetCharBBox(uint32_t charcode) override
~CPDF_Type3Font() override
int GetCharWidthF(uint32_t charcode) override
const CPDF_Type3Font * AsType3Font() const override
bool Load() override
AutoRestorer(T *location)
FX_RECT & operator=(const FX_RECT &that)=default