[gst-cvs] qt-gstreamer: Reimplement the way GValues are handled.
George Kiagiadakis
gkiagia at kemper.freedesktop.org
Fri Nov 26 07:18:04 PST 2010
Module: qt-gstreamer
Branch: master
Commit: 25585873f89e69b63bd040b2d91411a0090e6a2f
URL: http://cgit.freedesktop.org/gstreamer/qt-gstreamer/commit/?id=25585873f89e69b63bd040b2d91411a0090e6a2f
Author: George Kiagiadakis <george.kiagiadakis at collabora.co.uk>
Date: Fri Nov 26 10:17:37 2010 +0200
Reimplement the way GValues are handled.
With this new design, things are not so much dependent on templates anymore.
Every type is converted into a void* and is handled internally in
setData/getData, which use the GType of this type to determine if it
can be directly assigned to the GValue or if it needs conversion.
If a conversion is required, it is handled by g_value_transform, which
should handle all the cases that we want to support.
Internally, there is a dispatcher that holds set/get methods for the various
GTypes. Each of these methods knows how to convert void* back to the
original type and handle it. A method is provided to register additional
such methods from client code, if necessary.
ValueImpl<T> still stays around to handle conversion of C++ types in
some cases where the default implementation doesn't work as we want it
(RefPointer, QFlags, strings, Message/Query/Event subclasses)
As a bonus, ValueBase::set/get no longer throw exceptions, but they
behave like the QVariant equivalents (i.e. get returns a default-constructed
value if it cannot get the actual underlying value).
---
src/QGlib/value.cpp | 208 +++++++++++++++++++++++++++++++------------
src/QGlib/value.h | 248 +++++++++++++++++++++++++--------------------------
2 files changed, 273 insertions(+), 183 deletions(-)
Diff: http://cgit.freedesktop.org/gstreamer/qt-gstreamer/diff/?id=25585873f89e69b63bd040b2d91411a0090e6a2f
More information about the Gstreamer-commits
mailing list