diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-04 05:50:05 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-04 05:50:05 (GMT) |
commit | 9cfd793625e6582d2fe3eaff7d5dfac3a3fcdff6 (patch) | |
tree | 8f44e4adbf0de9308669820b80697e7ed372608d /examples/script/customclass/bytearrayclass.cpp | |
parent | 48ea5a5c74620f9811debc6bf1e49bf095d30722 (diff) | |
parent | 0ced984d3e2cb2a7a1a219ae7a9b09ff4e15a55c (diff) | |
download | Qt-9cfd793625e6582d2fe3eaff7d5dfac3a3fcdff6.zip Qt-9cfd793625e6582d2fe3eaff7d5dfac3a3fcdff6.tar.gz Qt-9cfd793625e6582d2fe3eaff7d5dfac3a3fcdff6.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples/script/customclass/bytearrayclass.cpp')
-rw-r--r-- | examples/script/customclass/bytearrayclass.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp index 7291b97..bce69e4 100644 --- a/examples/script/customclass/bytearrayclass.cpp +++ b/examples/script/customclass/bytearrayclass.cpp @@ -72,18 +72,6 @@ private: int m_last; }; -static qint32 toArrayIndex(const QString &str) -{ - QByteArray bytes = str.toUtf8(); - char *eptr; - quint32 pos = strtoul(bytes.constData(), &eptr, 10); - if ((eptr == bytes.constData() + bytes.size()) - && (QByteArray::number(pos) == bytes)) { - return pos; - } - return -1; -} - //! [0] ByteArrayClass::ByteArrayClass(QScriptEngine *engine) : QObject(engine), QScriptClass(engine) @@ -120,8 +108,9 @@ QScriptClass::QueryFlags ByteArrayClass::queryProperty(const QScriptValue &objec if (name == length) { return flags; } else { - qint32 pos = toArrayIndex(name); - if (pos == -1) + bool isArrayIndex; + qint32 pos = name.toArrayIndex(&isArrayIndex); + if (!isArrayIndex) return 0; *id = pos; if ((flags & HandlesReadAccess) && (pos >= ba->size())) |