QScriptValue REcmaToolMatrixItemDelegate::sizeHint (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaToolMatrixItemDelegate::sizeHint", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaToolMatrixItemDelegate::sizeHint"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RToolMatrixItemDelegate* self = getSelf("sizeHint", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: QStyleOptionViewItem */ && ( context->argument(1).isVariant() || context->argument(1).isQObject() || context->argument(1).isNull() ) /* type: QModelIndex */ ){ // prepare arguments: // argument is reference QStyleOptionViewItem* ap0 = qscriptvalue_cast< QStyleOptionViewItem* >( context->argument( 0 ) ); if( ap0 == NULL ){ return REcmaHelper::throwError("RToolMatrixItemDelegate: Argument 0 is not of type QStyleOptionViewItem*.", context); } QStyleOptionViewItem& a0 = *ap0; // argument is reference QModelIndex* ap1 = qscriptvalue_cast< QModelIndex* >( context->argument( 1 ) ); if( ap1 == NULL ){ return REcmaHelper::throwError("RToolMatrixItemDelegate: Argument 1 is not of type QModelIndex*.", context); } QModelIndex& a1 = *ap1; // end of arguments // call C++ function: // return type 'QSize' QSize cppResult = self->sizeHint(a0 , a1); // return type: QSize // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RToolMatrixItemDelegate.sizeHint().", context); } //REcmaHelper::functionEnd("REcmaToolMatrixItemDelegate::sizeHint", context, engine); return result; }
// public methods: QScriptValue REcmaRestrictAngleLength::restrictSnap (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaRestrictAngleLength::restrictSnap", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaRestrictAngleLength::restrictSnap"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RRestrictAngleLength* self = getSelf("restrictSnap", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RVector */ && ( context->argument(1).isVariant() || context->argument(1).isQObject() || context->argument(1).isNull() ) /* type: RVector */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RVector* ap0 = qscriptvalue_cast< RVector* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RRestrictAngleLength: Argument 0 is not of type RVector.", context); } RVector a0 = *ap0; // argument isCopyable and has default constructor and isSimpleClass RVector* ap1 = qscriptvalue_cast< RVector* >( context->argument( 1 ) ); if (ap1 == NULL) { return REcmaHelper::throwError("RRestrictAngleLength: Argument 1 is not of type RVector.", context); } RVector a1 = *ap1; // end of arguments // call C++ function: // return type 'RVector' RVector cppResult = self->restrictSnap(a0 , a1); // return type: RVector // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RRestrictAngleLength.restrictSnap().", context); } //REcmaHelper::functionEnd("REcmaRestrictAngleLength::restrictSnap", context, engine); return result; }
QScriptValue REcmaSharedPointerPointEntity::setProperty (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerPointEntity::setProperty", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerPointEntity::setProperty"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RPointEntity* self = getSelf("setProperty", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RPropertyTypeId */ && ( context->argument(1).isVariant() || context->argument(1).isQObject() || context->argument(1).isNumber() || context->argument(1).isString() || context->argument(1).isBool() || context->argument(1).isArray() || context->argument(1).isNull() || context->argument(1).isUndefined() ) /* type: QVariant */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RPropertyTypeId* ap0 = qscriptvalue_cast< RPropertyTypeId* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RPropertyTypeId.", context); } RPropertyTypeId a0 = *ap0; // argument isCopyable or pointer QVariant a1 = qscriptvalue_cast< QVariant >( context->argument( 1 ) ); // end of arguments // call C++ function: // return type 'bool' bool cppResult = self->setProperty(a0 , a1); // return type: bool // standard Type result = QScriptValue(cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RPointEntity.setProperty().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerPointEntity::setProperty", context, engine); return result; }
QScriptValue REcmaSpatialIndexNavel::bulkLoad (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSpatialIndexNavel::bulkLoad", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndexNavel::bulkLoad"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RSpatialIndexNavel* self = getSelf("bulkLoad", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isArray() ) /* type: QList < int > */ && ( context->argument(1).isArray() ) /* type: QList < QList < RBox > > */ ){ // prepare arguments: // argument isArray QList < int > a0; REcmaHelper::fromScriptValue( engine, context->argument(0), a0 ); // argument isArray QList < QList < RBox > > a1; REcmaHelper::fromScriptValue( engine, context->argument(1), a1 ); // end of arguments // call C++ function: // return type 'void' self->bulkLoad(a0 , a1); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndexNavel.bulkLoad().", context); } //REcmaHelper::functionEnd("REcmaSpatialIndexNavel::bulkLoad", context, engine); return result; }
QScriptValue REcmaSpatialIndexNavel::queryIntersected (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSpatialIndexNavel::queryIntersected", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndexNavel::queryIntersected"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RSpatialIndexNavel* self = getSelf("queryIntersected", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 6 && ( context->argument(0).isNumber() ) /* type: double */ && ( context->argument(1).isNumber() ) /* type: double */ && ( context->argument(2).isNumber() ) /* type: double */ && ( context->argument(3).isNumber() ) /* type: double */ && ( context->argument(4).isNumber() ) /* type: double */ && ( context->argument(5).isNumber() ) /* type: double */ ){ // prepare arguments: // argument isStandardType double a0 = (double) context->argument( 0 ). toNumber(); // argument isStandardType double a1 = (double) context->argument( 1 ). toNumber(); // argument isStandardType double a2 = (double) context->argument( 2 ). toNumber(); // argument isStandardType double a3 = (double) context->argument( 3 ). toNumber(); // argument isStandardType double a4 = (double) context->argument( 4 ). toNumber(); // argument isStandardType double a5 = (double) context->argument( 5 ). toNumber(); // end of arguments // call C++ function: // return type 'QMap < int , QSet < int > >' QMap < int , QSet < int > > cppResult = self->queryIntersected(a0 , a1 , a2 , a3 , a4 , a5); // return type: QMap < int , QSet < int > > // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else if( context->argumentCount() == 7 && ( context->argument(0).isNumber() ) /* type: double */ && ( context->argument(1).isNumber() ) /* type: double */ && ( context->argument(2).isNumber() ) /* type: double */ && ( context->argument(3).isNumber() ) /* type: double */ && ( context->argument(4).isNumber() ) /* type: double */ && ( context->argument(5).isNumber() ) /* type: double */ && ( context->argument(6).isVariant() || context->argument(6).isQObject() || context->argument(6).isNull() ) /* type: RSpatialIndexVisitor * */ ){ // prepare arguments: // argument isStandardType double a0 = (double) context->argument( 0 ). toNumber(); // argument isStandardType double a1 = (double) context->argument( 1 ). toNumber(); // argument isStandardType double a2 = (double) context->argument( 2 ). toNumber(); // argument isStandardType double a3 = (double) context->argument( 3 ). toNumber(); // argument isStandardType double a4 = (double) context->argument( 4 ). toNumber(); // argument isStandardType double a5 = (double) context->argument( 5 ). toNumber(); // argument is pointer RSpatialIndexVisitor * a6 = NULL; a6 = REcmaHelper::scriptValueTo<RSpatialIndexVisitor >( context->argument(6) ); if (a6==NULL && !context->argument(6).isNull()) { return REcmaHelper::throwError("RSpatialIndexNavel: Argument 6 is not of type RSpatialIndexVisitor *RSpatialIndexVisitor *.", context); } // end of arguments // call C++ function: // return type 'QMap < int , QSet < int > >' QMap < int , QSet < int > > cppResult = self->queryIntersected(a0 , a1 , a2 , a3 , a4 , a5 , a6); // return type: QMap < int , QSet < int > > // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndexNavel.queryIntersected().", context); } //REcmaHelper::functionEnd("REcmaSpatialIndexNavel::queryIntersected", context, engine); return result; }
QScriptValue REcmaImporter::setDocument (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaImporter::setDocument", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaImporter::setDocument"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RImporter* self = getSelf("setDocument", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RDocument * */ ){ // prepare arguments: // argument is pointer RDocument * a0 = NULL; a0 = REcmaHelper::scriptValueTo<RDocument >( context->argument(0) ); if (a0==NULL && !context->argument(0).isNull()) { return REcmaHelper::throwError("RImporter: Argument 0 is not of type RDocument *RDocument *.", context); } // end of arguments // call C++ function: // return type 'void' self->setDocument(a0); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RImporter.setDocument().", context); } //REcmaHelper::functionEnd("REcmaImporter::setDocument", context, engine); return result; }
QScriptValue REcmaSpatialIndexNavel::queryIntersectedSimple (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSpatialIndexNavel::queryIntersectedSimple", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndexNavel::queryIntersectedSimple"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RSpatialIndexNavel* self = getSelf("queryIntersectedSimple", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RBox */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RBox* ap0 = qscriptvalue_cast< RBox* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RSpatialIndexNavel: Argument 0 is not of type RBox.", context); } RBox a0 = *ap0; // end of arguments // call C++ function: // return type 'QList < int >' QList < int > cppResult = self->queryIntersectedSimple(a0); // return type: QList < int > // List of ...: result = REcmaHelper::listToScriptValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndexNavel.queryIntersectedSimple().", context); } //REcmaHelper::functionEnd("REcmaSpatialIndexNavel::queryIntersectedSimple", context, engine); return result; }
void ObservationGenerator::generateGoalObservations() { getSelf(gtSelf, obsSelf, player_); int seenPostCount = 0; int firstPost = 0; for (int i = WO_OWN_LEFT_GOALPOST; i <= WO_OPP_RIGHT_GOALPOST; i++){ getObject(gtPost, obsPost, i); float bearing = gtSelf.loc.getBearingTo(gtPost.loc,gtSelf.orientation); float distance = gtSelf.loc.getDistanceTo(gtPost.loc); if(isVisible(i)) { float missedObsRate = 1.0/10.0; if (distance > 3000) missedObsRate = 1.0/3.0; float randPct = rand_.sampleU(); if (randPct > (missedObsRate * MISSED_OBS_FACTOR) && distance < 7000){ // seen obsPost.seen = true; if (seenPostCount == 0) firstPost = i; seenPostCount++; float diff = joint_->values_[HeadPan] - bearing; obsPost.imageCenterX = iparams_.width/2.0 + (diff / (FOVx/2.0) * iparams_.width/2.0); obsPost.imageCenterY = iparams_.height/2.0; // add distance and bearing noise float randNoise = rand_.sampleU()-0.5; obsPost.visionDistance = distance + randNoise * VISION_ERROR_FACTOR * 0.25*distance;// up to 25% distance error obsPost.visionBearing = bearing + randNoise * VISION_ERROR_FACTOR * 5.0*DEG_T_RAD;// up to 5 deg bearing error obsPost.visionConfidence = 1.0; } } } // actually have to fill those into unknown post spot if (seenPostCount == 1){ // fill in unknown post WorldObject& obsPost = obs_object_->objects_[WO_UNKNOWN_GOALPOST]; WorldObject& known = obs_object_->objects_[firstPost]; obsPost.seen = true; obsPost.frameLastSeen = frame_info_->frame_id; obsPost.imageCenterX = known.imageCenterX; obsPost.imageCenterY = known.imageCenterY; obsPost.visionDistance = known.visionDistance; obsPost.visionBearing = known.visionBearing; obsPost.visionConfidence = 1.0; known.seen = false; } else if (seenPostCount == 2){ // fill in left and right post and goal with average of two float sumX = 0; float sumDist = 0; float sumBear = 0; for (int i = 0; i < 2; i++){ WorldObject& obsPost = obs_object_->objects_[WO_UNKNOWN_LEFT_GOALPOST+i]; WorldObject& known = obs_object_->objects_[firstPost+(i*2)]; obsPost.seen = true; obsPost.frameLastSeen = frame_info_->frame_id; obsPost.imageCenterX = known.imageCenterX; obsPost.imageCenterY = known.imageCenterY; obsPost.visionDistance = known.visionDistance; obsPost.visionBearing = known.visionBearing; obsPost.visionConfidence = 1.0; known.seen = false; sumX += obsPost.imageCenterX; sumDist += obsPost.visionDistance; sumBear += obsPost.visionBearing; } WorldObject& obsPost = obs_object_->objects_[WO_UNKNOWN_GOAL]; obsPost.seen = true; obsPost.frameLastSeen = frame_info_->frame_id; obsPost.imageCenterX = sumX / 2.0; obsPost.imageCenterY = iparams_.height/2.0; obsPost.visionDistance = sumDist / 2.0; obsPost.visionBearing = sumBear / 2.0; obsPost.visionConfidence = 1.0; } else if (seenPostCount > 2){ //cout << index_ << " error saw more than 2 posts: " << seenPostCount << endl; } }
QScriptValue REcmaPointEntity::exportEntity (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaPointEntity::exportEntity", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaPointEntity::exportEntity"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RPointEntity* self = getSelf("exportEntity", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RExporter */ ){ // prepare arguments: // argument is reference RExporter* ap0 = qscriptvalue_cast< RExporter* >( context->argument( 0 ) ); if( ap0 == NULL ){ return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RExporter*.", context); } RExporter& a0 = *ap0; // end of arguments // call C++ function: // return type 'void' self->exportEntity(a0); } else if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RExporter */ && ( context->argument(1).isBool() ) /* type: bool */ ){ // prepare arguments: // argument is reference RExporter* ap0 = qscriptvalue_cast< RExporter* >( context->argument( 0 ) ); if( ap0 == NULL ){ return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RExporter*.", context); } RExporter& a0 = *ap0; // argument isStandardType bool a1 = (bool) context->argument( 1 ). toBool(); // end of arguments // call C++ function: // return type 'void' self->exportEntity(a0 , a1); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RPointEntity.exportEntity().", context); } //REcmaHelper::functionEnd("REcmaPointEntity::exportEntity", context, engine); return result; }
QScriptValue REcmaLeaderData::getReferencePoints (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaLeaderData::getReferencePoints", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaLeaderData::getReferencePoints"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RLeaderData* self = getSelf("getReferencePoints", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 0 ){ // prepare arguments: // end of arguments // call C++ function: // return type 'QList < RVector >' QList < RVector > cppResult = self->getReferencePoints(); // return type: QList < RVector > // List of ...: result = REcmaHelper::listToScriptValue(engine, cppResult); } else if( context->argumentCount() == 1 && ( context->argument(0).isNumber() ) /* type: RS::ProjectionRenderingHint */ ){ // prepare arguments: // argument isStandardType RS::ProjectionRenderingHint a0 = (RS::ProjectionRenderingHint) (int) context->argument( 0 ). toNumber(); // end of arguments // call C++ function: // return type 'QList < RVector >' QList < RVector > cppResult = self->getReferencePoints(a0); // return type: QList < RVector > // List of ...: result = REcmaHelper::listToScriptValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RLeaderData.getReferencePoints().", context); } //REcmaHelper::functionEnd("REcmaLeaderData::getReferencePoints", context, engine); return result; }
QScriptValue REcmaLeaderData::moveReferencePoint (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaLeaderData::moveReferencePoint", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaLeaderData::moveReferencePoint"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RLeaderData* self = getSelf("moveReferencePoint", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RVector */ && ( context->argument(1).isVariant() || context->argument(1).isQObject() || context->argument(1).isNull() ) /* type: RVector */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RVector* ap0 = qscriptvalue_cast< RVector* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RLeaderData: Argument 0 is not of type RVector.", context); } RVector a0 = *ap0; // argument isCopyable and has default constructor and isSimpleClass RVector* ap1 = qscriptvalue_cast< RVector* >( context->argument( 1 ) ); if (ap1 == NULL) { return REcmaHelper::throwError("RLeaderData: Argument 1 is not of type RVector.", context); } RVector a1 = *ap1; // end of arguments // call C++ function: // return type 'bool' bool cppResult = self->moveReferencePoint(a0 , a1); // return type: bool // standard Type result = QScriptValue(cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RLeaderData.moveReferencePoint().", context); } //REcmaHelper::functionEnd("REcmaLeaderData::moveReferencePoint", context, engine); return result; }
QScriptValue REcmaSharedPointerRay::getVectorTo (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerRay::getVectorTo", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerRay::getVectorTo"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RRay* self = getSelf("getVectorTo", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RVector */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RVector* ap0 = qscriptvalue_cast< RVector* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RRay: Argument 0 is not of type RVector.", context); } RVector a0 = *ap0; // end of arguments // call C++ function: // return type 'RVector' RVector cppResult = self->getVectorTo(a0); // return type: RVector // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RVector */ && ( context->argument(1).isBool() ) /* type: bool */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RVector* ap0 = qscriptvalue_cast< RVector* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RRay: Argument 0 is not of type RVector.", context); } RVector a0 = *ap0; // argument isStandardType bool a1 = (bool) context->argument( 1 ). toBool(); // end of arguments // call C++ function: // return type 'RVector' RVector cppResult = self->getVectorTo(a0 , a1); // return type: RVector // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else if( context->argumentCount() == 3 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RVector */ && ( context->argument(1).isBool() ) /* type: bool */ && ( context->argument(2).isNumber() ) /* type: double */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RVector* ap0 = qscriptvalue_cast< RVector* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RRay: Argument 0 is not of type RVector.", context); } RVector a0 = *ap0; // argument isStandardType bool a1 = (bool) context->argument( 1 ). toBool(); // argument isStandardType double a2 = (double) context->argument( 2 ). toNumber(); // end of arguments // call C++ function: // return type 'RVector' RVector cppResult = self->getVectorTo(a0 , a1 , a2); // return type: RVector // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RRay.getVectorTo().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerRay::getVectorTo", context, engine); return result; }
QScriptValue REcmaSharedPointerRay::getPointsWithDistanceToEnd (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerRay::getPointsWithDistanceToEnd", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerRay::getPointsWithDistanceToEnd"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RRay* self = getSelf("getPointsWithDistanceToEnd", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isNumber() ) /* type: double */ && ( context->argument(1).isNumber() ) /* type: RS::From */ ){ // prepare arguments: // argument isStandardType double a0 = (double) context->argument( 0 ). toNumber(); // argument isStandardType RS::From a1 = (RS::From) (int) context->argument( 1 ). toNumber(); // end of arguments // call C++ function: // return type 'QList < RVector >' QList < RVector > cppResult = self->getPointsWithDistanceToEnd(a0 , a1); // return type: QList < RVector > // List of ...: result = REcmaHelper::listToScriptValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RRay.getPointsWithDistanceToEnd().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerRay::getPointsWithDistanceToEnd", context, engine); return result; }
// public methods: QScriptValue REcmaMoveReferencePointOperation::apply (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaMoveReferencePointOperation::apply", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaMoveReferencePointOperation::apply"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RMoveReferencePointOperation* self = getSelf("apply", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RDocument */ ){ // prepare arguments: // argument is reference RDocument* ap0 = qscriptvalue_cast< RDocument* >( context->argument( 0 ) ); if( ap0 == NULL ){ return REcmaHelper::throwError("RMoveReferencePointOperation: Argument 0 is not of type RDocument*.", context); } RDocument& a0 = *ap0; // end of arguments // call C++ function: // return type 'RTransaction' RTransaction cppResult = self->apply(a0); // return type: RTransaction // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RDocument */ && ( context->argument(1).isBool() ) /* type: bool */ ){ // prepare arguments: // argument is reference RDocument* ap0 = qscriptvalue_cast< RDocument* >( context->argument( 0 ) ); if( ap0 == NULL ){ return REcmaHelper::throwError("RMoveReferencePointOperation: Argument 0 is not of type RDocument*.", context); } RDocument& a0 = *ap0; // argument isStandardType bool a1 = (bool) context->argument( 1 ). toBool(); // end of arguments // call C++ function: // return type 'RTransaction' RTransaction cppResult = self->apply(a0 , a1); // return type: RTransaction // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RMoveReferencePointOperation.apply().", context); } //REcmaHelper::functionEnd("REcmaMoveReferencePointOperation::apply", context, engine); return result; }
int main(int argc, char *argv[]) { int counter=0; FILE *fd = NULL;fopen("./client.out", "w+"); if ( fd != NULL ) setOutputType(fd); else setOutputType(stderr); setLogLevel(LOG_LEVEL_DEBUG); uint8_t keep_alive = 1; uint8_t msg_type = 0, timeout = 0; int sockfd = 0, n = 0,c=0,xadd=0,yadd=1,BCD=0,running=1, startx=30,starty=30; char recvBuff[1024]; uint8_t gameStarted = 0,fakeResponded=0; struct EventPlayer event; sleep_time.tv_sec = 0; sleep_time.tv_nsec = 450000000; memset(recvBuff, '0',sizeof(recvBuff)); if(argc != 3) { printf("\n Usage: %s <ip of server> <port of server>\n",argv[0]); return 1; } init_game(); keep_alive = ConnectToServer(argv[1], argv[2], &sockfd); while (keep_alive) { void *buf = NULL; buf = RecieveMessage(sockfd, &msg_type, &timeout); if ( timeout == 5 ) { keep_alive = 0; ERROR("Connection to server timed out\n"); } else { if(buf){ switch(msg_type) { case 2: /* Player just connected to server; Message contains servers rules; */ NOTICE("Connected to server, please stand by\n"); CreateClientWorld(&game, buf); break; case 3: /* Update message received; calculate wait for button pressed */ DEBUG("Update information recieved\n" /*TODO add data here for debuging */); updateClientWorld(&game,buf); gameStarted = 1; break; default: keep_alive = 0; DEBUG("Trashed unhandeled message type:%d\n", msg_type); break; } free(buf); } if (gameStarted) { //init_game(); c = wgetch(key_detecter); if ( c != ERR ) { NOTICE(" WE PRESSED: %c\n",c); ClientMove(c, &game);//TODO pass c to world-done } event.direction = (getSelf(&game))->direction; if ( c == ' ') event.shot = 1; else event.shot = 0; SendMessage(sockfd, &event, sizeof(event), PCKT_EVENT); DEBUG("Sending update event { %d, %d } to server \n", event.direction, event.shot ); } drawWorld(&game); getchar(); refresh(); } } NOTICE("Disconnected from server\n"); if (fd != NULL) fclose(fd); //terminate_game(); return 0; }
QScriptValue REcmaLinetypePattern::equals (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaLinetypePattern::operator==", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaLinetypePattern::operator=="; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RLinetypePattern* self = getSelf("operator==", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RLinetypePattern */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RLinetypePattern* ap0 = qscriptvalue_cast< RLinetypePattern* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RLinetypePattern: Argument 0 is not of type RLinetypePattern.", context); } RLinetypePattern a0 = *ap0; // end of arguments // call C++ function: // return type 'bool' bool cppResult = self->operator==(a0); // return type: bool // standard Type result = QScriptValue(cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RLinetypePattern.equals().", context); } //REcmaHelper::functionEnd("REcmaLinetypePattern::operator==", context, engine); return result; }
// only for debugging / logging int FramebufferNativeWindow::getCurrentBufferIndex() const { Mutex::Autolock _l(mutex); const int index = mCurrentBufferIndex; return index; } int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window, #ifdef QCOM_HARDWARE android_native_buffer_t** buffer) #else ANativeWindowBuffer** buffer) #endif { FramebufferNativeWindow* self = getSelf(window); #ifndef QCOM_HARDWARE Mutex::Autolock _l(self->mutex); #endif framebuffer_device_t* fb = self->fbDev; #ifdef QCOM_HARDWARE int index = self->mBufferHead; #else int index = self->mBufferHead++; if (self->mBufferHead >= self->mNumBuffers) self->mBufferHead = 0; #endif GraphicLog& logger(GraphicLog::getInstance()); logger.log(GraphicLog::SF_FB_DEQUEUE_BEFORE, index);
int GonkNativeWindowClient::hook_lockBuffer_DEPRECATED(ANativeWindow* window, ANativeWindowBuffer* buffer) { GonkNativeWindowClient* c = getSelf(window); return c->lockBuffer_DEPRECATED(buffer); }
QScriptValue REcmaImporter::setKnownVariable (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaImporter::setKnownVariable", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaImporter::setKnownVariable"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RImporter* self = getSelf("setKnownVariable", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isNumber() ) /* type: RS::KnownVariable */ && ( context->argument(1).isVariant() || context->argument(1).isQObject() || context->argument(1).isNumber() || context->argument(1).isString() || context->argument(1).isBool() || context->argument(1).isArray() || context->argument(1).isNull() || context->argument(1).isUndefined() ) /* type: QVariant */ ){ // prepare arguments: // argument isStandardType RS::KnownVariable a0 = (RS::KnownVariable) (int) context->argument( 0 ). toNumber(); // argument isCopyable or pointer QVariant a1 = qscriptvalue_cast< QVariant >( context->argument( 1 ) ); // end of arguments // call C++ function: // return type 'void' self->setKnownVariable(a0 , a1); } else if( context->argumentCount() == 2 && ( context->argument(0).isNumber() ) /* type: RS::KnownVariable */ && ( context->argument(1).isVariant() || context->argument(1).isQObject() || context->argument(1).isNull() ) /* type: RVector */ ){ // prepare arguments: // argument isStandardType RS::KnownVariable a0 = (RS::KnownVariable) (int) context->argument( 0 ). toNumber(); // argument isCopyable and has default constructor and isSimpleClass RVector* ap1 = qscriptvalue_cast< RVector* >( context->argument( 1 ) ); if (ap1 == NULL) { return REcmaHelper::throwError("RImporter: Argument 1 is not of type RVector.", context); } RVector a1 = *ap1; // end of arguments // call C++ function: // return type 'void' self->setKnownVariable(a0 , a1); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RImporter.setKnownVariable().", context); } //REcmaHelper::functionEnd("REcmaImporter::setKnownVariable", context, engine); return result; }
int GonkNativeWindowClient::hook_queueBuffer_DEPRECATED(ANativeWindow* window, ANativeWindowBuffer* buffer) { GonkNativeWindowClient* c = getSelf(window); return c->queueBuffer(buffer, -1); }
QScriptValue REcmaSpatialIndexNavel::queryNearestNeighbor (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSpatialIndexNavel::queryNearestNeighbor", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndexNavel::queryNearestNeighbor"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RSpatialIndexNavel* self = getSelf("queryNearestNeighbor", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 4 && ( context->argument(0).isNumber() ) /* type: int */ && ( context->argument(1).isNumber() ) /* type: double */ && ( context->argument(2).isNumber() ) /* type: double */ && ( context->argument(3).isNumber() ) /* type: double */ ){ // prepare arguments: // argument isStandardType int a0 = (int) context->argument( 0 ). toNumber(); // argument isStandardType double a1 = (double) context->argument( 1 ). toNumber(); // argument isStandardType double a2 = (double) context->argument( 2 ). toNumber(); // argument isStandardType double a3 = (double) context->argument( 3 ). toNumber(); // end of arguments // call C++ function: // return type 'QMap < int , QSet < int > >' QMap < int , QSet < int > > cppResult = self->queryNearestNeighbor(a0 , a1 , a2 , a3); // return type: QMap < int , QSet < int > > // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else if( context->argumentCount() == 5 && ( context->argument(0).isNumber() ) /* type: int */ && ( context->argument(1).isNumber() ) /* type: double */ && ( context->argument(2).isNumber() ) /* type: double */ && ( context->argument(3).isNumber() ) /* type: double */ && ( context->argument(4).isVariant() || context->argument(4).isQObject() || context->argument(4).isNull() ) /* type: RSpatialIndexVisitor * */ ){ // prepare arguments: // argument isStandardType int a0 = (int) context->argument( 0 ). toNumber(); // argument isStandardType double a1 = (double) context->argument( 1 ). toNumber(); // argument isStandardType double a2 = (double) context->argument( 2 ). toNumber(); // argument isStandardType double a3 = (double) context->argument( 3 ). toNumber(); // argument is pointer RSpatialIndexVisitor * a4 = NULL; a4 = REcmaHelper::scriptValueTo<RSpatialIndexVisitor >( context->argument(4) ); if (a4==NULL && !context->argument(4).isNull()) { return REcmaHelper::throwError("RSpatialIndexNavel: Argument 4 is not of type RSpatialIndexVisitor *RSpatialIndexVisitor *.", context); } // end of arguments // call C++ function: // return type 'QMap < int , QSet < int > >' QMap < int , QSet < int > > cppResult = self->queryNearestNeighbor(a0 , a1 , a2 , a3 , a4); // return type: QMap < int , QSet < int > > // not standard type nor reference result = qScriptValueFromValue(engine, cppResult); } else if( context->argumentCount() == 3 && ( context->argument(0).isNumber() ) /* type: double */ && ( context->argument(1).isNumber() ) /* type: double */ && ( context->argument(2).isNumber() ) /* type: double */ ){ // prepare arguments: // argument isStandardType double a0 = (double) context->argument( 0 ). toNumber(); // argument isStandardType double a1 = (double) context->argument( 1 ). toNumber(); // argument isStandardType double a2 = (double) context->argument( 2 ). toNumber(); // end of arguments // call C++ function: // return type 'QPair < int , int >' QPair < int , int > cppResult = self->queryNearestNeighbor(a0 , a1 , a2); // return type: QPair < int , int > // Pair of ...: //result = REcmaHelper::pairToScriptValue(engine, cppResult); QVariantList vl; QVariant v; v.setValue(cppResult.first); vl.append(v); v.setValue(cppResult.second); vl.append(v); result = qScriptValueFromValue(engine, vl); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndexNavel.queryNearestNeighbor().", context); } //REcmaHelper::functionEnd("REcmaSpatialIndexNavel::queryNearestNeighbor", context, engine); return result; }
int GonkNativeWindowClient::hook_query(const ANativeWindow* window, int what, int* value) { const GonkNativeWindowClient* c = getSelf(window); return c->query(what, value); }
QScriptValue REcmaSpatialIndexNavel::removeFromIndex (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSpatialIndexNavel::removeFromIndex", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndexNavel::removeFromIndex"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RSpatialIndexNavel* self = getSelf("removeFromIndex", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 2 && ( context->argument(0).isNumber() ) /* type: int */ && ( context->argument(1).isArray() ) /* type: QList < RBox > */ ){ // prepare arguments: // argument isStandardType int a0 = (int) context->argument( 0 ). toNumber(); // argument isArray QList < RBox > a1; REcmaHelper::fromScriptValue( engine, context->argument(1), a1 ); // end of arguments // call C++ function: // return type 'bool' bool cppResult = self->removeFromIndex(a0 , a1); // return type: bool // standard Type result = QScriptValue(cppResult); } else if( context->argumentCount() == 3 && ( context->argument(0).isNumber() ) /* type: int */ && ( context->argument(1).isNumber() ) /* type: int */ && ( context->argument(2).isVariant() || context->argument(2).isQObject() || context->argument(2).isNull() ) /* type: RBox */ ){ // prepare arguments: // argument isStandardType int a0 = (int) context->argument( 0 ). toNumber(); // argument isStandardType int a1 = (int) context->argument( 1 ). toNumber(); // argument isCopyable and has default constructor and isSimpleClass RBox* ap2 = qscriptvalue_cast< RBox* >( context->argument( 2 ) ); if (ap2 == NULL) { return REcmaHelper::throwError("RSpatialIndexNavel: Argument 2 is not of type RBox.", context); } RBox a2 = *ap2; // end of arguments // call C++ function: // return type 'bool' bool cppResult = self->removeFromIndex(a0 , a1 , a2); // return type: bool // standard Type result = QScriptValue(cppResult); } else if( context->argumentCount() == 8 && ( context->argument(0).isNumber() ) /* type: int */ && ( context->argument(1).isNumber() ) /* type: int */ && ( context->argument(2).isNumber() ) /* type: double */ && ( context->argument(3).isNumber() ) /* type: double */ && ( context->argument(4).isNumber() ) /* type: double */ && ( context->argument(5).isNumber() ) /* type: double */ && ( context->argument(6).isNumber() ) /* type: double */ && ( context->argument(7).isNumber() ) /* type: double */ ){ // prepare arguments: // argument isStandardType int a0 = (int) context->argument( 0 ). toNumber(); // argument isStandardType int a1 = (int) context->argument( 1 ). toNumber(); // argument isStandardType double a2 = (double) context->argument( 2 ). toNumber(); // argument isStandardType double a3 = (double) context->argument( 3 ). toNumber(); // argument isStandardType double a4 = (double) context->argument( 4 ). toNumber(); // argument isStandardType double a5 = (double) context->argument( 5 ). toNumber(); // argument isStandardType double a6 = (double) context->argument( 6 ). toNumber(); // argument isStandardType double a7 = (double) context->argument( 7 ). toNumber(); // end of arguments // call C++ function: // return type 'bool' bool cppResult = self->removeFromIndex(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7); // return type: bool // standard Type result = QScriptValue(cppResult); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndexNavel.removeFromIndex().", context); } //REcmaHelper::functionEnd("REcmaSpatialIndexNavel::removeFromIndex", context, engine); return result; }
int GonkNativeWindowClient::hook_perform(ANativeWindow* window, int operation, ...) { va_list args; va_start(args, operation); GonkNativeWindowClient* c = getSelf(window); return c->perform(operation, args); }
QScriptValue REcmaTextEntity::setData (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaTextEntity::setData", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaTextEntity::setData"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RTextEntity* self = getSelf("setData", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RTextData */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RTextData* ap0 = qscriptvalue_cast< RTextData* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RTextEntity: Argument 0 is not of type RTextData.", context); } RTextData a0 = *ap0; // end of arguments // call C++ function: // return type 'void' self->setData(a0); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RTextEntity.setData().", context); } //REcmaHelper::functionEnd("REcmaTextEntity::setData", context, engine); return result; }
int GonkNativeWindowClient::hook_dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer, int* fenceFd) { GonkNativeWindowClient* c = getSelf(window); return c->dequeueBuffer(buffer, fenceFd); }
QScriptValue REcmaSharedPointerPointEntity::getData (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerPointEntity::getData", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerPointEntity::getData"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RPointEntity* self = getSelf("getData", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 0 ){ // prepare arguments: // end of arguments // call C++ function: // return type 'RPointData &' RPointData & cppResult = self->getData(); // return type: RPointData & // reference result = engine->newVariant( QVariant::fromValue(&cppResult)); } else if( context->argumentCount() == 0 ){ // prepare arguments: // end of arguments // call C++ function: // return type 'RPointData &' RPointData & cppResult = self->getData(); // return type: RPointData & // reference result = engine->newVariant( QVariant::fromValue(&cppResult)); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RPointEntity.getData().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerPointEntity::getData", context, engine); return result; }
int GonkNativeWindowClient::hook_cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd) { GonkNativeWindowClient* c = getSelf(window); return c->cancelBuffer(buffer, fenceFd); }
QScriptValue REcmaSharedPointerPointEntity::getProperty (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaSharedPointerPointEntity::getProperty", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerPointEntity::getProperty"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RPointEntity* self = getSelf("getProperty", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 1 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RPropertyTypeId */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RPropertyTypeId* ap0 = qscriptvalue_cast< RPropertyTypeId* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RPropertyTypeId.", context); } RPropertyTypeId a0 = *ap0; // end of arguments // call C++ function: // return type 'QPair < QVariant , RPropertyAttributes >' QPair < QVariant , RPropertyAttributes > cppResult = self->getProperty(a0); // return type: QPair < QVariant , RPropertyAttributes > // Pair of ...: //result = REcmaHelper::pairToScriptValue(engine, cppResult); QVariantList vl; QVariant v; // first type of pair is variant: if (QString(cppResult.first.typeName())=="RLineweight::Lineweight") { v.setValue((int)cppResult.first.value<RLineweight::Lineweight>()); } else { v.setValue(cppResult.first); } vl.append(v); v.setValue(cppResult.second); vl.append(v); result = qScriptValueFromValue(engine, vl); } else if( context->argumentCount() == 2 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RPropertyTypeId */ && ( context->argument(1).isBool() ) /* type: bool */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RPropertyTypeId* ap0 = qscriptvalue_cast< RPropertyTypeId* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RPropertyTypeId.", context); } RPropertyTypeId a0 = *ap0; // argument isStandardType bool a1 = (bool) context->argument( 1 ). toBool(); // end of arguments // call C++ function: // return type 'QPair < QVariant , RPropertyAttributes >' QPair < QVariant , RPropertyAttributes > cppResult = self->getProperty(a0 , a1); // return type: QPair < QVariant , RPropertyAttributes > // Pair of ...: //result = REcmaHelper::pairToScriptValue(engine, cppResult); QVariantList vl; QVariant v; // first type of pair is variant: if (QString(cppResult.first.typeName())=="RLineweight::Lineweight") { v.setValue((int)cppResult.first.value<RLineweight::Lineweight>()); } else { v.setValue(cppResult.first); } vl.append(v); v.setValue(cppResult.second); vl.append(v); result = qScriptValueFromValue(engine, vl); } else if( context->argumentCount() == 3 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: RPropertyTypeId */ && ( context->argument(1).isBool() ) /* type: bool */ && ( context->argument(2).isBool() ) /* type: bool */ ){ // prepare arguments: // argument isCopyable and has default constructor and isSimpleClass RPropertyTypeId* ap0 = qscriptvalue_cast< RPropertyTypeId* >( context->argument( 0 ) ); if (ap0 == NULL) { return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RPropertyTypeId.", context); } RPropertyTypeId a0 = *ap0; // argument isStandardType bool a1 = (bool) context->argument( 1 ). toBool(); // argument isStandardType bool a2 = (bool) context->argument( 2 ). toBool(); // end of arguments // call C++ function: // return type 'QPair < QVariant , RPropertyAttributes >' QPair < QVariant , RPropertyAttributes > cppResult = self->getProperty(a0 , a1 , a2); // return type: QPair < QVariant , RPropertyAttributes > // Pair of ...: //result = REcmaHelper::pairToScriptValue(engine, cppResult); QVariantList vl; QVariant v; // first type of pair is variant: if (QString(cppResult.first.typeName())=="RLineweight::Lineweight") { v.setValue((int)cppResult.first.value<RLineweight::Lineweight>()); } else { v.setValue(cppResult.first); } vl.append(v); v.setValue(cppResult.second); vl.append(v); result = qScriptValueFromValue(engine, vl); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RPointEntity.getProperty().", context); } //REcmaHelper::functionEnd("REcmaSharedPointerPointEntity::getProperty", context, engine); return result; }
// public methods: QScriptValue REcmaToolMatrixItemDelegate::paint (QScriptContext* context, QScriptEngine* engine) { //REcmaHelper::functionStart("REcmaToolMatrixItemDelegate::paint", context, engine); //qDebug() << "ECMAScript WRAPPER: REcmaToolMatrixItemDelegate::paint"; //QCoreApplication::processEvents(); QScriptValue result = engine->undefinedValue(); // public function: can be called from ECMA wrapper of ECMA shell: RToolMatrixItemDelegate* self = getSelf("paint", context); //Q_ASSERT(self!=NULL); if (self==NULL) { return REcmaHelper::throwError("self is NULL", context); } if( context->argumentCount() == 3 && ( context->argument(0).isVariant() || context->argument(0).isQObject() || context->argument(0).isNull() ) /* type: QPainter * */ && ( context->argument(1).isVariant() || context->argument(1).isQObject() || context->argument(1).isNull() ) /* type: QStyleOptionViewItem */ && ( context->argument(2).isVariant() || context->argument(2).isQObject() || context->argument(2).isNull() ) /* type: QModelIndex */ ){ // prepare arguments: // argument is pointer QPainter * a0 = NULL; a0 = REcmaHelper::scriptValueTo<QPainter >( context->argument(0) ); if (a0==NULL && !context->argument(0).isNull()) { return REcmaHelper::throwError("RToolMatrixItemDelegate: Argument 0 is not of type QPainter *QPainter *.", context); } // argument is reference QStyleOptionViewItem* ap1 = qscriptvalue_cast< QStyleOptionViewItem* >( context->argument( 1 ) ); if( ap1 == NULL ){ return REcmaHelper::throwError("RToolMatrixItemDelegate: Argument 1 is not of type QStyleOptionViewItem*.", context); } QStyleOptionViewItem& a1 = *ap1; // argument is reference QModelIndex* ap2 = qscriptvalue_cast< QModelIndex* >( context->argument( 2 ) ); if( ap2 == NULL ){ return REcmaHelper::throwError("RToolMatrixItemDelegate: Argument 2 is not of type QModelIndex*.", context); } QModelIndex& a2 = *ap2; // end of arguments // call C++ function: // return type 'void' self->paint(a0 , a1 , a2); } else { return REcmaHelper::throwError("Wrong number/types of arguments for RToolMatrixItemDelegate.paint().", context); } //REcmaHelper::functionEnd("REcmaToolMatrixItemDelegate::paint", context, engine); return result; }