[gst-cvs] qt-gstreamer: Reimplement the way GValues are handled.
gkiagia at kemper.freedesktop.org
Fri Nov 26 07:18:04 PST 2010
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(-)
More information about the Gstreamer-commits