On Wednesday, 28 de September de 2011 17:12:58 Harri Porten wrote:
> > This all boils down to a runtime determination of which plugin is active.
> 
> An interface exchanging type safety with void* for the purpose of platform 
> independant API will be fine with a string-based identifier?

I don't think we can make it any more abstract!

Someone could write a small wrapper class to bring back type safety and 
correct spelling of the resources. A "proper OOP" solution would probably be 
very heavyweight and you'd *still* have to do casts:

class QNativeDisplay { ... };
class QX11Display : pubilc QNativeDisplay { XDisplay display; };
class QXCBDisplay : public QNativeDisplay { XCBDisplay display; }
...


class QAbstractPlatform
{
public:
    enum Platform {
        // either this or dynamic_cast to the platform of your choice
        Other,
        XLib,
        XCB,
        Wayland,
        DirectFB,
        Win32,
        Cocoa,
        EGL,
        OpenWF,
        NaCl
    };
    virtual Platform platform() const = 0;
        
    virtual QNativeDisplay *nativeDisplay() const = 0;
    virtual QNativeSurface *nativeSurfaceForWidget(const QWidget *ptr) = 0;
    virtual QNativePixmap *nativePixmap(const QPixmap &pixmap) = 0;
};

class QXCBPlatform: public QAbstractPlatform
{
    // implement common pure virtuals with covariant returns
    QXCBDisplay *nativeDisplay() const override;
    QXCBPixmap *nativePixmap(const QPixmap &pixmap) override;

    // plaform specific (no matching resource elsewhere)
    virtual QXCBMITSHMPixmap *nativeMitShmPixmap(const QPixmap &pixmap) new;
};

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

Reply via email to