Changeset 35007 in webkit for trunk/JavaScriptCore/kjs/JSObject.h
- Timestamp:
- Jul 4, 2008, 10:35:09 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSObject.h
r34921 r35007 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 2 * Copyright (C) 1999-2001 Harri Porten ([email protected]) … … 22 21 */ 23 22 24 #ifndef KJS_OBJECT_H 25 #define KJS_OBJECT_H 26 23 #ifndef JSObject_h 24 #define JSObject_h 25 26 #include "ClassInfo.h" 27 27 #include "CommonIdentifiers.h" 28 28 #include "ExecState.h" … … 38 38 class InternalFunction; 39 39 class PropertyNameArray; 40 41 40 struct HashEntry; 42 41 struct HashTable; … … 51 50 IsGetterSetter = 1 << 5 }; // property is a getter or setter 52 51 53 /**54 * Class Information55 */56 struct ClassInfo {57 /**58 * A string denoting the class name. Example: "Window".59 */60 const char* className;61 /**62 * Pointer to the class information of the base class.63 * 0L if there is none.64 */65 const ClassInfo* parentClass;66 /**67 * Static hash-table of properties.68 * For classes that can be used from multiple threads, it is accessed via a getter function that would typically return a pointer to thread-specific value.69 */70 const HashTable* propHashTable(ExecState* exec) const71 {72 if (classPropHashTableGetterFunction)73 return classPropHashTableGetterFunction(exec);74 return staticPropHashTable;75 }76 77 const HashTable* staticPropHashTable;78 typedef const HashTable* (*ClassPropHashTableGetterFunction)(ExecState*);79 const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;80 };81 82 // This is an internal value object which stores getter and setter functions83 // for a property.84 class GetterSetter : public JSCell {85 public:86 JSType type() const { return GetterSetterType; }87 88 GetterSetter() : m_getter(0), m_setter(0) { }89 90 virtual void mark();91 92 JSObject* getter() const { return m_getter; }93 void setGetter(JSObject* getter) { m_getter = getter; }94 JSObject* setter() const { return m_setter; }95 void setSetter(JSObject* setter) { m_setter = setter; }96 97 private:98 virtual JSValue* toPrimitive(ExecState*, JSType preferred) const;99 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);100 virtual bool toBoolean(ExecState*) const;101 virtual double toNumber(ExecState*) const;102 virtual UString toString(ExecState*) const;103 virtual JSObject* toObject(ExecState*) const;104 105 JSObject* m_getter;106 JSObject* m_setter;107 };108 109 52 class JSObject : public JSCell { 110 53 public: … … 391 334 }; 392 335 393 JSObject* constructEmptyObject(ExecState*); 394 395 /** 396 * Types of Native Errors available. For custom errors, GeneralError 397 * should be used. 398 */ 399 enum ErrorType { GeneralError = 0, 400 EvalError = 1, 401 RangeError = 2, 402 ReferenceError = 3, 403 SyntaxError = 4, 404 TypeError = 5, 405 URIError = 6}; 406 407 /** 408 * @short Factory methods for error objects. 409 */ 410 class Error { 411 public: 412 /** 413 * Factory method for error objects. 414 * 415 * @param exec The current execution state 416 * @param errtype Type of error. 417 * @param message Optional error message. 418 * @param lineNumber Optional line number. 419 * @param sourceId Optional source id. 420 * @param sourceURL Optional source URL. 421 */ 422 static JSObject *create(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL); 423 static JSObject *create(ExecState *, ErrorType, const char *message); 424 }; 425 426 JSObject *throwError(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL); 427 JSObject *throwError(ExecState *, ErrorType, const UString &message); 428 JSObject *throwError(ExecState *, ErrorType, const char *message); 429 JSObject *throwError(ExecState *, ErrorType); 336 JSObject* constructEmptyObject(ExecState*); 430 337 431 338 inline JSObject::JSObject(JSValue* proto) … … 644 551 } 645 552 646 } // namespace 647 648 #endif // KJS_OBJECT_H553 } // namespace KJS 554 555 #endif // JSObject_h
Note:
See TracChangeset
for help on using the changeset viewer.