123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- #include "KSGSTastaturEreignis.h"
- #include "KSGSTyp.h"
- #include "KSGSInt.h"
- #include "KSGSBool.h"
- #include "../Error/Error.h"
- using namespace KSGScript;
- // Inhalt der KSGSTastaturEreigninKlasse Klasse aus KSGSTastaturEreignis.h
- // Konstruktor
- KSGSTastaturEreignisKlasse::KSGSTastaturEreignisKlasse( KSGScriptProcessor *zObj, TastaturEreignis std )
- : KSGSKlasseInstanz( KSGS_TASTATUREREIGNIS, 0, 0, zObj )
- {
- val = std;
- }
- // Destruktor
- KSGSTastaturEreignisKlasse::~KSGSTastaturEreignisKlasse()
- {}
- // nicht constant
- KSGSVariable *KSGSTastaturEreignisKlasse::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 setTaste( int taste )
- if( parameter->getEintragAnzahl() < 1 )
- error( 20, {}, obj );
- val.taste = parameter->z( 0 ) ? (unsigned char)parameter->z( 0 )->getInt() : (unsigned char)0;
- break;
- case 2: // 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 KSGSTastaturEreignisKlasse::set( TastaturEreignis &te )
- {
- val = te;
- }
- KSGSVariable *KSGSTastaturEreignisKlasse::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->getTastaturEreignis();
- ret = dynamic_cast<KSGSVariable *>( getThis() );
- }
- break;
- }
- if( !ret )
- error( 21, {}, obj );
- if( rechts )
- rechts->release();
- return ret;
- }
- // constant
- KSGSVariable *KSGSTastaturEreignisKlasse::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 taste
- ret = new KSGSIntKlasse( obj, val.taste );
- break;
- case 2: // bool verarbeitet
- ret = new KSGSBoolKlasse( obj, val.verarbeitet );
- break;
- }
- if( !ret )
- error( 17, {}, obj );
- return ret;
- }
- TastaturEreignis KSGSTastaturEreignisKlasse::getVal() const
- {
- return val;
- }
|