2
* This file is part of Soprano Project.
4
* Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
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.
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.
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.
22
#ifndef _SOPRANO_SERVER_CLIENT_H_
23
#define _SOPRANO_SERVER_CLIENT_H_
25
#include <QtCore/QObject>
26
#include <QtCore/QList>
27
#include <QtNetwork/QHostAddress>
31
#include "soprano_export.h"
33
// FIXME: add signals for conection and disconnection, maybe even make it async as Qt's network stuff itself
41
* \class TcpClient tcpclient.h Soprano/Client/TcpClient
43
* \brief Creates a connection to the %Soprano server.
45
* The %Soprano server can be accessed normally through PluginManager::discoverBackendByName()
46
* with name "sopranoserver" or by simply creating an instance of TcpClient. The latter solution can have advantages
47
* as it uses a new connection to the server.
49
* \author Sebastian Trueg <trueg@kde.org>
51
class SOPRANO_CLIENT_EXPORT TcpClient : public QObject, public Error::ErrorCache
57
* Create a new Client instance.
59
TcpClient( QObject* parent = 0 );
67
* The default %Soprano server connection port.
69
static const quint16 DEFAULT_PORT;
72
* Tries to connect to the %Soprano server.
74
* \return \p true on success, \p false if an error occured.
75
* Check lastError() for details.
77
bool connect( const QHostAddress& address = QHostAddress::LocalHost, int port = DEFAULT_PORT );
80
* Check if the client is connected to a server.
82
* \return \p true if this client is connected to a server, \p false
88
* Disconnect from the server. The created model instances are not
89
* deleted but remain useless; open iterators are closed.
94
* Creates a new Model instance that wraps a server model.
95
* %Client models are very light wrappers and creating them is
98
* \param name The name of the model to access.
99
* \param settings The settings to send to the server for creating a new model.
100
* These settings may be ignored by the server if a model with that name has
101
* already been created.
103
* \return A new Model instance wrapping the requested server
104
* model or 0 on error (check lastError() for details.)
106
Model* createModel( const QString& name, const QList<BackendSetting>& settings = QList<BackendSetting>() );
109
* Get a list of all models that the server currently holds.
110
* This method may return an empty list before any call to
113
* \return A list of the names of all models that are currently
114
* opened by the server.
116
// QStringList models() const;
119
void slotError( QAbstractSocket::SocketError error );