KItinerary

extractorrepository.h
1/*
2 SPDX-FileCopyrightText: 2017-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 <QStringList>
12#include <memory>
13#include <vector>
14
15class QJsonValue;
16class QString;
17
18namespace KItinerary {
19
20class AbstractExtractor;
21class ExtractorDocumentNode;
22class ExtractorRepositoryPrivate;
23class ScriptExtractor;
24
25/**
26 * Collection of all known data extractors.
27 * This class is usually not used directly, but as an implementation detail to KItinerary::ExtractorEngine.
28 *
29 * See KItinerary::Extractor on where this loads its content from.
30 * @internal This API is only exported for developer tooling.
31 * @see KItinerary::ScriptExtractor.
32 */
33class KITINERARY_EXPORT ExtractorRepository
34{
35public:
40
41 /** Reload the extractor repository.
42 * Not needed during normal operations, this is mainly for tooling.
43 */
44 void reload();
45
46 /** All known extractors. */
47 const std::vector<std::unique_ptr<AbstractExtractor>>& extractors() const;
48
49 /** Finds matching extractors for the given document node. */
50 void extractorsForNode(const ExtractorDocumentNode &node, std::vector<const AbstractExtractor*> &extractors) const;
51
52 /** Returns the extractor with the given identifier. */
53 const AbstractExtractor* extractorByName(QStringView name) const;
54
55 /** Returns the list of additional search paths for extractor scripts. */
56 QStringList additionalSearchPaths() const;
57 /** Sets additional search paths to look for extractors. */
58 void setAdditionalSearchPaths(const QStringList &searchPaths);
59
60 ///@cond internal
61 /** JSON serialization of @p extractor, including all other Extractor definitions in the same file, if any.
62 * Only for tooling, do not use otherwise.
63 */
64 QJsonValue extractorToJson(const ScriptExtractor *extractor) const;
65 ///@endcond
66
67private:
68 ExtractorRepositoryPrivate* d;
69};
70
71}
72
Abstract base class for data extractors.
A node in the extracted document object tree.
Collection of all known data extractors.
A single unstructured data extraction rule set.
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 Fri Oct 4 2024 12:00:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.