本文整理汇总了C++中QSMember::setPrivate方法的典型用法代码示例。如果您正苦于以下问题:C++ QSMember::setPrivate方法的具体用法?C++ QSMember::setPrivate怎么用?C++ QSMember::setPrivate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSMember
的用法示例。
在下文中一共展示了QSMember::setPrivate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check
void QSFuncDeclNode::check( QSCheckData *c )
{
// qDebug( "Function noticed: " + c->globalName(ident) );
if ( attrs )
attrs->check( c );
else
c->setLastAttributes( AttributeNone );
int as = c->lastAttributes();
QSClass * cl = c->currentScope();
Q_ASSERT( cl );
if ( (as&AttributeStatic) && cl->name() != QString::fromLatin1("Class") ) {
c->addError( this, QSErrAttrStaticContext,
QString::fromLatin1( "Function '%1' cannot be declared static "
"outside a class" ).arg( ident ) );
return;
}
// A bit of magic fail early when trying to overwrite a context.
if (c->inGlobal()) {
QSObject object = c->env()->globalObject().get(ident);
if (object.isValid()) {
if (object.objectType()->name() == QString::fromLatin1("QObject")) {
c->addError(this, QString("Cannot declare function '%1', already a global object "
"present with same name").arg(ident));
return;
}
}
}
QSMember m;
m.setPrivate( as&AttributePrivate );
if ( cl->member( 0, ident, &m ) ) {
QSMember mem( body, as );
cl->replaceMember( ident, &mem );
} else {
cl->addFunctionMember( ident, body, as );
}
int tmpVarBlockCount = c->varBlockCount();
c->setVarBlockCount( 0 );
QSFunctionScopeClass * fscope = new QSFunctionScopeClass( c->env()->objectClass(), this );
fscope->setEnclosingClass( cl );
body->setScopeDefinition( fscope );
fscope->setFunctionBodyNode(body);
c->enterFunction( fscope );
if( param )
param->check( c );
body->check( c );
c->leaveFunction();
if( c->varBlockCount()>fscope->numVariables() )
fscope->setNumVariables( c->varBlockCount() );
c->setVarBlockCount( tmpVarBlockCount );
// Calculate the number of arguments
int count = 0;
QSParameterNode * node = param;
while( node ) {
count++;
node = node->nextParam();
}
fscope->setNumArguments( count );
// unset attributes
c->setLastAttributes( AttributeNone );
}