本文整理汇总了C++中QSMember::type方法的典型用法代码示例。如果您正苦于以下问题:C++ QSMember::type方法的具体用法?C++ QSMember::type怎么用?C++ QSMember::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSMember
的用法示例。
在下文中一共展示了QSMember::type方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
void QSRegExpClass::write(QSObject *objPtr, const QSMember &mem,
const QSObject &val ) const
{
if (mem.type() != QSMember::Custom) {
QSWritableClass::write(objPtr, mem, val);
return;
}
Q_ASSERT(objPtr->objectType() == objPtr->objectType()->env()->regexpClass());
switch (mem.index()) {
case Source:
((QSRegExpShared*)objPtr->shVal())->source = val.toString();
break;
case Global:
((QSRegExpShared*)objPtr->shVal())->global = val.toBoolean();
break;
case IgnoreCase:
{
bool ic = val.toBoolean();
((QSRegExpShared*)objPtr->shVal())->ignoreCase = ic;
((QSRegExpShared*)objPtr->shVal())->reg.setCaseSensitive(!ic);
}
break;
default:
QSWritableClass::write(objPtr, mem, val);
}
}
示例2: write
void QSRectClass::write(QSObject *o, const QSMember &mem,
const QSObject &val) const
{
if (mem.type() == QSMember::Custom) {
int i = val.toInteger();
switch (mem.idx) {
case 0:
case 1:
rect(o)->setX(i);
break;
case 2:
case 3:
rect(o)->setY(i);
break;
case 4:
rect(o)->setWidth(i);
break;
case 5:
rect(o)->setHeight(i);
break;
case 6:
rect(o)->setRight(i);
break;
case 7:
rect(o)->setBottom(i);
break;
case 8:
break;
default:
qFatal("QSRectClass::write: unhandled case");
}
} else {
QSClass::write(o, mem, val);
}
}
示例3: fetchValue
QSObject QSRegExpClass::fetchValue( const QSObject *objPtr,
const QSMember &mem ) const
{
if ( mem.type() != QSMember::Custom )
return QSWritableClass::fetchValue( objPtr, mem );
QRegExp *re = regExp( objPtr );
switch ( mem.index() ) {
case Valid:
return createBoolean( re->isValid() );
case Empty:
return createBoolean( re->isEmpty() );
case MLength:
return createNumber( re->matchedLength() );
case Source:
return createString( source(objPtr) );
case Global:
return createBoolean( isGlobal(objPtr) );
case IgnoreCase:
return createBoolean( isIgnoreCase(objPtr) );
case CTexts: {
QSArray array( env() );
QStringList ct = re->capturedTexts();
QStringList::ConstIterator it = ct.begin();
int i = 0;
for ( ; it != ct.end(); ++it, ++i )
array.put( QString::number( i ), createString( *it ) );
array.put( QString::fromLatin1("length"), createNumber( i ) );
return array;
}
default:
return createUndefined();
}
}
示例4: fetchValue
QSObject QSRectClass::fetchValue(const QSObject *o,
const QSMember &mem) const
{
if (mem.type() == QSMember::Custom) {
switch (mem.idx) {
case 0:
case 1:
return createNumber(rect(o)->x());
case 2:
case 3:
return createNumber(rect(o)->y());
case 4:
return createNumber(rect(o)->width());
case 5:
return createNumber(rect(o)->height());
case 6:
return createNumber(rect(o)->right());
case 7:
return createNumber(rect(o)->bottom());
case 8:
return pointClass()->construct(rect(o)->center());
default:
qFatal("QSRectClass::fetchValue: unhandled case");
return createUndefined();
}
}
return QSClass::fetchValue(o, mem);
}
示例5: deleteProperty
// ECMA 8.6.2.5
bool QSObject::deleteProperty(const QString &p)
{
QSMember mem;
if (!objectType()->member(this, p, &mem) ||
mem.type() == QSMember::Identifier)
return TRUE;
return objectType()->deleteProperty(this, mem);
}
示例6: hasMember
static bool hasMember(QSEnv *env, const QString &function, QSMember::Type type)
{
QSObject o = env->globalObject();
QSMember member;
QStringList names = function.split(QString::fromLatin1("."));
int nameCount = names.count();
for (QStringList::ConstIterator it = names.begin(); it != names.end(); ++it, --nameCount) {
if (nameCount==1) {
if (o.objectType() == env->typeClass())
return QSTypeClass::classValue(&o)->member(0, *it, &member)
&& member.type() == type;
else if (o.objectType()->member(&o, *it, &member))
return o.objectType()->member(0, *it, &member) && member.type() == type;
} else {
o = o.get(*it);
if (!o.isValid())
return false;
}
}
return false;
}
示例7: fetchValue
QSObject QSStringClass::fetchValue( const QSObject *objPtr,
const QSMember &mem ) const
{
if ( mem.type() == QSMember::Custom )
if ( mem.idx == 0 ) {
return createNumber( objPtr->sVal().length() );
} else {
qFatal( "QSStringClass::fetchValue: unhandled member" );
return createUndefined();
}
else
return QSClass::fetchValue( objPtr, mem );
}
示例8: resolveValue
QSObject QSEnv::resolveValue(const QString &ident) const
{
Q_ASSERT(!ident.isEmpty());
ScopeChain::const_iterator it = scopeChain->begin();
QSMember mem;
int offset;
while (it != scopeChain->end() && (*it).isValid()) {
offset = 0;
const QSClass *cl = (*it).resolveMember(ident, &mem, (*it).objectType(), &offset);
if (cl && mem.type() != QSMember::Identifier) {
while (offset--)
it++;
return cl->fetchValue(&(*it), mem);
}
it++;
}
return QSObject();
}
示例9: check
void QSResolveNode::check( QSCheckData *c )
{
if ( !c->directLookupEnabled() )
return;
QSClass * cl = c->currentScope();
QSClass *cont = cl;
int uplvl = 0;
int blocks = 0;
QSMember member;
while ( cont ) {
QSMember mem;
if ( cont->member( 0, ident, &mem ) ) {
if ( mem.type()==QSMember::Variable && !mem.isStatic() ) {
member = mem;
break;
}
}
uplvl++;
cont = cont->enclosingClass();
}
if( member.isDefined() ) {
/* If the containing class has an undefined base, the indexes will be moved
when the we call QSAbstractBaseClass::replace() and the lookup info
will be crap. Therefore, we don't create it. */
QSClass *tmp = cont->base();
while (tmp) {
if (tmp->name() == QString::fromLatin1("AbstractBase"))
return;
tmp = tmp->base();
}
// Due to special handling of block scopes in the global object...
if( cont==c->env()->globalClass() )
uplvl+=blocks;
info = new QSLookupInfo( uplvl, member );
}
}
示例10: fetchValue
QSObject QSPixmapClass::fetchValue( const QSObject *obj,
const QSMember &mem ) const
{
if ( mem.type() == QSMember::Custom ) {
switch ( mem.index() ) {
case Width:
return createNumber( pixmap( obj )->width() );
case Height:
return createNumber( pixmap( obj )->height() );
case Rect:
return rectClass()->construct( pixmap( obj )->rect() );
case Size:
return sizeClass()->construct( pixmap( obj )->size() );
case Depth:
return createNumber( pixmap( obj )->depth() );
default:
qWarning( "QSPixmapClass::fetchValue: unhandled case" );
return createUndefined();
}
} else {
return QSClass::fetchValue( obj, mem );
}
}