1 | //======================================================================== |
2 | // |
3 | // PDFDocFactory.h |
4 | // |
5 | // This file is licensed under the GPLv2 or later |
6 | // |
7 | // Copyright 2010 Hib Eris <hib@hiberis.nl> |
8 | // Copyright 2010, 2018, 2021, 2022 Albert Astals Cid <aacid@kde.org> |
9 | // Copyright 2019, 2021 Oliver Sander <oliver.sander@tu-dresden.de> |
10 | // |
11 | //======================================================================== |
12 | |
13 | #ifndef PDFDOCFACTORY_H |
14 | #define PDFDOCFACTORY_H |
15 | |
16 | #include <memory> |
17 | |
18 | #include "PDFDoc.h" |
19 | #include "poppler_private_export.h" |
20 | |
21 | class GooString; |
22 | class PDFDocBuilder; |
23 | |
24 | //------------------------------------------------------------------------ |
25 | // PDFDocFactory |
26 | // |
27 | // PDFDocFactory allows the construction of PDFDocs from different URIs. |
28 | // |
29 | // By default, it supports local files, 'file://' and 'fd:0' (stdin). When |
30 | // compiled with libcurl, it also supports 'http://' and 'https://'. |
31 | // |
32 | // You can extend the supported URIs by giving a list of PDFDocBuilders to |
33 | // the constructor, or by registering a new PDFDocBuilder afterwards. |
34 | //------------------------------------------------------------------------ |
35 | |
36 | class POPPLER_PRIVATE_EXPORT PDFDocFactory |
37 | { |
38 | |
39 | public: |
40 | explicit PDFDocFactory(std::vector<PDFDocBuilder *> *pdfDocBuilders = nullptr); |
41 | ~PDFDocFactory(); |
42 | |
43 | PDFDocFactory(const PDFDocFactory &) = delete; |
44 | PDFDocFactory &operator=(const PDFDocFactory &) = delete; |
45 | |
46 | // Create a PDFDoc. Returns a PDFDoc. You should check this PDFDoc |
47 | // with PDFDoc::isOk() for failures. |
48 | // The caller is responsible for deleting ownerPassword, userPassWord and guiData. |
49 | std::unique_ptr<PDFDoc> createPDFDoc(const GooString &uri, const std::optional<GooString> &ownerPassword = {}, const std::optional<GooString> &userPassword = {}, void *guiDataA = nullptr); |
50 | |
51 | // Extend supported URIs with the ones from the PDFDocBuilder. |
52 | void registerPDFDocBuilder(PDFDocBuilder *pdfDocBuilder); |
53 | |
54 | private: |
55 | std::vector<PDFDocBuilder *> *builders; |
56 | }; |
57 | |
58 | #endif /* PDFDOCFACTORY_H */ |
59 | |