#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( 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; }