KItinerary::ExtractorDocumentNode

Search for usage in LXR

KItinerary::ExtractorDocumentNode Class Reference

#include <extractordocumentnode.h>

Properties

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< typenamestd::remove_pointer< T >::type > >::Defined, T >::type content () const
 
template<typename T >
std::enable_if< std::is_pointer< T >::value &&QMetaTypeId2< Internal::OwnedPtr< typenamestd::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

QVariantList KItinerary::ExtractorDocumentNode::childNodes
read

Child nodes, for QJSEngine access.

Definition at line 57 of file extractordocumentnode.h.

◆ content

QJSValue KItinerary::ExtractorDocumentNode::content
read

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 KItinerary::ExtractorDocumentNode::contextDateTime
read

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.

◆ isNull

bool KItinerary::ExtractorDocumentNode::isNull
read

Definition at line 52 of file extractordocumentnode.h.

◆ location

QVariant KItinerary::ExtractorDocumentNode::location
read

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 KItinerary::ExtractorDocumentNode::mimeType
read

The MIME type of this node.

Definition at line 60 of file extractordocumentnode.h.

◆ parent

KItinerary::ExtractorDocumentNode KItinerary::ExtractorDocumentNode::parent
read

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

Definition at line 55 of file extractordocumentnode.h.

◆ result

QJsonArray KItinerary::ExtractorDocumentNode::result
read

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.

◆ ~ExtractorDocumentNode()

ExtractorDocumentNode::~ExtractorDocumentNode ( )

Definition at line 60 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 > & ExtractorDocumentNode::childNodes ( ) const

The child nodes of this node.

Definition at line 136 of file extractordocumentnode.cpp.

◆ content() [1/3]

QVariant ExtractorDocumentNode::content ( ) const

Returns the decoded content of this node.

The content of the QVariant depends on the MIME type.

Definition at line 115 of file extractordocumentnode.cpp.

◆ content() [2/3]

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

Returns the content of this node converted to type T.

Definition at line 124 of file extractordocumentnode.h.

◆ content() [3/3]

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

Definition at line 130 of file extractordocumentnode.h.

◆ contextDateTime()

QDateTime ExtractorDocumentNode::contextDateTime ( ) const

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

Definition at line 165 of file extractordocumentnode.cpp.

◆ 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
inline

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

Definition at line 116 of file extractordocumentnode.h.

◆ isNull()

bool ExtractorDocumentNode::isNull ( ) const

Returns true if this is a null instance.

Definition at line 90 of file extractordocumentnode.cpp.

◆ location()

QVariant ExtractorDocumentNode::location ( ) const

Definition at line 178 of file extractordocumentnode.cpp.

◆ mimeType()

QString ExtractorDocumentNode::mimeType ( ) const

The MIME type of this node.

Definition at line 105 of file extractordocumentnode.cpp.

◆ operator=() [1/2]

ExtractorDocumentNode & ExtractorDocumentNode::operator= ( const ExtractorDocumentNode & other)

Definition at line 67 of file extractordocumentnode.cpp.

◆ operator=() [2/2]

ExtractorDocumentNode & ExtractorDocumentNode::operator= ( ExtractorDocumentNode && other)

Definition at line 76 of file extractordocumentnode.cpp.

◆ operator==()

bool ExtractorDocumentNode::operator== ( const ExtractorDocumentNode & other) const

Definition at line 85 of file extractordocumentnode.cpp.

◆ parent()

ExtractorDocumentNode ExtractorDocumentNode::parent ( ) const

Definition at line 95 of file extractordocumentnode.cpp.

◆ result()

ExtractorResult ExtractorDocumentNode::result ( ) const

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

Definition at line 150 of file extractordocumentnode.cpp.

◆ setContent() [1/2]

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.

◆ setContent() [2/2]

template<typename T >
void KItinerary::ExtractorDocumentNode::setContent ( const T & value)
inline

Definition at line 139 of file extractordocumentnode.h.

◆ 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.

◆ setUsedExtractor()

void ExtractorDocumentNode::setUsedExtractor ( const QString & usedExtractor)

Definition at line 241 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-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.