Soprano  2.9.0
datastream.h
Go to the documentation of this file.
1 /*
2  * This file is part of Soprano Project.
3  *
4  * Copyright (C) 2008 Sebastian Trueg <trueg@kde.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef _SOPRANO_DATA_STREAM_H_
23 #define _SOPRANO_DATA_STREAM_H_
24 
25 #include "soprano_export.h"
26 #include "error.h"
27 
28 class QUrl;
29 class QByteArray;
30 
31 namespace Soprano {
32 
33  class LiteralValue;
34  class BindingSet;
35  class BackendSetting;
36  class Node;
37  class Statement;
38  namespace Error {
39  class Locator;
40  }
41 
56  {
57  public:
58  DataStream();
59  virtual ~DataStream();
60 
61  bool writeByteArray( const QByteArray& );
62  bool writeString( const QString& );
63  bool writeUrl( const QUrl& );
64 // bool writeVariant( const QVariant& );
65  bool writeUnsignedInt8( quint8 );
66  bool writeUnsignedInt16( quint16 );
67  bool writeUnsignedInt32( quint32 );
68  bool writeInt32( qint32 );
69  bool writeBool( bool );
70 
71  bool writeErrorCode( Error::ErrorCode code );
72  bool writeLocator( const Error::Locator& );
73  bool writeError( const Error::Error& );
74 // bool writeBackendSetting( const BackendSetting& );
75  bool writeLiteralValue( const LiteralValue& );
76  bool writeNode( const Node& );
77  bool writeStatement( const Statement& );
78  bool writeBindingSet( const BindingSet& );
79 
80  bool readByteArray( QByteArray& );
81  bool readString( QString& );
82  bool readUrl( QUrl& );
83 // bool readVariant( QVariant& );
84  bool readUnsignedInt8( quint8& );
85  bool readUnsignedInt16( quint16& );
86  bool readUnsignedInt32( quint32& );
87  bool readInt32( qint32& );
88  bool readBool( bool& );
89 
90  bool readErrorCode( Error::ErrorCode& code );
91  bool readLocator( Error::Locator& );
92  bool readError( Error::Error& );
93 // bool readBackendSetting( BackendSetting& );
94  bool readLiteralValue( LiteralValue& );
95  bool readNode( Node& );
96  bool readStatement( Statement& );
97  bool readBindingSet( BindingSet& );
98 
99  protected:
104  virtual bool read( char* data, qint64 size ) = 0;
105 
110  virtual bool write( const char* data, qint64 size ) = 0;
111  };
112 }
113 
114 #endif