/usr/include/soprano/serializer.h is in libsoprano-dev 2.9.4+dfsg-1.1.
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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | /* This file is part of Soprano
*
* Copyright (C) 2007 Sebastian Trueg <trueg@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 SOPRANO_SERIALIZER_H
#define SOPRANO_SERIALIZER_H
#include "plugin.h"
#include "soprano_export.h"
#include "sopranotypes.h"
#include "error.h"
#include <QtCore/QObject>
#include <QtCore/QHash>
#include <QtCore/QUrl>
#include <QtCore/QString>
class QTextStream;
namespace Soprano
{
class StatementIterator;
/**
* \class Serializer serializer.h Soprano/Serializer
*
* \brief Soprano::Serializer defines the interface for a Soprano RDF serializer plugin.
*
* Each serializer plugin may support multiple RDF serializations (supportedSerializations()).
*
* \section Usage
*
* Using a Serializer is straightforward. One starts by getting a plugin that supports the requested
* RDF data serialization:
*
* \code
* const Soprano::Serializer* s = Soprano::PluginManager::instance()->discoverSerializerForSerialization( Soprano::SerializationRdfXml );
* \endcode
*
* Then serializing RDF data is done in a single method call which writes the serialized data to a QTextStream:
*
* \code
* QTextStream stream( stdout );
* s->serialize( model->listStatements(), stream, Soprano::SerializationRdfXml );
* \endcode
*
* \sa \ref soprano_writing_plugins
*
* \author Sebastian Trueg <trueg@kde.org>
*/
class SOPRANO_EXPORT Serializer : public Plugin, public Error::ErrorCache
{
public:
virtual ~Serializer();
/**
* The serialiazation types supported by this serializer.
* \return A combination of Soprano::RdfSerialization types. If
* the list contains Soprano::SerializationUser the serializer
* supports additional RDF serialiazations not
* officially supported by %Soprano.
*/
virtual RdfSerializations supportedSerializations() const = 0;
/**
* A serializer can support additional RDF serializations that are not defined in Soprano::RdfSerialization.
* In that case supportedSerializations() has to include Soprano::SerializationUser.
*
* The default implementation returns an empty list.
*
* \return A list of supported user RDF serializations.
*/
virtual QStringList supportedUserSerializations() const;
/**
* Check if a plugin supports a specific serialization.
*
* \param s The requested serialization.
* \param userSerialization If serialization is set to Soprano::SerializationUser this parameter specifies the
* requested serialization. It allows the extension of the %Soprano Serializer interface with new
* RDF serializations that are not officially supported by %Soprano.
*
* \return \p true if the serializer is able to parse RDF data encoded
* in serialization s, \p false otherwise.
*/
bool supportsSerialization( RdfSerialization s, const QString& userSerialization = QString() ) const;
/**
* Serialize a list of statements.
*
* \param it An iterator containing the statements to be serialized.
* \param stream The stream the serialized data should be written to.
* \param serialization The encoding to be used.
* \param userSerialization If serialization is set to Soprano::SerializationUser this parameter specifies the
* serialization to use. It allows the extension of the %Soprano Serializer interface with new
* RDF serializations that are not officially supported by %Soprano.
*
* \return \p true if the %serialization was successful, false otherwise.
*/
virtual bool serialize( StatementIterator it, QTextStream& stream, RdfSerialization serialization, const QString& userSerialization = QString() ) const = 0;
/**
* Add a prefix to be used by the serializer.
*
* Be aware that serializer instances are reused. Thus, it is highly recommended to clear prefixes after using the Serializer.
* A future version of %Soprano will have a revised %Serializer API which handles this issue more effective.
*
* Method is const for historical reasons.
*
* \since 2.3
*/
void addPrefix( const QString& qname, const QUrl& uri ) const;
/**
* Clear all prefixes set via addPrefix.
*
* Method is const for historical reasons.
*
* \since 2.3
*/
void clearPrefixes() const;
/**
* Retrieve all prefixes set via addPrefix.
*
* \return a QHash containing of the prefixe qnames and their URIs.
*
* \since 2.3
*/
QHash<QString, QUrl> prefixes() const;
protected:
Serializer( const QString& name );
private:
class Private;
Private* const d;
};
}
Q_DECLARE_INTERFACE(Soprano::Serializer, "org.soprano.plugins.Serializer/1.0")
#endif
|