[Interest] Best practices for making a Qt facade for a C library

Dmitriy Purgin dpurgin at gmail.com
Wed Jan 14 12:14:55 CET 2015


Hi Damian,

the application itself is GPLv3, for PulseAudio parts see [1] (every file
that starts with pulseaudio). I'm planning to release the library under
LGPL but didn't upload anything for public availability yet. As soon as I
port all the functionality from my app to the lib, I'll make a separate
repo on github.

Cheers
Dmitriy

[1] https://github.com/dpurgin/harbour-callrecorder/tree/master/daemon/src

2015-01-14 13:27 GMT+06:00 Damian Ivanov <damianatorrpm at gmail.com>:

> Hi Dmitriy,
>
> Wanted to ask if your stuff is open source and is available on github?
>
> 2015-01-14 0:26 GMT+01:00 Ian Monroe <ian at monroe.nu>:
> > On Tue, Jan 13, 2015 at 10:57 AM, Dmitriy Purgin <dpurgin at gmail.com>
> wrote:
> >>
> >> Hello all,
> >>
> >> I'm developing a small Qt project for SailfishOS (a Linux distribution,
> >> Meego descendant, Qt 5 based) and had to use some of PulseAudio (a sound
> >> server for POSIX OSes) API functions which are pure C. I've wrapped
> them in
> >> a couple of classes but it's evolving to something bigger now and I'm
> trying
> >> to detach these into a shared library which seems to become a basic
> >> PulseAudio binding. It's my first facading of a C library and I'm kind
> of
> >> stuck on the architecture now and hope that someone can share ideas on
> that.
> >
> >
> > Have you looked at the code generation done by QtGstreamer for glib
> stuff?
> > Not sure if it's any good, just want to make sure you know of it:
> > http://cgit.freedesktop.org/gstreamer/qt-gstreamer/tree/
> >
> >>
> >> So with the problem stated, my question is: does anyone know any "good
> >> practices" in designing this kind of relationships between classes or
> can
> >> share similar designs to look at? There's no technical problem for me to
> >> expose the inner parts of some classes to some other classes, I just
> >> wondered if there's a subtle way of doing this.
> >
> >
> > I wrap a C library and had a similar situation. My solution in this case
> > would be to give QtPulseAudioSource a new base class named something like
> > PulseAudioInterface. That class defines pa_context, it could possibly
> just
> > be a void pointer. It has a member variable for it and a
> > setPulseAudioContext method. Then QtPulseAudioContext would have a class
> > called something likeblessPulseAudioInterface. QtPulseAudioSource could
> call
> > it in its constructor.
> >
> > In this way it is pretty hidden from users of the library, and
> > QtPulseAudioContext has zero deps on AudioSource.
> >
> > Ian
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150114/a45ac996/attachment.html>


More information about the Interest mailing list