本文整理汇总了C++中QSObject::toBoolean方法的典型用法代码示例。如果您正苦于以下问题:C++ QSObject::toBoolean方法的具体用法?C++ QSObject::toBoolean怎么用?C++ QSObject::toBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSObject
的用法示例。
在下文中一共展示了QSObject::toBoolean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: test
QSObject QSRegExpClass::test( QSEnv *env )
{
QSObject obj = env->thisValue();
QRegExp *re = regExp( &obj );
QString s = env->arg( 0 ).toString();
uint length = s.length();
int i = obj.get( QString::fromLatin1("lastIndex") ).toInt32();
QSObject tmp = obj.get( QString::fromLatin1("global") );
if ( !tmp.toBoolean() )
i = 0;
if ( i < 0 || i >(int) length ) {
obj.put( QString::fromLatin1("lastIndex"), 0 );
return env->createBoolean( FALSE );
}
i = re->search( s, i );
obj.env()->regexpClass()->lastCaptures = re->capturedTexts();
return env->createBoolean( i >= 0 );
}