KItinerary

extractordocumentnodefactory.h
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
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
16class QByteArray;
17class QVariant;
18
19namespace KItinerary {
20
21class ExtractorDocumentNode;
22class ExtractorDocumentNodeFactoryPrivate;
23class ExtractorDocumentProcessor;
24
25/** Instantiates KItinerary::ExtractorDocumentNode instances using the type-specific document processor. */
26class KITINERARY_EXPORT ExtractorDocumentNodeFactory
27{
28public:
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
51private:
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.
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:48 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.