// ***** AUTOGENERATED CODE, DO NOT EDIT *****
            // ***** This class is not copyable.
        
        #include "REcmaKeyListenerAdapter.h"
        #include "RMetaTypes.h"
        #include "../REcmaHelper.h"

        // forwards declarations mapped to includes
        
                #include "RDocumentInterface.h"
            
            
        // includes for base ecma wrapper classes
        
                  #include "REcmaKeyListener.h"
                 void REcmaKeyListenerAdapter::initEcma(QScriptEngine& engine, QScriptValue* proto 
    
    ) 
    
    {

    bool protoCreated = false;
    if(proto == NULL){
        proto = new QScriptValue(engine.newVariant(qVariantFromValue(
                (RKeyListenerAdapter*) 0)));
        protoCreated = true;
    }

    
        // primary base class QObject:
        
            QScriptValue dpt = engine.defaultPrototype(
                qMetaTypeId<QObject*>());

            if (dpt.isValid()) {
                proto->setPrototype(dpt);
            }
          
        /*
        REcmaKeyListener::initEcma(engine, proto);
          
        */
    

    QScriptValue fun;

    // toString:
    REcmaHelper::registerFunction(&engine, proto, toString, "toString");
    

    // destroy:
    REcmaHelper::registerFunction(&engine, proto, destroy, "destroy");
    
        // conversion for base class QObject
        REcmaHelper::registerFunction(&engine, proto, getQObject, "getQObject");
        
        // conversion for base class RKeyListener
        REcmaHelper::registerFunction(&engine, proto, getRKeyListener, "getRKeyListener");
        

    // get class name
    REcmaHelper::registerFunction(&engine, proto, getClassName, "getClassName");
    

    // conversion to all base classes (multiple inheritance):
    REcmaHelper::registerFunction(&engine, proto, getBaseClasses, "getBaseClasses");
    

        // properties of secondary base class RKeyListener:
        

        // methods of secondary base class RKeyListener:
        

    // properties:
    

    // methods:
    
            REcmaHelper::registerFunction(&engine, proto, keyPressed, "keyPressed");
            
        engine.setDefaultPrototype(
            qMetaTypeId<RKeyListenerAdapter*>(), *proto);

        
                        qScriptRegisterMetaType<
                        RKeyListenerAdapter*>(
                        &engine, toScriptValue, fromScriptValue, *proto);
                    
    

    QScriptValue ctor = engine.newFunction(createEcma, *proto, 2);
    
    // static methods:
    

    // static properties:
    

    // enum values:
    

    // enum conversions:
    
        
    // init class:
    engine.globalObject().setProperty("RKeyListenerAdapter",
    ctor, QScriptValue::SkipInEnumeration);
    
    if( protoCreated ){
       delete proto;
    }
    
    }
     QScriptValue REcmaKeyListenerAdapter::createEcma(QScriptContext* context, QScriptEngine* engine) 
    
    {
    if (context->thisObject().strictlyEquals(
       engine->globalObject())) {
       return REcmaHelper::throwError(
       QString::fromLatin1("RKeyListenerAdapter(): Did you forget to construct with 'new'?"),
           context);
    }

    QScriptValue result;
    
            // constructor without variants:
            
    if( context->argumentCount() ==
        0
    ){
    // prepare arguments:
    
    // end of arguments

    // call C++ constructor:
    
            // non-copyable class:
            RKeyListenerAdapter
                    * cppResult =
                    new
                    RKeyListenerAdapter
                    ();
                
                    result = engine->newQObject(context->thisObject(), cppResult, QScriptEngine::QtOwnership);
                
    } else 

    {
       return REcmaHelper::throwError(
       QString::fromLatin1("RKeyListenerAdapter(): no matching constructor found."),
           context);
    }
    
    return result;
    }
    

    // conversion functions for base classes:
     QScriptValue REcmaKeyListenerAdapter::getQObject(QScriptContext *context,
            QScriptEngine *engine)
        
            {
                QObject* cppResult =
                    qscriptvalue_cast<RKeyListenerAdapter*> (context->thisObject());
                QScriptValue result = qScriptValueFromValue(engine, cppResult);
                return result;
            }
             QScriptValue REcmaKeyListenerAdapter::getRKeyListener(QScriptContext *context,
            QScriptEngine *engine)
        
            {
                RKeyListener* cppResult =
                    qscriptvalue_cast<RKeyListenerAdapter*> (context->thisObject());
                QScriptValue result = qScriptValueFromValue(engine, cppResult);
                return result;
            }
            

    // returns class name:
     QScriptValue REcmaKeyListenerAdapter::getClassName(QScriptContext *context, QScriptEngine *engine) 
        
    {
        return qScriptValueFromValue(engine, QString("RKeyListenerAdapter"));
    }
    

    // returns all base classes (in case of multiple inheritance):
     QScriptValue REcmaKeyListenerAdapter::getBaseClasses(QScriptContext *context, QScriptEngine *engine) 
        
    {
        QStringList list;
        
        list.append("QObject");
    
        list.append("RKeyListener");
    

        return qScriptValueFromSequence(engine, list);
    }
    
        // properties of secondary base class RKeyListener:
        

        // methods of secondary base class RKeyListener:
        

    // properties:
    

    // public methods:
     QScriptValue
        REcmaKeyListenerAdapter::keyPressed
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaKeyListenerAdapter::keyPressed", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaKeyListenerAdapter::keyPressed";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RKeyListenerAdapter* self = 
                        getSelf("keyPressed", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant()
        ) /* type: QKeyEvent * */
    
    ){
    // prepare arguments:
    
                    // argument is pointer
                    QKeyEvent * a0 = NULL;

                    a0 = 
                        REcmaHelper::scriptValueTo<QKeyEvent >(
                            context->argument(0)
                        );
                    
                    if (a0==NULL && 
                        !context->argument(0).isNull()) {
                        return REcmaHelper::throwError("RKeyListenerAdapter: Argument 0 is not of type QKeyEvent *QKeyEvent *.", context);                    
                    }
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->keyPressed(a0);
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RKeyListenerAdapter.keyPressed().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaKeyListenerAdapter::keyPressed", context, engine);
            return result;
        }
         QScriptValue REcmaKeyListenerAdapter::toString
    (QScriptContext *context, QScriptEngine *engine)
    
    {

    RKeyListenerAdapter* self = getSelf("toString", context);
    
    QString result;
    
            result = QString("RKeyListenerAdapter(0x%1)").arg((unsigned long int)self, 0, 16);
        
    return QScriptValue(result);
    }
     QScriptValue REcmaKeyListenerAdapter::destroy(QScriptContext *context, QScriptEngine *engine)
    
    {

        RKeyListenerAdapter* self = getSelf("RKeyListenerAdapter", context);
        //Q_ASSERT(self!=NULL);
        if (self==NULL) {
            return REcmaHelper::throwError("self is NULL", context);
        }
        
    
        delete self;
        context->thisObject().setData(engine->nullValue());
        context->thisObject().prototype().setData(engine->nullValue());
        context->thisObject().setPrototype(engine->nullValue());
        context->thisObject().setScriptClass(NULL);
        return engine->undefinedValue();
    }
    RKeyListenerAdapter* REcmaKeyListenerAdapter::getSelf(const QString& fName, QScriptContext* context)
    
        {
            RKeyListenerAdapter* self = NULL;

            
                // self could be a normal object (e.g. from an UI file) or
                // an ECMA shell object (made from an ECMA script):
                //self = getSelfShell(fName, context);
                

            //if (self==NULL) {
                self = REcmaHelper::scriptValueTo<RKeyListenerAdapter >(context->thisObject())
                
                ;
            //}

            if (self == NULL){
                // avoid recursion (toString is used by the backtrace):
                if (fName!="toString") {
                    REcmaHelper::throwError(QString("RKeyListenerAdapter.%1(): "
                        "This object is not a RKeyListenerAdapter").arg(fName),
                        context);
                }
                return NULL;
            }

            return self;
        }
        RKeyListenerAdapter* REcmaKeyListenerAdapter::getSelfShell(const QString& fName, QScriptContext* context)
    
        {
          RKeyListenerAdapter* selfBase = getSelf(fName, context);
                RKeyListenerAdapter* self = dynamic_cast<RKeyListenerAdapter*>(selfBase);
                //return REcmaHelper::scriptValueTo<RKeyListenerAdapter >(context->thisObject());
            if(self == NULL){
                REcmaHelper::throwError(QString("RKeyListenerAdapter.%1(): "
                    "This object is not a RKeyListenerAdapter").arg(fName),
                    context);
            }

            return self;
            


        }
         void fromScriptValue(const QScriptValue& value,
        RKeyListenerAdapter*
        &out) {
            QObject* o = value.toQObject();
            out = qobject_cast<
            RKeyListenerAdapter*>(o);
        }
     QScriptValue toScriptValue(QScriptEngine *engine,
        RKeyListenerAdapter*
        const &in){
            QScriptValue s = engine->newQObject(in, QScriptEngine::QtOwnership,
            QScriptEngine::PreferExistingWrapperObject);
            /*
            if(s.isNull()){
               REcmaHelper::throwError("This object is null.", engine->currentContext());
            }
            */
            return s;
        }
    