• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

Syndication Library

Syndication::DocumentSource

Syndication::DocumentSource Class Reference

#include <documentsource.h>

List of all members.


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 49 of file documentsource.h.


Public Member Functions

QByteArray asByteArray () const
QDomDocument asDomDocument () const
 DocumentSource (const DocumentSource &other)
 DocumentSource (const QByteArray &source, const QString &url)
 DocumentSource ()
unsigned int hash () const
DocumentSource & operator= (const DocumentSource &other)
unsigned int size () const
QString url () const
 ~DocumentSource ()

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:
  • documentsource.h
  • documentsource.cpp

Syndication Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.6
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