File indexing completed on 2024-12-29 04:49:57

0001 /*
0002     SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kitinerary_export.h"
0010 
0011 class QString;
0012 
0013 namespace KItinerary {
0014 class ExtractorDocumentNode;
0015 class ExtractorEngine;
0016 class ExtractorResult;
0017 
0018 /** Abstract base class for data extractors. */
0019 class KITINERARY_EXPORT AbstractExtractor
0020 {
0021 public:
0022     virtual ~AbstractExtractor();
0023 
0024     /** Identifier for this extractor.
0025      *  Mainly used for diagnostics and tooling.
0026      */
0027     virtual QString name() const = 0;
0028 
0029     /** Fast check whether this extractor is applicable for @p node. */
0030     virtual bool canHandle(const ExtractorDocumentNode &node) const = 0;
0031 
0032     /** Extract data from @p node. */
0033     virtual ExtractorResult extract(const ExtractorDocumentNode &node, const ExtractorEngine *engine) const = 0;
0034 };
0035 
0036 }
0037