Soprano  2.9.3
tcpclient.h
Go to the documentation of this file.
1 /*
2  * This file is part of Soprano Project.
3  *
4  * Copyright (C) 2007 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_SERVER_CLIENT_H_
23 #define _SOPRANO_SERVER_CLIENT_H_
24 
25 #include <QtCore/QObject>
26 #include <QtCore/QList>
27 #include <QtNetwork/QHostAddress>
28 
29 #include "error.h"
30 #include "backend.h"
31 #include "soprano_export.h"
32 
33 // FIXME: add signals for conection and disconnection, maybe even make it async as Qt's network stuff itself
34 
35 namespace Soprano {
36 
37  class Model;
38 
39  namespace Client {
58  {
59  Q_OBJECT
60 
61  public:
65  TcpClient( QObject* parent = 0 );
66 
70  virtual ~TcpClient();
71 
75  static const quint16 DEFAULT_PORT;
76 
83  bool connect( const QHostAddress& address = QHostAddress::LocalHost, int port = DEFAULT_PORT );
84 
91  bool isConnected();
92 
97  void disconnect();
98 
113 
124  void removeModel( const QString& name );
125 
134 // QStringList models() const;
135 
136  private Q_SLOTS:
137  void slotError( QAbstractSocket::SocketError error );
138 
139  private:
140  class Private;
141  Private* const d;
142  };
143  }
144 }
145 
146 #endif