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

KJS

KJS::FunctionImp

KJS::FunctionImp Class Reference

#include <scriptfunction.h>

Inheritance diagram for KJS::FunctionImp:

Inheritance graph
[legend]

List of all members.


Detailed Description

Implementation class for internal Functions.

Definition at line 38 of file scriptfunction.h.


Public Member Functions

 FunctionImp (ExecState *exec, const Identifier &n, FunctionBodyNode *b)
virtual ~FunctionImp ()
virtual bool getOwnPropertySlot (ExecState *, const Identifier &, PropertySlot &)
virtual void put (ExecState *exec, const Identifier &propertyName, JSValue *value, int attr=None)
virtual bool deleteProperty (ExecState *exec, const Identifier &propertyName)
virtual JSValue * callAsFunction (ExecState *exec, JSObject *thisObj, const List &args)
Identifier getParameterName (int index)
virtual Completion execute (ExecState *exec)=0
virtual const ClassInfo * classInfo () const
const ScopeChain & scope () const
void setScope (const ScopeChain &s)
virtual void mark ()

Public Attributes

RefPtr< FunctionBodyNode > body

Static Public Attributes

static const ClassInfo info = {"Function", &InternalFunctionImp::info, 0, 0}

Friends

class ActivationImp

Constructor & Destructor Documentation

KJS::FunctionImp::FunctionImp ( ExecState *  exec,
const Identifier &  n,
FunctionBodyNode *  b 
)

Definition at line 93 of file function.cpp.

KJS::FunctionImp::~FunctionImp (  )  [virtual]

Definition at line 106 of file function.cpp.


Member Function Documentation

bool KJS::FunctionImp::getOwnPropertySlot ( ExecState *  exec,
const Identifier &  propertyName,
PropertySlot &  slot 
) [virtual]

Reimplemented from KJS::JSObject.

Definition at line 276 of file function.cpp.

void KJS::FunctionImp::put ( ExecState *  exec,
const Identifier &  propertyName,
JSValue *  value,
int  attr = None 
) [virtual]

Sets the specified property.

See ECMA 8.6.2.2

Parameters:
exec The current execution state
propertyName The name of the property to set
propertyValue The value to set

Reimplemented from KJS::JSObject.

Definition at line 298 of file function.cpp.

bool KJS::FunctionImp::deleteProperty ( ExecState *  exec,
const Identifier &  propertyName 
) [virtual]

Removes the specified property from the object.

See ECMA 8.6.2.5

Parameters:
exec The current execution state
propertyName The name of the property to delete
Returns:
true if the property was successfully deleted or did not exist on the object. false if deleting the specified property is not allowed.

Reimplemented from KJS::JSObject.

Definition at line 305 of file function.cpp.

JSValue * KJS::FunctionImp::callAsFunction ( ExecState *  exec,
JSObject *  thisObj,
const List &  args 
) [virtual]

Implements KJS::InternalFunctionImp.

Definition at line 110 of file function.cpp.

Identifier KJS::FunctionImp::getParameterName ( int  index  ) 

Definition at line 319 of file function.cpp.

virtual Completion KJS::FunctionImp::execute ( ExecState *  exec  )  [pure virtual]

Implemented in KJS::DeclaredFunctionImp.

virtual const ClassInfo* KJS::FunctionImp::classInfo (  )  const [inline, virtual]

A pointer to a ClassInfo struct for this class.

This provides a basic facility for run-time type information, and can be used to check an object's class an inheritance (see inherits()). This should always return a statically declared pointer, or 0 to indicate that there is no class information.

This is primarily useful if you have application-defined classes that you wish to check against for casting purposes.

For example, to specify the class info for classes FooImp and BarImp, where FooImp inherits from BarImp, you would add the following in your class declarations:

   class BarImp : public JSObject {
     virtual const ClassInfo *classInfo() const { return &info; }
     static const ClassInfo info;
     // ...
   };

   class FooImp : public JSObject {
     virtual const ClassInfo *classInfo() const { return &info; }
     static const ClassInfo info;
     // ...
   };

And in your source file:

   const ClassInfo BarImp::info = {"Bar", 0, 0, 0}; // no parent class
   const ClassInfo FooImp::info = {"Foo", &BarImp::info, 0, 0};

See also:
inherits()

Reimplemented from KJS::InternalFunctionImp.

Reimplemented in KJS::DeclaredFunctionImp.

Definition at line 56 of file scriptfunction.h.

const ScopeChain& KJS::FunctionImp::scope (  )  const [inline]

Returns the scope of this object.

This is used when execution declared functions - the execution context for the function is initialized with extra object in it's scope. An example of this is functions declared inside other functions:

 function f() {

   function b() {
     return prototype;
   }

   var x = 4;
   // do some stuff
 }
 f.prototype = new String();

When the function f.b is executed, its scope will include properties of f. So in the example above the return value of f.b() would be the new String object that was assigned to f.prototype.

Parameters:
exec The current execution state
Returns:
The function's scope

Definition at line 87 of file scriptfunction.h.

void KJS::FunctionImp::setScope ( const ScopeChain &  s  )  [inline]

Definition at line 88 of file scriptfunction.h.

void KJS::FunctionImp::mark (  )  [virtual]

Reimplemented from KJS::JSObject.

Definition at line 100 of file function.cpp.


Friends And Related Function Documentation

friend class ActivationImp [friend]

Definition at line 39 of file scriptfunction.h.


Member Data Documentation

const ClassInfo KJS::FunctionImp::info = {"Function", &InternalFunctionImp::info, 0, 0} [static]

Reimplemented from KJS::InternalFunctionImp.

Reimplemented in KJS::DeclaredFunctionImp.

Definition at line 57 of file scriptfunction.h.

RefPtr<FunctionBodyNode> KJS::FunctionImp::body

Definition at line 59 of file scriptfunction.h.


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

KJS

Skip menu "KJS"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • 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