KJS::ObjectImp Class Reference
Inheritance diagram for KJS::ObjectImp:

Detailed Description
Definition at line 361 of file object.h.
Public Member Functions | |
ObjectImp (const Object &proto) | |
ObjectImp (ObjectImp *proto) | |
ObjectImp () | |
virtual | ~ObjectImp () |
virtual void | mark () |
Type | type () const |
virtual const ClassInfo * | classInfo () const |
bool | inherits (const ClassInfo *cinfo) const |
Value | prototype () const |
void | setPrototype (const Value &proto) |
virtual UString | className () const |
virtual Value | get (ExecState *exec, const Identifier &propertyName) const |
virtual Value | getPropertyByIndex (ExecState *exec, unsigned propertyName) const |
virtual void | put (ExecState *exec, const Identifier &propertyName, const Value &value, int attr=None) |
virtual void | putPropertyByIndex (ExecState *exec, unsigned propertyName, const Value &value, int attr=None) |
virtual bool | canPut (ExecState *exec, const Identifier &propertyName) const |
virtual bool | hasProperty (ExecState *exec, const Identifier &propertyName) const |
virtual bool | hasPropertyByIndex (ExecState *exec, unsigned propertyName) const |
virtual bool | deleteProperty (ExecState *exec, const Identifier &propertyName) |
virtual bool | deletePropertyByIndex (ExecState *exec, unsigned propertyName) |
void | deleteAllProperties (ExecState *) |
virtual Value | defaultValue (ExecState *exec, Type hint) const |
virtual bool | implementsConstruct () const |
virtual Object | construct (ExecState *exec, const List &args) |
virtual bool | implementsCall () const |
virtual Value | call (ExecState *exec, Object &thisObj, const List &args) |
virtual bool | implementsHasInstance () const |
virtual Boolean | hasInstance (ExecState *exec, const Value &value) |
const ScopeChain & | scope () const |
void | setScope (const ScopeChain &s) |
virtual ReferenceList | propList (ExecState *exec, bool recursive=true) |
Value | internalValue () const |
void | setInternalValue (const Value &v) |
void | setInternalValue (ValueImp *v) |
Value | toPrimitive (ExecState *exec, Type preferredType=UnspecifiedType) const |
bool | toBoolean (ExecState *exec) const |
double | toNumber (ExecState *exec) const |
UString | toString (ExecState *exec) const |
Object | toObject (ExecState *exec) const |
ValueImp * | getDirect (const Identifier &propertyName) const |
void | putDirect (const Identifier &propertyName, ValueImp *value, int attr=0) |
void | putDirect (const Identifier &propertyName, int value, int attr=0) |
void | setFunctionName (const Identifier &propertyName) |
Protected Attributes | |
PropertyMap | _prop |
Friends | |
class | ObjectProtoFuncImp |
Constructor & Destructor Documentation
ObjectImp::ObjectImp | ( | const Object & | proto | ) |
Creates a new ObjectImp with the specified prototype.
- Parameters:
-
proto The prototype
Definition at line 84 of file object.cpp.
ObjectImp::ObjectImp | ( | ) |
Creates a new ObjectImp with a prototype of Null() (that is, the ECMAScript "null" value, not a null Object).
Definition at line 95 of file object.cpp.
Member Function Documentation
const ClassInfo * ObjectImp::classInfo | ( | ) | const [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 ObjectImp { virtual const ClassInfo *classInfo() const { return &info; } static const ClassInfo info; // ... }; class FooImp : public ObjectImp { virtual const ClassInfo *classInfo() const { return &info; } static const ClassInfo info; // ... };
And in your source file:
const ClassInfo BarImp::info = {0, 0, 0}; // no parent class const ClassInfo FooImp::info = {&BarImp::info, 0, 0};
- See also:
- inherits()
Reimplemented in KJS::ArrayInstanceImp, KJS::ArrayPrototypeImp, KJS::BooleanInstanceImp, KJS::DateInstanceImp, KJS::DatePrototypeImp, KJS::ErrorInstanceImp, KJS::NativeErrorImp, KJS::InternalFunctionImp, KJS::FunctionImp, KJS::DeclaredFunctionImp, KJS::ArgumentsImp, KJS::ActivationImp, KJS::MathObjectImp, KJS::NumberInstanceImp, KJS::NumberObjectImp, KJS::RegExpPrototypeImp, KJS::RegExpImp, KJS::StringInstanceImp, and KJS::StringPrototypeImp.
Definition at line 123 of file object.cpp.
bool ObjectImp::inherits | ( | const ClassInfo * | cinfo | ) | const |
Checks whether this object inherits from the class with the specified classInfo() pointer.
This requires that both this class and the other class return a non-NULL pointer for their classInfo() methods (otherwise it will return false).
For example, for two ObjectImp pointers obj1 and obj2, you can check if obj1's class inherits from obj2's class using the following:
if (obj1->inherits(obj2->classInfo())) { // ... }
If you have a handle to a statically declared ClassInfo, such as in the classInfo() example, you can check for inheritance without needing an instance of the other class:
if (obj1->inherits(FooImp::info)) { // ... }
- Parameters:
-
cinfo The ClassInfo pointer for the class you want to check inheritance against.
- Returns:
- true if this object's class inherits from class with the ClassInfo pointer specified in cinfo
Definition at line 128 of file object.cpp.
Value ObjectImp::prototype | ( | ) | const |
Implementation of the [[Prototype]] internal property (implemented by all Objects).
- See also:
- Object::prototype()
Definition at line 148 of file object.cpp.
UString ObjectImp::className | ( | ) | const [virtual] |
Implementation of the [[Class]] internal property (implemented by all Objects).
The default implementation uses classInfo(). You should either implement classInfo(), or if you simply need a classname, you can reimplement className() instead.
- See also:
- Object::className()
Definition at line 158 of file object.cpp.
Value ObjectImp::get | ( | ExecState * | exec, | |
const Identifier & | propertyName | |||
) | const [virtual] |
Implementation of the [[Get]] internal property (implemented by all Objects).
- See also:
- Object::get()
Reimplemented in KJS::ArrayInstanceImp, KJS::ArrayPrototypeImp, KJS::DatePrototypeImp, KJS::FunctionImp, KJS::ArgumentsImp, KJS::ActivationImp, KJS::MathObjectImp, KJS::NumberObjectImp, KJS::RegExpObjectImp, KJS::StringInstanceImp, and KJS::StringPrototypeImp.
Definition at line 166 of file object.cpp.
void ObjectImp::put | ( | ExecState * | exec, | |
const Identifier & | propertyName, | |||
const Value & | value, | |||
int | attr = None | |||
) | [virtual] |
Implementation of the [[Put]] internal property (implemented by all Objects).
- See also:
- Object::put()
Reimplemented in KJS::ArrayInstanceImp, KJS::FunctionImp, KJS::ArgumentsImp, and KJS::StringInstanceImp.
Definition at line 195 of file object.cpp.
bool ObjectImp::canPut | ( | ExecState * | exec, | |
const Identifier & | propertyName | |||
) | const [virtual] |
Implementation of the [[CanPut]] internal property (implemented by all Objects).
- See also:
- Object::canPut()
Definition at line 229 of file object.cpp.
bool ObjectImp::hasProperty | ( | ExecState * | exec, | |
const Identifier & | propertyName | |||
) | const [virtual] |
Implementation of the [[HasProperty]] internal property (implemented by all Objects).
- See also:
- Object::hasProperty()
Reimplemented in KJS::ArrayInstanceImp, KJS::FunctionImp, KJS::ActivationImp, KJS::RegExpObjectImp, and KJS::StringInstanceImp.
Definition at line 247 of file object.cpp.
bool ObjectImp::deleteProperty | ( | ExecState * | exec, | |
const Identifier & | propertyName | |||
) | [virtual] |
Implementation of the [[Delete]] internal property (implemented by all Objects).
- See also:
- Object::deleteProperty()
Reimplemented in KJS::ArrayInstanceImp, KJS::FunctionImp, KJS::ActivationImp, and KJS::StringInstanceImp.
Definition at line 271 of file object.cpp.
void ObjectImp::deleteAllProperties | ( | ExecState * | ) |
Remove all properties from this object.
This doesn't take DontDelete into account, and isn't in the ECMA spec. It's simply a quick way to remove everything before destroying.
Definition at line 294 of file object.cpp.
Implementation of the [[DefaultValue]] internal property (implemented by all Objects).
- See also:
- Object::defaultValue()
Definition at line 300 of file object.cpp.
Implementation of the [[Construct]] internal property.
- See also:
- Object::construct()
Reimplemented in KJS::ArrayObjectImp, KJS::BooleanObjectImp, KJS::DateObjectImp, KJS::ErrorObjectImp, KJS::NativeErrorImp, KJS::FunctionObjectImp, KJS::DeclaredFunctionImp, KJS::NumberObjectImp, KJS::ObjectObjectImp, KJS::RegExpObjectImp, and KJS::StringObjectImp.
Definition at line 373 of file object.cpp.
Implementation of the [[Call]] internal property.
- See also:
- Object::call()
Reimplemented in KJS::ArrayProtoFuncImp, KJS::ArrayObjectImp, KJS::BooleanProtoFuncImp, KJS::BooleanObjectImp, KJS::DateProtoFuncImp, KJS::DateObjectImp, KJS::DateObjectFuncImp, KJS::ErrorProtoFuncImp, KJS::ErrorObjectImp, KJS::NativeErrorImp, KJS::FunctionPrototypeImp, KJS::FunctionProtoFuncImp, KJS::FunctionObjectImp, KJS::FunctionImp, KJS::GlobalFuncImp, KJS::MathFuncImp, KJS::NumberProtoFuncImp, KJS::NumberObjectImp, KJS::ObjectProtoFuncImp, KJS::ObjectObjectImp, KJS::RegExpProtoFuncImp, KJS::RegExpObjectImp, KJS::StringProtoFuncImp, KJS::StringObjectImp, and KJS::StringObjectFuncImp.
Definition at line 384 of file object.cpp.
Implementation of the [[HasInstance]] internal property.
- See also:
- Object::hasInstance()
Reimplemented in KJS::InternalFunctionImp.
Definition at line 395 of file object.cpp.
const ScopeChain& KJS::ObjectImp::scope | ( | ) | const [inline] |
ReferenceList ObjectImp::propList | ( | ExecState * | exec, | |
bool | recursive = true | |||
) | [virtual] |
Reimplemented in KJS::ArrayInstanceImp, and KJS::StringInstanceImp.
Definition at line 401 of file object.cpp.
void ObjectImp::setFunctionName | ( | const Identifier & | propertyName | ) |
Sets the name of the function, if this is an InternalFunctionImp object.
(calling InternalFunctionImp::setName)
Definition at line 484 of file object.cpp.
The documentation for this class was generated from the following files: