summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.co.uk>2010-12-14 11:52:06 +0200
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.co.uk>2010-12-14 11:52:06 +0200
commita077fcd62230ec1774454179a83f6ebd62f11130 (patch)
treee65c58dbd664c89ffd91ed408a8958351649c58b
parent814f639fb955f99829285c255b66b694b94fbc64 (diff)
Get rid of ValueBase; use Value as the base class.
-rw-r--r--src/QGlib/global.h1
-rw-r--r--src/QGlib/object.cpp2
-rw-r--r--src/QGlib/object.h2
-rw-r--r--src/QGlib/signal.h12
-rw-r--r--src/QGlib/value.cpp168
-rw-r--r--src/QGlib/value.h161
-rw-r--r--src/QGst/event.h4
-rw-r--r--src/QGst/global.h2
-rw-r--r--src/QGst/message.cpp2
-rw-r--r--src/QGst/message.h6
-rw-r--r--src/QGst/query.h4
-rw-r--r--src/QGst/value.cpp36
-rw-r--r--src/main.dox4
13 files changed, 178 insertions, 226 deletions
diff --git a/src/QGlib/global.h b/src/QGlib/global.h
index 13f9fa2..ae84526 100644
--- a/src/QGlib/global.h
+++ b/src/QGlib/global.h
@@ -29,7 +29,6 @@ typedef struct _GError GError;
namespace QGlib {
class Error;
-class ValueBase;
class Value;
class SharedValue;
class Quark;
diff --git a/src/QGlib/object.cpp b/src/QGlib/object.cpp
index 1b560be..40bbed8 100644
--- a/src/QGlib/object.cpp
+++ b/src/QGlib/object.cpp
@@ -67,7 +67,7 @@ Value Object::property(const char *name) const
return result;
}
-void Object::setPropertyValue(const char *name, const ValueBase & value)
+void Object::setPropertyValue(const char *name, const Value & value)
{
g_object_set_property(object<GObject>(), name, value);
}
diff --git a/src/QGlib/object.h b/src/QGlib/object.h
index 413a085..670dc99 100644
--- a/src/QGlib/object.h
+++ b/src/QGlib/object.h
@@ -38,7 +38,7 @@ public:
Value property(const char *name) const;
template <class T> void setProperty(const char *name, const T & value);
- void setPropertyValue(const char *name, const ValueBase & value);
+ void setPropertyValue(const char *name, const Value & value);
protected:
virtual void ref(bool increaseRef);
diff --git a/src/QGlib/signal.h b/src/QGlib/signal.h
index fadf660..e9b7e46 100644
--- a/src/QGlib/signal.h
+++ b/src/QGlib/signal.h
@@ -133,17 +133,17 @@ public:
/*! Emits a signal on a specified \a instance with the specified arguments.
*
- * This method will convert all the specified arguments to GValues using ValueBase::set()
+ * This method will convert all the specified arguments to GValues using Value::set()
* and will then call the non-templated emit() method, which is a wrapper for g_signal_emitv().
* The returned value from the signal (if the signal returns a value) will be converted
- * from GValue to the type R using ValueBase::get() and will be returned. If some argument
+ * from GValue to the type R using Value::get() and will be returned. If some argument
* is not of the type that the signal expects, a warning will be printed to stderr at runtime
* and the signal will not be emitted. If the return value is not of the type that the signal
* returns, the signal will be emitted, but a default-constructed value for the type R will
* be returned and a warning will be printed to stderr.
*
- * Note that since the implementation uses ValueBase::set() to convert the GValues into the
- * specified types, the same rules that apply to ValueBase::set() apply here (i.e. you should
+ * Note that since the implementation uses Value::set() to convert the GValues into the
+ * specified types, the same rules that apply to Value::set() apply here (i.e. you should
* only use the types of the bindings and not the C types, which means QGst::ObjectPtr instead
* of GstObject*, etc...).
*
@@ -176,8 +176,8 @@ public:
* will be printed to stderr at runtime and the \a slot will not be invoked. You are
* responsible for defining the \a slot with the correct arguments!
*
- * Note that since the implementation uses ValueBase::get() to convert the GValues into the
- * specified types, the same rules that apply to ValueBase::get() apply here (i.e. you should
+ * Note that since the implementation uses Value::get() to convert the GValues into the
+ * specified types, the same rules that apply to Value::get() apply here (i.e. you should
* only use the types of the bindings and not the C types, which means QGst::ObjectPtr instead
* of GstObject*, etc...).
*
diff --git a/src/QGlib/value.cpp b/src/QGlib/value.cpp
index ef90767..e781b9c 100644
--- a/src/QGlib/value.cpp
+++ b/src/QGlib/value.cpp
@@ -43,12 +43,12 @@ Dispatcher::Dispatcher()
#define DECLARE_VTABLE(T, NICK, GTYPE) \
struct ValueVTable_##NICK \
{ \
- static void get(const ValueBase & value, void *data) \
+ static void get(const Value & value, void *data) \
{ \
*reinterpret_cast<T*>(data) = g_value_get_##NICK(value); \
}; \
\
- static void set(ValueBase & value, const void *data) \
+ static void set(Value & value, const void *data) \
{ \
g_value_set_##NICK(value, *reinterpret_cast<T const *>(data)); \
}; \
@@ -106,41 +106,89 @@ void Dispatcher::setVTable(Type t, const ValueVTable & vtable)
Q_GLOBAL_STATIC(Private::Dispatcher, s_dispatcher);
-//BEGIN ValueBase
+//BEGIN Value
+
+Value::Value()
+ : m_value(NULL)
+{
+}
-ValueBase::ValueBase(GValue* val)
- : m_value(val)
+Value::Value(const GValue *gvalue)
+ : m_value(NULL)
{
+ if (gvalue) {
+ init(G_VALUE_TYPE(gvalue));
+ g_value_copy(gvalue, m_value);
+ }
}
-ValueBase::~ValueBase()
+Value::Value(const Value & other)
+ : m_value(NULL)
{
+ operator=(other);
}
-bool ValueBase::isValid() const
+Value::Value(const SharedValue & other)
+ : m_value(NULL)
+{
+ operator=(other);
+}
+
+Value::~Value()
+{
+ if (m_value) {
+ g_value_unset(m_value);
+ g_slice_free(GValue, m_value);
+ }
+}
+
+Value & Value::operator=(const Value & other)
+{
+ if (other.isValid()) {
+ init(other.type());
+ g_value_copy(other, m_value);
+ } else if (m_value) {
+ g_value_unset(m_value);
+ g_slice_free(GValue, m_value);
+ m_value = NULL;
+ }
+ return *this;
+}
+
+void Value::init(Type type)
+{
+ if (m_value) {
+ g_value_unset(m_value);
+ } else {
+ m_value = g_slice_new0(GValue);
+ }
+ g_value_init(m_value, type);
+}
+
+bool Value::isValid() const
{
return m_value != NULL;
}
-void ValueBase::reset()
+void Value::reset()
{
if (m_value) {
g_value_reset(m_value);
}
}
-Type ValueBase::type() const
+Type Value::type() const
{
Q_ASSERT(isValid());
return G_VALUE_TYPE(m_value);
}
-bool ValueBase::canTransformTo(Type t) const
+bool Value::canTransformTo(Type t) const
{
return m_value ? g_value_type_transformable(type(), t) : false;
}
-Value ValueBase::transformTo(Type t) const
+Value Value::transformTo(Type t) const
{
Q_ASSERT(isValid());
Value dest;
@@ -150,12 +198,12 @@ Value ValueBase::transformTo(Type t) const
}
//static
-void ValueBase::registerValueVTable(Type type, const ValueVTable & vtable)
+void Value::registerValueVTable(Type type, const ValueVTable & vtable)
{
s_dispatcher()->setVTable(type, vtable);
}
-void ValueBase::getData(Type dataType, void *data) const
+void Value::getData(Type dataType, void *data) const
{
if (!isValid()) {
throw Private::InvalidValueException();
@@ -182,7 +230,7 @@ void ValueBase::getData(Type dataType, void *data) const
}
}
-void ValueBase::setData(Type dataType, const void *data)
+void Value::setData(Type dataType, const void *data)
{
if (!isValid()) {
throw Private::InvalidValueException();
@@ -208,109 +256,27 @@ void ValueBase::setData(Type dataType, const void *data)
}
}
-//END ValueBase
-
-//BEGIN Value
-
-Value::Value()
- : ValueBase(NULL)
-{
-}
-
-Value::Value(const GValue *gvalue)
- : ValueBase(NULL)
-{
- if (gvalue) {
- init(G_VALUE_TYPE(gvalue));
- g_value_copy(gvalue, m_value);
- }
-}
-
-Value::Value(const SharedValue & other)
- : ValueBase(NULL)
-{
- operator=(other);
-}
-
-Value::Value(const Value & other)
- : ValueBase(NULL)
-{
- operator=(other);
-}
-
-Value::~Value()
-{
- if (m_value) {
- g_value_unset(m_value);
- g_slice_free(GValue, m_value);
- }
-}
-
-Value & Value::operator=(const SharedValue & other)
-{
- if (other.isValid()) {
- init(other.type());
- g_value_copy(other, m_value);
- } else if (m_value) {
- g_value_unset(m_value);
- g_slice_free(GValue, m_value);
- m_value = NULL;
- }
- return *this;
-}
-
-Value & Value::operator=(const Value & other)
-{
- if (other.isValid()) {
- init(other.type());
- g_value_copy(other, m_value);
- } else if (m_value) {
- g_value_unset(m_value);
- g_slice_free(GValue, m_value);
- m_value = NULL;
- }
- return *this;
-}
-
-void Value::init(Type type)
-{
- if (m_value) {
- g_value_unset(m_value);
- } else {
- m_value = g_slice_new0(GValue);
- }
- g_value_init(m_value, type);
-}
-
//END Value
//BEGIN SharedValue
SharedValue::SharedValue(GValue *gvalue)
- : ValueBase(gvalue)
-{
-}
-
-SharedValue::SharedValue(const SharedValue & other)
- : ValueBase(other.m_value)
+ : Value()
{
+ m_value = gvalue;
}
SharedValue::~SharedValue()
{
+ m_value = NULL;
}
-SharedValue & SharedValue::operator=(const SharedValue & other)
-{
- m_value = other.m_value;
- return *this;
-}
//END SharedValue
-QDebug & operator<<(QDebug debug, const ValueBase & value)
+QDebug & operator<<(QDebug debug, const Value & value)
{
- debug.nospace() << "QGlib::ValueBase";
+ debug.nospace() << "QGlib::Value";
if(!value.isValid()) {
debug << "(<invalid>)";
return debug.space();
diff --git a/src/QGlib/value.h b/src/QGlib/value.h
index 9b40694..7517b63 100644
--- a/src/QGlib/value.h
+++ b/src/QGlib/value.h
@@ -31,16 +31,16 @@
namespace QGlib {
/*! This structure holds the set and get methods that are used internally
- * by ValueBase to handle data of a specific type. If you want to provide
+ * by Value to handle data of a specific type. If you want to provide
* support for a custom type, you need to write two such methods, create
* a new ValueVTable instance that holds pointers to them and register it
- * using ValueBase::registerValueVTable().
+ * using Value::registerValueVTable().
* \sa \ref value_design
*/
struct ValueVTable
{
- typedef void (*SetFunction)(ValueBase & value, const void *data);
- typedef void (*GetFunction)(const ValueBase & value, void *data);
+ typedef void (*SetFunction)(Value & value, const void *data);
+ typedef void (*GetFunction)(const Value & value, void *data);
inline ValueVTable() : set(NULL), get(NULL) {}
inline ValueVTable(SetFunction s, GetFunction g) : set(s), get(g) {}
@@ -51,12 +51,40 @@ struct ValueVTable
/*! \headerfile value.h <QGlib/Value>
- * \brief Common base class for Value and SharedValue, wrappers for GValue
+ * \brief Wrapper class for GValue
+ *
+ * This class serves as a wrapper for GValue. GValue is a data type that can hold different
+ * types of values inside, like a QVariant.
+ * To set a value, you must first initialize this Value using one of the init() methods
+ * (preferably the template one) in order to tell it what kind of value it is going to hold.
+ * Once initialized to hold a specific type, you can use the set() and get() methods to set and
+ * get values of this type only. Attempting to use another type will assert. To change the type
+ * that this value holds, you can call the init() method again at any time. In this case, though,
+ * any held value will be lost.
*/
-class ValueBase
+class Value
{
public:
- /*! \returns whether this ValueBase instance wraps a valid GValue instance or not */
+ Value();
+
+ explicit Value(const GValue *gvalue);
+
+ template <typename T>
+ inline Value(const T & data);
+
+ Value(const Value & other);
+ Value(const SharedValue & other);
+
+ virtual ~Value();
+
+ Value & operator=(const Value & other);
+
+ void init(Type type);
+
+ template <typename T>
+ inline void init();
+
+ /*! \returns whether this Value instance wraps a valid GValue instance or not */
bool isValid() const;
/*! Clears the current value in this GValue instance and resets it to the
@@ -136,50 +164,10 @@ protected:
*/
void setData(Type dataType, const void *data);
-
- ValueBase(GValue *val);
- virtual ~ValueBase();
- Q_DISABLE_COPY(ValueBase)
-
GValue *m_value;
};
/*! \headerfile value.h <QGlib/Value>
- * \brief Wrapper class for GValue
- *
- * This class serves as a wrapper for GValue. GValue is a data type that can hold different
- * types of values inside, like a QVariant.
- * To set a value, you must first initialize this Value using one of the init() methods
- * (preferably the template one) in order to tell it what kind of value it is going to hold.
- * Once initialized to hold a specific type, you can use the set() and get() methods to set and
- * get values of this type only. Attempting to use another type will assert. To change the type
- * that this value holds, you can call the init() method again at any time. In this case, though,
- * any held value will be lost.
- * \note Unlike SharedValue, this class always keeps a private GValue internally which is
- * allocated in the constructors and freed from the destructor.
- * \sa SharedValue
- */
-class Value : public ValueBase
-{
-public:
- Value();
- explicit Value(const GValue *gvalue);
- template <typename T>
- inline Value(const T & data);
- Value(const SharedValue & other);
- Value(const Value & other);
- virtual ~Value();
-
- Value & operator=(const SharedValue & other);
- Value & operator=(const Value & other);
-
- void init(Type type);
-
- template <typename T>
- inline void init();
-};
-
-/*! \headerfile value.h <QGlib/Value>
* \brief Wrapper class for shared GValue instances
*
* This class serves as a wrapper for shared GValue instances. Some functions in the GStreamer
@@ -190,73 +178,73 @@ public:
* GValue instance for itself.
* \sa Value
*/
-class SharedValue : public ValueBase
+class SharedValue : public Value
{
public:
explicit SharedValue(GValue *gvalue);
- SharedValue(const SharedValue & other);
virtual ~SharedValue();
- SharedValue & operator=(const SharedValue & other);
+
+private:
+ Q_DISABLE_COPY(SharedValue);
};
-/*! This struct provides the implementation for the ValueBase::get() and ValueBase::set() methods.
+/*! This struct provides the implementation for the Value::get() and Value::set() methods.
* If you want to provide support for a custom type, you may want to provide a template
* specialization of this class to handle your type in a different way than the default
* implementation. You should normally not need to be concerned at all with this.
- * \note this struct is declared as friend in ValueBase and as a result it has access to
- * ValueBase::setData() and ValueBase::getData()
+ * \note this struct is declared as friend in Value and as a result it has access to
+ * Value::setData() and Value::getData()
* \sa \ref value_design
*/
template <typename T>
struct ValueImpl
{
- static inline T get(const ValueBase & value);
- static inline void set(ValueBase & value, const T & data);
+ static inline T get(const Value & value);
+ static inline void set(Value & value, const T & data);
};
// -- template implementations --
template <typename T>
-T ValueBase::get() const
+inline Value::Value(const T & data)
+ : m_value(NULL)
+{
+ init<T>();
+ set(data);
+}
+
+template <typename T>
+inline void Value::init()
+{
+ init(GetType<T>());
+}
+
+template <typename T>
+T Value::get() const
{
try {
return ValueImpl<T>::get(*this);
} catch (const std::exception & e) {
- qWarning() << "QGlib::ValueBase::get:" << e.what();
+ qWarning() << "QGlib::Value::get:" << e.what();
return T();
}
}
template <typename T>
-void ValueBase::set(const T & data)
+void Value::set(const T & data)
{
try {
ValueImpl<T>::set(*this, data);
} catch (const std::exception & e) {
- qWarning() << "QGlib::ValueBase::set:" << e.what();
+ qWarning() << "QGlib::Value::set:" << e.what();
}
}
-
-template <typename T>
-inline Value::Value(const T & data)
- : ValueBase(NULL)
-{
- init<T>();
- set(data);
-}
-
-template <typename T>
-inline void Value::init()
-{
- init(GetType<T>());
-}
-
// -- default ValueImpl implementation --
template <typename T>
-inline T ValueImpl<T>::get(const ValueBase & value)
+inline T ValueImpl<T>::get(const Value & value)
{
//Use int for enums, T for everything else
typename boost::mpl::if_<
@@ -269,7 +257,7 @@ inline T ValueImpl<T>::get(const ValueBase & value)
}
template <typename T>
-inline void ValueImpl<T>::set(ValueBase & value, const T & data)
+inline void ValueImpl<T>::set(Value & value, const T & data)
{
//Use const int for enums, const T for everything else
typename boost::mpl::if_<
@@ -285,14 +273,14 @@ inline void ValueImpl<T>::set(ValueBase & value, const T & data)
template <class T>
struct ValueImpl< QFlags<T> >
{
- static inline QFlags<T> get(const ValueBase & value)
+ static inline QFlags<T> get(const Value & value)
{
uint flags;
value.getData(GetType< QFlags<T> >(), &flags);
return QFlags<T>(QFlag(flags));
}
- static inline void set(ValueBase & value, const QFlags<T> & data)
+ static inline void set(Value & value, const QFlags<T> & data)
{
uint flags = data;
value.setData(GetType< QFlags<T> >(), &flags);
@@ -304,14 +292,14 @@ struct ValueImpl< QFlags<T> >
template <class T>
struct ValueImpl< RefPointer<T> >
{
- static inline RefPointer<T> get(const ValueBase & value)
+ static inline RefPointer<T> get(const Value & value)
{
typename T::CType *gobj;
value.getData(GetType<T>(), &gobj);
return RefPointer<T>::wrap(gobj);
}
- static inline void set(ValueBase & value, const RefPointer<T> & data)
+ static inline void set(Value & value, const RefPointer<T> & data)
{
typename T::CType *gobj = static_cast<typename T::CType*>(data);
value.setData(GetType<T>(), &gobj);
@@ -325,7 +313,7 @@ struct ValueImpl<char[N]>
{
//No get method, obviously.
- static inline void set(ValueBase & value, const char (&data)[N])
+ static inline void set(Value & value, const char (&data)[N])
{
QByteArray str = QByteArray::fromRawData(data, N);
value.setData(Type::String, &str);
@@ -339,7 +327,7 @@ struct ValueImpl<const char*>
{
//No get method, obviously.
- static inline void set(ValueBase & value, const char *data)
+ static inline void set(Value & value, const char *data)
{
QByteArray str = QByteArray::fromRawData(data, qstrlen(data));
value.setData(Type::String, &str);
@@ -351,14 +339,14 @@ struct ValueImpl<const char*>
template <>
struct ValueImpl<QString>
{
- static inline QString get(const ValueBase & value)
+ static inline QString get(const Value & value)
{
QByteArray str;
value.getData(Type::String, &str);
return QString::fromUtf8(str);
}
- static inline void set(ValueBase & value, const QString & data)
+ static inline void set(Value & value, const QString & data)
{
QByteArray str = data.toUtf8();
value.setData(Type::String, &str);
@@ -405,12 +393,11 @@ public:
// -- QDebug operator --
-/*! \relates QGlib::ValueBase */
-QDebug & operator<<(QDebug debug, const ValueBase & value);
+/*! \relates QGlib::Value */
+QDebug & operator<<(QDebug debug, const Value & value);
} //namespace QGlib
-QGLIB_REGISTER_TYPE(QGlib::ValueBase) //codegen: GType=G_TYPE_VALUE
QGLIB_REGISTER_TYPE(QGlib::Value)
QGLIB_REGISTER_TYPE(QGlib::SharedValue) //codegen: GType=G_TYPE_VALUE
diff --git a/src/QGst/event.h b/src/QGst/event.h
index 949e0c0..b8c37a2 100644
--- a/src/QGst/event.h
+++ b/src/QGst/event.h
@@ -44,8 +44,8 @@ namespace QGst {
* 'new_foo' and 'parse_foo' methods. You can use RefPointer::dynamicCast() to cast a EventPtr
* to a RefPointer of one of the Event subclasses and it will behave as expected (i.e. it will
* only succeed if the event type matches the event type that the subclass handles). Note
- * however that the Event subclasses \em cannot be used with ValueBase::get(), since a GValue
- * will actually contain a GstEvent (the subclasses do not exist in C) and ValueBase::get()
+ * however that the Event subclasses \em cannot be used with Value::get(), since a GValue
+ * will actually contain a GstEvent (the subclasses do not exist in C) and Value::get()
* is not able to do dynamic casts. As a result of that, Event subclasses also \em cannot be
* used as arguments in slots connected to GObject signals, even though you may know that your
* slot will only be called with that type of event.
diff --git a/src/QGst/global.h b/src/QGst/global.h
index 52fb0df..adbe94a 100644
--- a/src/QGst/global.h
+++ b/src/QGst/global.h
@@ -55,7 +55,7 @@
template<> \
struct ValueImpl<QGst::TYPE##BASECLASS##Ptr> \
{ \
- static void set(ValueBase & value, const QGst::TYPE##BASECLASS##Ptr & data) { \
+ static void set(Value & value, const QGst::TYPE##BASECLASS##Ptr & data) { \
ValueImpl<QGst::BASECLASS##Ptr>::set(value, data); \
} \
}; \
diff --git a/src/QGst/message.cpp b/src/QGst/message.cpp
index a754f3e..8011eae 100644
--- a/src/QGst/message.cpp
+++ b/src/QGst/message.cpp
@@ -332,7 +332,7 @@ QGlib::Value StreamStatusMessage::streamStatusObject() const
return QGlib::Value(gst_message_get_stream_status_object(object<GstMessage>()));
}
-void StreamStatusMessage::setStreamStatusObject(const QGlib::ValueBase & obj)
+void StreamStatusMessage::setStreamStatusObject(const QGlib::Value & obj)
{
gst_message_set_stream_status_object(object<GstMessage>(), obj);
}
diff --git a/src/QGst/message.h b/src/QGst/message.h
index 44ee0e7..062e83b 100644
--- a/src/QGst/message.h
+++ b/src/QGst/message.h
@@ -37,8 +37,8 @@ namespace QGst {
* 'new_foo' and 'parse_foo' methods. You can use RefPointer::dynamicCast() to cast a MessagePtr
* to a RefPointer of one of the Message subclasses and it will behave as expected (i.e. it will
* only succeed if the message type matches the message type that the subclass handles). Note
- * however that the Message subclasses \em cannot be used with ValueBase::get(), since a GValue
- * will actually contain a GstMessage (the subclasses do not exist in C) and ValueBase::get()
+ * however that the Message subclasses \em cannot be used with Value::get(), since a GValue
+ * will actually contain a GstMessage (the subclasses do not exist in C) and Value::get()
* is not able to do dynamic casts. As a result of that, Message subclasses also \em cannot be
* used as arguments in slots connected to GObject signals, even though you may know that your
* slot will only be called with that type of message.
@@ -186,7 +186,7 @@ public:
StreamStatusType statusType() const;
ElementPtr owner() const;
QGlib::Value streamStatusObject() const;
- void setStreamStatusObject(const QGlib::ValueBase & object);
+ void setStreamStatusObject(const QGlib::Value & object);
};
/*! \headerfile message.h <QGst/Message>
diff --git a/src/QGst/query.h b/src/QGst/query.h
index ecc4397..df22b1f 100644
--- a/src/QGst/query.h
+++ b/src/QGst/query.h
@@ -43,8 +43,8 @@ namespace QGst {
* the native C API, where there is only one Query class with tens of 'new_foo' and 'parse_foo'
* methods.
*
- * Note that the Query subclasses \em cannot be used with ValueBase::get(), since a GValue
- * will actually contain a GstQuery (the subclasses do not exist in C) and ValueBase::get()
+ * Note that the Query subclasses \em cannot be used with Value::get(), since a GValue
+ * will actually contain a GstQuery (the subclasses do not exist in C) and Value::get()
* is not able to do dynamic casts. As a result of that, Query subclasses also \em cannot be
* used as arguments in slots connected to GObject signals, even though you may know that your
* slot will only be called with that type of queries.
diff --git a/src/QGst/value.cpp b/src/QGst/value.cpp
index 3af0392..ad311a0 100644
--- a/src/QGst/value.cpp
+++ b/src/QGst/value.cpp
@@ -28,93 +28,93 @@ void registerValueVTables()
{
struct ValueVTable_MiniObject
{
- static void get(const QGlib::ValueBase & value, void *data)
+ static void get(const QGlib::Value & value, void *data)
{
*reinterpret_cast<GstMiniObject**>(data) = gst_value_get_mini_object(value);
};
- static void set(QGlib::ValueBase & value, const void *data)
+ static void set(QGlib::Value & value, const void *data)
{
gst_value_set_mini_object(value, *reinterpret_cast<GstMiniObject* const *>(data));
};
};
- QGlib::ValueBase::registerValueVTable(QGlib::GetType<MiniObject>(),
+ QGlib::Value::registerValueVTable(QGlib::GetType<MiniObject>(),
QGlib::ValueVTable(ValueVTable_MiniObject::set, ValueVTable_MiniObject::get));
struct ValueVTable_Fourcc
{
- static void get(const QGlib::ValueBase & value, void *data)
+ static void get(const QGlib::Value & value, void *data)
{
reinterpret_cast<Fourcc*>(data)->value.as_integer = gst_value_get_fourcc(value);
};
- static void set(QGlib::ValueBase & value, const void *data)
+ static void set(QGlib::Value & value, const void *data)
{
gst_value_set_fourcc(value, reinterpret_cast<Fourcc const *>(data)->value.as_integer);
};
};
- QGlib::ValueBase::registerValueVTable(QGlib::GetType<Fourcc>(),
+ QGlib::Value::registerValueVTable(QGlib::GetType<Fourcc>(),
QGlib::ValueVTable(ValueVTable_Fourcc::set, ValueVTable_Fourcc::get));
struct ValueVTable_Fraction
{
- static void get(const QGlib::ValueBase & value, void *data)
+ static void get(const QGlib::Value & value, void *data)
{
reinterpret_cast<Fraction*>(data)->numerator = gst_value_get_fraction_numerator(value);
reinterpret_cast<Fraction*>(data)->denominator = gst_value_get_fraction_denominator(value);
};
- static void set(QGlib::ValueBase & value, const void *data)
+ static void set(QGlib::Value & value, const void *data)
{
gst_value_set_fraction(value, reinterpret_cast<Fraction const *>(data)->numerator,
reinterpret_cast<Fraction const *>(data)->denominator);
};
};
- QGlib::ValueBase::registerValueVTable(QGlib::GetType<Fraction>(),
+ QGlib::Value::registerValueVTable(QGlib::GetType<Fraction>(),
QGlib::ValueVTable(ValueVTable_Fraction::set, ValueVTable_Fraction::get));
struct ValueVTable_IntRange
{
- static void get(const QGlib::ValueBase & value, void *data)
+ static void get(const QGlib::Value & value, void *data)
{
reinterpret_cast<IntRange*>(data)->start = gst_value_get_int_range_min(value);
reinterpret_cast<IntRange*>(data)->end = gst_value_get_int_range_max(value);
};
- static void set(QGlib::ValueBase & value, const void *data)
+ static void set(QGlib::Value & value, const void *data)
{
gst_value_set_int_range(value, reinterpret_cast<IntRange const *>(data)->start,
reinterpret_cast<IntRange const *>(data)->end);
};
};
- QGlib::ValueBase::registerValueVTable(QGlib::GetType<IntRange>(),
+ QGlib::Value::registerValueVTable(QGlib::GetType<IntRange>(),
QGlib::ValueVTable(ValueVTable_IntRange::set, ValueVTable_IntRange::get));
struct ValueVTable_DoubleRange
{
- static void get(const QGlib::ValueBase & value, void *data)
+ static void get(const QGlib::Value & value, void *data)
{
reinterpret_cast<DoubleRange*>(data)->start = gst_value_get_double_range_min(value);
reinterpret_cast<DoubleRange*>(data)->end = gst_value_get_double_range_max(value);
};
- static void set(QGlib::ValueBase & value, const void *data)
+ static void set(QGlib::Value & value, const void *data)
{
gst_value_set_double_range(value, reinterpret_cast<DoubleRange const *>(data)->start,
reinterpret_cast<DoubleRange const *>(data)->end);
};
};
- QGlib::ValueBase::registerValueVTable(QGlib::GetType<DoubleRange>(),
+ QGlib::Value::registerValueVTable(QGlib::GetType<DoubleRange>(),
QGlib::ValueVTable(ValueVTable_DoubleRange::set, ValueVTable_DoubleRange::get));
struct ValueVTable_FractionRange
{
- static void get(const QGlib::ValueBase & value, void *data)
+ static void get(const QGlib::Value & value, void *data)
{
reinterpret_cast<FractionRange*>(data)->start.numerator =
gst_value_get_fraction_numerator(gst_value_get_fraction_range_min(value));
@@ -126,7 +126,7 @@ void registerValueVTables()
gst_value_get_fraction_denominator(gst_value_get_fraction_range_max(value));
};
- static void set(QGlib::ValueBase & value, const void *data)
+ static void set(QGlib::Value & value, const void *data)
{
gst_value_set_fraction_range_full(value,
reinterpret_cast<FractionRange const *>(data)->start.numerator,
@@ -135,7 +135,7 @@ void registerValueVTables()
reinterpret_cast<FractionRange const *>(data)->end.denominator);
};
};
- QGlib::ValueBase::registerValueVTable(QGlib::GetType<FractionRange>(),
+ QGlib::Value::registerValueVTable(QGlib::GetType<FractionRange>(),
QGlib::ValueVTable(ValueVTable_FractionRange::set, ValueVTable_FractionRange::get));
}
diff --git a/src/main.dox b/src/main.dox
index 1f82664..06f8a3e 100644
--- a/src/main.dox
+++ b/src/main.dox
@@ -41,13 +41,13 @@
* determine if it can be directly assigned to the GValue or if it needs conversion.
* If it can be directly assigned, a dispatcher that holds set/get methods for the various
* GTypes is used to get the appropriate set/get method that knows how to convert void* back
- * to the original type and handle it. A method (ValueBase::registerValueVTable()) is
+ * to the original type and handle it. A method (Value::registerValueVTable()) is
* provided to register additional such methods from client code, if necessary.
* If a conversion is required, it is handled by g_value_transform. This of course means
* that an intermediate GValue that holds the given GType is created and transformed
* accordingly.
*
- * Between ValueBase::set/get and ValueBase::setData/getData, there is an intermediate layer,
+ * Between Value::set/get and Value::setData/getData, there is an intermediate layer,
* struct ValueImpl<T>. This struct provides the actual implementation of set() and get().
* This is provided as an external template, so that it is possible to specialize it for
* specific C++ types that need special handling. Examples include RefPointer<T>, QFlags<T>,