本文整理汇总了C++中QScriptObject::memberCount方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptObject::memberCount方法的具体用法?C++ QScriptObject::memberCount怎么用?C++ QScriptObject::memberCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptObject
的用法示例。
在下文中一共展示了QScriptObject::memberCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setValue
void QScriptValueIteratorImpl::setValue(const QScriptValueImpl &value)
{
if (!m_member.isValid())
return;
if (m_member.isGetterOrSetter()) {
// find and call the setter
QScriptValueImpl setter;
if (m_member.isObjectProperty() && !m_member.isSetter()) {
QScript::Member mb;
QScriptObject *obj = m_object.m_object_value;
mb.object(m_member.nameId(), obj->memberCount(), 0);
if (!obj->findSetter(&mb))
return;
m_object.get(mb, &setter);
} else {
m_object.get(m_member, &setter);
}
setter.call(m_object, QScriptValueImplList() << value);
} else {
m_object.put(m_member, value);
}
}
示例2: value
QScriptValueImpl QScriptValueIteratorImpl::value() const
{
if (!m_member.isValid())
return QScriptValueImpl();
QScriptValueImpl result;
m_object.get(m_member, &result);
if (m_member.isGetterOrSetter()) {
// find and call the getter
QScriptValueImpl getter;
if (m_member.isObjectProperty() && !m_member.isGetter()) {
QScript::Member mb;
QScriptObject *obj = m_object.m_object_value;
mb.object(m_member.nameId(), obj->memberCount(), 0);
if (!obj->findGetter(&mb))
return QScriptValueImpl();
m_object.get(mb, &getter);
} else {
getter = result;
}
result = getter.call(m_object);
}
return result;
}
示例3: switch
QDebug &operator<<(QDebug &d, const QScriptValueImpl &object)
{
d.nospace() << "QScriptValue(";
switch (object.type()) {
case QScript::InvalidType:
d.nospace() << "Invalid)";
return d;
case QScript::BooleanType:
d.nospace() << "bool=" << object.toBoolean();
break;
case QScript::IntegerType:
d.nospace() << "int=" << object.toInt32();
break;
case QScript::NumberType:
d.nospace() << "qsreal=" << object.toNumber();
break;
case QScript::LazyStringType:
case QScript::StringType:
d.nospace() << "string=" << object.toString();
break;
case QScript::ReferenceType:
d.nospace() << "reference";
break;
case QScript::NullType:
d.nospace() << "null";
break;
case QScript::UndefinedType:
d.nospace() << "undefined";
break;
case QScript::PointerType:
d.nospace() << "pointer";
break;
case QScript::ObjectType:
d.nospace() << object.classInfo()->name() << ",{";
QScriptObject *od = object.objectValue();
for (int i=0; i<od->memberCount(); ++i) {
if (i != 0)
d << ",";
QScript::Member m;
od->member(i, &m);
if (m.isValid() && m.isObjectProperty()) {
d << object.engine()->toString(m.nameId());
QScriptValueImpl o;
od->get(m, &o);
d.nospace() << QLatin1String(":")
<< (o.classInfo()
? o.classInfo()->name()
: QLatin1String("?"));
}
}
d.nospace() << "} scope={";
QScriptValueImpl scope = object.scope();
while (scope.isValid()) {
Q_ASSERT(scope.isObject());
d.nospace() << " " << scope.objectValue();
scope = scope.scope();
}
d.nospace() << "}";
break;
}
d << ")";
return d;
}