Small optimizations on libpyside.
This commit is contained in:
parent
af629d13fc
commit
be2e9569dd
3 changed files with 21 additions and 33 deletions
|
|
@ -100,11 +100,11 @@ static int registerString(const QByteArray& s, QList<QByteArray>* strings)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
QList<QByteArray>::const_iterator it = strings->begin();
|
QList<QByteArray>::const_iterator it = strings->begin();
|
||||||
QList<QByteArray>::const_iterator it_end = strings->end();
|
QList<QByteArray>::const_iterator itEnd = strings->end();
|
||||||
while(it != it_end) {
|
while (it != itEnd) {
|
||||||
if (strcmp(*it, s) == 0)
|
if (strcmp(*it, s) == 0)
|
||||||
return idx;
|
return idx;
|
||||||
idx += (*it).size() + 1;
|
idx += it->size() + 1;
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
strings->append(s);
|
strings->append(s);
|
||||||
|
|
@ -209,8 +209,10 @@ MethodData::MethodData()
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodData::MethodData(QMetaMethod::MethodType mtype, const char* signature, const char* type)
|
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()
|
void MethodData::clear()
|
||||||
|
|
@ -219,23 +221,6 @@ void MethodData::clear()
|
||||||
m_type.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
|
bool MethodData::isValid() const
|
||||||
{
|
{
|
||||||
return m_signature.size();
|
return m_signature.size();
|
||||||
|
|
@ -267,11 +252,6 @@ bool PropertyData::isValid() const
|
||||||
return !m_name.isEmpty();
|
return !m_name.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray PropertyData::name() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
int PropertyData::notifyId() const
|
int PropertyData::notifyId() const
|
||||||
{
|
{
|
||||||
return m_notifyId;
|
return m_notifyId;
|
||||||
|
|
@ -304,7 +284,7 @@ DynamicQMetaObject::DynamicQMetaObject(PyTypeObject* type, const QMetaObject* ba
|
||||||
parsePythonType(type);
|
parsePythonType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* metaObject)
|
DynamicQMetaObject::DynamicQMetaObject(const char* className, const QMetaObject* metaObject)
|
||||||
: m_d(new DynamicQMetaObjectPrivate)
|
: m_d(new DynamicQMetaObjectPrivate)
|
||||||
{
|
{
|
||||||
d.superdata = metaObject;
|
d.superdata = metaObject;
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ namespace PySide
|
||||||
MethodData(QMetaMethod::MethodType mtype, const char* signature, const char* type = 0);
|
MethodData(QMetaMethod::MethodType mtype, const char* signature, const char* type = 0);
|
||||||
void clear();
|
void clear();
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
QByteArray signature() const;
|
const QByteArray& signature() const { return m_signature; }
|
||||||
QByteArray type() const;
|
const QByteArray& type() const { return m_type; }
|
||||||
QMetaMethod::MethodType methodType() const;
|
QMetaMethod::MethodType methodType() const;
|
||||||
bool operator==(const MethodData& other) const;
|
bool operator==(const MethodData& other) const;
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ namespace PySide
|
||||||
public:
|
public:
|
||||||
PropertyData();
|
PropertyData();
|
||||||
PropertyData(const char* name, int notifyId=0, PySideProperty* data = 0);
|
PropertyData(const char* name, int notifyId=0, PySideProperty* data = 0);
|
||||||
QByteArray name() const;
|
const QByteArray& name() const { return m_name; }
|
||||||
QByteArray type() const;
|
QByteArray type() const;
|
||||||
uint flags() const;
|
uint flags() const;
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
@ -73,6 +73,12 @@ namespace PySide
|
||||||
int m_notifyId;
|
int m_notifyId;
|
||||||
PySideProperty* m_data;
|
PySideProperty* m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool MethodData::operator==(const MethodData& other) const
|
||||||
|
{
|
||||||
|
return m_mtype == other.methodType() && m_signature == other.signature();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -536,9 +536,11 @@ char* getTypeName(PyObject* type)
|
||||||
|
|
||||||
char* buildSignature(const char *name, const char *signature)
|
char* buildSignature(const char *name, const char *signature)
|
||||||
{
|
{
|
||||||
QString signal;
|
QByteArray signal(name);
|
||||||
signal.sprintf("%s(%s)", name, signature);
|
signal += '(';
|
||||||
return strdup(QMetaObject::normalizedSignature(signal.toAscii()));
|
signal += signature;
|
||||||
|
signal += ')';
|
||||||
|
return strdup(QMetaObject::normalizedSignature(signal));
|
||||||
}
|
}
|
||||||
|
|
||||||
char* parseSignature(PyObject *args)
|
char* parseSignature(PyObject *args)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue