123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- #include "KSGSMausEreignis.h"
- #include "KSGSTyp.h"
- #include "../Error/Error.h"
- #include "KSGSInt.h"
- #include "KSGSBool.h"
- using namespace KSGScript;
- // Inhalt der KSGSMausEreignisKlasse Klasse aus KSGSMausEreignis.h
- // Konstruktor
- KSGSMausEreignisKlasse::KSGSMausEreignisKlasse( KSGScriptObj *zObj, MausEreignis std )
- : KSGSKlasseInstanz( KSGS_MAUSEREIGNIS, 0, 0, zObj )
- {
- val = std;
- }
- // Destruktor
- KSGSMausEreignisKlasse::~KSGSMausEreignisKlasse()
- {
- }
- // nicht constant
- KSGSVariable *KSGSMausEreignisKlasse::startFunktion( int id, bool access, RCArray< KSGSVariable > *parameter )
- {
- KSGSVariable *ret = 0;
- switch( id )
- {
- case 0: // void setId( int id )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val.id = parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0;
- break;
- case 1: // void setMx( int mx )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val.mx = parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0;
- break;
- case 2: // void setMy( int my )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val.my = parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0;
- break;
- case 3: // void setRmx( int rmx )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val.rmx = parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0;
- break;
- case 4: // void setRmy( int rmy )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val.rmy = parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0;
- break;
- case 5: // void setVerarbeitet( bool verarbeitet )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val.verarbeitet = parameter->z( 0 ) ? parameter->z( 0 )->getBool() : 0;
- break;
- default: // unbekannt
- error( 19, {}, obj );
- break;
- }
- parameter->release();
- return ret;
- }
- void KSGSMausEreignisKlasse::set( MausEreignis &me )
- {
- val = me;
- }
- KSGSVariable *KSGSMausEreignisKlasse::doOperator( int id, KSGSVariable *rechts )
- {
- if( !rechts )
- {
- error( 3, {}, obj );
- return 0;
- }
- KSGSVariable *ret = 0;
- switch( id )
- {
- case KSGS_O_SET:
- if( 1 )
- {
- val = rechts->getMausEreignis();
- ret = getThis();
- }
- break;
- }
- if( !ret )
- error( 21, {}, obj );
- if( rechts )
- rechts->release();
- return ret;
- }
- // constant
- KSGSVariable *KSGSMausEreignisKlasse::getVariable( int id, bool zugriff ) const
- {
- KSGSVariable *ret = 0;
- switch( id )
- {
- case 0: // int id
- ret = new KSGSIntKlasse( obj, val.id );
- break;
- case 1: // int mx
- ret = new KSGSIntKlasse( obj, val.mx );
- break;
- case 2: // int my
- ret = new KSGSIntKlasse( obj, val.my );
- break;
- case 3: // int rmx
- ret = new KSGSIntKlasse( obj, val.rmx );
- break;
- case 4: // int rmy
- ret = new KSGSIntKlasse( obj, val.rmy );
- break;
- case 5: // bool verarbeitet
- ret = new KSGSBoolKlasse( obj, val.verarbeitet );
- break;
- }
- if( !ret )
- error( 17, {}, obj );
- return ret;
- }
- MausEreignis KSGSMausEreignisKlasse::getVal() const
- {
- return val;
- }
- // Reference Counting
- KSGSVariable *KSGSMausEreignisKlasse::release()
- {
- ref--;
- if( !ref )
- delete this;
- return 0;
- }
|