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)
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)

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

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

Child nodes, for QJSEngine access.

Definition at line 57 of file extractordocumentnode.h.

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.

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.

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.

QString ExtractorDocumentNode::mimeType

The MIME type of this node.

Definition at line 60 of file extractordocumentnode.h.

ExtractorDocumentNode ExtractorDocumentNode::parent

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

Definition at line 55 of file extractordocumentnode.h.

ExtractorResult ExtractorDocumentNode::result

Result access for QJSEngine.

Definition at line 70 of file extractordocumentnode.h.

Constructor & Destructor Documentation

ExtractorDocumentNode::ExtractorDocumentNode ( )

Creates a null node.

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

Definition at line 46 of file extractordocumentnode.cpp.

Member Function Documentation

void ExtractorDocumentNode::addResult ( ExtractorResult &&  result)

Add additional results from an extraction step.

Definition at line 149 of file extractordocumentnode.cpp.

void ExtractorDocumentNode::appendChild ( ExtractorDocumentNode child)

Add another child node.

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

Definition at line 135 of file extractordocumentnode.cpp.

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

The child nodes of this node.

QVariant KItinerary::ExtractorDocumentNode::content ( ) const

Returns the decoded content of this node.

The content of the QVariant depends on the MIME type.

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 122 of file extractordocumentnode.h.

QDateTime KItinerary::ExtractorDocumentNode::contextDateTime ( ) const

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

QVariantList ExtractorDocumentNode::findChildNodes ( const QJSValue jsFilter) const

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

Definition at line 218 of file extractordocumentnode.cpp.

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

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

Definition at line 114 of file extractordocumentnode.h.

bool KItinerary::ExtractorDocumentNode::isNull ( ) const

Returns true if this is a null instance.

QString KItinerary::ExtractorDocumentNode::mimeType ( ) const

The MIME type of this node.

ExtractorResult KItinerary::ExtractorDocumentNode::result ( ) const

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

void ExtractorDocumentNode::setContent ( const QVariant content)

Set decoded content.

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

Definition at line 114 of file extractordocumentnode.cpp.

void ExtractorDocumentNode::setContextDateTime ( const QDateTime contextDateTime)

Set the context date/time.

Only use this from KItinerary::ExtractorDocumentProcessor.

Definition at line 167 of file extractordocumentnode.cpp.

void ExtractorDocumentNode::setLocation ( const QVariant location)

Set the location information.

Only use this from KItinerary::ExtractorDocumentProcessor.

Definition at line 180 of file extractordocumentnode.cpp.

void ExtractorDocumentNode::setResult ( ExtractorResult &&  result)

Replace the existing results by result.

Definition at line 154 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-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:06:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.