KItinerary

extractordocumentnodefactory.h
1 /*
2  SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <kitinerary_export.h>
10 
11 #include <QString>
12 #include <QStringView>
13 
14 #include <memory>
15 
16 class QByteArray;
17 class QVariant;
18 
19 namespace KItinerary {
20 
21 class ExtractorDocumentNode;
22 class ExtractorDocumentNodeFactoryPrivate;
23 class ExtractorDocumentProcessor;
24 
25 /** Instantiates KItinerary::ExtractorDocumentNode instances using the type-specific document processor. */
26 class KITINERARY_EXPORT ExtractorDocumentNodeFactory
27 {
28 public:
31 
32  /** Create a new document node from @p data.
33  * @param fileName Optional hint for MIME-type auto-detection.
34  * @param mimeType MIME type of @p data if known, auto-detected otherwise.
35  */
36  ExtractorDocumentNode createNode(const QByteArray &data, QStringView fileName = {}, QStringView mimeType = {}) const;
37  /** Create a node for an already decoded content object. */
38  ExtractorDocumentNode createNode(const QVariant &decodedData, QStringView mimeType) const;
39 
40  /** Register a new document processor. */
41  void registerProcessor(std::unique_ptr<ExtractorDocumentProcessor> &&processor, QStringView canonicalMimeType,
42  std::initializer_list<QStringView> aliasMimeTypes = {});
43 
44  /** Perform extraction of "risky" content such as PDF files in a separate process.
45  * This is safer as it isolates the using application from crashes/hangs due to corrupt files.
46  * It is however slower, and not available on all platforms.
47  * This is off by default.
48  */
49  void setUseSeparateProcess(bool separateProcess);
50 
51 private:
52  std::unique_ptr<ExtractorDocumentNodeFactoryPrivate> d;
53 };
54 
55 }
56 
Instantiates KItinerary::ExtractorDocumentNode instances using the type-specific document processor.
A node in the extracted document object tree.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:08:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.