KItinerary

binarydocumentprocessor.cpp
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "binarydocumentprocessor.h"
8
9#include <KItinerary/ExtractorFilter>
10
11#include <QQmlEngine>
12
13using namespace KItinerary;
14
15bool BinaryDocumentProcessor::canHandleData([[maybe_unused]] const QByteArray &data, [[maybe_unused]] QStringView fileName) const
16{
17 return true;
18}
19
21{
23 node.setContent(encodedData);
24 return node;
25}
26
28{
29 const auto b = node.content<QByteArray>();
30 return filter.matches(QString::fromLatin1(b.constData(), b.size()));
31}
32
bool canHandleData(const QByteArray &encodedData, QStringView fileName) const override
Fast check whether the given encoded data can possibly be processed by this instance.
bool matches(const ExtractorFilter &filter, const ExtractorDocumentNode &node) const override
Checks whether the given filter matches node.
ExtractorDocumentNode createNodeFromData(const QByteArray &encodedData) const override
Create a document node from raw data.
QJSValue contentToScriptValue(const ExtractorDocumentNode &node, QJSEngine *engine) const override
Create a QJSValue for the node content.
A node in the extracted document object tree.
QJSValue content
The decoded content of this node.
void setContent(const QVariant &content)
Set decoded content.
Determines whether an extractor is applicable to a given email.
Classes for reservation/travel data models, data extraction and data augmentation.
Definition berelement.h:17
QString fromLatin1(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.