Syndication Library
#include <documentsource.h>
Public Member Functions | |
DocumentSource () | |
DocumentSource (const QByteArray &source, const QString &url) | |
DocumentSource (const DocumentSource &other) | |
~DocumentSource () | |
QByteArray | asByteArray () const |
QDomDocument | asDomDocument () const |
unsigned int | hash () const |
DocumentSource & | operator= (const DocumentSource &other) |
unsigned int | size () const |
QString | url () const |
Detailed Description
Represents the source of a syndication document, as read from the downloaded file.
It provides a (cached) DOM representation of the document, but keeps the raw data available (for (rarely used) non-XML formats like Okay! News).
This way the document can be passed to all available parsers (to find the right one for the source), regardless whether they parse XML formats or non-XML formats, without having every parser to do the XML parsing again.
Definition at line 50 of file documentsource.h.
Constructor & Destructor Documentation
Syndication::DocumentSource::DocumentSource | ( | ) |
Creates an empty document source.
The raw representation is empty and the DOM representation will be invalid.
Definition at line 43 of file documentsource.cpp.
Syndication::DocumentSource::DocumentSource | ( | const QByteArray & | source, |
const QString & | url | ||
) |
Creates a DocumentSource object from a raw byte array.
- Parameters
-
source the raw source (of the downloaded feed file usually) url the URL/path the source was read from
Definition at line 51 of file documentsource.cpp.
Syndication::DocumentSource::DocumentSource | ( | const DocumentSource & | other | ) |
Copy constructor.
The d pointer is shared, so this is a cheap operation.
- Parameters
-
other DocumentSource to copy
Definition at line 59 of file documentsource.cpp.
Syndication::DocumentSource::~DocumentSource | ( | ) |
destructor
Definition at line 64 of file documentsource.cpp.
Member Function Documentation
QByteArray Syndication::DocumentSource::asByteArray | ( | ) | const |
Returns the feed source as byte array.
- Returns
- the feed source as raw byte array.
Definition at line 74 of file documentsource.cpp.
QDomDocument Syndication::DocumentSource::asDomDocument | ( | ) | const |
Returns the feed source as DOM document.
The document is parsed only on the first call of this method and then cached.
If the feed source cannot be parsed successfully then the returned DOM node will be null (eg. asDomDocument().isNull() will return true)
- Returns
- XML representation parsed from the raw source
Definition at line 79 of file documentsource.cpp.
unsigned int Syndication::DocumentSource::hash | ( | ) | const |
calculates a hash value for the source array.
This can be used to decide whether the feed has changed since the last fetch. If the hash hasn't changed since the last fetch, the feed wasn't modified with high probability.
- Returns
- the hash calculated from the source, 0 if the source is empty
Definition at line 103 of file documentsource.cpp.
DocumentSource & Syndication::DocumentSource::operator= | ( | const DocumentSource & | other | ) |
Assignment operator.
The d pointer is shared, so this is a cheap operation.
- Parameters
-
other DocumentSource to assign to this instance
- Returns
- reference to this instance
Definition at line 68 of file documentsource.cpp.
unsigned int Syndication::DocumentSource::size | ( | ) | const |
returns the size the source array in bytes.
- Returns
- the size of the byte array in bytes. See also QByteArray::size()
Definition at line 98 of file documentsource.cpp.
QString Syndication::DocumentSource::url | ( | ) | const |
returns the URL the document source was loaded from
Definition at line 114 of file documentsource.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.