/usr/include/syndication/documentsource.h is in kdepimlibs5-dev 4:4.14.10-7+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | /*
* This file is part of the syndication library
*
* Copyright (C) 2005 Frank Osterfeld <osterfeld@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef SYNDICATION_DOCUMENTSOURCE_H
#define SYNDICATION_DOCUMENTSOURCE_H
#include <QtCore/QString>
#include <boost/shared_ptr.hpp>
#include "ksyndication_export.h"
class QByteArray;
class QDomDocument;
namespace Syndication {
/**
* 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
*/
class SYNDICATION_EXPORT DocumentSource
{
public:
/**
* Creates an empty document source. The raw representation is empty and
* the DOM representation will be invalid.
*/
DocumentSource();
/**
* Creates a DocumentSource object from a raw byte array
*
* @param source the raw source (of the downloaded feed file usually)
* @param url the URL/path the source was read from
*/
DocumentSource(const QByteArray& source, const QString& url);
/**
* Copy constructor. The d pointer is shared, so this is a cheap
* operation.
*
* @param other DocumentSource to copy
*/
DocumentSource(const DocumentSource& other);
/**
* destructor
*/
~DocumentSource();
/**
* Assignment operator. The d pointer is shared, so this is a cheap
* operation.
*
* @param other DocumentSource to assign to this instance
* @return reference to this instance
*/
DocumentSource& operator=(const DocumentSource& other);
/**
* Returns the feed source as byte array.
*
* @return the feed source as raw byte array.
*/
QByteArray asByteArray() const;
/**
* returns the size the source array in bytes.
*
* @return the size of the byte array in bytes.
* See also QByteArray::size()
*/
unsigned int size() 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.
*
* @return the hash calculated from the source, 0 if the
* source is empty
*/
unsigned int hash() 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)
*
* @return XML representation parsed from the raw source
*/
QDomDocument asDomDocument() const;
/**
* returns the URL the document source was loaded from
*/
QString url() const;
private:
class DocumentSourcePrivate;
boost::shared_ptr<DocumentSourcePrivate> d;
};
} // namespace Syndication
#endif // SYNDICATION_DOCUMENTSOURCE_H
|