• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ kjs::Value类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中kjs::Value的典型用法代码示例。如果您正苦于以下问题:C++ Value类的具体用法?C++ Value怎么用?C++ Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: startElement

bool SaxHandler::startElement( const QString &ns, const QString &ln, const QString &qn,
			       const QXmlAttributes &attrs )
{
    if ( !jshandler.isValid() ) {
	error = ErrorNoHandler;
	return false;
    }

    KJS::Identifier funName("startElement");
    if ( !jshandler.hasProperty(exec, funName) )
	return QXmlDefaultHandler::startElement( ns, ln, qn, attrs );

    KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
    if ( !fun.implementsCall() ) {
	error = ErrorNotCallable;
	return false;
    }

    KJS::List args;
    args.append( KJS::String(ns) );
    args.append( KJS::String(ln) );
    args.append( KJS::String(qn) );
    // TODO: XmlAttributes not yet supported

    KJS::Value ret = fun.call( exec, jshandler, args );
    return ret.toBoolean( exec );
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:27,代码来源:saxhandler.cpp


示例2: callMethod

KJS::Value KJSEmbedPart::callMethod( const QString & methodName, const KJS::List & args ) const
{
  KJS::ExecState *exec = js->globalExec();
  KJS::Identifier id = KJS::Identifier( KJS::UString(methodName.latin1() ));
  KJS::Object obj = js->globalObject();
  KJS::Object fun = obj.get(exec, id ).toObject( exec );
  KJS::Value retValue;
  if ( !fun.implementsCall() )
  {
  	// We need to create an exception here...
  }
  else
        retValue = fun.call(exec, obj, args);
	kdDebug( 80001 ) << "Returned type is: " << retValue.type() << endl;  
	if( exec->hadException() )
	{
		kdWarning( 80001 ) << "Got error: " << exec->exception().toString(exec).qstring() << endl;
		return exec->exception();
	}
	else
	{
		if( retValue.type() == 1 && retValue.type() == 0)
		{
			kdDebug( 80001 ) << "Got void return type. " << endl;
			return KJS::Null();
		}
	}
  return retValue;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:29,代码来源:kjsembedpart.cpp


示例3: setActive

void KstBindTimeInterpretation::setActive(KJS::ExecState *exec, const KJS::Value& value) {
  if (!_d) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
    exec->setException(eobj);
    return;
  }
  if (value.type() != KJS::BooleanType) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstWriteLocker wl(_d->_d);
  bool isIt;
  KstAxisInterpretation interp;
  KstAxisDisplay disp;
  if (_d->_xAxis) {
    _d->_d->getXAxisInterpretation(isIt, interp, disp);
    _d->_d->setXAxisInterpretation(value.toBoolean(exec), interp, disp);
  } else {
    _d->_d->getYAxisInterpretation(isIt, interp, disp);
    _d->_d->setYAxisInterpretation(value.toBoolean(exec), interp, disp);
  }
  _d->_d->setDirty();
  KstApp::inst()->paintAll(KstPainter::P_PAINT);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:25,代码来源:bind_timeinterpretation.cpp


示例4: setLineStyle

void KstBindCubicBezier::setLineStyle(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstViewBezierPtr d = makeBezier(_d);
  if (d) {
    KstWriteLocker wl(d);
    switch (w) {
      case 0:
        d->setPenStyle(Qt::SolidLine);
        break;
      case 1:
        d->setPenStyle(Qt::DashLine);
        break;
      case 2:
        d->setPenStyle(Qt::DotLine);
        break;
      case 3:
        d->setPenStyle(Qt::DashDotLine);
        break;
      case 4:
        d->setPenStyle(Qt::DashDotDotLine);
        break;
      default:
        return;
    }
    KstApp::inst()->paintAll(P_PAINT);
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:32,代码来源:bind_cubicbezier.cpp


示例5: constructorList

KJS::List KJSEmbedPart::constructorList() const
{
    KJS::List items;

    KJS::Object obj = js->globalObject();
    KJS::ExecState *exec = js->globalExec();

    KJS::ReferenceList l = obj.propList( exec );
    KJS::ReferenceListIterator propIt = l.begin();
    while ( propIt != l.end() ) {

	KJS::Identifier name = propIt->getPropertyName( exec );

	if ( obj.hasProperty( exec, name ) ) {
	    KJS::Value v = obj.get( exec, name );
	    KJS::Object vobj = v.toObject( exec );

	    if ( vobj.implementsConstruct() )
		items.append( KJS::String( name.ustring() ) );
	}

	propIt++;
    }

    return items;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:26,代码来源:kjsembedpart.cpp


示例6: setX

void KstBindPoint::setX(KJS::ExecState *exec, const KJS::Value& value) {
  if (value.type() != KJS::NumberType) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  _x = value.toNumber(exec);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:8,代码来源:bind_point.cpp


示例7: setName

void KstBindDocument::setName(KJS::ExecState *exec, const KJS::Value& value) {
  if (value.type() != KJS::StringType) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstApp::inst()->document()->setTitle(value.toString(exec).qstring());
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:8,代码来源:bind_document.cpp


示例8: setW

void KstBindSize::setW(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned int w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  _sz.setWidth(w);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:9,代码来源:bind_size.cpp


示例9: setOutput

void KstBindTimeInterpretation::setOutput(KJS::ExecState *exec, const KJS::Value& value) {
  if (!_d) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
    exec->setException(eobj);
    return;
  }
  unsigned i = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(i)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstWriteLocker wl(_d->_d);
  bool isIt;
  KstAxisInterpretation interp;
  KstAxisDisplay disp, newDisp;
  switch (i) {
    default:
    case 0:
      newDisp = AXIS_DISPLAY_DDMMYYHHMMSS_SS;
      break;
    case 1:
      newDisp = AXIS_DISPLAY_YYMMDDHHMMSS_SS;
      break;
    case 2:
      newDisp = AXIS_DISPLAY_JD;
      break;
    case 3:
      newDisp = AXIS_DISPLAY_MJD;
      break;
    case 4:
      newDisp = AXIS_DISPLAY_RJD;
      break;
    case 5:
      newDisp = AXIS_DISPLAY_YEAR;
      break;
    case 6:
      newDisp = AXIS_DISPLAY_KDE_SHORTDATE;
      break;
    case 7:
      newDisp = AXIS_DISPLAY_KDE_LONGDATE;
      break;
  }
    
  if (_d->_xAxis) {
    _d->_d->getXAxisInterpretation(isIt, interp, disp);
    _d->_d->setXAxisInterpretation(isIt, interp, newDisp);
  } else {
    _d->_d->getYAxisInterpretation(isIt, interp, disp);
    _d->_d->setYAxisInterpretation(isIt, interp, newDisp);
  }
  _d->_d->setDirty();
  KstApp::inst()->paintAll(KstPainter::P_PAINT);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:54,代码来源:bind_timeinterpretation.cpp


示例10: setRUnits

void KstBindPowerSpectrum::setRUnits(KJS::ExecState *exec, const KJS::Value& value) {
  if (value.type() != KJS::StringType) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstPSDPtr d = makePSD(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setRUnits(value.toString(exec).qstring());
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:12,代码来源:bind_powerspectrum.cpp


示例11: setFrequency

void KstBindPowerSpectrum::setFrequency(KJS::ExecState *exec, const KJS::Value& value) {
  if (value.type() != KJS::NumberType) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstPSDPtr d = makePSD(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setFreq(value.toNumber(exec));
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:12,代码来源:bind_powerspectrum.cpp


示例12: setLength

void KstBindPowerSpectrum::setLength(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned val;
  if (value.type() != KJS::NumberType || !value.toUInt32(val)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstPSDPtr d = makePSD(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setLen(val);
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:13,代码来源:bind_powerspectrum.cpp


示例13: getObj

static KJS::Object getObj(KJS::Interpreter *js, KJS::Value mightBeArray, int id) {
	KJS::ExecState *exec=js->globalExec();
    	KJS::Object constrs=mightBeArray.toObject(exec);
	KJS::Value constr;
	if (!exec->hadException()) {
		if (QString(constrs.classInfo()->className)=="Array") {
			kdDebug()<<"config page  constructor array detected"<<endl;
			constr=constrs.get(exec,id);
		} else constr=mightBeArray;
	
	}
	return constr.toObject(js->globalExec());
}
开发者ID:iegor,项目名称:kdesktop,代码行数:13,代码来源:plugin_katekjswrapper.cpp


示例14: scopeWalker

static KJS::Object scopeWalker( KJS::ExecState *exec, const KJS::Object &root, const QString &objectString )
{
  KJS::Object returnObject = root;
  QStringList objects = QStringList::split(".", objectString);
  for( uint idx = 0; idx < objects.count(); ++idx)
  {
    KJS::Identifier id = KJS::Identifier( KJS::UString( objects[idx] ));
    KJS::Value newObject = returnObject.get(exec, id );
    if( newObject.isValid() )
    	returnObject = newObject.toObject(exec);
  }
  return returnObject;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:13,代码来源:kjsembedpart.cpp


示例15: setBorderWidth

void KstBindEllipse::setBorderWidth(KJS::ExecState *exec, const KJS::Value& value) {
  unsigned w = 0;
  if (value.type() != KJS::NumberType || !value.toUInt32(w)) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
    exec->setException(eobj);
    return;
  }
  KstViewEllipsePtr d = makeEllipse(_d);
  if (d) {
    KstWriteLocker wl(d);
    d->setBorderWidth(w);
    KstApp::inst()->paintAll(KstPainter::P_PAINT);
  }
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:14,代码来源:bind_ellipse.cpp


示例16: constructorNames

QStringList KJSEmbedPart::constructorNames() const
{
    QStringList classes;

    KJS::List cons = constructorList();
    KJS::ListIterator it = cons.begin();
    while ( it != cons.end() ) {
	KJS::Value v = *it;
	classes += v.toString( js->globalExec() ).qstring();
	it++;
    }

    return classes;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:14,代码来源:kjsembedpart.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ klayge::UISlider类代码示例发布时间:2022-05-31
下一篇:
C++ kjs::ReferenceList类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap