Soprano  2.9.3
/build/buildd/soprano-2.9.3+dfsg1/soprano/datastream.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of Soprano Project.
00003  *
00004  * Copyright (C) 2008 Sebastian Trueg <trueg@kde.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public License
00017  * along with this library; see the file COPYING.LIB.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef _SOPRANO_DATA_STREAM_H_
00023 #define _SOPRANO_DATA_STREAM_H_
00024 
00025 #include "soprano_export.h"
00026 #include "error.h"
00027 
00028 class QUrl;
00029 class QByteArray;
00030 
00031 namespace Soprano {
00032 
00033     class LiteralValue;
00034     class BindingSet;
00035     class BackendSetting;
00036     class Node;
00037     class Statement;
00038     namespace Error {
00039         class Locator;
00040     }
00041 
00055     class SOPRANO_EXPORT DataStream : public Error::ErrorCache
00056     {
00057     public:
00058         DataStream();
00059         virtual ~DataStream();
00060 
00061         bool writeByteArray( const QByteArray& );
00062         bool writeString( const QString& );
00063         bool writeUrl( const QUrl& );
00064 //        bool writeVariant( const QVariant& );
00065         bool writeUnsignedInt8( quint8 );
00066         bool writeUnsignedInt16( quint16 );
00067         bool writeUnsignedInt32( quint32 );
00068         bool writeInt32( qint32 );
00069         bool writeBool( bool );
00070 
00071         bool writeErrorCode( Error::ErrorCode code );
00072         bool writeLocator( const Error::Locator& );
00073         bool writeError( const Error::Error& );
00074 //        bool writeBackendSetting( const BackendSetting& );
00075         bool writeLiteralValue( const LiteralValue& );
00076         bool writeNode( const Node& );
00077         bool writeStatement( const Statement& );
00078         bool writeBindingSet( const BindingSet& );
00079 
00080         bool readByteArray( QByteArray& );
00081         bool readString( QString& );
00082         bool readUrl( QUrl& );
00083 //        bool readVariant( QVariant& );
00084         bool readUnsignedInt8( quint8& );
00085         bool readUnsignedInt16( quint16& );
00086         bool readUnsignedInt32( quint32& );
00087         bool readInt32( qint32& );
00088         bool readBool( bool& );
00089 
00090         bool readErrorCode( Error::ErrorCode& code );
00091         bool readLocator( Error::Locator& );
00092         bool readError( Error::Error& );
00093 //        bool readBackendSetting( BackendSetting& );
00094         bool readLiteralValue( LiteralValue& );
00095         bool readNode( Node& );
00096         bool readStatement( Statement& );
00097         bool readBindingSet( BindingSet& );
00098 
00099     protected:
00104         virtual bool read( char* data, qint64 size ) = 0;
00105 
00110         virtual bool write( const char* data, qint64 size ) = 0;
00111     };
00112 }
00113 
00114 #endif