C++ (Qt)SerialPort::SerialPort(QObject *parent) : QIODevice(parent) , d_ptr(new SerialPortPrivate(this)){}
C++ (Qt)class SerialPortPrivate{public: // some common methods...#ifdef Q_WS_WIN //some windows specified methods#endif#ifdef Q_WS_MAC //some mac specified methods#endif#ifdef Q_WS_X11 //some unix specified methods#endif.... private: // some common data};
C++ (Qt)bool SerialPortPrivate::canReadNotification(){#if defined (Q_OS_WINCE) QMutexLocker locker(&m_readNotificationMutex);#endif Q_Q(SerialPort);......emit q->readyRead();......} bool SerialPortPrivate::canWriteNotification(){#if defined (Q_OS_WINCE) QMutexLocker locker(&m_writeNotificationMutex);#endif......}
C++ (Qt)class SerialPortPrivateData; class SerialPortPrivate{public: // some common methods...private: // some common data SerialPortPrivateData *m_data;};