当前位置: 首页>>代码示例>>C++>>正文


C++ QSObject::isDefined方法代码示例

本文整理汇总了C++中QSObject::isDefined方法的典型用法代码示例。如果您正苦于以下问题:C++ QSObject::isDefined方法的具体用法?C++ QSObject::isDefined怎么用?C++ QSObject::isDefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSObject的用法示例。


在下文中一共展示了QSObject::isDefined方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getQualified

QSObject QSObject::getQualified(const QString &name) const
{
  QSObject obj = *this;
  QString s = name;

  // break up dotted notation ns like P1.P2.P3
  while (!s.isEmpty()) {
    int pos = s.find('.');
    if (pos < 0)
      pos = s.length();
    // don't overwrite any existing objects, reuse them
    QString cname = s.left(pos);
    QSObject tmpobj = obj.get(cname);

    // Search the class hieriarchy for member if undefined
    if (!tmpobj.isDefined()) {
      QSClass *base = obj.objectType()->base();
      while (base && !tmpobj.isDefined()) {
        tmpobj = base->get(&obj, cname);
        base = base->base();
      }
      if (!tmpobj.isDefined())
        return env()->createUndefined();
    }
    obj = tmpobj;
    s = s.mid(pos + 1);
  }
  return obj;
}
开发者ID:miguelet17,项目名称:eneboo,代码行数:29,代码来源:qsobject.cpp

示例2: call

bool QSEngineImp::call( QSObject *scope, const QString &func,
                        const QSList &args )
{
    init();
    QSObject t;
    if ( !scope || !scope->isValid() ) {
        t = env()->globalObject();
        scope = &t;
    }

    QSObject v = scope->getQualified(func);
    Q_ASSERT(v.isValid());

    if ( !v.isDefined() ) {
        if (func != QString::fromLatin1("main")) {
            errType = ReferenceError;
            errMsgs.append( QString::fromLatin1("Unknown function: ") + func );
            errLines.append( 0 );
        }
        return false;
    }

    if ( !v.isFunction() ) {
        errType = TypeError;
        errMsgs.append( func + QString::fromLatin1(" is not a function. Call failed.") );
        errLines.append( 0 );
        return false;
    }
    QSObject res = v.invoke( QSMember(), args );

    if ( env()->isExceptionMode() ) {
        QSObject err = env()->exception();
        errType = 99; /* TODO */
        errLines.append(QSErrorClass::errorLine(&err));
        errMsgs.append(QSErrorClass::errorName(&err) + QString::fromLatin1(". ") + QSErrorClass::errorMessage(&err));
#ifdef QSDEBUGGER
        if (dbg)
            dbg->setSourceId(QSErrorClass::errorSourceId(&err));
#endif
        env()->clearException();
        return false;
    } else {
        errType = 0;
        errLines.clear();
        errMsgs.clear();

        // return value
        retVal = res;
        return true;
    }
}
开发者ID:AliYousuf,项目名称:pdfedit-ng-,代码行数:51,代码来源:qsinternal.cpp

示例3: varInfo

QString Debugger::varInfo(const QString &ident) const
{
  if (!eng)
    return QString();

  int dot = ident.find('.');
  if (dot < 0)
    dot = ident.length();
  QString sub = ident.mid(0, dot);
  QSObject obj;
  // resolve base
  if (sub == QString::fromLatin1("||Global||")) {
    obj = env()->globalObject();
  } else if (sub == QString::fromLatin1("||Activation||")) {
    obj = env()->currentScope();
  } else if (sub == QString::fromLatin1("this")) {
    obj = env()->thisValue();
  } else {
    obj = env()->resolveValue(ident);
    if (!obj.isValid())
      return QString();
  }
  // look up each part of a.b.c.
  while (dot < (int)ident.length()) {
    int olddot = dot;
    dot = ident.find('.', olddot + 1);
    if (dot < 0)
      dot = ident.length();
    sub = ident.mid(olddot + 1, dot - olddot - 1);
    obj = obj.get(sub);
    if (!obj.isDefined())
      break;
  }

  return sub + QString::fromLatin1("=") + obj.debugString();
}
开发者ID:juanjosepablos,项目名称:eneboo,代码行数:36,代码来源:qsdebugger.cpp


注:本文中的QSObject::isDefined方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。