summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <kiagiadakis.george@gmail.com>2010-07-04 20:52:09 +0300
committerGeorge Kiagiadakis <kiagiadakis.george@gmail.com>2010-07-04 20:52:09 +0300
commit17ff96d61e02a15e3516d6b5232badef46a0811d (patch)
tree058ddee3b948c4cbbe2a5d190c6dd1113ccd28ba
parent3e8d7e31e0244f75af80f5f00b3eec4c1e2cd944 (diff)
Remove QGlib::String again. It sucks.
From now on the following policy will apply: - Any methods that need to take a string argument will take a const char*. This is because native gstreamer functions also take a const char* and in most cases the programmer just passes an ascii string literal, so there is no need to copy it in some string class and then let gstreamer copy it again. QString is out of the question in this case, since it copies and converts to utf16, only to let the wrapper function copy it again and convert it back to ascii. In case the programmer needs to pass a QString to such a function, he should first convert it to utf8 with QString::toUtf8(). This will be documented later. - Any methods that need to return a string should return a QString. This is because: 1) we need to make sure that the programmer won't do anything stupid with the string, such as not free it or hold a reference to a free()-ed string, so we can't return char* like the C functions do. 2) Usually these strings are used for display or comparison, so the programmer needs to have an encoding-safe way to do that and this is what QString offers. Returning a QByteArray and forcing the programmer to convert it to unicode is not a good option.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/QGlib/String1
-rw-r--r--src/QGlib/closure.cpp3
-rw-r--r--src/QGlib/global.h1
-rw-r--r--src/QGlib/object.cpp6
-rw-r--r--src/QGlib/object.h11
-rw-r--r--src/QGlib/paramspec.cpp12
-rw-r--r--src/QGlib/paramspec.h7
-rw-r--r--src/QGlib/quark.cpp11
-rw-r--r--src/QGlib/quark.h8
-rw-r--r--src/QGlib/signal.cpp12
-rw-r--r--src/QGlib/signal.h20
-rw-r--r--src/QGlib/signalimpl_p.h16
-rw-r--r--src/QGlib/string.h75
-rw-r--r--src/QGlib/string_p.h (renamed from src/QGlib/string.cpp)11
-rw-r--r--src/QGlib/type.cpp7
-rw-r--r--src/QGlib/type.h5
-rw-r--r--src/QGlib/value.cpp1
-rw-r--r--src/QGlib/value.h1
-rw-r--r--src/QGst/bin.cpp4
-rw-r--r--src/QGst/bin.h4
-rw-r--r--src/QGst/caps.cpp11
-rw-r--r--src/QGst/caps.h9
-rw-r--r--src/QGst/childproxy.cpp8
-rw-r--r--src/QGst/childproxy.h10
-rw-r--r--src/QGst/element.cpp25
-rw-r--r--src/QGst/element.h18
-rw-r--r--src/QGst/elementfactory.cpp24
-rw-r--r--src/QGst/elementfactory.h17
-rw-r--r--src/QGst/ghostpad.cpp4
-rw-r--r--src/QGst/ghostpad.h6
-rw-r--r--src/QGst/object.cpp13
-rw-r--r--src/QGst/object.h8
-rw-r--r--src/QGst/pad.cpp2
-rw-r--r--src/QGst/pad.h2
-rw-r--r--src/QGst/pipeline.cpp2
-rw-r--r--src/QGst/pipeline.h2
-rw-r--r--src/QGst/pluginfeature.cpp6
-rw-r--r--src/QGst/pluginfeature.h4
-rw-r--r--src/QGst/structure.cpp31
-rw-r--r--src/QGst/structure.h26
-rw-r--r--tests/childproxytest.cpp8
-rw-r--r--tests/signalstest.cpp6
-rw-r--r--tests/structuretest.cpp6
44 files changed, 196 insertions, 270 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8835ec0..db7b671 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,7 +7,6 @@ set(QtGstreamer_SRCS
QGlib/object.cpp
QGlib/value.cpp
QGlib/closure.cpp
- QGlib/string.cpp
QGlib/signal.cpp
QGst/global.cpp
@@ -37,7 +36,6 @@ set(INSTALLED_HEADERS
QGlib/paramspec.h QGlib/ParamSpec
QGlib/object.h QGlib/Object
QGlib/value.h QGlib/Value
- QGlib/string.h QGlib/String
QGlib/closure.h QGlib/Closure
QGlib/closureimpl_p.h
QGlib/signal.h QGlib/Signal
diff --git a/src/QGlib/String b/src/QGlib/String
deleted file mode 100644
index eab76f2..0000000
--- a/src/QGlib/String
+++ /dev/null
@@ -1 +0,0 @@
-#include "string.h"
diff --git a/src/QGlib/closure.cpp b/src/QGlib/closure.cpp
index 79f33e4..1aef75e 100644
--- a/src/QGlib/closure.cpp
+++ b/src/QGlib/closure.cpp
@@ -17,6 +17,7 @@
#include "closure.h"
#include "quark.h"
#include <glib-object.h>
+#include <QtCore/QDebug>
namespace QGlib {
@@ -60,7 +61,7 @@ static void c_marshaller(GClosure *closure, GValue *returnValue, uint paramValue
if (ihint->detail != 0) {
Quark q(ihint->detail);
signalName.append(QLatin1String("::"));
- signalName.append(q.toString().toQString()); //FIXME ugly syntax
+ signalName.append(q.toString());
}
}
diff --git a/src/QGlib/global.h b/src/QGlib/global.h
index 33c65bb..dfbf811 100644
--- a/src/QGlib/global.h
+++ b/src/QGlib/global.h
@@ -30,7 +30,6 @@ namespace QGlib {
class ValueBase;
class Value;
class SharedValue;
-class String;
class Quark;
class Type;
class Signal;
diff --git a/src/QGlib/object.cpp b/src/QGlib/object.cpp
index cd98cdc..b7ce473 100644
--- a/src/QGlib/object.cpp
+++ b/src/QGlib/object.cpp
@@ -29,7 +29,7 @@ QList< RefPointer<T> > arrayToList(typename T::CType **array, uint n)
return result;
}
-ParamSpecPtr Object::findProperty(const String & name) const
+ParamSpecPtr Object::findProperty(const char *name) const
{
GObjectClass *klass = G_OBJECT_CLASS(g_type_class_ref(Type::fromInstance(object<void>())));
GParamSpec *param = g_object_class_find_property(klass, name);
@@ -52,7 +52,7 @@ QList<ParamSpecPtr> Object::listProperties() const
return result;
}
-Value Object::property(const String & name) const
+Value Object::property(const char *name) const
{
Value result;
ParamSpecPtr param = findProperty(name);
@@ -63,7 +63,7 @@ Value Object::property(const String & name) const
return result;
}
-void Object::setPropertyValue(const String & name, const ValueBase & value)
+void Object::setPropertyValue(const char *name, const ValueBase & value)
{
g_object_set_property(object<GObject>(), name, value);
}
diff --git a/src/QGlib/object.h b/src/QGlib/object.h
index bf1eaab..eb25d3b 100644
--- a/src/QGlib/object.h
+++ b/src/QGlib/object.h
@@ -22,7 +22,6 @@
#include "paramspec.h"
#include "value.h"
#include "type.h"
-#include "string.h"
#include <QtCore/QList>
namespace QGlib {
@@ -31,12 +30,12 @@ class Object : public RefCountedObject
{
QGLIB_WRAPPER(Object)
public:
- ParamSpecPtr findProperty(const String & name) const;
+ ParamSpecPtr findProperty(const char *name) const;
QList<ParamSpecPtr> listProperties() const;
- 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);
+ 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);
protected:
virtual void ref();
@@ -44,7 +43,7 @@ protected:
};
template <class T>
-void Object::setProperty(const String & name, const T & value)
+void Object::setProperty(const char *name, const T & value)
{
ParamSpecPtr param = findProperty(name);
if (param) {
diff --git a/src/QGlib/paramspec.cpp b/src/QGlib/paramspec.cpp
index cf0f1bb..54d8e1c 100644
--- a/src/QGlib/paramspec.cpp
+++ b/src/QGlib/paramspec.cpp
@@ -21,19 +21,19 @@
namespace QGlib {
-String ParamSpec::name() const
+QString ParamSpec::name() const
{
- return String(g_param_spec_get_name(object<GParamSpec>()));
+ return QString::fromUtf8(g_param_spec_get_name(object<GParamSpec>()));
}
-String ParamSpec::nick() const
+QString ParamSpec::nick() const
{
- return String(g_param_spec_get_nick(object<GParamSpec>()));
+ return QString::fromUtf8(g_param_spec_get_nick(object<GParamSpec>()));
}
-String ParamSpec::description() const
+QString ParamSpec::description() const
{
- return String(g_param_spec_get_blurb(object<GParamSpec>()));
+ return QString::fromUtf8(g_param_spec_get_blurb(object<GParamSpec>()));
}
ParamSpec::ParamFlags ParamSpec::flags() const
diff --git a/src/QGlib/paramspec.h b/src/QGlib/paramspec.h
index ae8fe3d..9a04f3c 100644
--- a/src/QGlib/paramspec.h
+++ b/src/QGlib/paramspec.h
@@ -21,6 +21,7 @@
#include "refpointer.h"
#include "type.h"
#include "value.h"
+#include <QtCore/QString>
namespace QGlib {
@@ -38,9 +39,9 @@ public:
};
Q_DECLARE_FLAGS(ParamFlags, ParamFlag);
- String name() const;
- String nick() const;
- String description() const;
+ QString name() const;
+ QString nick() const;
+ QString description() const;
ParamFlags flags() const;
Type valueType() const;
diff --git a/src/QGlib/quark.cpp b/src/QGlib/quark.cpp
index 3228073..ad47fb3 100644
--- a/src/QGlib/quark.cpp
+++ b/src/QGlib/quark.cpp
@@ -19,14 +19,19 @@
namespace QGlib {
-Quark::Quark(const String & str)
+Quark::Quark(const char *str)
{
m_quark = g_quark_from_string(str);
}
-String Quark::toString() const
+Quark::Quark(const QString & str)
{
- return String(g_quark_to_string(m_quark));
+ m_quark = g_quark_from_string(str.toUtf8());
+}
+
+QString Quark::toString() const
+{
+ return QString::fromUtf8(g_quark_to_string(m_quark));
}
}
diff --git a/src/QGlib/quark.h b/src/QGlib/quark.h
index 34a726f..2e5049a 100644
--- a/src/QGlib/quark.h
+++ b/src/QGlib/quark.h
@@ -17,7 +17,7 @@
#ifndef QGLIB_QUARK_H
#define QGLIB_QUARK_H
-#include "string.h"
+#include <QtCore/QString>
namespace QGlib {
@@ -25,10 +25,10 @@ class Quark
{
public:
inline Quark(quint32 gquark = 0) : m_quark(gquark) {}
- Quark(const String & str);
-
- String toString() const;
+ Quark(const char *str);
+ Quark(const QString & str);
+ QString toString() const;
inline operator quint32() const { return m_quark; }
private:
diff --git a/src/QGlib/signal.cpp b/src/QGlib/signal.cpp
index d49da11..ae42d0d 100644
--- a/src/QGlib/signal.cpp
+++ b/src/QGlib/signal.cpp
@@ -98,9 +98,9 @@ uint Signal::id() const
return d->id;
}
-String Signal::name() const
+QString Signal::name() const
{
- return d->query()->signal_name;
+ return QString::fromUtf8(d->query()->signal_name);
}
Signal::SignalFlags Signal::flags() const
@@ -128,7 +128,7 @@ QList<Type> Signal::paramTypes() const
}
//static
-Signal Signal::lookup(const String & name, Type type)
+Signal Signal::lookup(const char *name, Type type)
{
return Signal(g_signal_lookup(name, type));
}
@@ -147,11 +147,11 @@ QList<Signal> Signal::listSignals(Type type)
}
//static
-Value Signal::emit(void *instance, const String & detailedSignal, const QList<Value> & args)
+Value Signal::emit(void *instance, const char *detailedSignal, const QList<Value> & args)
{
Value result;
Type itype = Type::fromInstance(instance);
- QStringList signalParts = detailedSignal.toQString().split(QLatin1String("::"));
+ QStringList signalParts = QString::fromUtf8(detailedSignal).split(QLatin1String("::"));
Quark detail;
if (signalParts.size() > 1) {
detail = Quark(signalParts[1]);
@@ -225,7 +225,7 @@ Value Signal::emit(void *instance, const String & detailedSignal, const QList<Va
}
//static
-SignalHandler Signal::connect(void *instance, const String & detailedSignal,
+SignalHandler Signal::connect(void *instance, const char *detailedSignal,
const ClosurePtr & closure, ConnectFlags flags)
{
uint id = g_signal_connect_closure(instance, detailedSignal, closure,
diff --git a/src/QGlib/signal.h b/src/QGlib/signal.h
index 17e063a..a732677 100644
--- a/src/QGlib/signal.h
+++ b/src/QGlib/signal.h
@@ -93,34 +93,34 @@ public:
bool isValid() const;
uint id() const;
- QGlib::String name() const;
+ QString name() const;
SignalFlags flags() const;
Type instanceType() const;
Type returnType() const;
QList<Type> paramTypes() const;
- static Signal lookup(const QGlib::String & name, Type type);
+ static Signal lookup(const char *name, Type type);
static QList<Signal> listSignals(Type type);
#if QGLIB_HAVE_CXX0X
template <typename R, typename... Args>
- static R emit(void *instance, const QGlib::String & detailedSignal, Args&&... args);
+ static R emit(void *instance, const char *detailedSignal, Args&&... args);
template <typename T, typename R, typename... Args>
- static SignalHandler connect(void *instance, const QGlib::String & detailedSignal,
+ static SignalHandler connect(void *instance, const char *detailedSignal,
T *receiver, R (T::*slot)(Args...), ConnectFlags flags = 0);
#else //QGLIB_HAVE_CXX0X
//versions that take no arguments
template <typename R>
- static R emit(void *instance, const QGlib::String & detailedSignal);
+ static R emit(void *instance, const char *detailedSignal);
template <typename T, typename R>
- static SignalHandler connect(void *instance, const QGlib::String & detailedSignal,
+ static SignalHandler connect(void *instance, const char *detailedSignal,
T *receiver, R (T::*slot)(), ConnectFlags flags = 0);
# define QGLIB_SIGNAL_TMPL_PARAMS(n) \
@@ -131,11 +131,11 @@ public:
# define QGLIB_SIGNAL_EMIT_DECLARATION(z, n, data) \
template <typename R, QGLIB_SIGNAL_TMPL_PARAMS(n) > \
- static R emit(void *instance, const QGlib::String & detailedSignal, QGLIB_SIGNAL_TMPL_ARGS(n));
+ static R emit(void *instance, const char *detailedSignal, QGLIB_SIGNAL_TMPL_ARGS(n));
# define QGLIB_SIGNAL_CONNECT_DECLARATION(z, n, data) \
template <typename T, typename R, QGLIB_SIGNAL_TMPL_PARAMS(n) > \
- static SignalHandler connect(void *instance, const QGlib::String & detailedSignal, \
+ static SignalHandler connect(void *instance, const char *detailedSignal, \
T *receiver, R (T::*slot)(QGLIB_SIGNAL_TMPL_ARGS(n)), \
ConnectFlags flags = 0);
@@ -151,9 +151,9 @@ public:
#endif //QGLIB_HAVE_CXX0X
- static Value emit(void *instance, const QGlib::String & detailedSignal, const QList<Value> & args);
+ static Value emit(void *instance, const char *detailedSignal, const QList<Value> & args);
- static SignalHandler connect(void *instance, const QGlib::String & detailedSignal,
+ static SignalHandler connect(void *instance, const char *detailedSignal,
const ClosurePtr & closure, ConnectFlags flags = 0);
private:
diff --git a/src/QGlib/signalimpl_p.h b/src/QGlib/signalimpl_p.h
index bf055a2..d5d40da 100644
--- a/src/QGlib/signalimpl_p.h
+++ b/src/QGlib/signalimpl_p.h
@@ -64,7 +64,7 @@ QList<Value> packArguments(Arg1 && a1, Args&&... args)
template <typename R, typename... Args>
struct EmitImpl<R (Args...)>
{
- static inline R emit(void *instance, const QGlib::String & detailedSignal, Args&&... args)
+ static inline R emit(void *instance, const char *detailedSignal, Args&&... args)
{
Value && returnValue = Signal::emit(instance, detailedSignal, packArguments(args...));
@@ -81,7 +81,7 @@ struct EmitImpl<R (Args...)>
template <typename... Args>
struct EmitImpl<void (Args...)>
{
- static inline void emit(void *instance, const QGlib::String & detailedSignal, Args&&... args)
+ static inline void emit(void *instance, const char *detailedSignal, Args&&... args)
{
Value && returnValue = Signal::emit(instance, detailedSignal, packArguments(args...));
@@ -117,13 +117,13 @@ MemberFunction<T, R, Args...> mem_fn(R (T::*fn)(Args...), T *obj)
} //namespace Private
template <typename R, typename... Args>
-R Signal::emit(void *instance, const QGlib::String & detailedSignal, Args&&... args)
+R Signal::emit(void *instance, const char *detailedSignal, Args&&... args)
{
return QGlib::Private::EmitImpl<R (Args...)>::emit(instance, detailedSignal, args...);
}
template <typename T, typename R, typename... Args>
-SignalHandler Signal::connect(void *instance, const QGlib::String & detailedSignal,
+SignalHandler Signal::connect(void *instance, const char *detailedSignal,
T *receiver, R (T::*slot)(Args...), ConnectFlags flags)
{
typedef QGlib::Private::MemberFunction<T, R, Args...> F;
@@ -191,7 +191,7 @@ template <typename R QGLIB_SIGNAL_IMPL_COMMA
QGLIB_SIGNAL_IMPL_TEMPLATE_PARAMS>
struct EmitImpl<R (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)>
{
- static inline R emit(void *instance, const QGlib::String & detailedSignal
+ static inline R emit(void *instance, const char *detailedSignal
QGLIB_SIGNAL_IMPL_FUNCTION_PARAMS)
{
QList<Value> values;
@@ -211,7 +211,7 @@ struct EmitImpl<R (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)>
template <QGLIB_SIGNAL_IMPL_TEMPLATE_PARAMS>
struct EmitImpl<void (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)>
{
- static inline void emit(void *instance, const QGlib::String & detailedSignal
+ static inline void emit(void *instance, const char *detailedSignal
QGLIB_SIGNAL_IMPL_FUNCTION_PARAMS)
{
QList<Value> values;
@@ -228,7 +228,7 @@ struct EmitImpl<void (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)>
template <typename R QGLIB_SIGNAL_IMPL_COMMA
QGLIB_SIGNAL_IMPL_TEMPLATE_PARAMS>
-R Signal::emit(void *instance, const QGlib::String & detailedSignal QGLIB_SIGNAL_IMPL_FUNCTION_PARAMS)
+R Signal::emit(void *instance, const char *detailedSignal QGLIB_SIGNAL_IMPL_FUNCTION_PARAMS)
{
return QGlib::Private::EmitImpl<R (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)>
::emit(instance, detailedSignal QGLIB_SIGNAL_IMPL_FUNCTION_ARGS);
@@ -236,7 +236,7 @@ R Signal::emit(void *instance, const QGlib::String & detailedSignal QGLIB_SIGNAL
template <typename T, typename R QGLIB_SIGNAL_IMPL_COMMA
QGLIB_SIGNAL_IMPL_TEMPLATE_PARAMS>
-SignalHandler Signal::connect(void *instance, const QGlib::String & detailedSignal,
+SignalHandler Signal::connect(void *instance, const char *detailedSignal,
T *receiver, R (T::*slot)(QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS),
ConnectFlags flags)
{
diff --git a/src/QGlib/string.h b/src/QGlib/string.h
deleted file mode 100644
index e840b3f..0000000
--- a/src/QGlib/string.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- 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(); }
-
- inline bool operator==(const char *other) const { return m_str == other; }
- inline bool operator==(const QByteArray & other) const { return m_str == other; }
- inline bool operator==(const String & other) const { return m_str == other.m_str; }
- inline bool operator==(const QString & other) const { return QString::fromUtf8(m_str) == other; }
-
-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/string.cpp b/src/QGlib/string_p.h
index e1a9d07..08a0094 100644
--- a/src/QGlib/string.cpp
+++ b/src/QGlib/string_p.h
@@ -14,16 +14,21 @@
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/>.
*/
-#include "string.h"
+#include <QtCore/QString>
#include <glib.h>
+/* WARNING: This header should only be included from
+ * QtGstreamer source files and should not be installed */
+
namespace QGlib {
+namespace Private {
-String String::fromGCharPtr(char* s)
+inline QString stringFromGCharPtr(char *s)
{
- String str(s);
+ QString str = QString::fromUtf8(s);
g_free(s);
return str;
}
}
+}
diff --git a/src/QGlib/type.cpp b/src/QGlib/type.cpp
index f6e84bb..87dc65a 100644
--- a/src/QGlib/type.cpp
+++ b/src/QGlib/type.cpp
@@ -15,7 +15,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "type.h"
-#include "string.h"
#include "quark.h"
#include <glib-object.h>
@@ -26,14 +25,14 @@ Type Type::fromInstance(void *instance)
return G_TYPE_FROM_INSTANCE(instance);
}
-Type Type::fromName(const QGlib::String & name)
+Type Type::fromName(const char *name)
{
return g_type_from_name(name);
}
-QGlib::String Type::name() const
+QString Type::name() const
{
- return QGlib::String(g_type_name(m_type));
+ return QString::fromUtf8(g_type_name(m_type));
}
Quark Type::qname() const
diff --git a/src/QGlib/type.h b/src/QGlib/type.h
index 1b0c5df..d4e0f81 100644
--- a/src/QGlib/type.h
+++ b/src/QGlib/type.h
@@ -61,9 +61,9 @@ public:
template<class T>
static Type fromInstance(const RefPointer<T> & instance);
static Type fromInstance(void *nativeInstance);
- static Type fromName(const QGlib::String & name);
+ static Type fromName(const char *name);
- QGlib::String name() const;
+ QString name() const;
Quark qname() const;
bool isAbstract() const;
@@ -180,7 +180,6 @@ QGLIB_REGISTER_NATIVE_TYPE(float, Type::Float)
QGLIB_REGISTER_NATIVE_TYPE(double, Type::Double)
QGLIB_REGISTER_NATIVE_TYPE(void*, Type::Pointer)
QGLIB_REGISTER_NATIVE_TYPE(const char*, Type::String)
-QGLIB_REGISTER_NATIVE_TYPE(QGlib::String, Type::String)
QGLIB_REGISTER_NATIVE_TYPE(QByteArray, Type::String)
QGLIB_REGISTER_NATIVE_TYPE(QString, Type::String)
diff --git a/src/QGlib/value.cpp b/src/QGlib/value.cpp
index 6847db9..f584187 100644
--- a/src/QGlib/value.cpp
+++ b/src/QGlib/value.cpp
@@ -231,7 +231,6 @@ SHORT_VALUEIMPL_IMPLEMENTATION(double, double)
SHORT_VALUEIMPL_IMPLEMENTATION(void*, pointer)
SHORT_VALUEIMPL_IMPLEMENTATION(QGlib::Type, gtype)
SHORT_VALUEIMPL_IMPLEMENTATION(const char*, string)
-SHORT_VALUEIMPL_IMPLEMENTATION(QGlib::String, string)
SHORT_VALUEIMPL_IMPLEMENTATION(QByteArray, string)
QGLIB_REGISTER_VALUEIMPL_IMPLEMENTATION(QString, QString::fromUtf8(g_value_get_string(value)),
diff --git a/src/QGlib/value.h b/src/QGlib/value.h
index 14eadb3..6b6d16d 100644
--- a/src/QGlib/value.h
+++ b/src/QGlib/value.h
@@ -272,7 +272,6 @@ QGLIB_REGISTER_VALUEIMPL(double)
QGLIB_REGISTER_VALUEIMPL(void*)
QGLIB_REGISTER_VALUEIMPL(QGlib::Type)
QGLIB_REGISTER_VALUEIMPL(const char*)
-QGLIB_REGISTER_VALUEIMPL(QGlib::String)
QGLIB_REGISTER_VALUEIMPL(QByteArray)
QGLIB_REGISTER_VALUEIMPL(QString)
diff --git a/src/QGst/bin.cpp b/src/QGst/bin.cpp
index 4579e9b..cd7869e 100644
--- a/src/QGst/bin.cpp
+++ b/src/QGst/bin.cpp
@@ -22,7 +22,7 @@
namespace QGst {
//static
-BinPtr Bin::create(const QGlib::String & name)
+BinPtr Bin::create(const char *name)
{
GstElement *bin = gst_bin_new(name);
gst_object_ref_sink(bin);
@@ -39,7 +39,7 @@ bool Bin::remove(const ElementPtr & element)
return gst_bin_remove(object<GstBin>(), element);
}
-ElementPtr Bin::getElementByName(const QGlib::String & name, RecursionType r) const
+ElementPtr Bin::getElementByName(const char *name, RecursionType r) const
{
GstElement *e = NULL;
switch(r) {
diff --git a/src/QGst/bin.h b/src/QGst/bin.h
index ad7a663..9837198 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 create(const QGlib::String & name = QGlib::String());
+ static BinPtr create(const char *name = NULL);
bool add(const ElementPtr & element);
bool remove(const ElementPtr & element);
@@ -42,7 +42,7 @@ public:
*/
RecurseUp
};
- ElementPtr getElementByName(const QGlib::String & name, RecursionType = RecurseDown) const;
+ ElementPtr getElementByName(const char *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 ca75d63..aa93d48 100644
--- a/src/QGst/caps.cpp
+++ b/src/QGst/caps.cpp
@@ -16,13 +16,14 @@
*/
#include "caps.h"
#include "structure.h"
+#include "../QGlib/string_p.h"
#include <QtCore/QDebug>
#include <gst/gstcaps.h>
namespace QGst {
//static
-CapsPtr Caps::createSimple(const QGlib::String & mediaType)
+CapsPtr Caps::createSimple(const char *mediaType)
{
return CapsPtr::wrap(gst_caps_new_simple(mediaType, NULL), false);
}
@@ -40,14 +41,14 @@ CapsPtr Caps::createEmpty()
}
//static
-CapsPtr Caps::fromString(const QGlib::String & string)
+CapsPtr Caps::fromString(const char *string)
{
return CapsPtr::wrap(gst_caps_from_string(string), false);
}
-QGlib::String Caps::toString() const
+QString Caps::toString() const
{
- return QGlib::String::fromGCharPtr(gst_caps_to_string(object<GstCaps>()));
+ return QGlib::Private::stringFromGCharPtr(gst_caps_to_string(object<GstCaps>()));
}
//static
@@ -71,7 +72,7 @@ void Caps::merge(const CapsPtr & caps2)
gst_caps_merge(object<GstCaps>(), gst_caps_copy(caps2));
}
-void Caps::setValue(const QGlib::String & field, const QGlib::Value & value)
+void Caps::setValue(const char *field, const QGlib::Value & value)
{
gst_caps_set_value(object<GstCaps>(), field, value);
}
diff --git a/src/QGst/caps.h b/src/QGst/caps.h
index e6c2a8b..0da5198 100644
--- a/src/QGst/caps.h
+++ b/src/QGst/caps.h
@@ -21,7 +21,6 @@
#include "../QGlib/value.h"
#include "../QGlib/refpointer.h"
#include "../QGlib/type.h"
-#include "../QGlib/string.h"
namespace QGst {
@@ -29,19 +28,19 @@ class Caps : public QGlib::RefCountedObject
{
QGST_WRAPPER(Caps)
public:
- static CapsPtr createSimple(const QGlib::String & mediaType);
+ static CapsPtr createSimple(const char *mediaType);
static CapsPtr createAny();
static CapsPtr createEmpty();
- static CapsPtr fromString(const QGlib::String & string);
- QGlib::String toString() const;
+ static CapsPtr fromString(const char *string);
+ QString toString() const;
static CapsPtr fromXml(xmlNodePtr node);
xmlNodePtr toXml(xmlNodePtr parent) const;
void append(const CapsPtr & caps2);
void merge(const CapsPtr & caps2);
- void setValue(const QGlib::String & field, const QGlib::Value & value);
+ void setValue(const char *field, const QGlib::Value & value);
bool simplify();
void truncate();
diff --git a/src/QGst/childproxy.cpp b/src/QGst/childproxy.cpp
index dbe0075..6434ae4 100644
--- a/src/QGst/childproxy.cpp
+++ b/src/QGst/childproxy.cpp
@@ -25,7 +25,7 @@ uint ChildProxy::childrenCount() const
return gst_child_proxy_get_children_count(object<GstChildProxy>());
}
-ObjectPtr ChildProxy::childByName(const QGlib::String & name) const
+ObjectPtr ChildProxy::childByName(const char *name) const
{
return ObjectPtr::wrap(gst_child_proxy_get_child_by_name(object<GstChildProxy>(), name), false);
}
@@ -35,7 +35,7 @@ ObjectPtr ChildProxy::childByIndex(uint index) const
return ObjectPtr::wrap(gst_child_proxy_get_child_by_index(object<GstChildProxy>(), index), false);
}
-bool ChildProxy::findChildProperty(const QGlib::String & name, ObjectPtr *obj, QGlib::ParamSpecPtr *paramSpec) const
+bool ChildProxy::findChildProperty(const char *name, ObjectPtr *obj, QGlib::ParamSpecPtr *paramSpec) const
{
GstObject *op;
GParamSpec *pp;
@@ -47,12 +47,12 @@ bool ChildProxy::findChildProperty(const QGlib::String & name, ObjectPtr *obj, Q
return result;
}
-QGlib::Value ChildProxy::childProperty(const QGlib::String & name) const
+QGlib::Value ChildProxy::childProperty(const char *name) const
{
QGlib::ParamSpecPtr param;
ObjectPtr object;
if (findChildProperty(name, &object, &param)) {
- return object->property(param->name());
+ return object->property(param->name().toUtf8());
} else {
return QGlib::Value();
}
diff --git a/src/QGst/childproxy.h b/src/QGst/childproxy.h
index ddf5a38..cbf8a49 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 QGlib::String & name) const;
+ ObjectPtr childByName(const char *name) const;
ObjectPtr childByIndex(uint index) const;
- 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);
+ bool findChildProperty(const char *name, ObjectPtr *object, QGlib::ParamSpecPtr *paramSpec) const;
+ QGlib::Value childProperty(const char *name) const;
+ template <typename T> void setChildProperty(const char *name, const T & value);
};
template <typename T>
-void ChildProxy::setChildProperty(const QGlib::String & name, const T & value)
+void ChildProxy::setChildProperty(const char *name, const T & value)
{
QGlib::ParamSpecPtr param;
ObjectPtr object;
diff --git a/src/QGst/element.cpp b/src/QGst/element.cpp
index b2a36db..f157d36 100644
--- a/src/QGst/element.cpp
+++ b/src/QGst/element.cpp
@@ -61,13 +61,13 @@ bool Element::addPad(const PadPtr & pad)
return gst_element_add_pad(object<GstElement>(), pad);
}
-PadPtr Element::getStaticPad(const QGlib::String & name)
+PadPtr Element::getStaticPad(const char *name)
{
GstPad *pad = gst_element_get_static_pad(object<GstElement>(), name);
return PadPtr::wrap(pad, false);
}
-PadPtr Element::getRequestPad(const QGlib::String & name)
+PadPtr Element::getRequestPad(const char *name)
{
GstPad *pad = gst_element_get_request_pad(object<GstElement>(), name);
return PadPtr::wrap(pad, false);
@@ -78,37 +78,36 @@ void Element::releaseRequestPad(const PadPtr & pad)
gst_element_release_request_pad(object<GstElement>(), pad);
}
-bool Element::link(const QGlib::String & srcPadName, const ElementPtr & dest,
- const QGlib::String& sinkPadName, const CapsPtr & filter)
+bool Element::link(const char *srcPadName, const ElementPtr & dest,
+ const char *sinkPadName, const CapsPtr & filter)
{
return gst_element_link_pads_filtered(object<GstElement>(), srcPadName,
dest, sinkPadName, filter);
}
-bool Element::link(const QGlib::String & srcPadName, const ElementPtr & dest, const CapsPtr & filter)
+bool Element::link(const char *srcPadName, const ElementPtr & dest, const CapsPtr & filter)
{
- return link(srcPadName, dest, QGlib::String(), filter);
+ return link(srcPadName, dest, NULL, filter);
}
-bool Element::link(const ElementPtr & dest, const QGlib::String & sinkPadName, const CapsPtr & filter)
+bool Element::link(const ElementPtr & dest, const char *sinkPadName, const CapsPtr & filter)
{
- return link(QGlib::String(), dest, sinkPadName, filter);
+ return link(NULL, dest, sinkPadName, filter);
}
bool Element::link(const ElementPtr & dest, const CapsPtr & filter)
{
- return link(QGlib::String(), dest, QGlib::String(), filter);
+ return link(NULL, dest, NULL, filter);
}
-void Element::unlink(const QGlib::String & srcPadName, const ElementPtr & dest,
- const QGlib::String & sinkPadName)
+void Element::unlink(const char *srcPadName, const ElementPtr & dest, const char *sinkPadName)
{
gst_element_unlink_pads(object<GstElement>(), srcPadName, dest, sinkPadName);
}
-void Element::unlink(const ElementPtr & dest, const QGlib::String & sinkPadName)
+void Element::unlink(const ElementPtr & dest, const char *sinkPadName)
{
- unlink(QGlib::String(), dest, sinkPadName);
+ unlink(NULL, dest, sinkPadName);
}
}
diff --git a/src/QGst/element.h b/src/QGst/element.h
index e1a897a..4efde17 100644
--- a/src/QGst/element.h
+++ b/src/QGst/element.h
@@ -34,21 +34,21 @@ public:
bool setStateLocked(bool locked); //### is the return value ever needed?
bool addPad(const PadPtr & pad);
- PadPtr getStaticPad(const QGlib::String & name);
- PadPtr getRequestPad(const QGlib::String & name);
+ PadPtr getStaticPad(const char *name);
+ PadPtr getRequestPad(const char *name);
void releaseRequestPad(const PadPtr & pad);
- 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,
+ bool link(const char *srcPadName, const ElementPtr & dest,
+ const char *sinkPadName, const CapsPtr & filter = CapsPtr());
+ bool link(const char *srcPadName, const ElementPtr & dest,
const CapsPtr & filter = CapsPtr());
- bool link(const ElementPtr & dest, const QGlib::String & sinkPadName,
+ bool link(const ElementPtr & dest, const char *sinkPadName,
const CapsPtr & filter = CapsPtr());
bool link(const ElementPtr & dest, const CapsPtr & filter = CapsPtr());
- 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());
+ void unlink(const char *srcPadName, const ElementPtr & dest,
+ const char *sinkPadName = NULL);
+ void unlink(const ElementPtr & dest, const char *sinkPadName = NULL);
};
}
diff --git a/src/QGst/elementfactory.cpp b/src/QGst/elementfactory.cpp
index 80651ac..61ad8a8 100644
--- a/src/QGst/elementfactory.cpp
+++ b/src/QGst/elementfactory.cpp
@@ -23,13 +23,13 @@
namespace QGst {
//static
-ElementFactoryPtr ElementFactory::find(const QGlib::String & factoryName)
+ElementFactoryPtr ElementFactory::find(const char *factoryName)
{
return ElementFactoryPtr::wrap(gst_element_factory_find(factoryName), false);
}
//static
-ElementPtr ElementFactory::make(const QGlib::String & factoryName, const QGlib::String & elementName)
+ElementPtr ElementFactory::make(const char *factoryName, const char *elementName)
{
GstElement *e = gst_element_factory_make(factoryName, elementName);
gst_object_ref_sink(e);
@@ -41,24 +41,24 @@ QGlib::Type ElementFactory::elementType() const
return gst_element_factory_get_element_type(object<GstElementFactory>());
}
-QGlib::String ElementFactory::longName() const
+QString ElementFactory::longName() const
{
- return QGlib::String(gst_element_factory_get_longname(object<GstElementFactory>()));
+ return QString::fromUtf8(gst_element_factory_get_longname(object<GstElementFactory>()));
}
-QGlib::String ElementFactory::klass() const
+QString ElementFactory::klass() const
{
- return QGlib::String(gst_element_factory_get_klass(object<GstElementFactory>()));
+ return QString::fromUtf8(gst_element_factory_get_klass(object<GstElementFactory>()));
}
-QGlib::String ElementFactory::description() const
+QString ElementFactory::description() const
{
- return QGlib::String(gst_element_factory_get_description(object<GstElementFactory>()));
+ return QString::fromUtf8(gst_element_factory_get_description(object<GstElementFactory>()));
}
-QGlib::String ElementFactory::author() const
+QString ElementFactory::author() const
{
- return QGlib::String(gst_element_factory_get_author(object<GstElementFactory>()));
+ return QString::fromUtf8(gst_element_factory_get_author(object<GstElementFactory>()));
}
uint ElementFactory::padTemplatesCount() const
@@ -71,7 +71,7 @@ int ElementFactory::uriType() const
return gst_element_factory_get_uri_type(object<GstElementFactory>());
}
-bool ElementFactory::hasInterface(const QGlib::String & interfaceName) const
+bool ElementFactory::hasInterface(const char *interfaceName) const
{
return gst_element_factory_has_interface(object<GstElementFactory>(), interfaceName);
}
@@ -86,7 +86,7 @@ bool ElementFactory::canSrcCaps(const CapsPtr & caps) const
return gst_element_factory_can_src_caps(object<GstElementFactory>(), caps);
}
-ElementPtr ElementFactory::create(const QGlib::String & elementName) const
+ElementPtr ElementFactory::create(const char *elementName) const
{
GstElement *e = gst_element_factory_create(object<GstElementFactory>(), elementName);
gst_object_ref_sink(e);
diff --git a/src/QGst/elementfactory.h b/src/QGst/elementfactory.h
index 485b123..9859d47 100644
--- a/src/QGst/elementfactory.h
+++ b/src/QGst/elementfactory.h
@@ -25,23 +25,22 @@ class ElementFactory : public PluginFeature
{
QGST_WRAPPER(ElementFactory)
public:
- static ElementFactoryPtr find(const QGlib::String & factoryName);
- static ElementPtr make(const QGlib::String & factoryName,
- const QGlib::String & elementName = QGlib::String());
+ static ElementFactoryPtr find(const char *factoryName);
+ static ElementPtr make(const char *factoryName, const char *elementName = NULL);
QGlib::Type elementType() const;
- QGlib::String longName() const;
- QGlib::String klass() const;
- QGlib::String description() const;
- QGlib::String author() const;
+ QString longName() const;
+ QString klass() const;
+ QString description() const;
+ QString author() const;
uint padTemplatesCount() const;
int uriType() const;
- bool hasInterface(const QGlib::String & interfaceName) const;
+ bool hasInterface(const char *interfaceName) const;
bool canSinkCaps(const CapsPtr & caps) const;
bool canSrcCaps(const CapsPtr & caps) const;
- ElementPtr create(const QGlib::String & elementName) const;
+ ElementPtr create(const char *elementName) const;
};
}
diff --git a/src/QGst/ghostpad.cpp b/src/QGst/ghostpad.cpp
index 89331d1..2ad955a 100644
--- a/src/QGst/ghostpad.cpp
+++ b/src/QGst/ghostpad.cpp
@@ -19,14 +19,14 @@
namespace QGst {
-GhostPadPtr GhostPad::create(const PadPtr & target, const QGlib::String & name)
+GhostPadPtr GhostPad::create(const PadPtr & target, const char *name)
{
GstPad *gp = gst_ghost_pad_new(name, target);
gst_object_ref_sink(gp);
return GhostPadPtr::wrap(GST_GHOST_PAD(gp), false);
}
-GhostPadPtr GhostPad::create(PadDirection direction, const QGlib::String & name)
+GhostPadPtr GhostPad::create(PadDirection direction, const char *name)
{
GstPad *gp = gst_ghost_pad_new_no_target(name, static_cast<GstPadDirection>(direction));
gst_object_ref_sink(gp);
diff --git a/src/QGst/ghostpad.h b/src/QGst/ghostpad.h
index 6a27734..0fc259e 100644
--- a/src/QGst/ghostpad.h
+++ b/src/QGst/ghostpad.h
@@ -25,10 +25,8 @@ class GhostPad : public Pad
{
QGST_WRAPPER(GhostPad)
public:
- static GhostPadPtr create(const PadPtr & target,
- const QGlib::String & name = QGlib::String());
- static GhostPadPtr create(PadDirection direction,
- const QGlib::String & name = QGlib::String());
+ static GhostPadPtr create(const PadPtr & target, const char *name = NULL);
+ static GhostPadPtr create(PadDirection direction, const char *name = NULL);
PadPtr target() const;
bool setTarget(const PadPtr & target);
diff --git a/src/QGst/object.cpp b/src/QGst/object.cpp
index 833f027..ad4ac4f 100644
--- a/src/QGst/object.cpp
+++ b/src/QGst/object.cpp
@@ -15,16 +15,17 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "object.h"
+#include "../QGlib/string_p.h"
#include <gst/gstobject.h>
namespace QGst {
-QGlib::String Object::name() const
+QString Object::name() const
{
- return QGlib::String::fromGCharPtr(gst_object_get_name(object<GstObject>()));
+ return QGlib::Private::stringFromGCharPtr(gst_object_get_name(object<GstObject>()));
}
-bool Object::setName(const QGlib::String & name)
+bool Object::setName(const char *name)
{
return gst_object_set_name(object<GstObject>(), name);
}
@@ -44,12 +45,12 @@ void Object::unparent()
gst_object_unparent(object<GstObject>());
}
-QGlib::String Object::namePrefix() const
+QString Object::namePrefix() const
{
- return QGlib::String::fromGCharPtr(gst_object_get_name_prefix(object<GstObject>()));
+ return QGlib::Private::stringFromGCharPtr(gst_object_get_name_prefix(object<GstObject>()));
}
-void Object::setNamePrefix(const QGlib::String & prefix)
+void Object::setNamePrefix(const char *prefix)
{
gst_object_set_name_prefix(object<GstObject>(), prefix);
}
diff --git a/src/QGst/object.h b/src/QGst/object.h
index e93621e..8ba48b3 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:
- QGlib::String name() const;
- bool setName(const QGlib::String & name);
+ QString name() const;
+ bool setName(const char *name);
ObjectPtr parent() const;
bool setParent(const ObjectPtr & parent);
void unparent();
- QGlib::String namePrefix() const;
- void setNamePrefix(const QGlib::String & prefix);
+ QString namePrefix() const;
+ void setNamePrefix(const char *prefix);
bool isAncestorOf(const ObjectPtr & object) const;
diff --git a/src/QGst/pad.cpp b/src/QGst/pad.cpp
index 0aa3da1..adc168e 100644
--- a/src/QGst/pad.cpp
+++ b/src/QGst/pad.cpp
@@ -24,7 +24,7 @@
namespace QGst {
//static
-PadPtr Pad::create(PadDirection direction, const QGlib::String & name)
+PadPtr Pad::create(PadDirection direction, const char *name)
{
GstPad *pad = gst_pad_new(name, static_cast<GstPadDirection>(direction));
gst_object_ref_sink(pad);
diff --git a/src/QGst/pad.h b/src/QGst/pad.h
index d991798..acf1f92 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 create(PadDirection direction, const QGlib::String & name = QGlib::String());
+ static PadPtr create(PadDirection direction, const char *name = NULL);
PadDirection direction() const;
diff --git a/src/QGst/pipeline.cpp b/src/QGst/pipeline.cpp
index ddef07e..2c8cd2c 100644
--- a/src/QGst/pipeline.cpp
+++ b/src/QGst/pipeline.cpp
@@ -20,7 +20,7 @@
namespace QGst {
//static
-PipelinePtr Pipeline::create(const QGlib::String & name)
+PipelinePtr Pipeline::create(const char *name)
{
GstElement *p = gst_pipeline_new(name);
gst_object_ref_sink(p);
diff --git a/src/QGst/pipeline.h b/src/QGst/pipeline.h
index 570e7f1..0867d32 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 create(const QGlib::String & name = QGlib::String());
+ static PipelinePtr create(const char *name = NULL);
};
}
diff --git a/src/QGst/pluginfeature.cpp b/src/QGst/pluginfeature.cpp
index a287e9a..586f527 100644
--- a/src/QGst/pluginfeature.cpp
+++ b/src/QGst/pluginfeature.cpp
@@ -29,12 +29,12 @@ void PluginFeature::setRank(uint rank)
gst_plugin_feature_set_rank(object<GstPluginFeature>(), rank);
}
-QGlib::String PluginFeature::name() const
+QString PluginFeature::name() const
{
- return QGlib::String(gst_plugin_feature_get_name(object<GstPluginFeature>()));
+ return QString::fromUtf8(gst_plugin_feature_get_name(object<GstPluginFeature>()));
}
-void PluginFeature::setName(const QGlib::String & name)
+void PluginFeature::setName(const char *name)
{
gst_plugin_feature_set_name(object<GstPluginFeature>(), name);
}
diff --git a/src/QGst/pluginfeature.h b/src/QGst/pluginfeature.h
index 1b97046..3a797c3 100644
--- a/src/QGst/pluginfeature.h
+++ b/src/QGst/pluginfeature.h
@@ -28,8 +28,8 @@ public:
uint rank() const;
void setRank(uint rank);
- QGlib::String name() const;
- void setName(const QGlib::String & name);
+ QString name() const;
+ void setName(const char *name);
bool checkVersion(uint major, uint minor, uint micro) const;
diff --git a/src/QGst/structure.cpp b/src/QGst/structure.cpp
index 49fa3fc..1f94f25 100644
--- a/src/QGst/structure.cpp
+++ b/src/QGst/structure.cpp
@@ -15,6 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "structure.h"
+#include "../QGlib/string_p.h"
#include <gst/gststructure.h>
#include <QtCore/QDebug>
@@ -36,25 +37,25 @@ bool StructureBase::isValid() const
return m_structure != NULL;
}
-QGlib::String StructureBase::name() const
+QString StructureBase::name() const
{
Q_ASSERT(isValid());
- return QGlib::String(gst_structure_get_name(m_structure));
+ return QString::fromUtf8(gst_structure_get_name(m_structure));
}
-void StructureBase::setName(const QGlib::String & name)
+void StructureBase::setName(const char *name)
{
Q_ASSERT(isValid());
gst_structure_set_name(m_structure, name);
}
-QGlib::Value StructureBase::value(const QGlib::String & fieldName) const
+QGlib::Value StructureBase::value(const char *fieldName) const
{
Q_ASSERT(isValid());
return QGlib::Value(*gst_structure_get_value(m_structure, fieldName));
}
-void StructureBase::setValue(const QGlib::String & fieldName, const QGlib::Value & value)
+void StructureBase::setValue(const char *fieldName, const QGlib::Value & value)
{
Q_ASSERT(isValid());
gst_structure_set_value(m_structure, fieldName, value);
@@ -66,31 +67,31 @@ unsigned int StructureBase::numberOfFields() const
return gst_structure_n_fields(m_structure);
}
-QGlib::String StructureBase::fieldName(unsigned int fieldNumber)
+QString StructureBase::fieldName(unsigned int fieldNumber)
{
Q_ASSERT(isValid());
- return QGlib::String(gst_structure_nth_field_name(m_structure, fieldNumber));
+ return QString::fromUtf8(gst_structure_nth_field_name(m_structure, fieldNumber));
}
-QGlib::Type StructureBase::fieldType(const QGlib::String& fieldName) const
+QGlib::Type StructureBase::fieldType(const char *fieldName) const
{
Q_ASSERT(isValid());
return gst_structure_get_field_type(m_structure, fieldName);
}
-bool StructureBase::hasField(const QGlib::String& fieldName) const
+bool StructureBase::hasField(const char *fieldName) const
{
Q_ASSERT(isValid());
return gst_structure_has_field(m_structure, fieldName);
}
-bool StructureBase::hasFieldTyped(const QGlib::String& fieldName, QGlib::Type type) const
+bool StructureBase::hasFieldTyped(const char *fieldName, QGlib::Type type) const
{
Q_ASSERT(isValid());
return gst_structure_has_field_typed(m_structure, fieldName, type);
}
-void StructureBase::removeField(const QGlib::String& fieldName)
+void StructureBase::removeField(const char *fieldName)
{
Q_ASSERT(isValid());
return gst_structure_remove_field(m_structure, fieldName);
@@ -102,17 +103,17 @@ void StructureBase::removeAllFields()
return gst_structure_remove_all_fields(m_structure);
}
-QGlib::String StructureBase::toString() const
+QString StructureBase::toString() const
{
Q_ASSERT(isValid());
- return QGlib::String::fromGCharPtr(gst_structure_to_string(m_structure));
+ return QGlib::Private::stringFromGCharPtr(gst_structure_to_string(m_structure));
}
//END StructureBase
//BEGIN Structure
-Structure::Structure(const QGlib::String & name)
+Structure::Structure(const char *name)
: StructureBase(gst_structure_empty_new(name))
{
}
@@ -152,7 +153,7 @@ Structure & Structure::operator=(const Structure & other)
return *this;
}
-Structure Structure::fromString(const QGlib::String& str)
+Structure Structure::fromString(const char *str)
{
Structure s(SharedStructure(NULL));
s.m_structure = gst_structure_from_string(str, NULL);
diff --git a/src/QGst/structure.h b/src/QGst/structure.h
index 730d56b..8db9e0c 100644
--- a/src/QGst/structure.h
+++ b/src/QGst/structure.h
@@ -19,8 +19,8 @@
#include "global.h"
#include "../QGlib/type.h"
-#include "../QGlib/string.h"
#include "../QGlib/value.h"
+#include <QtCore/QString>
namespace QGst {
@@ -29,22 +29,22 @@ class StructureBase
public:
bool isValid() const;
- QGlib::String name() const;
- void setName(const QGlib::String & name);
+ QString name() const;
+ void setName(const char *name);
- QGlib::Value value(const QGlib::String & fieldName) const;
- void setValue(const QGlib::String & fieldName, const QGlib::Value & value);
+ QGlib::Value value(const char *fieldName) const;
+ void setValue(const char *fieldName, const QGlib::Value & value);
unsigned int numberOfFields() const;
- 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?
+ QString fieldName(unsigned int fieldNumber);
+ QGlib::Type fieldType(const char *fieldName) const;
+ bool hasField(const char *fieldName) const;
+ bool hasFieldTyped(const char *fieldName, QGlib::Type type) const; //FIXME better name?
- void removeField(const QGlib::String & fieldName);
+ void removeField(const char *fieldName);
void removeAllFields();
- QGlib::String toString() const; //FIXME maybe call it serialize()?
+ QString toString() const; //FIXME maybe call it serialize()?
inline operator GstStructure*() { return m_structure; }
inline operator const GstStructure*() const { return m_structure; }
@@ -64,7 +64,7 @@ class SharedStructure;
class Structure : public StructureBase
{
public:
- Structure(const QGlib::String & name);
+ Structure(const char *name);
Structure(const SharedStructure & other);
Structure(const Structure & other);
virtual ~Structure();
@@ -72,7 +72,7 @@ public:
Structure & operator=(const SharedStructure & other);
Structure & operator=(const Structure & other);
- static Structure fromString(const QGlib::String & str);
+ static Structure fromString(const char *str);
};
class SharedStructure : public StructureBase
diff --git a/tests/childproxytest.cpp b/tests/childproxytest.cpp
index 6bb1910..75d8512 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(), QGlib::String("mytee"));
+ QCOMPARE(tee2->name(), QString("mytee"));
}
{
QGst::ElementPtr tee2 = bin->childByName("mytee").dynamicCast<QGst::Element>();
QVERIFY(!tee2.isNull());
- QCOMPARE(tee2->name(), QGlib::String("mytee"));
+ QCOMPARE(tee2->name(), QString("mytee"));
}
}
@@ -81,8 +81,8 @@ void ChildProxyTest::propertiesTest()
QCOMPARE(bin->findChildProperty("mytee::has-chain", &obj, &param), true);
QVERIFY(!obj.isNull());
QVERIFY(!param.isNull());
- QCOMPARE(obj->name(), QGlib::String("mytee"));
- QCOMPARE(param->name(), QGlib::String("has-chain"));
+ QCOMPARE(obj->name(), QString("mytee"));
+ QCOMPARE(param->name(), QString("has-chain"));
}
{
diff --git a/tests/signalstest.cpp b/tests/signalstest.cpp
index 96391e7..001872f 100644
--- a/tests/signalstest.cpp
+++ b/tests/signalstest.cpp
@@ -58,7 +58,7 @@ void SignalsTest::queryTest()
QGlib::Signal s = QGlib::Signal::lookup("notify", QGlib::GetType<QGlib::Object>());
QVERIFY(s.isValid());
- QCOMPARE(s.name(), QGlib::String("notify"));
+ QCOMPARE(s.name(), QString("notify"));
QCOMPARE(s.instanceType(), QGlib::GetType<QGlib::Object>());
QCOMPARE(s.flags(), QGlib::Signal::RunFirst | QGlib::Signal::NoRecurse |
@@ -73,8 +73,8 @@ void SignalsTest::queryTest()
void SignalsTest::emitTestClosure(const QGlib::ObjectPtr & instance, const QGlib::ParamSpecPtr & param)
{
qDebug() << "emitTestClosure called";
- QCOMPARE(instance->property("name").get<QGlib::String>(), QGlib::String("mybin"));
- QCOMPARE(param->name(), QGlib::String("name"));
+ QCOMPARE(instance->property("name").get<QString>(), QString("mybin"));
+ QCOMPARE(param->name(), QString("name"));
closureCalled = true;
}
diff --git a/tests/structuretest.cpp b/tests/structuretest.cpp
index 2f85a95..6d77a5f 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(), QGlib::String("mystructure"));
+ QCOMPARE(s.name(), QString("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), QGlib::String("intfield"));
+ QCOMPARE(s.fieldName(0), QString("intfield"));
QCOMPARE(s.value("intfield").get<int>(), 20);
QCOMPARE(s.fieldType("intfield"), QGlib::Type(QGlib::Type::Int));
- s.setValue("strfield", QGlib::String("hello world"));
+ s.setValue("strfield", QString("hello world"));
QCOMPARE(s.numberOfFields(), static_cast<unsigned int>(2));
qDebug() << s;