Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

jsobjectproxy.h

00001 // -*- c++ -*-
00002 
00003 /*
00004  *  Copyright (C) 2001-2003, Richard J. Moore <rich@kde.org>
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Library General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Library General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Library General Public License
00017  *  along with this library; see the file COPYING.LIB.  If not, write to
00018  *  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  *  Boston, MA 02111-1307, USA.
00020  */
00021 
00022 #ifndef KJSEMBEDJSOBJECTPROXY_H
00023 #define KJSEMBEDJSOBJECTPROXY_H
00024 
00025 #include <qguardedptr.h>
00026 #include <qcstring.h>
00027 
00028 #include <kjs/object.h>
00029 #include <kjsembed/jsbinding.h>
00030 
00031 namespace KJS { class Interpreter; };
00032 
00033 namespace KJSEmbed {
00034 
00035 namespace Bindings { class JSObjectProxyImp; };
00036 
00037 class JSSecurityPolicy;
00038 class JSObjectProxyPrivate;
00039 
00094 class JSObjectProxy : public KJS::ObjectImp
00095 {
00096 public:
00101     JSObjectProxy( KJS::Interpreter *js, QObject *target );
00102 
00108     JSObjectProxy( KJS::Interpreter *js, QObject *target, QObject *root );
00109 
00116     JSObjectProxy( KJS::Interpreter *js, QObject *target,
00117                    QObject *root, const JSSecurityPolicy *sp );
00118 
00119     ~JSObjectProxy() {}
00120 
00127     virtual void addBindings( KJS::ExecState *state, KJS::Object &object );
00128 
00129     KJS::Object createSubProxy( QObject *target, KJS::ExecState *state=0 ) const;
00130 
00132     KJS::Interpreter *jscript() const { return js; }
00133 
00135     QObject *rootObject() const { return root; }
00136 
00138     QObject *object() const { return obj; }
00139 
00141     const JSSecurityPolicy *securityPolicy() const { return policy; }
00142 
00147     void setSecurityPolicy( const JSSecurityPolicy *sp );
00148 
00150     virtual KJS::Value get( KJS::ExecState *state, const KJS::UString &p ) const;
00151 
00153     virtual void put( KJS::ExecState *state, const KJS::UString &p,
00154                       const KJS::Value &v, int attr = KJS::None );
00155 
00157     virtual KJS::UString toString( KJS::ExecState *exec ) const;
00158 
00159     int findSignature( const QString &sig ) const;
00160 
00161 private:
00162     bool isAllowed( KJS::Interpreter *js ) const;
00163 
00164 private:
00165     KJS::Interpreter *js;
00166     QGuardedPtr<QObject> obj;
00167     QGuardedPtr<QObject> root;
00168     const JSSecurityPolicy *policy;
00169     class JSObjectProxyPrivate *d;
00170     friend class Bindings::JSObjectProxyImp;
00171 };
00172 
00173 }; // namespace KJSEmbed
00174 
00175 #endif // KJSEMBEDJSOBJECTPROXY_H
00176 
00177 // Local Variables:
00178 // c-basic-offset: 4
00179 // End:

Generated at Sat Feb 1 03:23:35 2003 for KJSEmbed by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001