本文整理汇总了C++中QSObject::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ QSObject::toString方法的具体用法?C++ QSObject::toString怎么用?C++ QSObject::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSObject
的用法示例。
在下文中一共展示了QSObject::toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: isEqual
QSEqualsResult QSStringClass::isEqual( const QSObject &a, const QSObject &b ) const
{
Q_ASSERT( a.isA( this ) );
if ( b.isString() )
return (QSEqualsResult) (a.sVal() == b.sVal() || (a.sVal().isEmpty() && b.sVal().isEmpty()));
else if ( b.isNumber() )
return ( QSEqualsResult ) ( a.sVal() == b.toString() );
else if ( !b.isPrimitive() )
return isEqual( a, b.toPrimitive() );
else
return EqualsUndefined;
}
示例3: qsEval
// eval()
static QSObject qsEval( QSEnv *env )
{
QSObject x = env->arg( 0 );
if ( !x.isString() ) {
return x;
} else {
QSEngineImp *eimp = env->engine()->imp();
QString s = x.toString();
QSNode *progNode = 0;
{ // begin mutext locker
QMutexLocker locker(qsa_lexer_mutex());
QSLexer::lexer()->setCode( s,
#ifdef QSDEBUGGER
eimp->sourceId()
#else
0
#endif
);
int yp = qsyyparse();
progNode = QSProgramNode::last();
if ( yp || QSLexer::lexer()->lexerState() == QSLexer::Bad ) {
if (!progNode && progNode->deref())
delete progNode;
return env->throwError( SyntaxError );
}
} // end mutext locker
QSCheckData data( env );
QSObject scopeTop = env->currentScope();
postfixAdd( scopeTop.objectType(), &data );
QSEvalScopeClass *cl = new QSEvalScopeClass( env->objectClass() );
data.enterEval( cl );
progNode->check( &data );
if ( data.hasError() ) {
if (!progNode->deref())
delete progNode;
return env->throwError( EvalError,
data.errorMessages().first(),
data.errorLines().first() );
}
QSList empty;
env->pushScope( cl->construct( empty ) );
// ### delete tmp scope class
QSObject res = ((QSProgramNode*)progNode)->execute( env );
if (!progNode->deref())
delete progNode;
env->popScope();
if ( env->isReturnValueMode() )
return res;
else if ( env->isNormalMode() ) {
if ( res.isValid() )
return res;
else
return env->createUndefined();
} else
return res;
}
}