本文整理汇总了C++中QScriptValueImpl::member方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptValueImpl::member方法的具体用法?C++ QScriptValueImpl::member怎么用?C++ QScriptValueImpl::member使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptValueImpl
的用法示例。
在下文中一共展示了QScriptValueImpl::member方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasPrevious
bool QScriptValueIteratorImpl::hasPrevious()
{
if (m_foundMember.isValid() && !m_foundForward) {
// we have the information about the previous element already
return true;
}
QScriptValueImpl obj = m_object;
if (m_searchClassDataIterator) {
Q_ASSERT(m_classDataIterator != 0);
if (m_foundMember.isValid()) {
// undo effect of hasNext()
m_foundMember.invalidate();
QScript::Member dummy;
m_classDataIterator->previous(&dummy);
}
while (m_classDataIterator->hasPrevious()) {
QScript::Member m;
m_classDataIterator->previous(&m);
if (acceptsMember(obj, m)) {
m_foundObject = obj;
m_foundMember = m;
m_foundForward = false;
return true;
}
}
m_searchClassDataIterator = false;
m_searchIndex = obj.memberCount();
m_foundMember.invalidate();
}
// search object members
int i = m_searchIndex - 1;
if (m_foundMember.isValid()) {
// undo effect of hasPrevious()
m_foundMember.invalidate();
--i;
}
for ( ; i >= 0; --i) {
QScript::Member m;
obj.member(i, &m);
if (acceptsMember(obj, m)) {
m_foundObject = obj;
m_foundMember = m;
m_foundForward = false;
m_searchIndex = i;
return true;
}
}
return false;
}
示例2: hasPrevious
/*!
Returns true if there is at least one item behind the iterator
(i.e. the iterator is \e not at the front of the property sequence);
otherwise returns false.
\sa previous(), hasNext()
*/
bool QScriptValueIterator::hasPrevious() const
{
Q_D(const QScriptValueIterator);
if ((d->nextIndex != -1) && !d->forward)
return true;
if (!d->object.isObject())
return false;
QScriptValueImpl v = QScriptValuePrivate::valueOf(d->object);
int i = d->index;
if ((i != -1) && d->forward)
++i;
bool found = false;
while (! found && --i >= 0) {
QScript::Member member;
v.member(i, &member);
found = member.isValid();
if (found) {
QScriptValueImpl vv;
v.get(member, &vv);
found = vv.isValid();
}
}
QScriptValueIteratorPrivate *that;
that = const_cast<QScriptValueIteratorPrivate*>(d);
if (found) {
that->forward = false;
that->nextIndex = i;
return true;
} else {
that->nextIndex = -1;
return false;
}
}
示例3: hasNext
/*!
Returns true if there is at least one item ahead of the iterator
(i.e. the iterator is \e not at the back of the property sequence);
otherwise returns false.
\sa next(), hasPrevious()
*/
bool QScriptValueIterator::hasNext() const
{
Q_D(const QScriptValueIterator);
if ((d->nextIndex != -1) && d->forward)
return true;
if (!d->object.isObject())
return false;
QScriptValueImpl v = QScriptValuePrivate::valueOf(d->object);
int i = d->index;
if ((i != -1) && !d->forward)
--i;
int count = v.memberCount();
bool found = false;
while (! found && ++i < count) {
QScript::Member member;
v.member(i, &member);
found = member.isValid();
if (found && (member.isObjectProperty() || v.isArray())) {
QScriptValueImpl vv;
v.get(member, &vv);
found = vv.isValid();
}
}
QScriptValueIteratorPrivate *that;
that = const_cast<QScriptValueIteratorPrivate*>(d);
if (found) {
that->forward = true;
that->nextIndex = i;
return true;
} else {
that->nextIndex = -1;
return false;
}
}
示例4: hasNext
bool QScriptValueIteratorImpl::hasNext()
{
if (m_foundMember.isValid() && m_foundForward) {
// we have the information about the next element already
return true;
}
int idx, count;
QScriptValueImpl obj = m_object;
if (m_searchClassDataIterator) {
Q_ASSERT(m_classDataIterator != 0);
if (m_foundMember.isValid()) {
// undo effect of hasPrevious()
m_foundMember.invalidate();
QScript::Member dummy;
m_classDataIterator->next(&dummy);
}
goto LSearchClassData;
}
idx = m_searchIndex;
if (m_foundMember.isValid()) {
// undo effect of hasPrevious()
m_foundMember.invalidate();
++idx;
}
LSearchObjectData:
count = obj.memberCount();
for (int i = idx; i < count; ++i) {
QScript::Member m;
obj.member(i, &m);
if (acceptsMember(obj, m)) {
m_foundObject = obj;
m_foundMember = m;
m_foundForward = true;
m_searchIndex = i + 1;
return true;
}
}
if (!m_classDataIterator) {
QScriptClassData *data = obj.classInfo()->data();
if (!data)
goto LNext;
m_classDataIterator = data->newIterator(obj);
if (!m_classDataIterator)
goto LNext;
}
m_searchClassDataIterator = true;
LSearchClassData:
Q_ASSERT(m_classDataIterator != 0);
while (m_classDataIterator->hasNext()) {
QScript::Member m;
m_classDataIterator->next(&m);
if (acceptsMember(obj, m)) {
m_foundObject = obj;
m_foundMember = m;
m_foundForward = true;
return true;
}
}
LNext:
if (!m_enumerateProto || !obj.prototype().isObject())
return false;
// look in prototype
obj = obj.prototype();
idx = 0;
if (m_classDataIterator) {
delete m_classDataIterator;
m_classDataIterator = 0;
m_searchClassDataIterator = false;
}
goto LSearchObjectData;
}