• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KJSEmbed

KJSEmbed::Engine

KJSEmbed::Engine Class Reference

#include <kjsembed.h>

List of all members.


Detailed Description

The main interface for running embedded Javascript.

Definition at line 44 of file kjsembed.h.


Public Types

enum  ExitStatus { Success = 0, Failure = 1 }

Public Member Functions

 Engine (bool enableBindings=true)
virtual ~Engine ()
bool isBindingsEnabled () const
ExitStatus runFile (const KJS::UString &file)
ExitStatus execute (const KJS::UString &code)
KJS::Completion completion () const
KJS::Interpreter * interpreter () const
KJS::JSObject * addObject (QObject *obj, const KJS::UString &name=KJS::UString()) const
KJS::JSObject * addObject (QObject *obj, KJS::JSObject *parent, const KJS::UString &name=KJS::UString()) const
KJS::JSObject * construct (const KJS::UString &className, const KJS::List &args=KJS::List()) const
KJS::JSValue * callMethod (const KJS::UString &methodName, const KJS::List &args=KJS::List())
KJS::JSValue * callMethod (KJS::JSObject *parent, const KJS::UString &methodName, const KJS::List &args=KJS::List())

Static Public Member Functions

static KJS::Completion runFile (KJS::Interpreter *interpreter, const KJS::UString &file)

Member Enumeration Documentation

enum KJSEmbed::Engine::ExitStatus

Status codes for script execution.

Note that you can access the completion object itself with completion() for more detail.

Enumerator:
Success 
Failure 

Definition at line 51 of file kjsembed.h.


Constructor & Destructor Documentation

KJSEmbed::Engine::Engine ( bool  enableBindings = true  ) 

Constructs an embedded JS engine.

Parameters:
enableBindings If true then the bindings will be added to the interpreter created. Otherwise a plain interpreter with nothing beyond the JS built in functions and objects is created. This allows users who want to run untrusted scripts to choose exactly which bindings they offer.

Definition at line 167 of file kjsembed.cpp.

KJSEmbed::Engine::~Engine (  )  [virtual]

Clean up.

Definition at line 175 of file kjsembed.cpp.


Member Function Documentation

bool KJSEmbed::Engine::isBindingsEnabled (  )  const

Returns true if the Engine was created with the bindings enabled.

Definition at line 180 of file kjsembed.cpp.

Engine::ExitStatus KJSEmbed::Engine::runFile ( const KJS::UString &  file  ) 

Execute the file with the specified name using the current interpreter.

Parameters:
file Filename to execute.

Definition at line 238 of file kjsembed.cpp.

KJS::Completion KJSEmbed::Engine::runFile ( KJS::Interpreter *  interpreter,
const KJS::UString &  file 
) [static]

Execute the file with the specified name using the specified interpreter.

Parameters:
interpreter Interpreter to use.
file Filename to execute.

Definition at line 210 of file kjsembed.cpp.

Engine::ExitStatus KJSEmbed::Engine::execute ( const KJS::UString &  code  ) 

Execute a code string using the current interpreter.

Parameters:
code The script code to execute.

Definition at line 250 of file kjsembed.cpp.

KJS::Completion KJSEmbed::Engine::completion (  )  const

Returns the Completion object for the last script executed.

Definition at line 200 of file kjsembed.cpp.

KJS::Interpreter * KJSEmbed::Engine::interpreter (  )  const

Returns the current interpreter.

Definition at line 205 of file kjsembed.cpp.

KJS::JSObject * KJSEmbed::Engine::addObject ( QObject *  obj,
const KJS::UString &  name = KJS::UString() 
) const

publishes a QObject to the global context of the javascript interpereter.

Definition at line 195 of file kjsembed.cpp.

KJS::JSObject * KJSEmbed::Engine::addObject ( QObject *  obj,
KJS::JSObject *  parent,
const KJS::UString &  name = KJS::UString() 
) const

publishes a QObject to a parent object.

Definition at line 185 of file kjsembed.cpp.

KJS::JSObject * KJSEmbed::Engine::construct ( const KJS::UString &  className,
const KJS::List &  args = KJS::List() 
) const

Create a new instance of an object that the Javascript engine knows about.

If the object doesn't exist a KJS::jsNull() is returned and an exception thrown.

Definition at line 261 of file kjsembed.cpp.

KJS::JSValue * KJSEmbed::Engine::callMethod ( const KJS::UString &  methodName,
const KJS::List &  args = KJS::List() 
)

Execute a method at the global scope of the javascript interperter.

Definition at line 268 of file kjsembed.cpp.

KJS::JSValue * KJSEmbed::Engine::callMethod ( KJS::JSObject *  parent,
const KJS::UString &  methodName,
const KJS::List &  args = KJS::List() 
)

Execute a method on an object.

Definition at line 290 of file kjsembed.cpp.


The documentation for this class was generated from the following files:
  • kjsembed.h
  • kjsembed.cpp

KJSEmbed

Skip menu "KJSEmbed"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   WTF
  • KJSEmbed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  •   core
  • Phonon
  •   Backend
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal