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


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

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


在下文中一共展示了QSObject::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setVar

bool Debugger::setVar(const QString &ident, const QSObject &value)
{
  if (!eng || ident == QString::fromLatin1("this"))
    return false;
  int dot = ident.find('.');
  QString sub = dot > 0 ? ident.mid(0, dot) : ident;
  QSObject base;
  // resolve base
  if (sub == QString::fromLatin1("||Global||")) {
    base = env()->globalObject();
  } else if (sub == QString::fromLatin1("||Activation||")) {
    base = env()->currentScope();
  } else if (sub == QString::fromLatin1("this")) {
    base = env()->thisValue();
  } else {
    // return false;
    ScopeChain::const_iterator it = env()->scope().begin();
    for (it = env()->scope().begin(); it != env()->scope().end(); ++it) {
      if ((*it).hasProperty(sub)) {
        base = *it;
        break;
      }
    }
    if (it == env()->scope().end())
      return false;
#if 0 // ###
    const QSList *chain = Context::current()->pScopeChain();
    QSListIterator scope = chain->begin();
    while (scope != chain->end()) {
      if (scope->hasProperty(sub)) {
        base = *scope;
        break;
      }
      scope++;
    }
    if (scope == chain->end())
      return false;
#endif
  }
  // look up each part of a.b.c.
  while (dot > 0) {
    int olddot = dot;
    dot = ident.find('.', olddot + 1);
    if (dot < 0) {
      sub = ident.mid(olddot + 1);
      break;
    }
    sub = ident.mid(olddot + 1, dot - olddot - 1);
    if (!base.hasProperty(sub))
      return false;
    base = base.get(sub);
  }

  base.put(sub, value);

  return true;
}
开发者ID:juanjosepablos,项目名称:eneboo,代码行数:57,代码来源:qsdebugger.cpp

示例3: 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 );
}
开发者ID:AliYousuf,项目名称:pdfedit-ng-,代码行数:18,代码来源:qsregexp_object.cpp

示例4: queryQSObject

QSObject QSAEditor::queryQSObject( QSObject &ctx, const QString &property ) const
{
    QString s = property;

    QSObject ctxValue = ctx.get( s );
    if ( ctxValue.isA( env()->typeClass() ) ) {
	return ctxValue;
    }

    if ( s.indexOf( '[' ) != -1 )
	return QSArray( env() );
    else if ( s == QString::fromLatin1("false") || s == QString::fromLatin1("true") )
	return env()->createBoolean( false );
    else if ( s[0] == '\'' || s[0] == '\"' )
	return env()->createString( QString::fromLatin1("") );
    return ctxValue;
}
开发者ID:aschet,项目名称:qsaqt5,代码行数:17,代码来源:qsaeditor.cpp

示例5: hasMember

static bool hasMember(QSEnv *env, const QString &function, QSMember::Type type)
{
    QSObject o = env->globalObject();
    QSMember member;
    QStringList names = function.split(QString::fromLatin1("."));
    int nameCount = names.count();
    for (QStringList::ConstIterator it = names.begin(); it != names.end(); ++it, --nameCount) {
	if (nameCount==1) {
	    if (o.objectType() == env->typeClass())
		return QSTypeClass::classValue(&o)->member(0, *it, &member)
		    && member.type() == type;
	    else if (o.objectType()->member(&o, *it, &member))
		return o.objectType()->member(0, *it, &member) && member.type() == type;
	} else {
	    o = o.get(*it);
	    if (!o.isValid())
		return false;
	}
    }
    return false;
}
开发者ID:aschet,项目名称:qsaqt5,代码行数:21,代码来源:quickinterpreter.cpp

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