Commit 343d0e74 authored by Volker Krause's avatar Volker Krause
Browse files

Remove the old generic IATA BCBP extractor

This is now no longer needed as we create proper IATA BCBP nodes in the
document tree.
parent da19ff00
Pipeline #62601 canceled with stages
......@@ -27,13 +27,11 @@ private Q_SLOTS:
ExtractorRepository repo;
const auto count = repo.extractors().size();
QVERIFY(count > 0);
QVERIFY(repo.extractorByName(u"<IATA BCBP>"));
QVERIFY(repo.extractorByName(u"chaos-communication-congress"));
QVERIFY(!repo.extractorByName(u"I-DONT-EXIST"));
repo.reload();
QCOMPARE(repo.extractors().size(), count);
QVERIFY(repo.extractorByName(u"<IATA BCBP>"));
QVERIFY(repo.extractorByName(u"chaos-communication-congress"));
QVERIFY(!repo.extractorByName(u"I-DONT-EXIST"));
}
......@@ -61,10 +59,7 @@ private Q_SLOTS:
root = engine.documentNodeFactory()->createNode(QStringLiteral("M1DOE/JOHN EXXX007 TXLBRUSN 2592 110"), u"text/plain");
QVERIFY(!root.isNull());
engine.extractorRepository()->extractorsForNode(root, extractors);
QCOMPARE(extractors.size(), 1);
QVERIFY(extractors[0]->name().startsWith(QLatin1String("<IATA BCBP>")));
QVERIFY(!dynamic_cast<const ScriptExtractor*>(extractors[0]));
extractors.clear();
QCOMPARE(extractors.size(), 0);
}
};
......
......@@ -38,8 +38,6 @@ set(kitinerary_lib_srcs
era/ssbv2ticket.cpp
era/ssbv3ticket.cpp
extractors/iatabcbpextractor.cpp
iata/iatabcbp.cpp
iata/iatabcbpparser.cpp
iata/iatabcbpsections.cpp
......
......@@ -8,7 +8,6 @@
#include "extractorrepository.h"
#include "logging.h"
#include "extractors/iatabcbpextractor.h"
#include <KItinerary/ExtractorDocumentNode>
#include <KItinerary/ExtractorDocumentProcessor>
......@@ -58,7 +57,6 @@ void ExtractorRepositoryPrivate::loadAll()
void ExtractorRepositoryPrivate::initBuiltInExtractors()
{
addExtractor(std::make_unique<IataBcbpExtractor>());
}
ExtractorRepository::ExtractorRepository()
......
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "iatabcbpextractor.h"
#include <iata/iatabcbpparser.h>
#include <KItinerary/ExtractorDocumentNode>
#include <KItinerary/ExtractorResult>
using namespace KItinerary;
QString IataBcbpExtractor::name() const
{
return QStringLiteral("<IATA BCBP>");
}
bool IataBcbpExtractor::canHandle(const ExtractorDocumentNode &node) const
{
return node.isA<QString>() && IataBcbpParser::maybeIataBcbp(node.content<QString>());
}
ExtractorResult IataBcbpExtractor::extract(const ExtractorDocumentNode &node, [[maybe_unused]] const ExtractorEngine *engine) const
{
return IataBcbpParser::parse(node.content<QString>(), node.contextDateTime().date());
}
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#pragma once
#include <KItinerary/AbstractExtractor>
namespace KItinerary {
/** IATA boarding pass barcode extractor. */
class IataBcbpExtractor : public AbstractExtractor
{
public:
QString name() const override;
bool canHandle(const ExtractorDocumentNode &node) const override;
ExtractorResult extract(const ExtractorDocumentNode &node, const ExtractorEngine *engine) const override;
};
}
......@@ -87,8 +87,3 @@ QVector<QVariant> IataBcbpParser::parse(const IataBcbp &bcbp, const QDate &conte
return result;
}
bool IataBcbpParser::maybeIataBcbp(const QString &message)
{
return IataBcbp::maybeIataBcbp(message);
}
......@@ -34,11 +34,6 @@ namespace IataBcbpParser
*/
QVector<QVariant> parse(const QString &message, const QDate &externalIssueDate = QDate());
KITINERARY_EXPORT QVector<QVariant> parse(const IataBcbp &bcbp, const QDate &contextDate);
/** Quickly test if @p message could be a IATA BCBP code.
* This optimizes for speed rather than correctness, for use in barcode content auto-detection.
*/
bool maybeIataBcbp(const QString &message);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment