1 // Copyright (c) 2005-2021 Jay Berkenbilt
2 //
3 // This file is part of qpdf.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // 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
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 // Versions of qpdf prior to version 7 were released under the terms
18 // of version 2.0 of the Artistic License. At your option, you may
19 // continue to consider qpdf to be licensed under those terms. Please
20 // see the manual for additional information.
21 
22 #ifndef QPDFDOCUMENTHELPER_HH
23 #define QPDFDOCUMENTHELPER_HH
24 
25 #include <qpdf/DLL.h>
26 #include <qpdf/QPDF.hh>
27 
28 // This is a base class for QPDF Document Helper classes. Document
29 // helpers are classes that provide a convenient, higher-level API for
30 // accessing document-level structures with a PDF file. Document
31 // helpers are always initialized with a reference to a QPDF object,
32 // and the object can always be retrieved. The intention is that you
33 // may freely intermix use of document helpers with the underlying
34 // QPDF object unless there is a specific comment in a specific helper
35 // method that says otherwise. The pattern of using helper objects was
36 // introduced to allow creation of higher level helper functions
37 // without polluting the public interface of QPDF.
38 
39 class QPDFDocumentHelper
40 {
41   public:
42     QPDF_DLL
QPDFDocumentHelper(QPDF & qpdf)43     QPDFDocumentHelper(QPDF& qpdf) :
44         qpdf(qpdf)
45     {
46     }
47     QPDF_DLL
~QPDFDocumentHelper()48     virtual ~QPDFDocumentHelper()
49     {
50     }
51     QPDF_DLL
getQPDF()52     QPDF& getQPDF()
53     {
54         return this->qpdf;
55     }
56     QPDF_DLL
getQPDF() const57     QPDF const& getQPDF() const
58     {
59         return this->qpdf;
60     }
61 
62   protected:
63     QPDF& qpdf;
64 };
65 
66 #endif // QPDFDOCUMENTHELPER_HH
67