diff options
38 files changed, 284 insertions, 211 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 540ed21..b907256 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,6 +7,7 @@ set(QtGstreamer_SRCS QGlib/object.cpp QGlib/value.cpp QGlib/closure.cpp + QGlib/string.cpp QGst/global.cpp QGst/structure.cpp @@ -35,6 +36,7 @@ set(INSTALLED_HEADERS QGlib/object.h QGlib/Object QGlib/value.h QGlib/Value QGlib/closure.h QGlib/Closure + QGlib/string.h QGlib/String QGlib/valueimpl/assert.h QGlib/valueimpl/valueimpl.h diff --git a/src/QGlib/String b/src/QGlib/String new file mode 100644 index 0000000..eab76f2 --- /dev/null +++ b/src/QGlib/String @@ -0,0 +1 @@ +#include "string.h" diff --git a/src/QGlib/global.h b/src/QGlib/global.h index b1aa18c..5deb655 100644 --- a/src/QGlib/global.h +++ b/src/QGlib/global.h @@ -102,6 +102,7 @@ QGLIB_REGISTER_NATIVE_TYPE(float, Type::Float) QGLIB_REGISTER_NATIVE_TYPE(double, Type::Double) QGLIB_REGISTER_NATIVE_TYPE(QString, Type::String) QGLIB_REGISTER_NATIVE_TYPE(QByteArray, Type::String) +QGLIB_REGISTER_NATIVE_TYPE(String, Type::String) QGLIB_REGISTER_NATIVE_TYPE(char*, Type::String) #endif diff --git a/src/QGlib/object.cpp b/src/QGlib/object.cpp index 672b54c..fa7f333 100644 --- a/src/QGlib/object.cpp +++ b/src/QGlib/object.cpp @@ -15,15 +15,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "object.h" -#include "../QGst/helpers_p.h" #include <glib-object.h> namespace QGlib { -ParamSpecPtr Object::findProperty(const QString & name) const +ParamSpecPtr Object::findProperty(const String & name) const { GObjectClass *klass = G_OBJECT_CLASS(g_type_class_ref(Type::fromInstance(m_object))); - GParamSpec *param = g_object_class_find_property(klass, qstringToGcharPtr(name)); + GParamSpec *param = g_object_class_find_property(klass, name); g_type_class_unref(klass); if (param) { return ParamSpecPtr::wrap(g_param_spec_ref_sink(param), false); @@ -43,20 +42,20 @@ QList<ParamSpecPtr> Object::listProperties() const return result; } -Value Object::property(const QString & name) const +Value Object::property(const String & name) const { Value result; ParamSpecPtr param = findProperty(name); if (param && (param->flags() & ParamSpec::Readable)) { result.init(param->valueType()); - g_object_get_property(G_OBJECT(m_object), qstringToGcharPtr(name), result.peekGValue()); + g_object_get_property(G_OBJECT(m_object), name, result.peekGValue()); } return result; } -void Object::setPropertyValue(const QString & name, const ValueBase & value) +void Object::setPropertyValue(const String & name, const ValueBase & value) { - g_object_set_property(G_OBJECT(m_object), qstringToGcharPtr(name), value.peekGValue()); + g_object_set_property(G_OBJECT(m_object), name, value.peekGValue()); } void Object::ref() diff --git a/src/QGlib/object.h b/src/QGlib/object.h index 8ccf330..fe035ac 100644 --- a/src/QGlib/object.h +++ b/src/QGlib/object.h @@ -26,12 +26,12 @@ class Object : public RefCountedObject { QGLIB_WRAPPER(Object) public: - ParamSpecPtr findProperty(const QString & name) const; + ParamSpecPtr findProperty(const String & name) const; QList<ParamSpecPtr> listProperties() const; - Value property(const QString & name) const; - template <class T> void setProperty(const QString & name, const T & value); - void setPropertyValue(const QString & name, const ValueBase & value); + Value property(const String & name) const; + template <class T> void setProperty(const String & name, const T & value); + void setPropertyValue(const String & name, const ValueBase & value); protected: virtual void ref(); @@ -39,7 +39,7 @@ protected: }; template <class T> -void Object::setProperty(const QString & name, const T & value) +void Object::setProperty(const String & name, const T & value) { ParamSpecPtr param = findProperty(name); if (param) { diff --git a/src/QGlib/paramspec.cpp b/src/QGlib/paramspec.cpp index 028b4ee..7981cc5 100644 --- a/src/QGlib/paramspec.cpp +++ b/src/QGlib/paramspec.cpp @@ -19,19 +19,19 @@ namespace QGlib { -QString ParamSpec::name() const +String ParamSpec::name() const { - return QString::fromUtf8(g_param_spec_get_name(G_PARAM_SPEC(m_object))); + return String(g_param_spec_get_name(G_PARAM_SPEC(m_object))); } -QString ParamSpec::nick() const +String ParamSpec::nick() const { - return QString::fromUtf8(g_param_spec_get_nick(G_PARAM_SPEC(m_object))); + return String(g_param_spec_get_nick(G_PARAM_SPEC(m_object))); } -QString ParamSpec::description() const +String ParamSpec::description() const { - return QString::fromUtf8(g_param_spec_get_blurb(G_PARAM_SPEC(m_object))); + return String(g_param_spec_get_blurb(G_PARAM_SPEC(m_object))); } ParamSpec::ParamFlags ParamSpec::flags() const diff --git a/src/QGlib/paramspec.h b/src/QGlib/paramspec.h index 9eaf30a..950f6f1 100644 --- a/src/QGlib/paramspec.h +++ b/src/QGlib/paramspec.h @@ -35,9 +35,9 @@ public: }; Q_DECLARE_FLAGS(ParamFlags, ParamFlag); - QString name() const; - QString nick() const; - QString description() const; + String name() const; + String nick() const; + String description() const; ParamFlags flags() const; Type valueType() const; diff --git a/src/QGlib/quark.cpp b/src/QGlib/quark.cpp index 308fc94..a0832d5 100644 --- a/src/QGlib/quark.cpp +++ b/src/QGlib/quark.cpp @@ -24,14 +24,14 @@ Quark::Quark(const char *str) m_quark = g_quark_from_string(str); } -Quark::Quark(const QString & str) +Quark::Quark(const String & str) { - m_quark = g_quark_from_string(str.toUtf8().constData()); + m_quark = g_quark_from_string(str); } -QString Quark::toString() const +String Quark::toString() const { - return QString::fromUtf8(g_quark_to_string(m_quark)); + return String(g_quark_to_string(m_quark)); } } diff --git a/src/QGlib/quark.h b/src/QGlib/quark.h index a6f59f8..185baa1 100644 --- a/src/QGlib/quark.h +++ b/src/QGlib/quark.h @@ -17,7 +17,7 @@ #ifndef QGLIB_QUARK_H #define QGLIB_QUARK_H -#include <QtCore/QString> +#include "string.h" namespace QGlib { @@ -26,9 +26,9 @@ class Quark public: inline Quark(quint32 gquark) : m_quark(gquark) {} Quark(const char *str); - Quark(const QString & str); + Quark(const String & str); - QString toString() const; + String toString() const; inline operator quint32() const { return m_quark; } diff --git a/src/QGst/helpers_p.h b/src/QGlib/string.cpp index a69835f..b22c5d0 100644 --- a/src/QGst/helpers_p.h +++ b/src/QGlib/string.cpp @@ -14,20 +14,16 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef HELPERS_P_H -#define HELPERS_P_H - +#include "string.h" #include <glib.h> -#include <QtCore/QString> -inline QString gcharPtrToQString(gchar *str) +namespace QGlib { + +String String::fromGCharPtr(char* s) { - QString result = QString::fromUtf8(str); - g_free(str); - return result; + String str(s); + g_free(s); + return str; } -#define qstringToGcharPtr(str) \ - (str.isEmpty() ? NULL : str.toUtf8().constData()) - -#endif +}
\ No newline at end of file diff --git a/src/QGlib/string.h b/src/QGlib/string.h new file mode 100644 index 0000000..50d47e8 --- /dev/null +++ b/src/QGlib/string.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2010 George Kiagiadakis <kiagiadakis.george@gmail.com> + + This library is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef QGLIB_STRING_H +#define QGLIB_STRING_H + +#include <QtCore/QByteArray> +#include <QtCore/QString> +#include <QtCore/QDebug> + +namespace QGlib { + +/** This is a string class based on QByteArray. It is used instead of QString + * to avoid the overhead of converting the data to/from UTF-16 when not necessary. + * Since GLib/Gstreamer use entirely UTF-8 encoding, expect the data of this class + * to be encoded as UTF-8. This means that if you want to display this string + * somewhere, you should first convert it to QString with the toQString() method + * or with operator QString(). + */ +class String +{ +public: + inline String() {} + inline String(const char *str) : m_str(str) {} + inline String(const QByteArray & str) : m_str(str) {} + inline String(const QString & str) : m_str(str.toUtf8()) {} + + inline QString toQString() const { return QString::fromUtf8(m_str.constData(), m_str.size()); } + inline operator QString() const { return toQString(); } + + /** This is a special method that is used to wrap the return value of glib/gstreamer + * methods that return a newly allocated gchar*. This method converts it to a String + * and calls g_free() on the original string to free it. + */ + static String fromGCharPtr(char *s); + + /** This is a special method that is used to pass this string as an argument to + * glib/gstreamer methods that take a const gchar*. If the string is empty, it + * returns NULL to hit the sanity checks of those methods. + */ + inline const char *toGCharPtr() const { return m_str.isEmpty() ? NULL : m_str.constData(); } + + /** Behaves the same as toGCharPtr() */ + inline operator const char*() const { return toGCharPtr(); } + +private: + QByteArray m_str; +}; + +} //namespace QGlib + +inline QDebug operator<<(QDebug dbg, const QGlib::String & str) +{ + return dbg << str.toQString(); +} + +#endif // QGLIB_STRING_H diff --git a/src/QGlib/type.cpp b/src/QGlib/type.cpp index 1363250..bf866d9 100644 --- a/src/QGlib/type.cpp +++ b/src/QGlib/type.cpp @@ -29,9 +29,9 @@ Type Type::fromName(const char *name) return g_type_from_name(name); } -QString Type::name() const +QGlib::String Type::name() const { - return QString::fromUtf8(g_type_name(m_type)); + return QGlib::String(g_type_name(m_type)); } Quark Type::qname() const diff --git a/src/QGlib/type.h b/src/QGlib/type.h index e878e4c..9fd5535 100644 --- a/src/QGlib/type.h +++ b/src/QGlib/type.h @@ -65,7 +65,7 @@ public: static Type fromInstance(void *nativeInstance); static Type fromName(const char *name); - QString name() const; + QGlib::String name() const; Quark qname() const; bool isAbstract() const; diff --git a/src/QGlib/valueimpl/nativetypes.h b/src/QGlib/valueimpl/nativetypes.h index 1b4a831..a814702 100644 --- a/src/QGlib/valueimpl/nativetypes.h +++ b/src/QGlib/valueimpl/nativetypes.h @@ -127,4 +127,19 @@ public: } }; +template <> +class ValueImpl<QGlib::String> +{ +public: + static QGlib::String get(const ValueBase & value) { + VALUE_ASSERT(value.type().fundamental() == Type::String); + return value.getString(); + } + + static void set(ValueBase & value, const QGlib::String & data) { + VALUE_ASSERT(value.type().fundamental() == Type::String); + value.setString(data); + } +}; + } diff --git a/src/QGst/bin.cpp b/src/QGst/bin.cpp index 0c7ccf0..11d5e18 100644 --- a/src/QGst/bin.cpp +++ b/src/QGst/bin.cpp @@ -16,16 +16,15 @@ */ #include "bin.h" #include "pad.h" -#include "helpers_p.h" #include <gst/gstbin.h> #include <gst/gstutils.h> namespace QGst { //static -BinPtr Bin::newBin(const QString & name) +BinPtr Bin::newBin(const QGlib::String & name) { - GstElement *bin = gst_bin_new(qstringToGcharPtr(name)); + GstElement *bin = gst_bin_new(name); gst_object_ref_sink(GST_OBJECT(bin)); return BinPtr::wrap(GST_BIN(bin), false); } @@ -40,15 +39,15 @@ bool Bin::remove(const ElementPtr & element) return gst_bin_remove(GST_BIN(m_object), element); } -ElementPtr Bin::getElementByName(const QString & name, RecursionType r) const +ElementPtr Bin::getElementByName(const QGlib::String & name, RecursionType r) const { GstElement *e = NULL; switch(r) { case RecurseDown: - e = gst_bin_get_by_name(GST_BIN(m_object), qstringToGcharPtr(name)); + e = gst_bin_get_by_name(GST_BIN(m_object), name); break; case RecurseUp: - e = gst_bin_get_by_name_recurse_up(GST_BIN(m_object), qstringToGcharPtr(name)); + e = gst_bin_get_by_name_recurse_up(GST_BIN(m_object), name); break; default: Q_ASSERT_X(false, "QGst::Bin::getByName", "Invalid RecursionType"); diff --git a/src/QGst/bin.h b/src/QGst/bin.h index 73d2eb9..d37629f 100644 --- a/src/QGst/bin.h +++ b/src/QGst/bin.h @@ -26,7 +26,7 @@ class Bin : public Element, public ChildProxy { QGST_WRAPPER(Bin) public: - static BinPtr newBin(const QString & name = QString()); + static BinPtr newBin(const QGlib::String & name = QGlib::String()); bool add(const ElementPtr & element); bool remove(const ElementPtr & element); @@ -42,7 +42,7 @@ public: */ RecurseUp }; - ElementPtr getElementByName(const QString & name, RecursionType = RecurseDown) const; + ElementPtr getElementByName(const QGlib::String & name, RecursionType = RecurseDown) const; ElementPtr getElementByInterface(QGlib::Type interfaceType) const; template <typename T> QGlib::RefPointer<T> getElementByInterface() const; diff --git a/src/QGst/caps.cpp b/src/QGst/caps.cpp index 2e71a75..49b1b90 100644 --- a/src/QGst/caps.cpp +++ b/src/QGst/caps.cpp @@ -16,16 +16,15 @@ */ #include "caps.h" #include "structure.h" -#include "helpers_p.h" #include <QtCore/QDebug> #include <gst/gstcaps.h> namespace QGst { //static -CapsPtr Caps::newSimple(const QString & mediaType) +CapsPtr Caps::newSimple(const QGlib::String & mediaType) { - return CapsPtr::wrap(gst_caps_new_simple(qstringToGcharPtr(mediaType), NULL), false); + return CapsPtr::wrap(gst_caps_new_simple(mediaType, NULL), false); } //static @@ -41,14 +40,14 @@ CapsPtr Caps::newEmpty() } //static -CapsPtr Caps::fromString(const QString & string) +CapsPtr Caps::fromString(const QGlib::String & string) { - return CapsPtr::wrap(gst_caps_from_string(qstringToGcharPtr(string)), false); + return CapsPtr::wrap(gst_caps_from_string(string), false); } -QString Caps::toString() const +QGlib::String Caps::toString() const { - return gcharPtrToQString(gst_caps_to_string(GST_CAPS(m_object))); + return QGlib::String::fromGCharPtr(gst_caps_to_string(GST_CAPS(m_object))); } //static @@ -77,9 +76,9 @@ void Caps::merge(const CapsPtr & caps2) gst_caps_merge(GST_CAPS(m_object), gst_caps_copy(caps2)); } -void Caps::setValue(const QString& field, const QGlib::Value& value) +void Caps::setValue(const QGlib::String & field, const QGlib::Value & value) { - gst_caps_set_value(GST_CAPS(m_object), qstringToGcharPtr(field), value.peekGValue()); + gst_caps_set_value(GST_CAPS(m_object), field, value.peekGValue()); } bool Caps::simplify() diff --git a/src/QGst/caps.h b/src/QGst/caps.h index a5e90f2..867241d 100644 --- a/src/QGst/caps.h +++ b/src/QGst/caps.h @@ -26,12 +26,12 @@ class Caps : public QGlib::RefCountedObject { QGST_WRAPPER(Caps) public: - static CapsPtr newSimple(const QString & mediaType); + static CapsPtr newSimple(const QGlib::String & mediaType); static CapsPtr newAny(); static CapsPtr newEmpty(); - static CapsPtr fromString(const QString & string); - QString toString() const; + static CapsPtr fromString(const QGlib::String & string); + QGlib::String toString() const; static CapsPtr fromXml(xmlNodePtr node); xmlNodePtr toXml(xmlNodePtr parent) const; @@ -39,7 +39,7 @@ public: void makeWritable(); void append(const CapsPtr & caps2); void merge(const CapsPtr & caps2); - void setValue(const QString & field, const QGlib::Value & value); + void setValue(const QGlib::String & field, const QGlib::Value & value); bool simplify(); void truncate(); diff --git a/src/QGst/childproxy.cpp b/src/QGst/childproxy.cpp index a9c5e54..3247e7e 100644 --- a/src/QGst/childproxy.cpp +++ b/src/QGst/childproxy.cpp @@ -15,7 +15,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "childproxy.h" -#include "helpers_p.h" #include <gst/gstobject.h> #include <gst/gstchildproxy.h> @@ -26,10 +25,9 @@ uint ChildProxy::childrenCount() const return gst_child_proxy_get_children_count(GST_CHILD_PROXY(m_object)); } -ObjectPtr ChildProxy::childByName(const QString & name) const +ObjectPtr ChildProxy::childByName(const QGlib::String & name) const { - return ObjectPtr::wrap(gst_child_proxy_get_child_by_name(GST_CHILD_PROXY(m_object), - qstringToGcharPtr(name)), false); + return ObjectPtr::wrap(gst_child_proxy_get_child_by_name(GST_CHILD_PROXY(m_object), name), false); } ObjectPtr ChildProxy::childByIndex(uint index) const @@ -37,11 +35,11 @@ ObjectPtr ChildProxy::childByIndex(uint index) const return ObjectPtr::wrap(gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(m_object), index), false); } -bool ChildProxy::findChildProperty(const QString & name, ObjectPtr *object, QGlib::ParamSpecPtr *paramSpec) const +bool ChildProxy::findChildProperty(const QGlib::String & name, ObjectPtr *object, QGlib::ParamSpecPtr *paramSpec) const { GstObject *op; GParamSpec *pp; - bool result = gst_child_proxy_lookup(GST_OBJECT(m_object), qstringToGcharPtr(name), &op, &pp); + bool result = gst_child_proxy_lookup(GST_OBJECT(m_object), name, &op, &pp); if (result) { *object = ObjectPtr::wrap(op, false); *paramSpec = QGlib::ParamSpecPtr::wrap(pp, false); @@ -49,7 +47,7 @@ bool ChildProxy::findChildProperty(const QString & name, ObjectPtr *object, QGli return result; } -QGlib::Value ChildProxy::childProperty(const QString & name) const +QGlib::Value ChildProxy::childProperty(const QGlib::String & name) const { QGlib::ParamSpecPtr param; ObjectPtr object; diff --git a/src/QGst/childproxy.h b/src/QGst/childproxy.h index 29733ee..ddf5a38 100644 --- a/src/QGst/childproxy.h +++ b/src/QGst/childproxy.h @@ -25,16 +25,16 @@ class ChildProxy : public virtual Object { public: uint childrenCount() const; - ObjectPtr childByName(const QString & name) const; + ObjectPtr childByName(const QGlib::String & name) const; ObjectPtr childByIndex(uint index) const; - bool findChildProperty(const QString & name, ObjectPtr *object, QGlib::ParamSpecPtr *paramSpec) const; - QGlib::Value childProperty(const QString & name) const; - template <typename T> void setChildProperty(const QString & name, const T & value); + bool findChildProperty(const QGlib::String & name, ObjectPtr *object, QGlib::ParamSpecPtr *paramSpec) const; + QGlib::Value childProperty(const QGlib::String & name) const; + template <typename T> void setChildProperty(const QGlib::String & name, const T & value); }; template <typename T> -void ChildProxy::setChildProperty(const QString & name, const T & value) +void ChildProxy::setChildProperty(const QGlib::String & name, const T & value) { QGlib::ParamSpecPtr param; ObjectPtr object; diff --git a/src/QGst/element.cpp b/src/QGst/element.cpp index e0e95d1..628b5d7 100644 --- a/src/QGst/element.cpp +++ b/src/QGst/element.cpp @@ -16,7 +16,6 @@ */ #include "element.h" #include "pad.h" -#include "helpers_p.h" #include <gst/gstelement.h> #include <gst/gstutils.h> @@ -62,15 +61,15 @@ bool Element::addPad(const PadPtr & pad) return gst_element_add_pad(GST_ELEMENT(m_object), pad); } -PadPtr Element::getStaticPad(const QString & name) +PadPtr Element::getStaticPad(const QGlib::String & name) { - GstPad *pad = gst_element_get_static_pad(GST_ELEMENT(m_object), qstringToGcharPtr(name)); + GstPad *pad = gst_element_get_static_pad(GST_ELEMENT(m_object), name); return PadPtr::wrap(pad, false); } -PadPtr Element::getRequestPad(const QString & name) +PadPtr Element::getRequestPad(const QGlib::String & name) { - GstPad *pad = gst_element_get_request_pad(GST_ELEMENT(m_object), qstringToGcharPtr(name)); + GstPad *pad = gst_element_get_request_pad(GST_ELEMENT(m_object), name); return PadPtr::wrap(pad, false); } @@ -79,37 +78,37 @@ void Element::releaseRequestPad(const PadPtr & pad) gst_element_release_request_pad(GST_ELEMENT(m_object), pad); } -bool Element::link(const QString & srcPadName, const ElementPtr & dest, - const QString& sinkPadName, const CapsPtr & filter) +bool Element::link(const QGlib::String & srcPadName, const ElementPtr & dest, + const QGlib::String& sinkPadName, const CapsPtr & filter) { - return gst_element_link_pads_filtered(GST_ELEMENT(m_object), qstringToGcharPtr(srcPadName), - dest, qstringToGcharPtr(sinkPadName), filter); + return gst_element_link_pads_filtered(GST_ELEMENT(m_object), srcPadName, + dest, sinkPadName, filter); } -bool Element::link(const QString & srcPadName, const ElementPtr & dest, const CapsPtr & filter) +bool Element::link(const QGlib::String & srcPadName, const ElementPtr & dest, const CapsPtr & filter) { - return link(srcPadName, dest, QString(), filter); + return link(srcPadName, dest, QGlib::String(), filter); } -bool Element::link(const ElementPtr & dest, const QString & sinkPadName, const CapsPtr & filter) +bool Element::link(const ElementPtr & dest, const QGlib::String & sinkPadName, const CapsPtr & filter) { - return link(QString(), dest, sinkPadName, filter); + return link(QGlib::String(), dest, sinkPadName, filter); } bool Element::link(const ElementPtr & dest, const CapsPtr & filter) { - return link(QString(), dest, QString(), filter); + return link(QGlib::String(), dest, QGlib::String(), filter); } -void Element::unlink(const QString & srcPadName, const ElementPtr & dest, const QString & sinkPadName) +void Element::unlink(const QGlib::String & srcPadName, const ElementPtr & dest, + const QGlib::String & sinkPadName) { - gst_element_unlink_pads(GST_ELEMENT(m_object), qstringToGcharPtr(srcPadName), - dest, qstringToGcharPtr(sinkPadName)); + gst_element_unlink_pads(GST_ELEMENT(m_object), srcPadName, dest, sinkPadName); } -void Element::unlink(const ElementPtr & dest, const QString & sinkPadName) +void Element::unlink(const ElementPtr & dest, const QGlib::String & sinkPadName) { - unlink(QString(), dest, sinkPadName); + unlink(QGlib::String(), dest, sinkPadName); } } diff --git a/src/QGst/element.h b/src/QGst/element.h index 7a26c44..46a271a 100644 --- a/src/QGst/element.h +++ b/src/QGst/element.h @@ -34,19 +34,21 @@ public: bool setStateLocked(bool locked); //### is the return value ever needed? bool addPad(const PadPtr & pad); - PadPtr getStaticPad(const QString & name); - PadPtr getRequestPad(const QString & name); + PadPtr getStaticPad(const QGlib::String & name); + PadPtr getRequestPad(const QGlib::String & name); void releaseRequestPad(const PadPtr & pad); - bool link(const QString & srcPadName, const ElementPtr & dest, const QString & sinkPadName, + bool link(const QGlib::String & srcPadName, const ElementPtr & dest, + const QGlib::String & sinkPadName, const CapsPtr & filter = CapsPtr()); + bool link(const QGlib::String & srcPadName, const ElementPtr & dest, + const CapsPtr & filter = CapsPtr()); + bool link(const ElementPtr & dest, const QGlib::String & sinkPadName, const CapsPtr & filter = CapsPtr()); - bool link(const QString & srcPadName, const ElementPtr & dest, const CapsPtr & filter = CapsPtr()); - bool link(const ElementPtr & dest, const QString & sinkPadName, const CapsPtr & filter = CapsPtr()); bool link(const ElementPtr & dest, const CapsPtr & filter = CapsPtr()); - void unlink(const QString & srcPadName, const ElementPtr & dest, - const QString & sinkPadName = QString()); - void unlink(const ElementPtr & dest, const QString & sinkPadName = QString()); + void unlink(const QGlib::String & srcPadName, const ElementPtr & dest, + const QGlib::String & sinkPadName = QGlib::String()); + void unlink(const ElementPtr & dest, const QGlib::String & sinkPadName = QGlib::String()); }; } diff --git a/src/QGst/elementfactory.cpp b/src/QGst/elementfactory.cpp index 267139e..934ae76 100644 --- a/src/QGst/elementfactory.cpp +++ b/src/QGst/elementfactory.cpp @@ -16,7 +16,6 @@ */ #include "elementfactory.h" #include "element.h" -#include "helpers_p.h" #include <gst/gstelement.h> #include <gst/gstelementfactory.h> #include <gst/gstutils.h> @@ -24,16 +23,15 @@ namespace QGst { //static -ElementFactoryPtr ElementFactory::find(const QString & factoryName) +ElementFactoryPtr ElementFactory::find(const QGlib::String & factoryName) { - return ElementFactoryPtr::wrap(gst_element_factory_find(qstringToGcharPtr(factoryName)), false); + return ElementFactoryPtr::wrap(gst_element_factory_find(factoryName), false); } //static -ElementPtr ElementFactory::make(const QString & factoryName, const QString & elementName) +ElementPtr ElementFactory::make(const QGlib::String & factoryName, const QGlib::String & elementName) { - GstElement *e = gst_element_factory_make(qstringToGcharPtr(factoryName), - qstringToGcharPtr(elementName)); + GstElement *e = gst_element_factory_make(factoryName, elementName); gst_object_ref_sink(e); return ElementPtr::wrap(e, false); } @@ -43,24 +41,24 @@ QGlib::Type ElementFactory::elementType() const return gst_element_factory_get_element_type(GST_ELEMENT_FACTORY(m_object)); } -QString ElementFactory::longName() const +QGlib::String ElementFactory::longName() const { - return QString::fromUtf8(gst_element_factory_get_longname(GST_ELEMENT_FACTORY(m_object))); + return QGlib::String(gst_element_factory_get_longname(GST_ELEMENT_FACTORY(m_object))); } -QString ElementFactory::klass() const +QGlib::String ElementFactory::klass() const { - return QString::fromUtf8(gst_element_factory_get_klass(GST_ELEMENT_FACTORY(m_object))); + return QGlib::String(gst_element_factory_get_klass(GST_ELEMENT_FACTORY(m_object))); } -QString ElementFactory::description() const +QGlib::String ElementFactory::description() const { - return QString::fromUtf8(gst_element_factory_get_description(GST_ELEMENT_FACTORY(m_object))); + return QGlib::String(gst_element_factory_get_description(GST_ELEMENT_FACTORY(m_object))); } -QString ElementFactory::author() const +QGlib::String ElementFactory::author() const { - return QString::fromUtf8(gst_element_factory_get_author(GST_ELEMENT_FACTORY(m_object))); + return QGlib::String(gst_element_factory_get_author(GST_ELEMENT_FACTORY(m_object))); } uint ElementFactory::padTemplatesCount() const @@ -73,10 +71,9 @@ int ElementFactory::uriType() const return gst_element_factory_get_uri_type(GST_ELEMENT_FACTORY(m_object)); } -bool ElementFactory::hasInterface(const QString & interfaceName) const +bool ElementFactory::hasInterface(const QGlib::String & interfaceName) const { - return gst_element_factory_has_interface(GST_ELEMENT_FACTORY(m_object), - qstringToGcharPtr(interfaceName)); + return gst_element_factory_has_interface(GST_ELEMENT_FACTORY(m_object), interfaceName); } bool ElementFactory::canSinkCaps(const CapsPtr & caps) const @@ -89,10 +86,9 @@ bool ElementFactory::canSrcCaps(const CapsPtr & caps) const return gst_element_factory_can_src_caps(GST_ELEMENT_FACTORY(m_object), caps); } -ElementPtr ElementFactory::create(const QString & elementName) const +ElementPtr ElementFactory::create(const QGlib::String & elementName) const { - GstElement *e = gst_element_factory_create(GST_ELEMENT_FACTORY(m_object), - qstringToGcharPtr(elementName)); + GstElement *e = gst_element_factory_create(GST_ELEMENT_FACTORY(m_object), elementName); gst_object_ref_sink(e); return ElementPtr::wrap(e, false); } diff --git a/src/QGst/elementfactory.h b/src/QGst/elementfactory.h index 4bba31c..485b123 100644 --- a/src/QGst/elementfactory.h +++ b/src/QGst/elementfactory.h @@ -25,22 +25,23 @@ class ElementFactory : public PluginFeature { QGST_WRAPPER(ElementFactory) public: - static ElementFactoryPtr find(const QString & factoryName); - static ElementPtr make(const QString & factoryName, const QString & elementName = QString()); + static ElementFactoryPtr find(const QGlib::String & factoryName); + static ElementPtr make(const QGlib::String & factoryName, + const QGlib::String & elementName = QGlib::String()); QGlib::Type elementType() const; - QString longName() const; - QString klass() const; - QString description() const; - QString author() const; + QGlib::String longName() const; + QGlib::String klass() const; + QGlib::String description() const; + QGlib::String author() const; uint padTemplatesCount() const; int uriType() const; - bool hasInterface(const QString & interfaceName) const; + bool hasInterface(const QGlib::String & interfaceName) const; bool canSinkCaps(const CapsPtr & caps) const; bool canSrcCaps(const CapsPtr & caps) const; - ElementPtr create(const QString & elementName) const; + ElementPtr create(const QGlib::String & elementName) const; }; } diff --git a/src/QGst/ghostpad.cpp b/src/QGst/ghostpad.cpp index c4707a7..00955cf 100644 --- a/src/QGst/ghostpad.cpp +++ b/src/QGst/ghostpad.cpp @@ -15,22 +15,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ghostpad.h" -#include "helpers_p.h" #include <gst/gstghostpad.h> namespace QGst { -GhostPadPtr GhostPad::newGhostPad(const PadPtr & target, const QString & name) +GhostPadPtr GhostPad::newGhostPad(const PadPtr & target, const QGlib::String & name) { - GstPad *gp = gst_ghost_pad_new(qstringToGcharPtr(name), target); + GstPad *gp = gst_ghost_pad_new(name, target); gst_object_ref_sink(gp); return GhostPadPtr::wrap(GST_GHOST_PAD(gp), false); } -GhostPadPtr GhostPad::newGhostPad(PadDirection direction, const QString & name) +GhostPadPtr GhostPad::newGhostPad(PadDirection direction, const QGlib::String & name) { - GstPad *gp = gst_ghost_pad_new_no_target(qstringToGcharPtr(name), - static_cast<GstPadDirection>(direction)); + GstPad *gp = gst_ghost_pad_new_no_target(name, static_cast<GstPadDirection>(direction)); gst_object_ref_sink(gp); return GhostPadPtr::wrap(GST_GHOST_PAD(gp), false); } diff --git a/src/QGst/ghostpad.h b/src/QGst/ghostpad.h index 508946d..d2e12ab 100644 --- a/src/QGst/ghostpad.h +++ b/src/QGst/ghostpad.h @@ -25,8 +25,10 @@ class GhostPad : public Pad { QGST_WRAPPER(GhostPad) public: - static GhostPadPtr newGhostPad(const PadPtr & target, const QString & name = QString()); - static GhostPadPtr newGhostPad(PadDirection direction, const QString & name = QString()); + static GhostPadPtr newGhostPad(const PadPtr & target, + const QGlib::String & name = QGlib::String()); + static GhostPadPtr newGhostPad(PadDirection direction, + const QGlib::String & name = QGlib::String()); PadPtr target() const; bool setTarget(const PadPtr & target); diff --git a/src/QGst/object.cpp b/src/QGst/object.cpp index acbeb9b..dce5e62 100644 --- a/src/QGst/object.cpp +++ b/src/QGst/object.cpp @@ -15,19 +15,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "object.h" -#include "helpers_p.h" #include <gst/gstobject.h> namespace QGst { -QString Object::name() const +QGlib::String Object::name() const { - return gcharPtrToQString(gst_object_get_name(GST_OBJECT(m_object))); + return QGlib::String::fromGCharPtr(gst_object_get_name(GST_OBJECT(m_object))); } -bool Object::setName(const QString & name) +bool Object::setName(const QGlib::String & name) { - return gst_object_set_name(GST_OBJECT(m_object), qstringToGcharPtr(name)); + return gst_object_set_name(GST_OBJECT(m_object), name); } ObjectPtr Object::parent() const @@ -45,14 +44,14 @@ void Object::unparent() gst_object_unparent(GST_OBJECT(m_object)); } -QString Object::namePrefix() const +QGlib::String Object::namePrefix() const { - return gcharPtrToQString(gst_object_get_name_prefix(GST_OBJECT(m_object))); + return QGlib::String::fromGCharPtr(gst_object_get_name_prefix(GST_OBJECT(m_object))); } -void Object::setNamePrefix(const QString & prefix) +void Object::setNamePrefix(const QGlib::String & prefix) { - gst_object_set_name_prefix(GST_OBJECT(m_object), qstringToGcharPtr(prefix)); + gst_object_set_name_prefix(GST_OBJECT(m_object), prefix); } bool Object::isAncestorOf(const ObjectPtr & object) const diff --git a/src/QGst/object.h b/src/QGst/object.h index 8556c9d..e93621e 100644 --- a/src/QGst/object.h +++ b/src/QGst/object.h @@ -26,15 +26,15 @@ class Object : public virtual QGlib::Object { QGST_WRAPPER(Object) public: - QString name() const; - bool setName(const QString & name); + QGlib::String name() const; + bool setName(const QGlib::String & name); ObjectPtr parent() const; bool setParent(const ObjectPtr & parent); void unparent(); - QString namePrefix() const; - void setNamePrefix(const QString & prefix); + QGlib::String namePrefix() const; + void setNamePrefix(const QGlib::String & prefix); bool isAncestorOf(const ObjectPtr & object) const; diff --git a/src/QGst/pad.cpp b/src/QGst/pad.cpp index 868f50e..15769eb 100644 --- a/src/QGst/pad.cpp +++ b/src/QGst/pad.cpp @@ -17,7 +17,6 @@ #include "pad.h" #include "caps.h" #include "element.h" -#include "helpers_p.h" #include <QtCore/QDebug> #include <gst/gstpad.h> #include <gst/gstutils.h> @@ -25,9 +24,9 @@ namespace QGst { //static -PadPtr Pad::newPad(PadDirection direction, const QString & name) +PadPtr Pad::newPad(PadDirection direction, const QGlib::String & name) { - GstPad *pad = gst_pad_new(qstringToGcharPtr(name), static_cast<GstPadDirection>(direction)); + GstPad *pad = gst_pad_new(name, static_cast<GstPadDirection>(direction)); return PadPtr::wrap(pad, false); } diff --git a/src/QGst/pad.h b/src/QGst/pad.h index c5827a4..25ef442 100644 --- a/src/QGst/pad.h +++ b/src/QGst/pad.h @@ -25,7 +25,7 @@ class Pad : public Object { QGST_WRAPPER(Pad) public: - static PadPtr newPad(PadDirection direction, const QString & name = QString()); + static PadPtr newPad(PadDirection direction, const QGlib::String & name = QGlib::String()); PadDirection direction() const; diff --git a/src/QGst/pipeline.cpp b/src/QGst/pipeline.cpp index 3d2b039..672df0e 100644 --- a/src/QGst/pipeline.cpp +++ b/src/QGst/pipeline.cpp @@ -15,15 +15,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "pipeline.h" -#include "helpers_p.h" #include <gst/gstpipeline.h> namespace QGst { //static -PipelinePtr Pipeline::newPipeline(const QString & name) +PipelinePtr Pipeline::newPipeline(const QGlib::String & name) { - GstElement *p = gst_pipeline_new(qstringToGcharPtr(name)); + GstElement *p = gst_pipeline_new(name); gst_object_ref_sink(p); return PipelinePtr::wrap(GST_PIPELINE(p), false); } diff --git a/src/QGst/pipeline.h b/src/QGst/pipeline.h index b59edc1..ca887c6 100644 --- a/src/QGst/pipeline.h +++ b/src/QGst/pipeline.h @@ -25,7 +25,7 @@ class Pipeline : public Bin { QGST_WRAPPER(Pipeline) public: - static PipelinePtr newPipeline(const QString & name = QString()); + static PipelinePtr newPipeline(const QGlib::String & name = QGlib::String()); }; } diff --git a/src/QGst/pluginfeature.cpp b/src/QGst/pluginfeature.cpp index a4cb147..cab1346 100644 --- a/src/QGst/pluginfeature.cpp +++ b/src/QGst/pluginfeature.cpp @@ -15,7 +15,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "pluginfeature.h" -#include "helpers_p.h" #include <gst/gstpluginfeature.h> namespace QGst { @@ -30,14 +29,14 @@ void PluginFeature::setRank(uint rank) gst_plugin_feature_set_rank(GST_PLUGIN_FEATURE(m_object), rank); } -QString PluginFeature::name() const +QGlib::String PluginFeature::name() const { - return QString::fromUtf8(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(m_object))); + return QGlib::String(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(m_object))); } -void PluginFeature::setName(const QString & name) +void PluginFeature::setName(const QGlib::String & name) { - gst_plugin_feature_set_name(GST_PLUGIN_FEATURE(m_object), qstringToGcharPtr(name)); + gst_plugin_feature_set_name(GST_PLUGIN_FEATURE(m_object), name); } bool PluginFeature::checkVersion(uint major, uint minor, uint micro) const diff --git a/src/QGst/pluginfeature.h b/src/QGst/pluginfeature.h index 5daaade..a4437ec 100644 --- a/src/QGst/pluginfeature.h +++ b/src/QGst/pluginfeature.h @@ -28,8 +28,8 @@ public: uint rank() const; void setRank(uint rank); - QString name() const; - void setName(const QString & name); + QGlib::String name() const; + void setName(const QGlib::String & name); bool checkVersion(uint major, uint minor, uint micro) const; diff --git a/src/QGst/structure.cpp b/src/QGst/structure.cpp index b382074..519da20 100644 --- a/src/QGst/structure.cpp +++ b/src/QGst/structure.cpp @@ -15,7 +15,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "structure.h" -#include "helpers_p.h" #include <gst/gststructure.h> #include <QtCore/QDebug> @@ -37,28 +36,28 @@ bool StructureBase::isValid() const return m_structure != NULL; } -QString StructureBase::name() const +QGlib::String StructureBase::name() const { Q_ASSERT(isValid()); - return QString::fromUtf8(gst_structure_get_name(m_structure)); + return QGlib::String(gst_structure_get_name(m_structure)); } -void StructureBase::setName(const QString & name) +void StructureBase::setName(const QGlib::String & name) { Q_ASSERT(isValid()); - gst_structure_set_name(m_structure, qstringToGcharPtr(name)); + gst_structure_set_name(m_structure, name); } -QGlib::Value StructureBase::value(const QString & fieldName) const +QGlib::Value StructureBase::value(const QGlib::String & fieldName) const { Q_ASSERT(isValid()); - return QGlib::Value(*gst_structure_get_value(m_structure, qstringToGcharPtr(fieldName))); + return QGlib::Value(*gst_structure_get_value(m_structure, fieldName)); } -void StructureBase::setValue(const QString & fieldName, const QGlib::Value & value) +void StructureBase::setValue(const QGlib::String & fieldName, const QGlib::Value & value) { Q_ASSERT(isValid()); - gst_structure_set_value(m_structure, qstringToGcharPtr(fieldName), value.peekGValue()); + gst_structure_set_value(m_structure, fieldName, value.peekGValue()); } unsigned int StructureBase::numberOfFields() const @@ -67,34 +66,34 @@ unsigned int StructureBase::numberOfFields() const return gst_structure_n_fields(m_structure); } -QString StructureBase::fieldName(unsigned int fieldNumber) +QGlib::String StructureBase::fieldName(unsigned int fieldNumber) { Q_ASSERT(isValid()); - return QString::fromUtf8(gst_structure_nth_field_name(m_structure, fieldNumber)); + return QGlib::String(gst_structure_nth_field_name(m_structure, fieldNumber)); } -QGlib::Type StructureBase::fieldType(const QString& fieldName) const +QGlib::Type StructureBase::fieldType(const QGlib::String& fieldName) const { Q_ASSERT(isValid()); - return gst_structure_get_field_type(m_structure, qstringToGcharPtr(fieldName)); + return gst_structure_get_field_type(m_structure, fieldName); } -bool StructureBase::hasField(const QString& fieldName) const +bool StructureBase::hasField(const QGlib::String& fieldName) const { Q_ASSERT(isValid()); - return gst_structure_has_field(m_structure, qstringToGcharPtr(fieldName)); + return gst_structure_has_field(m_structure, fieldName); } -bool StructureBase::hasFieldTyped(const QString& fieldName, QGlib::Type type) const +bool StructureBase::hasFieldTyped(const QGlib::String& fieldName, QGlib::Type type) const { Q_ASSERT(isValid()); - return gst_structure_has_field_typed(m_structure, qstringToGcharPtr(fieldName), type); + return gst_structure_has_field_typed(m_structure, fieldName, type); } -void StructureBase::removeField(const QString& fieldName) +void StructureBase::removeField(const QGlib::String& fieldName) { Q_ASSERT(isValid()); - return gst_structure_remove_field(m_structure, qstringToGcharPtr(fieldName)); + return gst_structure_remove_field(m_structure, fieldName); } void StructureBase::removeAllFields() @@ -103,18 +102,18 @@ void StructureBase::removeAllFields() return gst_structure_remove_all_fields(m_structure); } -QString StructureBase::toString() const +QGlib::String StructureBase::toString() const { Q_ASSERT(isValid()); - return gcharPtrToQString(gst_structure_to_string(m_structure)); + return QGlib::String::fromGCharPtr(gst_structure_to_string(m_structure)); } //END StructureBase //BEGIN Structure -Structure::Structure(const QString & name) - : StructureBase(gst_structure_empty_new(qstringToGcharPtr(name))) +Structure::Structure(const QGlib::String & name) + : StructureBase(gst_structure_empty_new(name)) { } @@ -153,10 +152,10 @@ Structure & Structure::operator=(const Structure & other) return *this; } -Structure Structure::fromString(const QString& str) +Structure Structure::fromString(const QGlib::String& str) { Structure s(SharedStructure(NULL)); - s.m_structure = gst_structure_from_string(qstringToGcharPtr(str), NULL); + s.m_structure = gst_structure_from_string(str, NULL); return s; } diff --git a/src/QGst/structure.h b/src/QGst/structure.h index 75a1e11..a6bd58b 100644 --- a/src/QGst/structure.h +++ b/src/QGst/structure.h @@ -27,22 +27,22 @@ class StructureBase public: bool isValid() const; - QString name() const; - void setName(const QString & name); + QGlib::String name() const; + void setName(const QGlib::String & name); - QGlib::Value value(const QString & fieldName) const; - void setValue(const QString & fieldName, const QGlib::Value & value); + QGlib::Value value(const QGlib::String & fieldName) const; + void setValue(const QGlib::String & fieldName, const QGlib::Value & value); unsigned int numberOfFields() const; - QString fieldName(unsigned int fieldNumber); - QGlib::Type fieldType(const QString & fieldName) const; - bool hasField(const QString & fieldName) const; - bool hasFieldTyped(const QString & fieldName, QGlib::Type type) const; //FIXME better name? + QGlib::String fieldName(unsigned int fieldNumber); + QGlib::Type fieldType(const QGlib::String & fieldName) const; + bool hasField(const QGlib::String & fieldName) const; + bool hasFieldTyped(const QGlib::String & fieldName, QGlib::Type type) const; //FIXME better name? - void removeField(const QString & fieldName); + void removeField(const QGlib::String & fieldName); void removeAllFields(); - QString toString() const; //FIXME maybe call it serialize()? + QGlib::String toString() const; //FIXME maybe call it serialize()? inline GstStructure *peekGstStructure() { return m_structure; } inline const GstStructure *peekGstStructure() const { return m_structure; } @@ -62,7 +62,7 @@ class SharedStructure; class Structure : public StructureBase { public: - Structure(const QString & name); + Structure(const QGlib::String & name); Structure(const SharedStructure & other); Structure(const Structure & other); virtual ~Structure(); @@ -70,7 +70,7 @@ public: Structure & operator=(const SharedStructure & other); Structure & operator=(const Structure & other); - static Structure fromString(const QString & str); + static Structure fromString(const QGlib::String & str); }; class SharedStructure : public StructureBase diff --git a/tests/childproxytest.cpp b/tests/childproxytest.cpp index cece80c..27e8621 100644 --- a/tests/childproxytest.cpp +++ b/tests/childproxytest.cpp @@ -41,13 +41,13 @@ void ChildProxyTest::inspectionTest() { QGst::ElementPtr tee2 = bin->childByIndex(0).dynamicCast<QGst::Element>(); QVERIFY(!tee2.isNull()); - QCOMPARE(tee2->name(), QString("mytee")); + QCOMPARE(tee2->name(), QGlib::String("mytee")); } { QGst::ElementPtr tee2 = bin->childByName("mytee").dynamicCast<QGst::Element>(); QVERIFY(!tee2.isNull()); - QCOMPARE(tee2->name(), QString("mytee")); + QCOMPARE(tee2->name(), QGlib::String("mytee")); } } @@ -81,8 +81,8 @@ void ChildProxyTest::propertiesTest() QCOMPARE(bin->findChildProperty("mytee::has-chain", &obj, ¶m), true); QVERIFY(!obj.isNull()); QVERIFY(!param.isNull()); - QCOMPARE(obj->name(), QString("mytee")); - QCOMPARE(param->name(), QString("has-chain")); + QCOMPARE(obj->name(), QGlib::String("mytee")); + QCOMPARE(param->name(), QGlib::String("has-chain")); } { diff --git a/tests/structuretest.cpp b/tests/structuretest.cpp index 3fa20fb..f0d8106 100644 --- a/tests/structuretest.cpp +++ b/tests/structuretest.cpp @@ -30,17 +30,17 @@ void StructureTest::bindingsTest() QGst::Structure s("mystructure"); QVERIFY(s.isValid()); - QCOMPARE(s.name(), QString("mystructure")); + QCOMPARE(s.name(), QGlib::String("mystructure")); QCOMPARE(s.numberOfFields(), static_cast<unsigned int>(0)); s.setValue("intfield", 20); QCOMPARE(s.numberOfFields(), static_cast<unsigned int>(1)); QVERIFY(s.hasField("intfield")); - QCOMPARE(s.fieldName(0), QString("intfield")); + QCOMPARE(s.fieldName(0), QGlib::String("intfield")); QCOMPARE(s.value("intfield").get<int>(), 20); QCOMPARE(s.fieldType("intfield"), QGlib::Type(QGlib::Type::Int)); - s.setValue("strfield", QString("hello world")); + s.setValue("strfield", QGlib::String("hello world")); QCOMPARE(s.numberOfFields(), static_cast<unsigned int>(2)); qDebug() << s; |