Changeset 10801 in webkit for trunk/JavaScriptCore/kjs/date_object.h
- Timestamp:
- Oct 9, 2005, 3:56:30 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/date_object.h
r10456 r10801 1 // -*- c-basic-offset: 2 -*-2 1 /* 3 2 * This file is part of the KDE libraries … … 20 19 */ 21 20 22 #ifndef _DATE_OBJECT_H_23 #define _DATE_OBJECT_H_21 #ifndef DATE_OBJECT_H 22 #define DATE_OBJECT_H 24 23 25 24 #include "internal.h" 26 #include "function_object.h"27 25 28 26 namespace KJS { 29 27 30 class DateInstanceImp : public ObjectImp { 31 public: 32 DateInstanceImp(ObjectImp *proto); 28 class FunctionPrototypeImp; 29 class ObjectPrototypeImp; 33 30 34 virtual const ClassInfo *classInfo() const { return &info; }35 static const ClassInfo info;36 };31 class DateInstanceImp : public ObjectImp { 32 public: 33 DateInstanceImp(ObjectImp *proto); 37 34 38 /** 39 * @internal 40 * 41 * The initial value of Date.prototype (and thus all objects created 42 * with the Date constructor 43 */ 44 class DatePrototypeImp : public DateInstanceImp { 45 public: 46 DatePrototypeImp(ExecState *exec, ObjectPrototypeImp *objectProto); 47 bool getOwnPropertySlot(ExecState *, const Identifier &, PropertySlot&); 48 virtual const ClassInfo *classInfo() const { return &info; } 49 static const ClassInfo info; 50 }; 35 virtual const ClassInfo *classInfo() const { return &info; } 36 static const ClassInfo info; 37 }; 51 38 52 /** 53 * @internal 54 * 55 * Class to implement all methods that are properties of the 56 * Date.prototype object 57 */ 58 class DateProtoFuncImp : public InternalFunctionImp { 59 public: 60 DateProtoFuncImp(ExecState *exec, int i, int len); 39 /** 40 * @internal 41 * 42 * The initial value of Date.prototype (and thus all objects created 43 * with the Date constructor 44 */ 45 class DatePrototypeImp : public DateInstanceImp { 46 public: 47 DatePrototypeImp(ExecState *, ObjectPrototypeImp *); 48 virtual bool getOwnPropertySlot(ExecState *, const Identifier &, PropertySlot&); 49 virtual const ClassInfo *classInfo() const { return &info; } 50 static const ClassInfo info; 51 }; 61 52 62 virtual bool implementsCall() const; 63 virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args); 53 /** 54 * @internal 55 * 56 * The initial value of the the global variable's "Date" property 57 */ 58 class DateObjectImp : public InternalFunctionImp { 59 public: 60 DateObjectImp(ExecState *, FunctionPrototypeImp *, DatePrototypeImp *); 64 61 62 virtual bool implementsConstruct() const; 63 virtual ObjectImp *construct(ExecState *, const List &args); 64 virtual bool implementsCall() const; 65 virtual ValueImp *callAsFunction(ExecState *, ObjectImp *thisObj, const List &args); 65 66 66 Completion execute(const List &); 67 enum { ToString, ToDateString, ToTimeString, ToLocaleString, 68 ToLocaleDateString, ToLocaleTimeString, ValueOf, GetTime, 69 GetFullYear, GetMonth, GetDate, GetDay, GetHours, GetMinutes, 70 GetSeconds, GetMilliSeconds, GetTimezoneOffset, SetTime, 71 SetMilliSeconds, SetSeconds, SetMinutes, SetHours, SetDate, 72 SetMonth, SetFullYear, ToUTCString, 73 // non-normative properties (Appendix B) 74 GetYear, SetYear, ToGMTString }; 75 private: 76 int id; 77 bool utc; 78 }; 79 80 /** 81 * @internal 82 * 83 * The initial value of the the global variable's "Date" property 84 */ 85 class DateObjectImp : public InternalFunctionImp { 86 public: 87 DateObjectImp(ExecState *exec, 88 FunctionPrototypeImp *funcProto, 89 DatePrototypeImp *dateProto); 90 91 virtual bool implementsConstruct() const; 92 virtual ObjectImp *construct(ExecState *exec, const List &args); 93 virtual bool implementsCall() const; 94 virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args); 95 96 Completion execute(const List &); 97 ObjectImp *construct(const List &); 98 }; 99 100 /** 101 * @internal 102 * 103 * Class to implement all methods that are properties of the 104 * Date object 105 */ 106 class DateObjectFuncImp : public InternalFunctionImp { 107 public: 108 DateObjectFuncImp(ExecState *exec, FunctionPrototypeImp *funcProto, 109 int i, int len); 110 111 virtual bool implementsCall() const; 112 virtual ValueImp *callAsFunction(ExecState *exec, ObjectImp *thisObj, const List &args); 113 114 enum { Parse, UTC }; 115 private: 116 int id; 117 }; 118 119 // helper functions 120 double parseDate(const UString &u); 121 double KRFCDate_parseDate(const UString &_date); 122 double timeClip(double t); 123 double makeTime(struct tm *t, double milli, bool utc); 67 Completion execute(const List &); 68 ObjectImp *construct(const List &); 69 }; 124 70 125 71 } // namespace
Note:
See TracChangeset
for help on using the changeset viewer.