Search for usage in LXR

KItinerary::ExtractorDocumentNode Class Reference

#include <extractordocumentnode.h>


QVariantList childNodes
QJSValue content
QDateTime contextDateTime
bool isNull
QVariant location
QString mimeType
KItinerary::ExtractorDocumentNode parent
QJsonArray result

Public Member Functions

 ExtractorDocumentNode ()
 ExtractorDocumentNode (const ExtractorDocumentNode &other)
 ExtractorDocumentNode (ExtractorDocumentNode &&other)
void addResult (ExtractorResult &&result)
void appendChild (ExtractorDocumentNode &child)
const std::vector< ExtractorDocumentNode > & childNodes () const
QVariant content () const
template<typename T >
std::enable_if<!std::is_pointer< T >::value||!QMetaTypeId2< Internal::OwnedPtr< typename std::remove_pointer< T >::type > >::Defined, T >::type content () const
template<typename T >
std::enable_if< std::is_pointer< T >::value &&QMetaTypeId2< Internal::OwnedPtr< typename std::remove_pointer< T >::type > >::Defined, T >::type content () const
QDateTime contextDateTime () const
Q_INVOKABLE QVariantList findChildNodes (const QJSValue &jsFilter) const
template<typename T >
bool isA () const
bool isNull () const
QVariant location () const
QString mimeType () const
ExtractorDocumentNodeoperator= (const ExtractorDocumentNode &other)
ExtractorDocumentNodeoperator= (ExtractorDocumentNode &&other)
bool operator== (const ExtractorDocumentNode &other) const
ExtractorDocumentNode parent () const
ExtractorResult result () const
void setContent (const QVariant &content)
template<typename T >
void setContent (const T &value)
void setContextDateTime (const QDateTime &contextDateTime)
void setLocation (const QVariant &location)
void setResult (ExtractorResult &&result)
void setUsedExtractor (const QString &usedExtractor)
QString usedExtractor () const

Detailed Description

A node in the extracted document object tree.

Essentially this models a tree of variants representing the input document, Each node being associated with and managed by the KItinerary::ExtractorDocumentProcessor for its corresponding type. Each nodes also carries the result of data extraction on itself and/or its children. This is meant for consumption in both C++ and JS code.

Definition at line 49 of file extractordocumentnode.h.

Property Documentation

◆ childNodes

const std::vector< ExtractorDocumentNode > & ExtractorDocumentNode::childNodes

Child nodes, for QJSEngine access.

Definition at line 57 of file extractordocumentnode.h.

◆ content

QVariant ExtractorDocumentNode::content

The decoded content of this node.

The exact type in here depends on the MIME type, adapted for QJSEngine consumption.

Definition at line 64 of file extractordocumentnode.h.

◆ contextDateTime

QDateTime ExtractorDocumentNode::contextDateTime

The best known context date/time at this point in the document tree.

If not set on this node, the context date/time of the parent node is returned.

Definition at line 68 of file extractordocumentnode.h.

◆ location

QVariant ExtractorDocumentNode::location

Information about the location of this node in relation to one of its ancestors.

The exact meaning of this depends on the type of the node, one example would be a page number an image is found on in a PDF document.

Definition at line 76 of file extractordocumentnode.h.

◆ mimeType

QString ExtractorDocumentNode::mimeType

The MIME type of this node.

Definition at line 60 of file extractordocumentnode.h.

◆ parent

ExtractorDocumentNode ExtractorDocumentNode::parent

The parent node, or a null node if this is the root node.

Definition at line 55 of file extractordocumentnode.h.

◆ result

ExtractorResult ExtractorDocumentNode::result

Result access for QJSEngine.

Definition at line 70 of file extractordocumentnode.h.

Constructor & Destructor Documentation

◆ ExtractorDocumentNode()

ExtractorDocumentNode::ExtractorDocumentNode ( )

Creates a null node.

See also
KItinerary::ExtractorDocumentNodeFactory on how to create proper instances.

Definition at line 47 of file extractordocumentnode.cpp.

Member Function Documentation

◆ addResult()

void ExtractorDocumentNode::addResult ( ExtractorResult &&  result)

Add additional results from an extraction step.

Definition at line 155 of file extractordocumentnode.cpp.

◆ appendChild()

void ExtractorDocumentNode::appendChild ( ExtractorDocumentNode child)

Add another child node.

Do not use this outside of KItinerary::ExtractorDocumentProcessor::expandNode().

Definition at line 141 of file extractordocumentnode.cpp.

◆ childNodes()

const std::vector<ExtractorDocumentNode>& KItinerary::ExtractorDocumentNode::childNodes ( ) const

The child nodes of this node.

◆ content() [1/2]

QVariant KItinerary::ExtractorDocumentNode::content ( ) const

Returns the decoded content of this node.

The content of the QVariant depends on the MIME type.

◆ content() [2/2]

template<typename T >
std::enable_if<!std::is_pointer<T>::value || !QMetaTypeId2<Internal::OwnedPtr<typename std::remove_pointer<T>::type> >::Defined, T>::type KItinerary::ExtractorDocumentNode::content ( ) const

Returns the content of this node converted to type T.

Definition at line 124 of file extractordocumentnode.h.

◆ contextDateTime()

QDateTime KItinerary::ExtractorDocumentNode::contextDateTime ( ) const

The best known context date/time at this point in the document tree.

◆ findChildNodes()

QVariantList ExtractorDocumentNode::findChildNodes ( const QJSValue jsFilter) const

JS API for finding child nodes given an KItinerary::ExtractorFilter.

Definition at line 224 of file extractordocumentnode.cpp.

◆ isA()

template<typename T >
bool KItinerary::ExtractorDocumentNode::isA ( ) const

Checks if the content of this node is of type T.

Definition at line 116 of file extractordocumentnode.h.

◆ isNull()

bool KItinerary::ExtractorDocumentNode::isNull ( ) const

Returns true if this is a null instance.

◆ mimeType()

QString KItinerary::ExtractorDocumentNode::mimeType ( ) const

The MIME type of this node.

◆ result()

ExtractorResult KItinerary::ExtractorDocumentNode::result ( ) const

Returns the results that have accumulated so far from this node or its children.

◆ setContent()

void ExtractorDocumentNode::setContent ( const QVariant content)

Set decoded content.

Only to be used from KItinerary::ExtractorDocumentProcessor::createNodeFromData.

Definition at line 120 of file extractordocumentnode.cpp.

◆ setContextDateTime()

void ExtractorDocumentNode::setContextDateTime ( const QDateTime contextDateTime)

Set the context date/time.

Only use this from KItinerary::ExtractorDocumentProcessor.

Definition at line 173 of file extractordocumentnode.cpp.

◆ setLocation()

void ExtractorDocumentNode::setLocation ( const QVariant location)

Set the location information.

Only use this from KItinerary::ExtractorDocumentProcessor.

Definition at line 186 of file extractordocumentnode.cpp.

◆ setResult()

void ExtractorDocumentNode::setResult ( ExtractorResult &&  result)

Replace the existing results by result.

Definition at line 160 of file extractordocumentnode.cpp.

◆ usedExtractor()

QString ExtractorDocumentNode::usedExtractor ( ) const

Extractor used for the result of this node, if any.

for development tooling only

Definition at line 236 of file extractordocumentnode.cpp.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 04:02:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.