[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/libqt-addon/libqt-addon
From:       Thiago Macieira <thiagom () mail ! com>
Date:       2003-12-12 20:16:34
[Download RAW message or body]

CVS commit by thiago: 

Updating to the new class hierarchy


  M +13 -7     qclientsocketbase.cpp   1.8
  M +11 -4     qclientsocketbase.h   1.8
  M +3 -1      qstreamsocket.cpp   1.7
  M +5 -16     qstreamsocket.h   1.5


--- kdenonbeta/libqt-addon/libqt-addon/qclientsocketbase.h  #1.7:1.8
@@ -49,5 +49,5 @@ class QClientSocketBasePrivate;
  * @version $Id$
  */
-class QClientSocketBase : public QObject, public QSocketBase
+class QClientSocketBase : public QObject, public QActiveSocketBase
 {
   Q_OBJECT
@@ -210,5 +210,6 @@ public:
    *
    * Unlike @ref bind(const QString&, const QString&) above, this function
-   * really does bind the socket. No lookup is performed. 
+   * really does bind the socket. No lookup is performed. The @ref bound
+   * signal will be emitted.
    */
   virtual bool bind(const QResolverEntry& address);
@@ -282,4 +283,10 @@ public:
 
   /**
+   * This call is not supported on sockets. Reimplemented from QIODevice.
+   */
+  virtual void flush()
+  { }
+
+  /**
    * Returns the number of bytes available on this socket.
    * Reimplemented from QSocketBase.

--- kdenonbeta/libqt-addon/libqt-addon/qclientsocketbase.cpp  #1.7:1.8
@@ -46,14 +46,13 @@ public:
   QResolverResults localResults, peerResults;
 
-  bool enableRead : 1, enableWrite : 1, lookupFinishedEarly : 1;
+  bool enableRead : 1, enableWrite : 1;
 };
 
 QClientSocketBase::QClientSocketBase(QObject *parent, const char *name)
-  : QObject(parent, name), QSocketBase(), d(new QClientSocketBasePrivate)
+  : QObject(parent, name), d(new QClientSocketBasePrivate)
 {
   d->state = Idle;
   d->enableRead = true;
   d->enableWrite = false;
-  d->lookupFinishedEarly = false;
 }
 
@@ -79,7 +78,14 @@ bool QClientSocketBase::setSocketOptions
   QMutexLocker locker(mutex());
   QSocketBase::setSocketOptions(opts); // call parent
+
+  // don't create the device unnecessarily
+  if (hasDevice())
+    {
   bool result = socketDevice()->setSocketOptions(opts); // and set the implementation
   copyError();
   return result;
+    }
+
+  return true;
 }
 

--- kdenonbeta/libqt-addon/libqt-addon/qstreamsocket.h  #1.4:1.5
@@ -35,4 +35,5 @@ ADDON_START
 class QResolverEntry;
 class QResolverResults;
+class QServerSocket;
 
 class QStreamSocketPrivate;
@@ -105,11 +106,4 @@ public:
 
   /**
-   * Reimplemented from QSocketBase. This kind of socket doesn't support
-   * being placed in listen mode.
-   */
-  virtual bool listen(int)
-  { setError(IO_ListenError, NotSupported); return false; }
-
-  /**
    * Reimplemented from QClientSocketBase.
    *
@@ -124,11 +118,4 @@ public:
   virtual bool connect(const QResolverEntry& entry);
 
-  /**
-   * Reimplemented from QSocketBase. This kind of socket doesn't support
-   * accepting.
-   */
-  virtual QSocketBase* accept()
-  { setError(IO_AcceptError, NotSupported); return 0L; }
-
 signals:
   /**
@@ -166,4 +153,6 @@ private:
 
   QStreamSocketPrivate *d;
+
+  friend class QServerSocket;
 };
 

--- kdenonbeta/libqt-addon/libqt-addon/qstreamsocket.cpp  #1.6:1.7
@@ -355,2 +355,4 @@ void QStreamSocket::connectionSucceeded(
   emit connected(peer);
 }
+
+#include "qstreamsocket.moc"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic