本文整理汇总了C++中QSMember::index方法的典型用法代码示例。如果您正苦于以下问题:C++ QSMember::index方法的具体用法?C++ QSMember::index怎么用?C++ QSMember::index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSMember
的用法示例。
在下文中一共展示了QSMember::index方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
示例2: 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);
}
}
示例3: check
void QSVarBindingNode::check( QSCheckData *c )
{
var->check( c );
if ( assign )
assign->check( c );
if (!c->directLookupEnabled()) {
c->addError( this, QString::fromLatin1( "QSA does not support declaring variables inside "
"a 'with' block" ));
return;
}
int attrs = c->lastAttributes();
QSClass * cl = c->currentScope();
QSMember m;
if ( cl->member( 0, var->identifier(), &m ) ) {
if( cl->asClass() ) {
c->addError( this, QString::fromLatin1( "Variable '%1' has already been "
"declared in class '%2'" )
.arg( var->identifier() )
.arg( cl->identifier() ) );
return;
}
m = QSMember( QSMember::Variable, 0, attrs );
cl->replaceMember( var->identifier(), &m );
idx = m.index();
} else {
idx = cl->addVariableMember( var->identifier(), attrs );
}
// store pointer to init node if this is a class member
QSClassClass *clcl = cl->asClass();
if ( clcl ) {
if( attrs & AttributeStatic )
clcl->addStaticInitializer( assign );
else
clcl->addMemberInitializer( assign );
idx = -1; // Disable the variable binding node.
}
}
示例4: 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 );
}
}