diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.co.uk> | 2011-01-12 00:52:10 +0200 |
---|---|---|
committer | George Kiagiadakis <george.kiagiadakis@collabora.co.uk> | 2011-01-12 00:52:10 +0200 |
commit | 3e41d0624cadb2c347639c6401344b4ccd786102 (patch) | |
tree | 48b1f6227d3a426e979b76ad6150e2fd0cd1ba98 | |
parent | 403f903933ccd50bc2f6f51af3c8545593036a8a (diff) |
Add a template Structure::setValue() method.
This will help avoiding implicit type casting mistakes that may
happen by using the version that takes a Value.
-rw-r--r-- | src/QGst/structure.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/QGst/structure.h b/src/QGst/structure.h index 9b7d68c..05e5ba7 100644 --- a/src/QGst/structure.h +++ b/src/QGst/structure.h @@ -63,6 +63,8 @@ public: void setName(const char *name); QGlib::Value value(const char *fieldName) const; + template <typename T> + inline void setValue(const char *fieldName, const T & value); void setValue(const char *fieldName, const QGlib::Value & value); unsigned int numberOfFields() const; @@ -92,6 +94,12 @@ private: QSharedDataPointer<Data> d; }; +template <typename T> +inline void Structure::setValue(const char *fieldName, const T & value) +{ + setValue(fieldName, QGlib::Value::create(value)); +} + //static inline Structure fromString(const QString & str) { |