• Skip to content
  • Skip to link menu
KDE 4.8 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

Syndication Library

  • Syndication
  • DocumentSource
Public Member Functions
Syndication::DocumentSource Class Reference

#include <documentsource.h>

List of all members.

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.

Author:
Frank Osterfeld

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:
sourcethe raw source (of the downloaded feed file usually)
urlthe 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:
otherDocumentSource 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:
otherDocumentSource 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:
  • documentsource.h
  • documentsource.cpp

Syndication Library

Skip menu "Syndication Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal