/src/qpdf/include/qpdf/QPDFObjectHelper.hh
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2005-2021 Jay Berkenbilt |
2 | | // Copyright (c) 2022-2025 Jay Berkenbilt and Manfred Holger |
3 | | // |
4 | | // This file is part of qpdf. |
5 | | // |
6 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
7 | | // in compliance with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
12 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
13 | | // or implied. See the License for the specific language governing permissions and limitations under |
14 | | // the License. |
15 | | // |
16 | | // Versions of qpdf prior to version 7 were released under the terms of version 2.0 of the Artistic |
17 | | // License. At your option, you may continue to consider qpdf to be licensed under those terms. |
18 | | // Please see the manual for additional information. |
19 | | |
20 | | #ifndef QPDFOBJECTHELPER_HH |
21 | | #define QPDFOBJECTHELPER_HH |
22 | | |
23 | | #include <qpdf/DLL.h> |
24 | | |
25 | | #include <qpdf/QPDFObjectHandle.hh> |
26 | | |
27 | | // This is a base class for QPDF Object Helper classes. Object helpers are classes that provide a |
28 | | // convenient, higher-level API for working with specific types of QPDF objects. Object helpers are |
29 | | // always initialized with a QPDFObjectHandle, and the underlying object handle can always be |
30 | | // retrieved. The intention is that you may freely intermix use of object helpers with the |
31 | | // underlying QPDF objects unless there is a specific comment in a specific helper method that says |
32 | | // otherwise. The pattern of using helper objects was introduced to allow creation of higher level |
33 | | // helper functions without polluting the public interface of QPDFObjectHandle. |
34 | | class QPDF_DLL_CLASS QPDFObjectHelper: public qpdf::BaseHandle |
35 | | { |
36 | | public: |
37 | | QPDFObjectHelper(QPDFObjectHandle oh) : |
38 | 0 | qpdf::BaseHandle(oh.getObj()) |
39 | 0 | { |
40 | 0 | } |
41 | | QPDF_DLL |
42 | | virtual ~QPDFObjectHelper(); |
43 | | QPDFObjectHandle |
44 | | getObjectHandle() |
45 | 0 | { |
46 | 0 | return {obj}; |
47 | 0 | } |
48 | | QPDFObjectHandle const |
49 | | getObjectHandle() const |
50 | 0 | { |
51 | 0 | return {obj}; |
52 | 0 | } |
53 | | |
54 | | protected: |
55 | | QPDF_DLL_PRIVATE |
56 | | QPDFObjectHandle |
57 | | oh() |
58 | 0 | { |
59 | 0 | return {obj}; |
60 | 0 | } |
61 | | QPDF_DLL_PRIVATE |
62 | | QPDFObjectHandle const |
63 | | oh() const |
64 | 0 | { |
65 | 0 | return {obj}; |
66 | 0 | } |
67 | | QPDFObjectHandle oh_; |
68 | | }; |
69 | | |
70 | | #endif // QPDFOBJECTHELPER_HH |