blob: 51e7cba7f82c4d12bb8dc27e0f462447787f44e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PUBLIC_CPP_FPDF_DELETERS_H_
#define PUBLIC_CPP_FPDF_DELETERS_H_
#include "public/fpdf_annot.h"
#include "public/fpdf_dataavail.h"
#include "public/fpdf_edit.h"
#include "public/fpdf_formfill.h"
#include "public/fpdf_structtree.h"
#include "public/fpdf_text.h"
#include "public/fpdfview.h"
// Custom deleters for using FPDF_* types with std::unique_ptr<>.
struct FPDFAnnotationDeleter {
inline void operator()(FPDF_ANNOTATION annot) { FPDFPage_CloseAnnot(annot); }
};
struct FPDFAvailDeleter {
inline void operator()(FPDF_AVAIL avail) { FPDFAvail_Destroy(avail); }
};
struct FPDFBitmapDeleter {
inline void operator()(FPDF_BITMAP bitmap) { FPDFBitmap_Destroy(bitmap); }
};
struct FPDFDocumentDeleter {
inline void operator()(FPDF_DOCUMENT doc) { FPDF_CloseDocument(doc); }
};
struct FPDFFormHandleDeleter {
inline void operator()(FPDF_FORMHANDLE form) {
FPDFDOC_ExitFormFillEnvironment(form);
}
};
struct FPDFTextPageDeleter {
inline void operator()(FPDF_TEXTPAGE text) { FPDFText_ClosePage(text); }
};
struct FPDFPageDeleter {
inline void operator()(FPDF_PAGE page) { FPDF_ClosePage(page); }
};
struct FPDFStructTreeDeleter {
inline void operator()(FPDF_STRUCTTREE tree) { FPDF_StructTree_Close(tree); }
};
struct FPDFFontDeleter {
inline void operator()(FPDF_FONT font) { FPDFFont_Close(font); }
};
#endif // PUBLIC_CPP_FPDF_DELETERS_H_
|