summaryrefslogtreecommitdiffstats
path: root/libpyside
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-07-22 16:10:29 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2011-07-25 15:32:42 -0300
commitbe2e9569ddde5f674d562dbd269ffeecb60db652 (patch)
tree58cffea1d8d67f638a2efb50c2403c799fc15666 /libpyside
parentaf629d13fc63808f2f9fcdb64a6f7a6bf24dbc0e (diff)
downloadpyside-be2e9569ddde5f674d562dbd269ffeecb60db652.tar.gz
pyside-be2e9569ddde5f674d562dbd269ffeecb60db652.tar.xz
pyside-be2e9569ddde5f674d562dbd269ffeecb60db652.zip
Small optimizations on libpyside.
Diffstat (limited to 'libpyside')
-rw-r--r--libpyside/dynamicqmetaobject.cpp34
-rw-r--r--libpyside/dynamicqmetaobject_p.h12
-rw-r--r--libpyside/pysidesignal.cpp8
3 files changed, 21 insertions, 33 deletions
diff --git a/libpyside/dynamicqmetaobject.cpp b/libpyside/dynamicqmetaobject.cpp
index cc83007..42447d7 100644
--- a/libpyside/dynamicqmetaobject.cpp
+++ b/libpyside/dynamicqmetaobject.cpp
@@ -100,11 +100,11 @@ static int registerString(const QByteArray& s, QList<QByteArray>* strings)
{
int idx = 0;
QList<QByteArray>::const_iterator it = strings->begin();
- QList<QByteArray>::const_iterator it_end = strings->end();
- while(it != it_end) {
+ QList<QByteArray>::const_iterator itEnd = strings->end();
+ while (it != itEnd) {
if (strcmp(*it, s) == 0)
return idx;
- idx += (*it).size() + 1;
+ idx += it->size() + 1;
++it;
}
strings->append(s);
@@ -209,8 +209,10 @@ MethodData::MethodData()
}
MethodData::MethodData(QMetaMethod::MethodType mtype, const char* signature, const char* type)
- : m_signature(signature), m_type(type), m_mtype(mtype)
+ : m_signature(signature), m_mtype(mtype)
{
+ if (qstrcmp(type, "void"))
+ m_type = type;
}
void MethodData::clear()
@@ -219,23 +221,6 @@ void MethodData::clear()
m_type.clear();
}
-bool MethodData::operator==(const MethodData& other) const
-{
- return ((m_signature == other.signature()) && (m_mtype == other.methodType()));
-}
-
-QByteArray MethodData::signature() const
-{
- return m_signature;
-}
-
-QByteArray MethodData::type() const
-{
- if (m_type == "void")
- return QByteArray();
- return m_type;
-}
-
bool MethodData::isValid() const
{
return m_signature.size();
@@ -267,11 +252,6 @@ bool PropertyData::isValid() const
return !m_name.isEmpty();
}
-QByteArray PropertyData::name() const
-{
- return m_name;
-}
-
int PropertyData::notifyId() const
{
return m_notifyId;
@@ -304,7 +284,7 @@ DynamicQMetaObject::DynamicQMetaObject(PyTypeObject* type, const QMetaObject* ba
parsePythonType(type);
}
-DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* metaObject)
+DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* metaObject)
: m_d(new DynamicQMetaObjectPrivate)
{
d.superdata = metaObject;
diff --git a/libpyside/dynamicqmetaobject_p.h b/libpyside/dynamicqmetaobject_p.h
index d8a2b6f..a4a17a1 100644
--- a/libpyside/dynamicqmetaobject_p.h
+++ b/libpyside/dynamicqmetaobject_p.h
@@ -43,8 +43,8 @@ namespace PySide
MethodData(QMetaMethod::MethodType mtype, const char* signature, const char* type = 0);
void clear();
bool isValid() const;
- QByteArray signature() const;
- QByteArray type() const;
+ const QByteArray& signature() const { return m_signature; }
+ const QByteArray& type() const { return m_type; }
QMetaMethod::MethodType methodType() const;
bool operator==(const MethodData& other) const;
@@ -60,7 +60,7 @@ namespace PySide
public:
PropertyData();
PropertyData(const char* name, int notifyId=0, PySideProperty* data = 0);
- QByteArray name() const;
+ const QByteArray& name() const { return m_name; }
QByteArray type() const;
uint flags() const;
bool isValid() const;
@@ -73,6 +73,12 @@ namespace PySide
int m_notifyId;
PySideProperty* m_data;
};
+
+inline bool MethodData::operator==(const MethodData& other) const
+{
+ return m_mtype == other.methodType() && m_signature == other.signature();
+}
+
}
#endif
diff --git a/libpyside/pysidesignal.cpp b/libpyside/pysidesignal.cpp
index 1bdaa73..018e826 100644
--- a/libpyside/pysidesignal.cpp
+++ b/libpyside/pysidesignal.cpp
@@ -536,9 +536,11 @@ char* getTypeName(PyObject* type)
char* buildSignature(const char *name, const char *signature)
{
- QString signal;
- signal.sprintf("%s(%s)", name, signature);
- return strdup(QMetaObject::normalizedSignature(signal.toAscii()));
+ QByteArray signal(name);
+ signal += '(';
+ signal += signature;
+ signal += ')';
+ return strdup(QMetaObject::normalizedSignature(signal));
}
char* parseSignature(PyObject *args)