add more spacing
[personal-kdebase.git] / workspace / kcontrol / kfontinst / kio / Socket.h
blob721aa2c034ac18d5085a90f279e4c19c45c1b7a1
1 #ifndef __SOCKET_H__
2 #define __SOCKET_H__
4 /*
5 * KFontInst - KDE Font Installer
7 * Copyright 2003-2007 Craig Drummond <craig@kde.org>
9 * ----
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; see the file COPYING. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
27 #include <QtCore/QVariant>
29 class QVariant;
30 class QByteArray;
31 class QString;
33 namespace KFI
36 class CSocket
38 public:
40 static const int constTimeout=1;
42 CSocket(int fd=-1);
43 ~CSocket();
45 bool read(QVariant &var, int timeout=constTimeout);
46 bool read(QString &str, int timeout=constTimeout);
47 bool read(int &i, int timeout=constTimeout);
48 bool read(qulonglong &i, int timeout=constTimeout);
49 bool read(bool &b, int timeout=constTimeout);
50 bool write(const QVariant &var, int timeout=constTimeout);
51 bool connectToServer(const QByteArray &sock, unsigned int socketUid);
53 private:
55 bool readBlock(char *data, int size, int timeout);
56 bool writeBlock(const char *data, int size, int timeout);
57 bool waitForReadyRead(int timeout);
58 bool waitForReadyWrite(int timeout);
60 protected:
62 int itsFd;
67 #endif